Mercurial > hg > soundsoftware-site
comparison app/views/my/page_layout.html.erb @ 1115:433d4f72a19b redmine-2.2
Update to Redmine SVN revision 11137 on 2.2-stable branch
author | Chris Cannam |
---|---|
date | Mon, 07 Jan 2013 12:01:42 +0000 |
parents | cbb26bc654de |
children |
comparison
equal
deleted
inserted
replaced
929:5f33065ddc4b | 1115:433d4f72a19b |
---|---|
1 <script language="JavaScript"> | |
2 //<![CDATA[ | |
3 function recreateSortables() { | |
4 Sortable.destroy('list-top'); | |
5 Sortable.destroy('list-left'); | |
6 Sortable.destroy('list-right'); | |
7 | |
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 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 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 } | |
12 | |
13 function updateSelect() { | |
14 s = $('block-select') | |
15 for (var i = 0; i < s.options.length; i++) { | |
16 if ($('block_' + s.options[i].value)) { | |
17 s.options[i].disabled = true; | |
18 } else { | |
19 s.options[i].disabled = false; | |
20 } | |
21 } | |
22 s.options[0].selected = true; | |
23 } | |
24 | |
25 function afterAddBlock() { | |
26 recreateSortables(); | |
27 updateSelect(); | |
28 } | |
29 | |
30 function removeBlock(block) { | |
31 Effect.DropOut(block); | |
32 updateSelect(); | |
33 } | |
34 //]]> | |
35 </script> | |
36 | |
37 <div class="contextual"> | 1 <div class="contextual"> |
38 <% form_tag({:action => "add_block"}, :id => "block-form") do %> | 2 <% if @block_options.present? %> |
39 <%= label_tag('block-select', l(:label_my_page_block)) %>: | 3 <%= form_tag({:action => "add_block"}, :id => "block-form") do %> |
40 <%= select_tag 'block', "<option></option>" + options_for_select(@block_options), :id => "block-select" %> | 4 <%= label_tag('block-select', l(:label_my_page_block)) %>: |
41 <%= link_to_remote l(:button_add), | 5 <%= select_tag 'block', |
42 {:url => { :action => "add_block" }, | 6 content_tag('option') + options_for_select(@block_options), |
43 :with => "Form.serialize('block-form')", | 7 :id => "block-select" %> |
44 :update => "list-top", | 8 <%= link_to l(:button_add), '#', :onclick => '$("#block-form").submit()', :class => 'icon icon-add' %> |
45 :position => :top, | 9 <% end %> |
46 :complete => "afterAddBlock();" | |
47 }, :class => 'icon icon-add' | |
48 %> | |
49 <% end %> | 10 <% end %> |
50 <%= link_to l(:button_back), {:action => 'page'}, :class => 'icon icon-cancel' %> | 11 <%= link_to l(:button_back), {:action => 'page'}, :class => 'icon icon-cancel' %> |
51 </div> | 12 </div> |
52 | 13 |
53 <h2><%=l(:label_my_page)%></h2> | 14 <h2><%=l(:label_my_page)%></h2> |
71 next unless MyController::BLOCKS.keys.include? b %> | 32 next unless MyController::BLOCKS.keys.include? b %> |
72 <%= render :partial => 'block', :locals => {:user => @user, :block_name => b} %> | 33 <%= render :partial => 'block', :locals => {:user => @user, :block_name => b} %> |
73 <% end if @blocks['right'] %> | 34 <% end if @blocks['right'] %> |
74 </div> | 35 </div> |
75 | 36 |
76 <%= sortable_element 'list-top', | 37 <%= javascript_tag "initMyPageSortable('top', '#{ escape_javascript url_for(:action => "order_blocks", :group => "top") }');" %> |
77 :tag => 'div', | 38 <%= javascript_tag "initMyPageSortable('left', '#{ escape_javascript url_for(:action => "order_blocks", :group => "left") }');" %> |
78 :only => 'mypage-box', | 39 <%= javascript_tag "initMyPageSortable('right', '#{ escape_javascript url_for(:action => "order_blocks", :group => "right") }');" %> |
79 :handle => "handle", | |
80 :dropOnEmpty => true, | |
81 :containment => ['list-top', 'list-left', 'list-right'], | |
82 :constraint => false, | |
83 :url => { :action => "order_blocks", :group => "top" } | |
84 %> | |
85 | 40 |
86 <%= sortable_element 'list-left', | |
87 :tag => 'div', | |
88 :only => 'mypage-box', | |
89 :handle => "handle", | |
90 :dropOnEmpty => true, | |
91 :containment => ['list-top', 'list-left', 'list-right'], | |
92 :constraint => false, | |
93 :url => { :action => "order_blocks", :group => "left" } | |
94 %> | |
95 | |
96 <%= sortable_element 'list-right', | |
97 :tag => 'div', | |
98 :only => 'mypage-box', | |
99 :handle => "handle", | |
100 :dropOnEmpty => true, | |
101 :containment => ['list-top', 'list-left', 'list-right'], | |
102 :constraint => false, | |
103 :url => { :action => "order_blocks", :group => "right" } | |
104 %> | |
105 | |
106 <%= javascript_tag "updateSelect()" %> | |
107 <% html_title(l(:label_my_page)) -%> | 41 <% html_title(l(:label_my_page)) -%> |