diff --git a/app/controllers/application.rb b/app/controllers/application.rb index d2e67da..2b467f7 100644 --- a/app/controllers/application.rb +++ b/app/controllers/application.rb @@ -4,10 +4,6 @@ class ApplicationController < ActionController::Base helper :document helper :language - - def boxes_holder - environment - end def boxes_editor? false diff --git a/app/controllers/box_organizer_controller.rb b/app/controllers/box_organizer_controller.rb index df7cdb5..595809d 100644 --- a/app/controllers/box_organizer_controller.rb +++ b/app/controllers/box_organizer_controller.rb @@ -13,7 +13,7 @@ class BoxOrganizerController < ApplicationController @target_box = block_before.box else - (params[:target] =~ /end-of-box-([0-9])+/) + (params[:target] =~ /end-of-box-([0-9]+)/) @target_box = boxes_holder.boxes.find($1) end diff --git a/app/controllers/my_profile/profile_design_controller.rb b/app/controllers/my_profile/profile_design_controller.rb index 7b32e4a..666399a 100644 --- a/app/controllers/my_profile/profile_design_controller.rb +++ b/app/controllers/my_profile/profile_design_controller.rb @@ -3,7 +3,7 @@ class ProfileDesignController < BoxOrganizerController needs_profile def index - render :text => '...', :layout => true + render :action => 'index', :layout => true end def boxes_editor? diff --git a/app/helpers/boxes_helper.rb b/app/helpers/boxes_helper.rb index 4217295..8ffd08b 100644 --- a/app/helpers/boxes_helper.rb +++ b/app/helpers/boxes_helper.rb @@ -26,7 +26,7 @@ module BoxesHelper end def display_box(box, main_content) - content_tag('div', content_tag('div', display_box_content(box, main_content), :class => 'blocks'), :class => 'box', :id => "box-#{box.position}" ) + content_tag('div', content_tag('div', display_box_content(box, main_content), :class => 'blocks'), :class => "box box-#{box.position}", :id => "box-#{box.id}" ) end def display_updated_box(box) @@ -53,7 +53,7 @@ module BoxesHelper end end - classes = ['block', block.class.name.underscore.gsub('_', '-') ].uniq.join(' ') + classes = 'block' # ['block', block.class.name.underscore.gsub('_', '-') ].uniq.join(' ') box_decorator.block_target(block.box, block) + content_tag('div', result + box_decorator.block_move_buttons(block), :class => classes, :id => "block-#{block.id}") + box_decorator.block_handle(block) end diff --git a/app/models/main_block.rb b/app/models/main_block.rb index d4ed3d3..49901ab 100644 --- a/app/models/main_block.rb +++ b/app/models/main_block.rb @@ -1,7 +1,7 @@ class MainBlock < Block def content(main_content = nil) - main_content + main_content + "(id: ##{self.id})" end end diff --git a/app/models/profile.rb b/app/models/profile.rb index 14e0fee..dde7a2f 100644 --- a/app/models/profile.rb +++ b/app/models/profile.rb @@ -81,11 +81,17 @@ class Profile < ActiveRecord::Base self.environment ||= Environment.default end - after_create do |profile| + # registar callback for creating boxes after the object is created. + after_create :create_boxes + + # creates the initial set of boxes when the profile is created. Can be + # overriden for each subclass to create a custom set of boxes for its + # instances. + def create_boxes 3.times do - profile.boxes << Box.new + self.boxes << Box.new end - profile.boxes.first.blocks << MainBlock.new + self.boxes.first.blocks << MainBlock.new end # Returns information about the profile's owner that was made public by diff --git a/app/views/box_organizer/index.rhtml b/app/views/box_organizer/index.rhtml index a7f937f..5c6bdf9 100644 --- a/app/views/box_organizer/index.rhtml +++ b/app/views/box_organizer/index.rhtml @@ -1,3 +1,5 @@ -