incubator-deltacloud-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lut...@apache.org
Subject svn commit: r1160500 - in /incubator/deltacloud/trunk/server: public/javascripts/application.js server.rb views/addresses/_address.html.haml views/addresses/index.html.haml
Date Mon, 22 Aug 2011 23:25:42 GMT
Author: lutter
Date: Mon Aug 22 23:25:42 2011
New Revision: 1160500

URL: http://svn.apache.org/viewvc?rev=1160500&view=rev
Log:
addresses: make creation from HTML UI work

Added:
    incubator/deltacloud/trunk/server/views/addresses/_address.html.haml
Modified:
    incubator/deltacloud/trunk/server/public/javascripts/application.js
    incubator/deltacloud/trunk/server/server.rb
    incubator/deltacloud/trunk/server/views/addresses/index.html.haml

Modified: incubator/deltacloud/trunk/server/public/javascripts/application.js
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/server/public/javascripts/application.js?rev=1160500&r1=1160499&r2=1160500&view=diff
==============================================================================
--- incubator/deltacloud/trunk/server/public/javascripts/application.js (original)
+++ incubator/deltacloud/trunk/server/public/javascripts/application.js Mon Aug 22 23:25:42
2011
@@ -132,3 +132,12 @@ function create_rule_source_field(name, 
 
   $(html).insertBefore("#new_rule_form_fields")
 }
+
+function create_address(url)
+{
+  $.post(url, function(data) {
+    var ul = $('#address_list')
+    ul.append($(data))
+    ul.listview('refresh')
+  })
+}

Modified: incubator/deltacloud/trunk/server/server.rb
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/server/server.rb?rev=1160500&r1=1160499&r2=1160500&view=diff
==============================================================================
--- incubator/deltacloud/trunk/server/server.rb (original)
+++ incubator/deltacloud/trunk/server/server.rb Mon Aug 22 23:25:42 2011
@@ -994,7 +994,7 @@ collection :addresses do
       response['Location'] = address_url(@address.id)
       respond_to do |format|
         format.xml  { haml :"addresses/show", :ugly => true }
-        format.html { haml :"addresses/show" }
+        format.html { haml :"addresses/_address", :layout => false }
         format.json { convert_to_json(:address, @address) }
       end
     end

Added: incubator/deltacloud/trunk/server/views/addresses/_address.html.haml
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/server/views/addresses/_address.html.haml?rev=1160500&view=auto
==============================================================================
--- incubator/deltacloud/trunk/server/views/addresses/_address.html.haml (added)
+++ incubator/deltacloud/trunk/server/views/addresses/_address.html.haml Mon Aug 22 23:25:42
2011
@@ -0,0 +1,6 @@
+%li
+  %a{ :href => address_url(@address.id), :'data-ajax' => 'false'}
+    %img{ :class => 'ui-link-thumb', :src => '/images/address.png'}
+    %h3= @address.id
+    %span{ :class => 'ui-li-count'}
+      = @address.instance_id ? @address.instance_id : 'Free'

Modified: incubator/deltacloud/trunk/server/views/addresses/index.html.haml
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/server/views/addresses/index.html.haml?rev=1160500&r1=1160499&r2=1160500&view=diff
==============================================================================
--- incubator/deltacloud/trunk/server/views/addresses/index.html.haml (original)
+++ incubator/deltacloud/trunk/server/views/addresses/index.html.haml Mon Aug 22 23:25:42
2011
@@ -1,15 +1,9 @@
 =header "Addresses" do
-  %a{ :href => create_address_url, :'data-icon' => :plus, :'data-role' => :button,
:class => 'ui-btn-right', :'data-ajax' => "false", :'method' => :post} Create new
address
+  %a{ :href => "#", :onclick => "create_address('#{create_address_url}')", :'data-icon'
=> :plus, :'data-role' => :button, :class => 'ui-btn-right', :'data-ajax' => "false",
:method => :post} Create new address
 =subheader "#{Thread::current[:provider] || ENV['API_PROVIDER'] || 'default'}"
 
 %div{ :'data-role' => :content, :'data-theme' => 'c'}
-  %ul{ :'data-role' => :listview , :'data-inset' => :true, :'data-divider-theme' =>
'a'}
+  %ul#address_list{ :'data-role' => :listview , :'data-inset' => :true, :'data-divider-theme'
=> 'a'}
     %li{ :'data-role' => 'list-divider'}=driver_symbol
     - @elements.each do |address|
-      %li
-        %a{ :href => address_url(address.id), :'data-ajax' => 'false'}
-          %img{ :class => 'ui-link-thumb', :src => '/images/address.png'}
-          %h3=address.id
-          %span{ :class => 'ui-li-count'}=address.instance_id ? address.instance_id :
'Free'
-
-
+      = haml :"addresses/_address", :locals => { :@address => address, :partial =>
true }



Mime
View raw message