Commit 432cfc1cd829aa4e6d41edb39be2c23ac501f1f7
1 parent
e78974a8
Exists in
profile_api_improvements
and in
1 other branch
Fixes setting items in profile
Concern needs to be included before first use of setting items
Showing
1 changed file
with
14 additions
and
14 deletions
Show diff stats
app/models/profile.rb
@@ -187,6 +187,20 @@ class Profile < ApplicationRecord | @@ -187,6 +187,20 @@ class Profile < ApplicationRecord | ||
187 | Person.members_of(self).by_role(roles) | 187 | Person.members_of(self).by_role(roles) |
188 | end | 188 | end |
189 | 189 | ||
190 | + extend ActsAsHavingSettings::ClassMethods | ||
191 | + acts_as_having_settings field: :data | ||
192 | + | ||
193 | + def settings | ||
194 | + data | ||
195 | + end | ||
196 | + | ||
197 | + settings_items :redirect_l10n, :type => :boolean, :default => false | ||
198 | + settings_items :public_content, :type => :boolean, :default => true | ||
199 | + settings_items :description | ||
200 | + settings_items :fields_privacy, :type => :hash, :default => {} | ||
201 | + settings_items :email_suggestions, :type => :boolean, :default => false | ||
202 | + settings_items :profile_admin_mail_notification, :type => :boolean, :default => true | ||
203 | + | ||
190 | extend ActsAsHavingBoxes::ClassMethods | 204 | extend ActsAsHavingBoxes::ClassMethods |
191 | acts_as_having_boxes | 205 | acts_as_having_boxes |
192 | 206 | ||
@@ -254,20 +268,6 @@ class Profile < ApplicationRecord | @@ -254,20 +268,6 @@ class Profile < ApplicationRecord | ||
254 | scrap.nil? ? Scrap.all_scraps(self) : Scrap.all_scraps(self).find(scrap) | 268 | scrap.nil? ? Scrap.all_scraps(self) : Scrap.all_scraps(self).find(scrap) |
255 | end | 269 | end |
256 | 270 | ||
257 | - extend ActsAsHavingSettings::ClassMethods | ||
258 | - acts_as_having_settings field: :data | ||
259 | - | ||
260 | - def settings | ||
261 | - data | ||
262 | - end | ||
263 | - | ||
264 | - settings_items :redirect_l10n, :type => :boolean, :default => false | ||
265 | - settings_items :public_content, :type => :boolean, :default => true | ||
266 | - settings_items :description | ||
267 | - settings_items :fields_privacy, :type => :hash, :default => {} | ||
268 | - settings_items :email_suggestions, :type => :boolean, :default => false | ||
269 | - settings_items :profile_admin_mail_notification, :type => :boolean, :default => true | ||
270 | - | ||
271 | validates_length_of :description, :maximum => 550, :allow_nil => true | 271 | validates_length_of :description, :maximum => 550, :allow_nil => true |
272 | 272 | ||
273 | # Valid identifiers must match this format. | 273 | # Valid identifiers must match this format. |