Skip to content

Commit

Permalink
tidying up, tests pass, last traces of inheritance removed
Browse files Browse the repository at this point in the history
  • Loading branch information
will-r committed Nov 21, 2011
1 parent 4e3cd57 commit 8bcf6d7
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 7 deletions.
2 changes: 1 addition & 1 deletion app/models/group.rb
Expand Up @@ -116,7 +116,7 @@ def membership_for(reader)
def self.define_retrieval_methods(classname)
type_scope = "for_#{classname.downcase.pluralize}".intern
Permission.send :named_scope, type_scope, :conditions => { :permitted_type => classname }
define_method("#{classname.downcase}_permissions") { self.inherited_permissions.send type_scope }
define_method("#{classname.downcase}_permissions") { self.permissions.send type_scope }
define_method("#{classname.downcase.pluralize}") {
ids = self.send("#{classname.to_s.downcase}_permissions".intern).map(&:permitted_id)
classname.constantize.find_these(ids)
Expand Down
26 changes: 25 additions & 1 deletion app/views/admin/readers/_form.html.haml
Expand Up @@ -5,7 +5,7 @@
= render_region :form_top, :locals => {:f => f}

- render_region :form, :locals => {:f => f} do |form|
- form.name do
- form.edit_name do
%p
= f.label :forename
= f.text_field :forename, :class => "textbox activate", :size => 32, :maxlength => 100
Expand All @@ -26,6 +26,30 @@
- form.edit_password do
= render "password_fields", :f => f

- form.edit_phone do
%p
= f.label :phone
= f.text_field :phone, :class => 'textbox'
%p
= f.label :mobile
= f.text_field :mobile, :class => 'textbox'

- form.edit_address do
%p
= f.label :post_line1, t('activerecord.attributes.reader.postal_address')
= f.text_field :post_line1, :class => 'textbox'
%br
= f.text_field :post_line2, :class => 'textbox'
%p
= f.label :post_city
= f.text_field :post_city, :class => 'textbox'
%p
= f.label :post_province
= f.text_field :post_province, :class => 'textbox'
%p
= f.label :postcode
= f.text_field :postcode, :class => 'textbox'

- form.edit_description do
- if Radiant.config['reader.show_descriptions?']
%p
Expand Down
1 change: 1 addition & 0 deletions config/locales/en.yml
Expand Up @@ -280,6 +280,7 @@ en:
message_preview_introduction: "This is a snapshot of the message that was delivered to you %{date}. If it contains instructions they may now be out of date."
mistaken_access_error: "If you think that's a mistake, and that you should be allowed to do whatever it was you just tried to do, please contact your site administrator."
must_be_empty: "must be empty"
name: "Name"
name_and_login: "Name and Login"
navigation:
account: "Preferences"
Expand Down
2 changes: 1 addition & 1 deletion lib/radiant-reader-extension.rb
@@ -1,5 +1,5 @@
module RadiantReaderExtension
VERSION = '3.0.32'
VERSION = '3.0.33'
SUMMARY = %q{Reader/viewer/visitor registration, login and access-control for Radiant CMS}
DESCRIPTION = %q{Provides reader/member/user registration and management functions including password-reminder, group-based page access control and administrative email.}
URL = "http://radiant.spanner.org/reader"
Expand Down
2 changes: 1 addition & 1 deletion lib/reader_admin_ui.rb
Expand Up @@ -29,7 +29,7 @@ def load_default_reader_regions
OpenStruct.new.tap do |reader|
reader.edit = Radiant::AdminUI::RegionSet.new do |edit|
edit.main.concat %w{edit_header edit_form}
edit.form.concat %w{edit_name edit_email edit_nickname edit_password reader_groups edit_description edit_notes}
edit.form.concat %w{edit_name edit_email edit_nickname edit_password reader_groups edit_address edit_phone edit_description edit_notes}
edit.form_bottom.concat %w{edit_timestamp edit_buttons}
end
reader.index = Radiant::AdminUI::RegionSet.new do |index|
Expand Down
4 changes: 3 additions & 1 deletion lib/reader_tags.rb
Expand Up @@ -36,6 +36,8 @@ class TagError < StandardError; end
end
tag 'readers:each' do |tag|
tag.locals.readers = get_readers(tag)

Rails.logger.warn "readers:each: tlr has #{tag.locals.readers.size} readers"
tag.render('reader_list', tag.attr.dup, &tag.block)
end

Expand Down Expand Up @@ -73,7 +75,7 @@ class TagError < StandardError; end
we are on an uncached page.
}
tag 'reader' do |tag|
tag.expand if tag.locals.reader = get_reader(tag)
tag.expand if tag.locals.reader ||= get_reader(tag)
end

[:name, :forename, :surname, :nickname, :preferred_name, :preferred_informal_name, :email, :description, :login, :honorific].each do |field|
Expand Down
3 changes: 1 addition & 2 deletions spec/datasets/readers_dataset.rb
Expand Up @@ -86,8 +86,7 @@ def create_group(name, attributes={})
create_model :group, symbol, {
:name => name,
:slug => name.downcase,
:description => "#{name} group",
:parent_id => @group_id
:description => "#{name} group"
}.merge(attributes)
if block_given?
@group_id = group_id(symbol)
Expand Down

0 comments on commit 8bcf6d7

Please sign in to comment.