Commit 5d4345c4f9ff03506fe99ce0e135fb75d94a9066
1 parent
18230315
Exists in
master
and in
28 other branches
r215@sede: terceiro | 2007-07-28 07:53:39 -0300
ActionItem8: making VirtualCommunity provide flexible_template functionality. git-svn-id: https://svn.colivre.coop.br/svn/noosfero/trunk@219 3f533792-8f58-4932-b0fe-aaf55b0a4547
Showing
4 changed files
with
53 additions
and
6 deletions
Show diff stats
app/controllers/home_controller.rb
app/models/profile.rb
app/models/virtual_community.rb
... | ... | @@ -16,6 +16,8 @@ class VirtualCommunity < ActiveRecord::Base |
16 | 16 | # Relationships and applied behaviour |
17 | 17 | # ################################################# |
18 | 18 | |
19 | + acts_as_flexible_template | |
20 | + | |
19 | 21 | # One VirtualCommunity can be reached by many domains |
20 | 22 | has_many :domains, :as => :owner |
21 | 23 | |
... | ... | @@ -76,6 +78,36 @@ class VirtualCommunity < ActiveRecord::Base |
76 | 78 | def has_terms_of_use? |
77 | 79 | ! self.settings['terms_of_use'].nil? |
78 | 80 | end |
81 | + | |
82 | + # Returns the template used by +flexible_template+ plugin. | |
83 | + def flexible_template_template | |
84 | + self.settings['flexible_template_template'] | |
85 | + end | |
86 | + | |
87 | + # Sets the template used by +flexible_template+ plugin. | |
88 | + def flexible_template_template=(value) | |
89 | + self.settings['flexible_template_template'] = value | |
90 | + end | |
91 | + | |
92 | + # Returns the theme used by +flexible_template+ plugin | |
93 | + def flexible_template_theme | |
94 | + self.settings['flexible_template_theme'] | |
95 | + end | |
96 | + | |
97 | + # Sets the theme used by +flexible_template+ plugin | |
98 | + def flexible_template_theme=(value) | |
99 | + self.settings['flexible_template_theme'] = value | |
100 | + end | |
101 | + | |
102 | + # Returns the icon theme used by +flexible_template+ plugin | |
103 | + def flexible_template_icon_theme | |
104 | + self.settings['flexible_template_icon_theme'] | |
105 | + end | |
106 | + | |
107 | + # Sets the icon theme used by +flexible_template+ plugin | |
108 | + def flexible_template_icon_theme=(value) | |
109 | + self.settings['flexible_template_icon_theme'] = value | |
110 | + end | |
79 | 111 | |
80 | 112 | # ################################################# |
81 | 113 | # Validations | ... | ... |
test/unit/virtual_community_test.rb
... | ... | @@ -78,4 +78,23 @@ class VirtualCommunityTest < Test::Unit::TestCase |
78 | 78 | assert v.has_terms_of_use? |
79 | 79 | end |
80 | 80 | |
81 | + def test_should_profive_flexible_template_stuff | |
82 | + v = VirtualCommunity.new | |
83 | + | |
84 | + # template | |
85 | + assert_nil v.flexible_template_template | |
86 | + v.flexible_template_template = 'bli' | |
87 | + assert_equal 'bli', v.flexible_template_template | |
88 | + | |
89 | + # theme | |
90 | + assert_nil v.flexible_template_theme | |
91 | + v.flexible_template_theme = 'bli' | |
92 | + assert_equal 'bli', v.flexible_template_theme | |
93 | + | |
94 | + # icon theme | |
95 | + assert_nil v.flexible_template_icon_theme | |
96 | + v.flexible_template_icon_theme = 'bli' | |
97 | + assert_equal 'bli', v.flexible_template_icon_theme | |
98 | + end | |
99 | + | |
81 | 100 | end | ... | ... |