diff --git a/app/controllers/home_controller.rb b/app/controllers/home_controller.rb index 3174682..ee86b7a 100644 --- a/app/controllers/home_controller.rb +++ b/app/controllers/home_controller.rb @@ -1,9 +1,5 @@ class HomeController < ApplicationController - uses_flexible_template :owner => 'owner' - - def flexible_template_owner - Profile.find(1) - end + uses_flexible_template :owner => 'virtual_community' end diff --git a/app/models/profile.rb b/app/models/profile.rb index 2ce2434..e77eebf 100644 --- a/app/models/profile.rb +++ b/app/models/profile.rb @@ -11,7 +11,7 @@ class Profile < ActiveRecord::Base homepage.save! end - act_as_flexible_template + acts_as_flexible_template # Valid identifiers must match this format. IDENTIFIER_FORMAT = /^[a-z][a-z0-9_]*[a-z0-9]$/ diff --git a/app/models/virtual_community.rb b/app/models/virtual_community.rb index ac859d3..5af9122 100644 --- a/app/models/virtual_community.rb +++ b/app/models/virtual_community.rb @@ -16,6 +16,8 @@ class VirtualCommunity < ActiveRecord::Base # Relationships and applied behaviour # ################################################# + acts_as_flexible_template + # One VirtualCommunity can be reached by many domains has_many :domains, :as => :owner @@ -76,6 +78,36 @@ class VirtualCommunity < ActiveRecord::Base def has_terms_of_use? ! self.settings['terms_of_use'].nil? end + + # Returns the template used by +flexible_template+ plugin. + def flexible_template_template + self.settings['flexible_template_template'] + end + + # Sets the template used by +flexible_template+ plugin. + def flexible_template_template=(value) + self.settings['flexible_template_template'] = value + end + + # Returns the theme used by +flexible_template+ plugin + def flexible_template_theme + self.settings['flexible_template_theme'] + end + + # Sets the theme used by +flexible_template+ plugin + def flexible_template_theme=(value) + self.settings['flexible_template_theme'] = value + end + + # Returns the icon theme used by +flexible_template+ plugin + def flexible_template_icon_theme + self.settings['flexible_template_icon_theme'] + end + + # Sets the icon theme used by +flexible_template+ plugin + def flexible_template_icon_theme=(value) + self.settings['flexible_template_icon_theme'] = value + end # ################################################# # Validations diff --git a/test/unit/virtual_community_test.rb b/test/unit/virtual_community_test.rb index 327f727..154d84d 100644 --- a/test/unit/virtual_community_test.rb +++ b/test/unit/virtual_community_test.rb @@ -78,4 +78,23 @@ class VirtualCommunityTest < Test::Unit::TestCase assert v.has_terms_of_use? end + def test_should_profive_flexible_template_stuff + v = VirtualCommunity.new + + # template + assert_nil v.flexible_template_template + v.flexible_template_template = 'bli' + assert_equal 'bli', v.flexible_template_template + + # theme + assert_nil v.flexible_template_theme + v.flexible_template_theme = 'bli' + assert_equal 'bli', v.flexible_template_theme + + # icon theme + assert_nil v.flexible_template_icon_theme + v.flexible_template_icon_theme = 'bli' + assert_equal 'bli', v.flexible_template_icon_theme + end + end -- libgit2 0.21.2