radiant-reader-extension 3.0.37 → 3.0.38

Sign up to get free protection for your applications and to get access to all the features.
@@ -90,9 +90,8 @@ class AccountsController < ReaderActionController
90
90
  end
91
91
 
92
92
  def update
93
- @reader.attributes = params[:reader]
94
- @reader.clear_password = params[:reader][:password] if params[:reader][:password]
95
- if @reader.save
93
+ params[:reader][:clear_password] = params[:reader][:password] if params[:reader][:password]
94
+ if @reader.update_attributes(params[:reader])
96
95
  flash[:notice] = t('reader_extension.account_updated')
97
96
  redirect_to reader_dashboard_url
98
97
  else
@@ -18,6 +18,7 @@ class Reader < ActiveRecord::Base
18
18
  end
19
19
 
20
20
  belongs_to :user
21
+ before_validation :combine_names
21
22
  before_update :update_user
22
23
 
23
24
  belongs_to :created_by, :class_name => 'User'
@@ -28,8 +29,6 @@ class Reader < ActiveRecord::Base
28
29
  has_many :groups, :through => :memberships, :uniq => true
29
30
  accepts_nested_attributes_for :memberships
30
31
 
31
- before_validation :combine_names
32
-
33
32
  validates_presence_of :name, :forename, :surname, :email
34
33
  validates_uniqueness_of :nickname, :allow_blank => true
35
34
  validates_length_of :name, :forename, :surname, :maximum => 100, :allow_nil => false
@@ -268,12 +267,15 @@ class Reader < ActiveRecord::Base
268
267
  private
269
268
 
270
269
  def combine_names
271
- if self.name?
272
- self.forename ||= self.name.split(/\s+/).first
273
- self.surname ||= self.name.split(/\s+/).last
274
- else
270
+ if self.forename_changed? || self.surname_changed?
275
271
  self.name = "#{self.forename} #{self.surname}"
272
+ elsif self.name_changed?
273
+ self.forename = self.name.split(/\s+/).first
274
+ self.surname = self.name.split(/\s+/).last
276
275
  end
276
+ self.forename = self.name.split(/\s+/).first unless self.forename?
277
+ self.surname = self.name.split(/\s+/).last unless self.surname?
278
+ self.name = "#{self.forename} #{self.surname}" unless self.name?
277
279
  end
278
280
 
279
281
  def email_must_not_be_in_use
@@ -67,9 +67,9 @@
67
67
  - form.edit_groups do
68
68
  = render :partial => 'choose_memberships'
69
69
 
70
- - render_region :form_bottom, :locals => {:f => f} do |form_bottom|
71
- - form_bottom.edit_buttons do
70
+ - form.buttons do
72
71
  %p
73
72
  = submit_tag reader.new_record? ? t('reader_extension.create_account') : t("reader_extension.update_account")
74
73
  or
75
74
  = link_to 'cancel', request.referer
75
+
@@ -86,9 +86,8 @@
86
86
  %br
87
87
  %span.formnote= t('reader_extension.form_notes.account.unshareable')
88
88
 
89
- - render_region :form_bottom, :locals => {:f => f} do |form_bottom|
90
- - form_bottom.edit_buttons do
91
- %p
92
- = submit_tag reader.new_record? ? t('reader_extension.create_account') : t("reader_extension.update_account")
93
- or
94
- = link_to 'cancel', request.referer
89
+ - form.buttons do
90
+ %p
91
+ = submit_tag reader.new_record? ? t('reader_extension.create_account') : t("reader_extension.update_account")
92
+ or
93
+ = link_to 'cancel', request.referer
@@ -1,5 +1,5 @@
1
1
  module RadiantReaderExtension
2
- VERSION = '3.0.37'
2
+ VERSION = '3.0.38'
3
3
  SUMMARY = %q{Reader/viewer/visitor registration, login and access-control for Radiant CMS}
4
4
  DESCRIPTION = %q{Provides reader/member/user registration and management functions including password-reminder, group-based page access control and administrative email.}
5
5
  URL = "http://radiant.spanner.org/reader"
@@ -115,13 +115,11 @@ module ReaderAdminUI
115
115
  end
116
116
  account.edit = Radiant::AdminUI::RegionSet.new do |edit|
117
117
  edit.main.concat %w{preamble form gravatar}
118
- edit.form.concat %w{edit_name edit_email edit_password}
119
- edit.form_bottom.concat %w{edit_buttons}
118
+ edit.form.concat %w{edit_name edit_email edit_password buttons}
120
119
  end
121
120
  account.edit_profile = Radiant::AdminUI::RegionSet.new do |edit_profile|
122
121
  edit_profile.main.concat %w{preamble profile_form gravatar}
123
- edit_profile.profile_form.concat %w{edit_honorific edit_name edit_dob edit_phone edit_mobile edit_address edit_shareability}
124
- edit_profile.form_bottom.concat %w{edit_buttons}
122
+ edit_profile.profile_form.concat %w{edit_honorific edit_name edit_dob edit_phone edit_mobile edit_address edit_shareability buttons}
125
123
  end
126
124
  account.new = account.edit
127
125
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: radiant-reader-extension
3
3
  version: !ruby/object:Gem::Version
4
- hash: 77
4
+ hash: 75
5
5
  prerelease:
6
6
  segments:
7
7
  - 3
8
8
  - 0
9
- - 37
10
- version: 3.0.37
9
+ - 38
10
+ version: 3.0.38
11
11
  platform: ruby
12
12
  authors:
13
13
  - William Ross
@@ -339,6 +339,7 @@ files:
339
339
  - public/stylesheets/sass/admin/reader_group.sass
340
340
  - public/stylesheets/sass/reader.sass
341
341
  - radiant-reader-extension-3.0.37.gem
342
+ - radiant-reader-extension-3.0.38.gem
342
343
  - radiant-reader-extension.gemspec
343
344
  - Rakefile
344
345
  - reader_extension.rb
@@ -367,7 +368,7 @@ files:
367
368
  homepage: http://radiant.spanner.org/reader
368
369
  licenses: []
369
370
 
370
- post_install_message: "\n Add this to your radiant project with a line in your Gemfile:\n\n gem 'radiant-reader-extension', '~> 3.0.37'\n\n and if you haven't already, remember to enable ActionMailer in your\n project's config/environment.rb.\n "
371
+ post_install_message: "\n Add this to your radiant project with a line in your Gemfile:\n\n gem 'radiant-reader-extension', '~> 3.0.38'\n\n and if you haven't already, remember to enable ActionMailer in your\n project's config/environment.rb.\n "
371
372
  rdoc_options: []
372
373
 
373
374
  require_paths: