diff --git a/app/controllers/application.rb b/app/controllers/application.rb index 6cc41f6..334707a 100644 --- a/app/controllers/application.rb +++ b/app/controllers/application.rb @@ -2,10 +2,6 @@ # available in all controllers. class ApplicationController < ActionController::Base - ICONS_DIR_PATH = "#{RAILS_ROOT}/public/icons" - THEME_DIR_PATH = "#{RAILS_ROOT}/public/themes" - - before_filter :detect_stuff_by_domain attr_reader :virtual_community @@ -19,49 +15,6 @@ class ApplicationController < ActionController::Base end end - before_filter :load_icons_theme - # Load the icons belongs to a Profile and set it at @chosen_icons_theme variable. - # If no profile exist the @chosen_icons_theme variable is set to 'default' - def load_icons_theme - if Profile.exists?(1) - @owner = Profile.find(1) - end - @chosen_icons_theme = @owner.icons_theme.nil? ? "default" : @owner.icons_theme - end - - - # Set the default template to the profile - def set_default_template - p = Profile.find(params[:object_id]) - set_template(p,params[:template_name]) - end - - # Set the default theme to the profile - def set_default_theme - p = Profile.find(params[:object_id]) - set_theme(p,params[:theme_name]) - end - - # Set the default icons theme to the profile - def set_default_icons_theme - p = Profile.find(params[:object_id]) - set_icons_theme(p,params[:icons_theme_name]) - end - - - private - - # Set to the owner the theme choosed - def set_theme(object, theme_name) - object.theme = theme_name - object.save - end - - # Set to the owner the icons theme choosed - def set_icons_theme(object,icons_theme_name) - object.icons_theme = icons_theme_name - object.save - end protected diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 5b4dd3f..ef3f434 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -1,34 +1,6 @@ # Methods added to this helper will be available to all templates in the application. module ApplicationHelper - ICONS_DIR_PATH = "#{RAILS_ROOT}/public/icons" - - - # Generate a select option to choose one of the available icons themes. - # The available icons themes are those in 'public/icons' - def select_icons_theme(object, chosen_icons_theme = nil) - return '' if object.nil? - available_icons_themes = Dir.new("#{ICONS_DIR_PATH}").to_a - REJECTED_DIRS - icons_theme_options = options_for_select(available_icons_themes.map{|icons_theme| [icons_theme, icons_theme] }, chosen_icons_theme) - select_tag('icons_theme_name', icons_theme_options ) + - change_icons_theme('icons_theme_name', object) - end - - # Generate a observer to reload a page when a icons theme is selected - def change_icons_theme(observed_field, object) - observe_field( observed_field, - :url => {:action => 'set_default_icons_theme'}, - :with =>"'icons_theme_name=' + escape(value) + '&object_id=' + escape(#{object.id})", - :complete => "document.location.reload();" - ) - end - - #Display a given icon passed as argument - #The icon path should be '/icons/{icons_theme}/{icon_image}' - def display_icon(icon , icons_theme = "default", options = {}) - image_tag("/icons/#{icons_theme}/#{icon}.png", options) - end - # Displays context help. You can pass the content of the help message as the # first parameter or using template code inside a block passed to this diff --git a/app/views/home/index.rhtml b/app/views/home/index.rhtml index fc58b31..66d854d 100644 --- a/app/views/home/index.rhtml +++ b/app/views/home/index.rhtml @@ -1,9 +1,9 @@ <%= flash[:notice] %> Start page of Virtual Community <%= @virtual_community.name %> -<%= @boxes.length %> Teste: <%= @ft_config[:template].inspect %> +<%= @ft_config[:owner].template %> caralho diff --git a/app/views/layouts/_box_template.rhtml b/app/views/layouts/_box_template.rhtml deleted file mode 100644 index 653b6ff..0000000 --- a/app/views/layouts/_box_template.rhtml +++ /dev/null @@ -1 +0,0 @@ -<%= edit_blocks(@box) %> diff --git a/app/views/layouts/application.rhtml b/app/views/layouts/application.rhtml index 21310f5..5385d13 100644 --- a/app/views/layouts/application.rhtml +++ b/app/views/layouts/application.rhtml @@ -21,34 +21,34 @@ <%= link_to _('Show Layout'), :controller => 'home' %> <%= link_to _('Edit Layout'), :controller => 'edit_template' %> - <%= select_template(@owner, @chosen_template) %> - <%= select_theme(@owner, @chosen_theme) %> - <%= select_icons_theme(@owner, @chosen_icons_theme) %> + <%= select_template %> + <%= select_theme %> + <%= select_icons_theme %> - <%= display_icon('back', @chosen_icons_theme )%> + <%= display_icon('back')%> <%= flash[:notice] %> - <%= display_boxes(@boxes, yield) %> + <%= display_boxes(yield) %>
- diff --git a/public/themes/default/blue.css b/public/themes/default/blue.css deleted file mode 100644 index cdf802a..0000000 --- a/public/themes/default/blue.css +++ /dev/null @@ -1,3 +0,0 @@ -body { - background-color: white; -} diff --git a/public/themes/default/default.css b/public/themes/default/default.css new file mode 100644 index 0000000..f8f72fa --- /dev/null +++ b/public/themes/default/default.css @@ -0,0 +1,3 @@ +#box { + background-color: white; +} diff --git a/public/themes/pink/pink.css b/public/themes/pink/pink.css index ec84a33..a1fceb8 100644 --- a/public/themes/pink/pink.css +++ b/public/themes/pink/pink.css @@ -1,4 +1,4 @@ -body { +#box { background-color: pink; } -- libgit2 0.21.2