OSDN Git Service

added svn:eol-style native property on /app files
[redminele/redmine.git] / app / views / my / page_layout.rhtml
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('/my/order_blocks?group=top', {asynchronous:true, evalScripts:true, onComplete:function(request){new Effect.Highlight("list-top",{});}, onLoaded:function(request){Element.hide('indicator')}, onLoading:function(request){Element.show('indicator')}, 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('/my/order_blocks?group=left', {asynchronous:true, evalScripts:true, onComplete:function(request){new Effect.Highlight("list-left",{});}, onLoaded:function(request){Element.hide('indicator')}, onLoading:function(request){Element.show('indicator')}, 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('/my/order_blocks?group=right', {asynchronous:true, evalScripts:true, onComplete:function(request){new Effect.Highlight("list-right",{});}, onLoaded:function(request){Element.hide('indicator')}, onLoading:function(request){Element.show('indicator')}, 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     $(block).parentNode.removeChild($(block));
32     updateSelect();
33 }
34 //]]>
35 </script>
36
37 <div class="contextual">
38 <span id="indicator" style="display:none"><%= image_tag "loading.gif", :align => "absmiddle" %></span>
39 <% form_tag({:action => "add_block"}, :id => "block-form") do %>
40 <%= select_tag 'block', "<option></option>" + options_for_select(@block_options), :id => "block-select" %>
41 <%= link_to_remote l(:button_add),
42            {:url => { :action => "add_block" },
43             :with => "Form.serialize('block-form')",
44             :update => "list-top",
45             :position => :top,
46             :complete => "afterAddBlock();",
47             :loading => "Element.show('indicator')",
48             :loaded => "Element.hide('indicator')"
49            }, :class => 'icon icon-add'
50              %>
51 <% end %>
52 <%= link_to l(:button_save), {:action => 'page_layout_save'}, :class => 'icon icon-save' %>
53 <%= link_to l(:button_cancel), {:action => 'page'}, :class => 'icon icon-cancel' %>
54 </div>
55
56 <h2><%=l(:label_my_page)%></h2>
57
58 <div id="list-top" class="block-receiver">
59         <% @blocks['top'].each do |b| 
60            next unless MyController::BLOCKS.keys.include? b %>
61         <%= render :partial => 'block', :locals => {:user => @user, :block_name => b} %>
62         <% end if @blocks['top'] %>
63 </div>
64
65 <div id="list-left" class="splitcontentleft block-receiver">
66         <% @blocks['left'].each do |b| 
67            next unless MyController::BLOCKS.keys.include? b %>
68         <%= render :partial => 'block', :locals => {:user => @user, :block_name => b} %>
69         <% end if @blocks['left'] %>
70 </div>
71
72 <div id="list-right" class="splitcontentright block-receiver">
73         <% @blocks['right'].each do |b| 
74            next unless MyController::BLOCKS.keys.include? b %>
75         <%= render :partial => 'block', :locals => {:user => @user, :block_name => b} %>
76         <% end if @blocks['right'] %>
77 </div>
78
79 <%= sortable_element 'list-top',
80       :tag => 'div',
81       :only => 'mypage-box',
82       :handle => "handle",
83       :dropOnEmpty => true,
84       :containment => ['list-top', 'list-left', 'list-right'],
85       :constraint => false,
86       :complete => visual_effect(:highlight, 'list-top'), 
87       :url => { :action => "order_blocks", :group => "top" },
88       :loading => "Element.show('indicator')",
89       :loaded => "Element.hide('indicator')"
90        %>
91       
92       
93 <%= sortable_element 'list-left', 
94       :tag => 'div',
95       :only => 'mypage-box',
96       :handle => "handle",
97       :dropOnEmpty => true,
98       :containment => ['list-top', 'list-left', 'list-right'],
99       :constraint => false,
100       :complete => visual_effect(:highlight, 'list-left'), 
101       :url => { :action => "order_blocks", :group => "left" },
102       :loading => "Element.show('indicator')",
103       :loaded => "Element.hide('indicator')" %>
104       
105 <%= sortable_element 'list-right', 
106       :tag => 'div',
107       :only => 'mypage-box',
108       :handle => "handle",
109       :dropOnEmpty => true,
110       :containment => ['list-top', 'list-left', 'list-right'],
111       :constraint => false,
112       :complete => visual_effect(:highlight, 'list-right'), 
113       :url => { :action => "order_blocks", :group => "right" },
114       :loading => "Element.show('indicator')",
115       :loaded => "Element.hide('indicator')" %>
116       
117 <%= javascript_tag "updateSelect()" %>