##// END OF EJS Templates
Use content_tag helper....
Jean-Philippe Lang -
r9497:46400e355efe
parent child
Show More
@@ -1,109 +1,109
1 1 <script language="JavaScript">
2 2 //<![CDATA[
3 3 function recreateSortables() {
4 4 Sortable.destroy('list-top');
5 5 Sortable.destroy('list-left');
6 6 Sortable.destroy('list-right');
7 7
8 8 Sortable.create("list-top", {constraint:false, containment:['list-top','list-left','list-right'], dropOnEmpty:true, handle:'handle', onUpdate:function(){new Ajax.Request('<%= url_for(:controller => 'my', :action => 'order_blocks', :group => 'top') %>', {asynchronous:true, evalScripts:true, parameters:Sortable.serialize("list-top")})}, only:'mypage-box', tag:'div'})
9 9 Sortable.create("list-left", {constraint:false, containment:['list-top','list-left','list-right'], dropOnEmpty:true, handle:'handle', onUpdate:function(){new Ajax.Request('<%= url_for(:controller => 'my', :action => 'order_blocks', :group => 'left') %>', {asynchronous:true, evalScripts:true, parameters:Sortable.serialize("list-left")})}, only:'mypage-box', tag:'div'})
10 10 Sortable.create("list-right", {constraint:false, containment:['list-top','list-left','list-right'], dropOnEmpty:true, handle:'handle', onUpdate:function(){new Ajax.Request('<%= url_for(:controller => 'my', :action => 'order_blocks', :group => 'right') %>', {asynchronous:true, evalScripts:true, parameters:Sortable.serialize("list-right")})}, only:'mypage-box', tag:'div'})
11 11 }
12 12
13 13 function updateSelect() {
14 14 s = $('block-select')
15 15 for (var i = 0; i < s.options.length; i++) {
16 16 if ($('block_' + s.options[i].value)) {
17 17 s.options[i].disabled = true;
18 18 } else {
19 19 s.options[i].disabled = false;
20 20 }
21 21 }
22 22 s.options[0].selected = true;
23 23 }
24 24
25 25 function afterAddBlock() {
26 26 recreateSortables();
27 27 updateSelect();
28 28 }
29 29
30 30 function removeBlock(block) {
31 31 Effect.DropOut(block);
32 32 updateSelect();
33 33 }
34 34 //]]>
35 35 </script>
36 36
37 37 <div class="contextual">
38 38 <%= form_tag({:action => "add_block"}, :id => "block-form") do %>
39 39 <%= label_tag('block-select', l(:label_my_page_block)) %>:
40 40 <%= select_tag 'block',
41 "<option></option>".html_safe + options_for_select(@block_options),
41 content_tag('option') + options_for_select(@block_options),
42 42 :id => "block-select" %>
43 43 <%= link_to_remote l(:button_add),
44 44 {:url => { :action => "add_block" },
45 45 :with => "Form.serialize('block-form')",
46 46 :update => "list-top",
47 47 :position => :top,
48 48 :complete => "afterAddBlock();"
49 49 }, :class => 'icon icon-add'
50 50 %>
51 51 <% end %>
52 52 <%= link_to l(:button_back), {:action => 'page'}, :class => 'icon icon-cancel' %>
53 53 </div>
54 54
55 55 <h2><%=l(:label_my_page)%></h2>
56 56
57 57 <div id="list-top" class="block-receiver">
58 58 <% @blocks['top'].each do |b|
59 59 next unless MyController::BLOCKS.keys.include? b %>
60 60 <%= render :partial => 'block', :locals => {:user => @user, :block_name => b} %>
61 61 <% end if @blocks['top'] %>
62 62 </div>
63 63
64 64 <div id="list-left" class="splitcontentleft block-receiver">
65 65 <% @blocks['left'].each do |b|
66 66 next unless MyController::BLOCKS.keys.include? b %>
67 67 <%= render :partial => 'block', :locals => {:user => @user, :block_name => b} %>
68 68 <% end if @blocks['left'] %>
69 69 </div>
70 70
71 71 <div id="list-right" class="splitcontentright block-receiver">
72 72 <% @blocks['right'].each do |b|
73 73 next unless MyController::BLOCKS.keys.include? b %>
74 74 <%= render :partial => 'block', :locals => {:user => @user, :block_name => b} %>
75 75 <% end if @blocks['right'] %>
76 76 </div>
77 77
78 78 <%= sortable_element 'list-top',
79 79 :tag => 'div',
80 80 :only => 'mypage-box',
81 81 :handle => "handle",
82 82 :dropOnEmpty => true,
83 83 :containment => ['list-top', 'list-left', 'list-right'],
84 84 :constraint => false,
85 85 :url => { :action => "order_blocks", :group => "top" }
86 86 %>
87 87
88 88 <%= sortable_element 'list-left',
89 89 :tag => 'div',
90 90 :only => 'mypage-box',
91 91 :handle => "handle",
92 92 :dropOnEmpty => true,
93 93 :containment => ['list-top', 'list-left', 'list-right'],
94 94 :constraint => false,
95 95 :url => { :action => "order_blocks", :group => "left" }
96 96 %>
97 97
98 98 <%= sortable_element 'list-right',
99 99 :tag => 'div',
100 100 :only => 'mypage-box',
101 101 :handle => "handle",
102 102 :dropOnEmpty => true,
103 103 :containment => ['list-top', 'list-left', 'list-right'],
104 104 :constraint => false,
105 105 :url => { :action => "order_blocks", :group => "right" }
106 106 %>
107 107
108 108 <%= javascript_tag "updateSelect()" %>
109 109 <% html_title(l(:label_my_page)) -%>
General Comments 0
You need to be logged in to leave comments. Login now