Commit 6445ba190f08948eaa3c299bc0861dcdf47048c1
1 parent
8895178c
Exists in
master
and in
28 other branches
ActionItem0: finishinh structure
git-svn-id: https://svn.colivre.coop.br/svn/noosfero/trunk@60 3f533792-8f58-4932-b0fe-aaf55b0a4547
Showing
2 changed files
with
24 additions
and
21 deletions
Show diff stats
app/controllers/edit_template_controller.rb
@@ -6,6 +6,9 @@ class EditTemplateController < ApplicationController | @@ -6,6 +6,9 @@ class EditTemplateController < ApplicationController | ||
6 | # def load_owner | 6 | # def load_owner |
7 | # end | 7 | # end |
8 | 8 | ||
9 | + def index | ||
10 | + @bli = _('testing the app') | ||
11 | + end | ||
9 | # before_filter :load_boxes | 12 | # before_filter :load_boxes |
10 | def load_boxes | 13 | def load_boxes |
11 | @owner = User.find(1) | 14 | @owner = User.find(1) |
@@ -15,6 +18,8 @@ class EditTemplateController < ApplicationController | @@ -15,6 +18,8 @@ class EditTemplateController < ApplicationController | ||
15 | # This method changes a block content to a different box place and | 18 | # This method changes a block content to a different box place and |
16 | # updates all boxes at the ends | 19 | # updates all boxes at the ends |
17 | def change_box | 20 | def change_box |
21 | +render :text => "fudeuuuuuu" | ||
22 | +return | ||
18 | b = Block.find(params[:block]) | 23 | b = Block.find(params[:block]) |
19 | b.box = Box.find(params[:box_id]) | 24 | b.box = Box.find(params[:box_id]) |
20 | b.save | 25 | b.save |
@@ -28,6 +33,8 @@ class EditTemplateController < ApplicationController | @@ -28,6 +33,8 @@ class EditTemplateController < ApplicationController | ||
28 | end | 33 | end |
29 | 34 | ||
30 | def sort_box | 35 | def sort_box |
36 | +render :text => "oxeee" | ||
37 | +return | ||
31 | blocks = Array.new | 38 | blocks = Array.new |
32 | box_number = params[:box_number] | 39 | box_number = params[:box_number] |
33 | pos = 0 | 40 | pos = 0 |
app/helpers/application_helper.rb
@@ -2,8 +2,8 @@ | @@ -2,8 +2,8 @@ | ||
2 | module ApplicationHelper | 2 | module ApplicationHelper |
3 | 3 | ||
4 | def display_boxes(boxes, main_content) | 4 | def display_boxes(boxes, main_content) |
5 | - boxes.each do |box| | ||
6 | - content_tag(:div, show_blocks(box, main_content) ,:id=>"box_#{box.id}") | 5 | + boxes.map do |box| |
6 | + content_tag(:div, show_blocks(box, main_content) ,:id=>"box_#{box.number}") | ||
7 | end | 7 | end |
8 | end | 8 | end |
9 | 9 | ||
@@ -12,13 +12,8 @@ module ApplicationHelper | @@ -12,13 +12,8 @@ module ApplicationHelper | ||
12 | content_tag(:ul, | 12 | content_tag(:ul, |
13 | blocks.map {|b| | 13 | blocks.map {|b| |
14 | content_tag(:li, b.main? ? main_content : b.to_html, :class =>"block_item_box_#{b.box_id}" , :id => "block_#{b.id}" ) + draggable('block_'+b.id.to_s) | 14 | content_tag(:li, b.main? ? main_content : b.to_html, :class =>"block_item_box_#{b.box_id}" , :id => "block_#{b.id}" ) + draggable('block_'+b.id.to_s) |
15 | - }, :id => "sort_#{box_number}" | ||
16 | - ) +"" | ||
17 | - #drag_drop_item(box_number) + sortable_block(box_number) | ||
18 | - end | ||
19 | - | ||
20 | - def sortable_(box_number) | ||
21 | - drag_drop_item(box_number) + sortable_block(box_number) | 15 | + }, :id => "sort_#{box.number}" |
16 | + ) + drag_drop_item(box.number) + sortable_block(box.number) | ||
22 | end | 17 | end |
23 | 18 | ||
24 | def sortable_block(box_number) | 19 | def sortable_block(box_number) |
@@ -27,21 +22,22 @@ module ApplicationHelper | @@ -27,21 +22,22 @@ module ApplicationHelper | ||
27 | :url => {:action => 'sort_box', :box_number => box_number } | 22 | :url => {:action => 'sort_box', :box_number => box_number } |
28 | end | 23 | end |
29 | 24 | ||
30 | - def draggable item | 25 | + def draggable(item) |
31 | draggable_element(item, :ghosting=>true, :revert=>true) | 26 | draggable_element(item, :ghosting=>true, :revert=>true) |
32 | end | 27 | end |
33 | 28 | ||
34 | - def drag_drop_item box_id | ||
35 | - boxes = Box.find_not_box(box_id) | ||
36 | - return boxes.map{ |b| | ||
37 | - drop_receiving_element("box_#{box_id}", | ||
38 | - :accept => "block_item_box_#{b.id}", | ||
39 | - :complete => "$('spinner').hide();", | ||
40 | - :before => "$('spinner').show();", | ||
41 | - :hoverclass => 'hover', | ||
42 | - :with => "'block=' + encodeURIComponent(element.id.split('_').last())", | ||
43 | - :url => {:action=>:change_box, :box_id=> box_id}) | ||
44 | - }.to_s | 29 | + def drag_drop_item box_number |
30 | + boxes = Box.find_not_box(box_number) | ||
31 | + | ||
32 | + boxes.map{ |b| | ||
33 | + drop_receiving_element("box_#{box_number}", | ||
34 | + :accept => "block_item_box_#{b.number}", | ||
35 | + :complete => "$('spinner').hide();", | ||
36 | + :before => "$('spinner').show();", | ||
37 | + :hoverclass => 'hover', | ||
38 | + :with => "'block=' + encodeURIComponent(element.id.split('_').last())", | ||
39 | + :url => {:action=>:change_box, :box_id => box_number}) | ||
40 | + }.to_s | ||
45 | end | 41 | end |
46 | 42 | ||
47 | 43 |