-
-
Save dergachev/4c2d62c05b9eeba1c83e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/app/controllers/my_controller.rb b/app/controllers/my_controller.rb | |
index b381fbc..b4a4aad 100644 | |
--- a/app/controllers/my_controller.rb | |
+++ b/app/controllers/my_controller.rb | |
@@ -132,7 +132,7 @@ class MyController < ApplicationController | |
@user = User.current | |
layout = @user.pref[:my_page_layout] || {} | |
# remove if already present in a group | |
- %w(top left right).each {|f| (layout[f] ||= []).delete block } | |
+ %w(top left right bottom).each {|f| (layout[f] ||= []).delete block } | |
# add it on top | |
layout['top'].unshift block | |
@user.pref[:my_page_layout] = layout | |
@@ -147,7 +147,7 @@ class MyController < ApplicationController | |
@user = User.current | |
# remove block in all groups | |
layout = @user.pref[:my_page_layout] || {} | |
- %w(top left right).each {|f| (layout[f] ||= []).delete block } | |
+ %w(top left right bottom).each {|f| (layout[f] ||= []).delete block } | |
@user.pref[:my_page_layout] = layout | |
@user.pref.save | |
render :nothing => true | |
@@ -164,7 +164,7 @@ class MyController < ApplicationController | |
if group_items and group_items.is_a? Array | |
layout = @user.pref[:my_page_layout] || {} | |
# remove group blocks if they are presents in other groups | |
- %w(top left right).each {|f| | |
+ %w(top left right bottom).each {|f| | |
layout[f] = (layout[f] || []) - group_items | |
} | |
layout[group] = group_items | |
diff --git a/app/views/my/page.rhtml b/app/views/my/page.rhtml | |
index 608e233..b143fb4 100644 | |
--- a/app/views/my/page.rhtml | |
+++ b/app/views/my/page.rhtml | |
@@ -31,6 +31,15 @@ | |
<% end if @blocks['right'] %> | |
</div> | |
+<div id="list-bottom" style="clear:both"> | |
+ <% @blocks['bottom'].each do |b| | |
+ next unless MyController::BLOCKS.keys.include? b %> | |
+ <div class="mypage-box"> | |
+ <%= render :partial => "my/blocks/#{b}", :locals => { :user => @user } %> | |
+ </div> | |
+ <% end if @blocks['bottom'] %> | |
+</div> | |
+ | |
<%= context_menu :controller => 'issues', :action => 'context_menu' %> | |
<% html_title(l(:label_my_page)) -%> | |
diff --git a/app/views/my/page_layout.rhtml b/app/views/my/page_layout.rhtml | |
index d2ad84c..085678d 100644 | |
--- a/app/views/my/page_layout.rhtml | |
+++ b/app/views/my/page_layout.rhtml | |
@@ -4,10 +4,12 @@ function recreateSortables() { | |
Sortable.destroy('list-top'); | |
Sortable.destroy('list-left'); | |
Sortable.destroy('list-right'); | |
+ Sortable.destroy('list-bottom'); | |
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'}) | |
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'}) | |
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'}) | |
+ Sortable.create("list-bottom", {constraint:false, containment:['list-top','list-left','list-bottom'], dropOnEmpty:true, handle:'handle', onUpdate:function(){new Ajax.Request('<%= url_for(:controller => 'my', :action => 'order_blocks', :group => 'bottom') %>', {asynchronous:true, evalScripts:true, parameters:Sortable.serialize("list-bottom")})}, only:'mypage-box', tag:'div'}) | |
} | |
function updateSelect() { | |
@@ -73,12 +75,19 @@ function removeBlock(block) { | |
<% end if @blocks['right'] %> | |
</div> | |
+<div id="list-bottom" class="block-receiver" style="clear:both"> | |
+ <% @blocks['bottom'].each do |b| | |
+ next unless MyController::BLOCKS.keys.include? b %> | |
+ <%= render :partial => 'block', :locals => {:user => @user, :block_name => b} %> | |
+ <% end if @blocks['bottom'] %> | |
+</div> | |
+ | |
<%= sortable_element 'list-top', | |
:tag => 'div', | |
:only => 'mypage-box', | |
:handle => "handle", | |
:dropOnEmpty => true, | |
- :containment => ['list-top', 'list-left', 'list-right'], | |
+ :containment => ['list-top', 'list-left', 'list-right', 'list-bottom'], | |
:constraint => false, | |
:url => { :action => "order_blocks", :group => "top" } | |
%> | |
@@ -89,7 +98,7 @@ function removeBlock(block) { | |
:only => 'mypage-box', | |
:handle => "handle", | |
:dropOnEmpty => true, | |
- :containment => ['list-top', 'list-left', 'list-right'], | |
+ :containment => ['list-top', 'list-left', 'list-right', 'list-bottom'], | |
:constraint => false, | |
:url => { :action => "order_blocks", :group => "left" } | |
%> | |
@@ -99,10 +108,20 @@ function removeBlock(block) { | |
:only => 'mypage-box', | |
:handle => "handle", | |
:dropOnEmpty => true, | |
- :containment => ['list-top', 'list-left', 'list-right'], | |
+ :containment => ['list-top', 'list-left', 'list-right', 'list-bottom'], | |
:constraint => false, | |
:url => { :action => "order_blocks", :group => "right" } | |
%> | |
+ | |
+<%= sortable_element 'list-bottom', | |
+ :tag => 'div', | |
+ :only => 'mypage-box', | |
+ :handle => "handle", | |
+ :dropOnEmpty => true, | |
+ :containment => ['list-top', 'list-left', 'list-right', 'list-bottom'], | |
+ :constraint => false, | |
+ :url => { :action => "order_blocks", :group => "bottom" } | |
+ %> | |
<%= javascript_tag "updateSelect()" %> | |
<% html_title(l(:label_my_page)) -%> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment