radiant-reader-extension 3.0.0.rc3 → 3.0.0.rc4

Sign up to get free protection for your applications and to get access to all the features.
@@ -24,6 +24,8 @@ class Admin::MessagesController < Admin::ResourceController
24
24
  @readers = @message.inactive_readers
25
25
  when "unsent"
26
26
  @readers = @message.undelivered_readers
27
+ when "selected"
28
+ @readers = @message.possible_readers.find(params['recipients'])
27
29
  else
28
30
  redirect_to admin_message_url(@message)
29
31
  return
@@ -9,7 +9,8 @@ class Admin::PermissionsController < ApplicationController
9
9
  def create
10
10
  @page = Page.find(params[:page_id])
11
11
  raise ActiveRecord::RecordNotFound unless @page
12
- @permission = Permission.find_or_create_by_page_id_and_group_id(@page.id, @group.id)
12
+ scope = @group.permissions.for(@page)
13
+ @permission = scope.first || scope.create!
13
14
  respond_to do |format|
14
15
  format.html {
15
16
  flash[:notice] = "#{@page.name} bound to group #{@group.name}"
@@ -21,7 +22,7 @@ class Admin::PermissionsController < ApplicationController
21
22
 
22
23
  def destroy
23
24
  @permission = @group.permissions.find(params[:id])
24
- @page = @permission.page
25
+ @page = @permission.permitted
25
26
  @permission.delete if @permission
26
27
  respond_to do |format|
27
28
  format.html {
data/app/models/group.rb CHANGED
@@ -40,7 +40,7 @@ class Group < ActiveRecord::Base
40
40
  :select => "groups.*, count(pp.group_id) AS pcount",
41
41
  :joins => "INNER JOIN permissions as pp on pp.group_id = groups.id",
42
42
  :conditions => [conditions, *binds],
43
- :having => "pcount > 0", # otherwise attached_to([]) returns all groups
43
+ :having => "count(pp.group_id) > 0", # otherwise attached_to([]) returns all groups
44
44
  :group => column_names.map { |n| 'groups.' + n }.join(','),
45
45
  :readonly => false
46
46
  }
@@ -1,11 +1,11 @@
1
1
  class Message < ActiveRecord::Base
2
2
 
3
- has_groups
4
3
  has_site if respond_to? :has_site
5
4
 
6
5
  belongs_to :layout
7
6
  belongs_to :created_by, :class_name => 'User'
8
7
  belongs_to :updated_by, :class_name => 'User'
8
+ belongs_to :group
9
9
 
10
10
  has_many :deliveries, :class_name => 'MessageReader', :conditions => ["message_readers.sent_at IS NOT NULL and message_readers.sent_at <= ?", Time.now.to_s(:db)]
11
11
  has_many :recipients, :through => :deliveries, :source => :reader
@@ -21,13 +21,19 @@ class Message < ActiveRecord::Base
21
21
  named_scope :ordinary, { :conditions => "function_id = '' OR function_id IS NULL" }
22
22
  named_scope :published, { :conditions => "status_id >= 100" }
23
23
 
24
+ named_scope :belonging_to, lambda {|group|
25
+ { :conditions => {:group_id => group }}
26
+ }
27
+
28
+ named_scope :ungrouped, :conditions => {:group_id => nil}
29
+
24
30
  def filtered_body
25
31
  filter.filter(body)
26
32
  end
27
33
 
28
- # has to return a named_scope for chainability
34
+ # has to return a scope for chainability
29
35
  def possible_readers
30
- groups.any? ? Reader.in_groups(groups) : Reader.scoped({})
36
+ group ? group.readers : Reader.scoped({})
31
37
  end
32
38
 
33
39
  def undelivered_readers
@@ -1,9 +1,8 @@
1
1
  class MessageFunction
2
- attr_accessor :name, :description
2
+ attr_accessor :name
3
3
 
4
4
  def initialize(name, description='')
5
5
  @name = name
6
- @description = description
7
6
  end
8
7
 
9
8
  def symbol
@@ -14,6 +13,10 @@ class MessageFunction
14
13
  @name
15
14
  end
16
15
 
16
+ def description
17
+ I18n.t("message_functions.#{@name}")
18
+ end
19
+
17
20
  def humanize
18
21
  to_s.gsub('_', ' ')
19
22
  end
@@ -34,6 +37,8 @@ class MessageFunction
34
37
  @@functions = [
35
38
  MessageFunction.new('welcome', 'Welcome'),
36
39
  MessageFunction.new('invitation', 'Invitation' ),
40
+ MessageFunction.new('group_welcome', 'Group welcome'),
41
+ MessageFunction.new('group_invitation', 'Group invitation' ),
37
42
  MessageFunction.new('password_reset', 'Password instructions'),
38
43
  MessageFunction.new('activation', 'Activation instructions')
39
44
  ]
@@ -2,10 +2,10 @@ class Permission < ActiveRecord::Base
2
2
 
3
3
  belongs_to :group
4
4
  belongs_to :permitted, :polymorphic => true
5
-
5
+
6
6
  named_scope :for, lambda { |object|
7
- { :conditions => ["permissions.permitted_id = ? and permissions.permitted_type = ?", object.id, object.class.to_s] }
7
+ { :conditions => {:permitted_id => object.id, :permitted_type => object.class.name.to_s} }
8
8
  }
9
-
9
+
10
10
  end
11
11
 
data/app/models/reader.rb CHANGED
@@ -47,7 +47,7 @@ class Reader < ActiveRecord::Base
47
47
  named_scope :except, lambda { |readers|
48
48
  readers = [readers].flatten
49
49
  if readers.any?
50
- { :conditions => ["NOT readers.id IN (#{readers.map{"?"}.join(',')})", readers.map(&:id)] }
50
+ { :conditions => ["NOT readers.id IN (#{readers.map{"?"}.join(',')})", *readers.map(&:id)] }
51
51
  else
52
52
  { }
53
53
  end
@@ -229,7 +229,7 @@ class Reader < ActiveRecord::Base
229
229
  private
230
230
 
231
231
  def email_must_not_be_in_use
232
- reader = Reader.find_by_email(self.email) # the finds will be site-scoped if appropriate
232
+ reader = Reader.find_by_email(self.email)
233
233
  user = User.find_by_email(self.email)
234
234
  if user && user != self.user
235
235
  errors.add :value, :taken_by_author
@@ -258,7 +258,7 @@ private
258
258
  end
259
259
 
260
260
  def send_group_invitation_message(group=nil)
261
- send_functional_message('invitation', group)
261
+ send_functional_message('group_invitation', group)
262
262
  end
263
263
 
264
264
  end
@@ -7,8 +7,8 @@ class ReaderNotifier < ActionMailer::Base
7
7
  prefix = site ? site.abbreviation : Radiant::Config['email.prefix']
8
8
  host = site ? site.base_domain : Radiant::Config['site.host'] || 'www.example.com'
9
9
  default_url_options[:host] = host
10
- sender = Radiant::Config['email.name'] || "sender_not_configured"
11
- sender_address = Radiant::Config['email.address'] || "admin@#{host}"
10
+ sender = Radiant::Config['email.name'] || current_user.name
11
+ sender_address = Radiant::Config['email.address'] || current_user.email
12
12
 
13
13
  message_layout(message.layout) if message.layout
14
14
  content_type("text/html")
@@ -18,7 +18,7 @@
18
18
  %br
19
19
  = f.text_field :name, :class => 'standard'
20
20
  %br
21
- %span.formnote= t('reader_extension.form_notes.name')
21
+ %span.formnote= t('reader_extension.form_notes.account.name')
22
22
 
23
23
  - if reader.new_record?
24
24
  %p
@@ -26,7 +26,7 @@
26
26
  %br
27
27
  = text_field_tag reader.email_field, params[reader.email_field] || reader.email, :id => "reader_#{reader.email_field}", :class => 'standard'
28
28
  %br
29
- %span.formnote= t('reader_extension.form_notes.email')
29
+ %span.formnote= t('reader_extension.form_notes.account.email')
30
30
  .innocuous
31
31
  %p
32
32
  =f.label :email, nil, :class => 'required'
@@ -41,14 +41,14 @@
41
41
  %br
42
42
  = f.text_field :email, :class => 'standard'
43
43
  %br
44
- %span.formnote= t('reader_extension.form_notes.email')
44
+ %span.formnote= t('reader_extension.form_notes.account.email')
45
45
 
46
46
  %p
47
47
  = f.label :login, nil, :class => 'optional'
48
48
  %br
49
49
  = f.text_field :login, :class => 'standard'
50
50
  %br
51
- %span.formnote= t('reader_extension.form_notes.login')
51
+ %span.formnote= t('reader_extension.form_notes.account.login')
52
52
 
53
53
  - if reader.new_record?
54
54
  %p
@@ -56,7 +56,7 @@
56
56
  %br
57
57
  = f.password_field :password, :class => 'standard', :autocomplete => 'off'
58
58
  %br
59
- %span.formnote= t('reader_extension.form_notes.new_password')
59
+ %span.formnote= t('reader_extension.form_notes.account.new_password')
60
60
 
61
61
  %p
62
62
  = f.label :password_confirmation, nil, :class => 'required'
@@ -77,7 +77,7 @@
77
77
  = f.label :password, t('reader_extension.new_password'), :class => 'required'
78
78
  %br
79
79
  = f.password_field :password, :class => 'standard', :autocomplete => 'off'
80
- %span.formnote= t('reader_extension.form_notes.new_password')
80
+ %span.formnote= t('reader_extension.form_notes.account.new_password')
81
81
  %p
82
82
  = f.label :password_confirmation, t('reader_extension.confirm_new_password'), :class => 'required'
83
83
  %br
@@ -3,7 +3,7 @@
3
3
  %h1
4
4
  = t('reader_extension.invite_into_group', :name => @group.name)
5
5
 
6
- - if message = @group.messages.for_function('invitation').first
6
+ - if message = @group.messages.for_function('group_invitation').first
7
7
 
8
8
  - form_for :group, @group, :url => admin_group_group_invitations_url(@group), :html => {:id => 'preview_form', :method => 'post'} do
9
9
  .form-area
@@ -49,7 +49,7 @@
49
49
  %td
50
50
  = text_field_tag "reader_#{i}[login]", reader.login, :class => "preview#{ ' with_error' if reader.errors.on(:login)}", :title => reader.errors.on(:login), :disabled => true
51
51
  %td
52
- = text_field_tag "reader_#{i}[phone]", reader.phone, :class => "preview#{ ' with_error' if reader.errors.on(:phone)}", :title => reader.errors.on(:phone)
52
+ = text_field_tag "reader_#{i}[phone]", reader.phone, :class => "preview#{ ' with_error' if reader.errors.on(:phone)}", :title => reader.errors.on(:phone), :disabled => true
53
53
  - i = i + 1
54
54
 
55
55
  %p.buttons
@@ -14,11 +14,11 @@
14
14
  = link_to image('plus') + ' ' + t("reader_extension.create_new_message"), new_admin_group_message_url(@group), :class => 'action create'
15
15
  %h3
16
16
  =t('reader_extension.admin_messages').titlecase
17
- - ['welcome', 'invitation'].each do |func|
17
+ - ['group_welcome', 'group_invitation'].each do |func|
18
18
  - message = Message.functional(func, @group)
19
19
  %p.ruled
20
20
  %label
21
- = t("reader_extension.#{func}_message")
21
+ = t("message_functions.#{func}")
22
22
  - if message
23
23
  %strong
24
24
  = link_to message.subject, admin_message_url(message)
@@ -4,28 +4,41 @@
4
4
  - render_region :form do |formpart|
5
5
  - formpart.edit_subject do
6
6
  %p.title
7
- = form.label :subject, "Message Subject"
7
+ = form.label :subject
8
8
  = form.text_field :subject, :class => 'textbox', :maxlength => 255
9
- - if @message.new_record?
10
- = form.hidden_field :function_id
11
9
 
12
10
  - formpart.edit_body do
13
11
  %div.body
14
12
  %p
15
13
  %span.filter
16
- = form.label :filter_id, "Filter:"
17
- = form.select :filter_id, TextFilter.descendants.map { |tf| tf.filter_name }.sort, :id => 'message_filter', :include_blank => true
18
- = form.label :body, "Message Body"
14
+ = form.label :filter_id
15
+ = form.select :filter_id, TextFilter.descendants.map { |tf| tf.filter_name }.sort, :include_blank => true
16
+ = form.label :body
19
17
  = form.text_area :body, :class => 'textarea', :style => 'width: 100%'
20
18
 
21
- = render_region :body_bottom, :locals => {:form => form}
19
+ - formpart.edit_function do
20
+ - if admin?
21
+ %div.function.set
22
+ %p
23
+ = form.label :function_id
24
+ = form.select :function_id, MessageFunction.find_all.map { |mf| [t("message_functions.#{mf.name}"), mf.name] }, :include_blank => true
25
+ %p
26
+ = form.label :group_id
27
+ = form.select :group_id, Group.all.map { |g| [g.name, g.id] }, :include_blank => true
28
+
29
+ - elsif @message.new_record?
30
+ - if @message.group
31
+ = f.hidden_field :group_id
32
+ - if @message.function
33
+ = f.hidden_field :function_id
22
34
 
23
35
  - render_region :form_bottom do |form_bottom|
24
36
  - form_bottom.edit_timestamp do
25
- = updated_stamp @message
37
+ = updated_stamp @message
26
38
  - form_bottom.edit_buttons do
27
39
  %p.buttons
28
40
  = save_model_button(@message)
29
41
  = save_model_and_continue_editing_button(@message)
30
- or
31
- = link_to "cancel", admin_reader_configuration_url
42
+ = t('or')
43
+ = link_to t("cancel"), @message.new_record? ? admin_messages_url : admin_message_url(@message)
44
+
@@ -5,8 +5,7 @@
5
5
 
6
6
  - main.edit_header do
7
7
  %h1
8
- Edit
9
- = render :partial => 'message_description'
8
+ = t('reader_extension.edit_message')
10
9
 
11
10
  - main.edit_form do
12
11
  - form_for :message, @message, :url => admin_message_url(@message), :html => {:id => 'message_form', :method => 'put'} do |f|
@@ -19,7 +19,14 @@
19
19
  - tbody.subject_cell do
20
20
  %td.name
21
21
  = link_to message.subject, admin_message_url(message), :class => message.has_function? ? "functional" : "normal"
22
- = render :partial => '/admin/messages/list_function', :locals => {:message => message}
22
+ %span.function
23
+ - if message.administrative?
24
+ = t("message_functions.#{message.function}")
25
+ - else
26
+ = t("message_functions.ad_hoc")
27
+ - if message.group
28
+ = t('reader_extension.for')
29
+ = link_to message.group.name, admin_group_url(message.group)
23
30
 
24
31
  - tbody.sent_cell do
25
32
  %td.message_sent
@@ -5,8 +5,7 @@
5
5
 
6
6
  - main.edit_header do
7
7
  %h1
8
- Create
9
- = render :partial => 'message_description'
8
+ = t('reader_extension.create_message')
10
9
 
11
10
  - main.edit_form do
12
11
  - form_for :message, @message, :url => admin_messages_url, :html => {:id => 'message_form', :method => 'post'} do |f|
@@ -1,4 +1,5 @@
1
1
  - include_stylesheet('admin/reader')
2
+ - include_javascript('admin/reader')
2
3
  - body_classes << "reversed"
3
4
 
4
5
  = render_region :top
@@ -33,37 +34,57 @@
33
34
  - delivery.function do
34
35
  - if @message.administrative?
35
36
  %p
36
- = t("reader_extension.#{@message.function}_sent_automatically")
37
- %ul
38
- %li
39
- = link_to t('reader_extension.edit_message').titlecase, edit_admin_message_url(@message)
40
- %li
41
- = link_to t('reader_extension.reader_configuration_page').titlecase, admin_reader_configuration_url
42
-
37
+ - if @message.group
38
+ = t("reader_extension.belongs_to_group", :name => @message.group.name, :href => admin_group_url(@message.group))
39
+ = t("reader_extension.message_group_administrative")
40
+ = t("reader_extension.message_function.#{@message.function}")
41
+ - else
42
+ = t("reader_extension.message_administrative")
43
+ = t("reader_extension.message_function.#{@message.function}")
44
+ - else
45
+ %p
46
+ = t("reader_extension.message_adhoc")
47
+ = t("reader_extension.message_group_adhoc", :name => @message.group.name, :href => admin_group_url(@message.group))
48
+
43
49
  - delivery.options do
44
50
  - unless @message.administrative?
45
51
  - form_for :message, @message, :url => deliver_admin_message_url(@message), :html => {"data-onsubmit_status"=>"Sending email messages&#8230;"} do |f|
46
52
  %h3
47
53
  = t("reader_extension.send_to").titlecase + ":"
48
- %p
49
- = radio_button_tag 'delivery', 'all', true, :id => 'delivery_to_all', :disabled => @message.possible_readers.empty?
50
- %label.checkbox{:for => 'delivery_to_all', :class => @message.possible_readers.empty? ? 'disabled' : ''}
51
- = t('reader_extension.everyone')
52
- = t('reader_extension.count_people', :count => @message.possible_readers.count)
53
- %p
54
- = radio_button_tag 'delivery', 'unsent', false, :id => 'delivery_to_unsent', :disabled => @message.undelivered_readers.empty?
55
- %label.checkbox{:for => 'delivery_to_unsent', :class => @message.undelivered_readers.empty? ? 'disabled' : ''}
56
- = t('reader_extension.everyone_unsent')
57
- = t('reader_extension.count_people', :count => @message.undelivered_readers.count)
58
- %p
59
- = radio_button_tag 'delivery', 'inactive', false, :id => 'delivery_to_inactive', :disabled => @message.inactive_readers.empty?
60
- %label.checkbox{:for => 'delivery_to_inactive', :class => @message.inactive_readers.empty? ? 'disabled' : ''}
61
- = t('reader_extension.everyone_inactive')
62
- = t('reader_extension.count_people', :count => @message.inactive_readers.count)
54
+ .radio_group
55
+ %p
56
+ = radio_button_tag 'delivery', 'all', true, :id => 'delivery_to_all', :disabled => @message.possible_readers.empty?
57
+ %label.checkbox{:for => 'delivery_to_all', :class => @message.possible_readers.empty? ? 'disabled' : ''}
58
+ = t('reader_extension.everyone')
59
+ = t('reader_extension.count_people', :count => @message.possible_readers.count)
60
+ %p
61
+ = radio_button_tag 'delivery', 'unsent', false, :id => 'delivery_to_unsent', :disabled => @message.undelivered_readers.empty?
62
+ %label.checkbox{:for => 'delivery_to_unsent', :class => @message.undelivered_readers.empty? ? 'disabled' : ''}
63
+ = t('reader_extension.everyone_unsent')
64
+ = t('reader_extension.count_people', :count => @message.undelivered_readers.count)
65
+ %p
66
+ = radio_button_tag 'delivery', 'inactive', false, :id => 'delivery_to_inactive', :disabled => @message.inactive_readers.empty?
67
+ %label.checkbox{:for => 'delivery_to_inactive', :class => @message.inactive_readers.empty? ? 'disabled' : ''}
68
+ = t('reader_extension.everyone_inactive')
69
+ = t('reader_extension.count_people', :count => @message.inactive_readers.count)
70
+ %p
71
+ = radio_button_tag 'delivery', 'selected', false, :id => 'delivery_to_selected', :disabled => @message.possible_readers.empty?, :rel => 'toggle[select_recipients]'
72
+ %label.checkbox{:for => 'delivery_to_selected', :class => @message.possible_readers.empty? ? 'disabled' : ''}
73
+ = t('reader_extension.selected_people') + "..."
74
+ %ul#select_recipients
75
+ %li
76
+ = check_box_tag 'null', '', false, :class => 'select_all'
77
+ %label.checkbox.select_all
78
+ = t('reader_extension.select_all')
79
+ - @message.possible_readers.each do |reader|
80
+ %li
81
+ = check_box_tag "recipients[]", reader.id, false, :id => "recipients_#{reader.id}", :class => 'toggled'
82
+ %label.checkbox
83
+ = reader.name
63
84
 
64
85
  %p.buttons
65
86
  = submit_tag t('reader_extension.send_message')
66
- = t('reader_extension.or')
87
+ = t('or')
67
88
  = link_to t('reader_extension.cancel'), admin_messages_url
68
89
 
69
90
 
@@ -22,6 +22,10 @@ en:
22
22
  postcode: "Postcode"
23
23
  surname: "Surname"
24
24
  unshareable: "Share none of this information"
25
+ message:
26
+ subject: "Message Subject"
27
+ filter_id: "Filter"
28
+ body: "Message body"
25
29
  errors:
26
30
  models:
27
31
  reader:
@@ -39,7 +43,6 @@ en:
39
43
  password:
40
44
  too_short: "this must have at least six characters"
41
45
  invalid: "this must include at least one non-letter"
42
-
43
46
  config:
44
47
  reader:
45
48
  allow_registration?: "Allow registration"
@@ -59,6 +62,14 @@ en:
59
62
  groups: "Groups"
60
63
  messages: "Messages"
61
64
  settings: "Settings"
65
+ message_functions:
66
+ activation: "Activation instructions"
67
+ ad_hoc: "Ad hoc message"
68
+ invitation: "Invitation"
69
+ group_welcome: "Group welcome"
70
+ group_invitation: "Group invitation"
71
+ password_reset: "Password instructions"
72
+ welcome: "Registration complete"
62
73
  reader_extension:
63
74
  access_denied: "Access denied"
64
75
  account_settings: "Account settings"
@@ -133,18 +144,19 @@ en:
133
144
  everyone_in_group: "Everyone in the group"
134
145
  forgotten_password: "Forgotten your password?"
135
146
  form_notes:
136
- description: "you can fill this in later. Textile formatting is allowed."
137
- email: "we will send activation instructions to this address"
138
- existing_password: "leave blank to keep present password. If changing, at least four characters."
139
- login: "you can always use your email address instead"
140
- name: "this is how you will be referred to on the site"
141
- new_password: "at least six characters, please, and with at least one non-letter character"
142
- honorific: "this is prepended to your name but only in a formal setting"
143
- post_country: "Please choose from the list"
144
- post_organisation: "You can omit this unless it's part of your postal address"
145
- unshareable: "to keep one field private, uncheck it above. To keep all your contact information private and receive only administrative messages, check this box."
146
- phone: "with area code but no country code"
147
- mobile: "without country code"
147
+ account:
148
+ description: "you can fill this in later. Textile formatting is allowed."
149
+ email: "we will send activation instructions to this address"
150
+ existing_password: "leave blank to keep present password. If changing, at least four characters."
151
+ login: "you can always use your email address instead"
152
+ name: "this is how you will be referred to on the site"
153
+ new_password: "at least six characters, please, and with at least one non-letter character"
154
+ honorific: "this is prepended to your name but only in a formal setting"
155
+ post_country: "Please choose from the list"
156
+ post_organisation: "You can omit this unless it's part of your postal address"
157
+ unshareable: "to keep one field private, uncheck it above. To keep all your contact information private and receive only administrative messages, check this box."
158
+ phone: "with area code but no country code"
159
+ mobile: "without country code"
148
160
  form_problem: "there was a problem with the form"
149
161
  getting_gravatar: "If you would like a picture to appear next to your messages, give yourself a gravatar at"
150
162
  groups: "Groups"
@@ -170,6 +182,17 @@ en:
170
182
  message_delivered: "Message delivered"
171
183
  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."
172
184
  must_be_empty: "must be empty"
185
+ message_adhoc: "This is an ad-hoc message you can send at any time."
186
+ message_administrative: "This message is sent automatically"
187
+ message_group_adhoc: 'It is restricted to members of the <a href="%{href}">%{name}</a> group.'
188
+ message_group_administrative: "It is sent automatically"
189
+ message_function:
190
+ welcome: "when someone completes the registration and email-confirmation process."
191
+ password_reset: "when someone asks to reset their password."
192
+ activation: "when someone registers here."
193
+ invitation: "when someone is invited to visit the site."
194
+ group_welcome: "when someone is admitted to the group."
195
+ group_invitation: "when someone is invited into the group."
173
196
  navigation:
174
197
  account: "Your account"
175
198
  activate: "Activate account"
@@ -234,6 +257,8 @@ en:
234
257
  reset_password: "Reset your password"
235
258
  restart_password_change: "Send another password-reset message"
236
259
  return_to_page: "return to the page you were looking at before you started registering"
260
+ select_all: "Select all"
261
+ selected_people: "Selected people"
237
262
  send_it_again: "send it again"
238
263
  send_reset_button: "send me instructions"
239
264
  sent_on: "sent %{date}"
@@ -262,17 +287,14 @@ en:
262
287
  your_name: "Your name"
263
288
  send_to: "Send to"
264
289
  reader_configuration_page: "reader settings"
265
- welcome_sent_automatically: "This message is sent automatically when someone completes the registration and email-confirmation process."
266
290
  welcome_please_log_in: '<span class="greeting">Welcome!</span> To take part, please <a href="%{login_url}">log in</a> or <a href="%{register_url}">register</a>.'
267
- password_reset_sent_automatically: "This message is sent automatically when someone asks to reset their password."
268
- activation_sent_automatically: "This message is sent automatically when someone begins to register."
269
- invitation_sent_automatically: "This message is sent automatically when someone is invited to the site."
270
- everyone_unsent: "anyone who has not received this message"
271
- everyone_inactive: "anyone who has not activated their account"
291
+ everyone_unsent: "Anyone who has not received this message"
292
+ everyone_inactive: "Anyone who has not activated their account"
272
293
  everyone: "Everyone"
273
- send_message: "Send Message"
274
- edit_message: "edit message"
275
- delete_message: "delete message"
294
+ create_message: "Create new message"
295
+ send_message: "Send message"
296
+ edit_message: "Edit message"
297
+ delete_message: "Delete message"
276
298
  this_message_functional: "This is the %{function} message."
277
299
  preview_and_send_message: "Preview and send message"
278
300
  really_delete_message: "Are you sure you want to delete the message '%{title}'? This cannot be undone."
@@ -287,6 +309,54 @@ en:
287
309
  separator: " &raquo; "
288
310
  vcard_file: "address book"
289
311
  you_are_not_shared: "You have chosen not to share your contact information."
312
+
313
+ # group
314
+ group: "group"
315
+ subscriptions: "subscriptions"
316
+ inherited_group: "group is attached higher in the page tree: can't be detached here"
317
+ public_if_no_groups: "Leave all groups unchecked for public access"
318
+ allowed_groups: "Allow access only to:"
319
+ page_private: "Sorry: you don't have permission to view that page."
320
+ none: "none"
321
+ new_group: "new group"
322
+ group_members: "Group members"
323
+ private_pages: "Private pages"
324
+ admin_messages: "Administrative messages"
325
+ other_messages: "Ad-hoc messages"
326
+ create_new_message: "Send a new message"
327
+ delete_message: "delete message"
328
+ create_welcome: "create welcome"
329
+ create_invitation: "create invitation"
330
+ last_sent: "last sent"
331
+ private_page_explanation: "The pages selected on the left are only visible to the people selected on the right (unless another group is also given permission to see that page)."
332
+ sent_to_group: "sent automatically to the %{name} group"
333
+ sent_to_these_groups: "sent automatically to these groups"
334
+ group_welcome: "This is the welcome message"
335
+ group_invitation: "This is the invitation message"
336
+ all_in_group: "Everyone in the group"
337
+ inactive_in_group: "Group members who have not activated their account"
338
+ unsent_in_group: "Group members who have not received this message"
339
+ group_page: "group page"
340
+ for_group: "for the %{name} group"
341
+ add_members: "add members"
342
+ delete_group: "delete group"
343
+ really_delete_group: "Are you sure you want to completely remove the '%{name}' group? This cannot be undone."
344
+ edit_group: "edit group"
345
+ belongs_to_group: 'This message belongs to the <a href="%{href}">%{name}</a> group.'
346
+ belongs_to_these_groups: "This message is sent to these groups:"
347
+ invite_into_group: "Invite people into the %{name} group"
348
+ invitation_instructions: "This is a quick way to bring a group of people into the system in one go. Enter a comma-separated list of names and email addresses (one person per line) and after a bit of checking and tweaking on the next page, each of those people will be invited into the system and issued an account with a vaguely adequate username and entirely random password. Anyone who is already here will just be added to the group."
349
+ check_invitation_message: "Preview invitation message"
350
+ no_invitation_message: "This group has no invitation message. You will need to create one before you can invite people into it."
351
+ create_invitation_message: "create invitation message"
352
+ check_invitation_list: "Check the invitation list"
353
+ invitation_preview_instructions: "Fields in red have validation problems. That usually means an email address or login needs checking. Hover your mouse pointer over the affected field to find out more. Fields in grey show that we already have that person here (based on their email address). You can still bring them into the group but you can't edit their details here."
354
+ full_name: "full name"
355
+ email: "email"
356
+ optional_phone: "[phone]"
357
+ optional_login: "[login]"
358
+ page_not_public: "The page you have requested is not public. Please log in. If your account has the necessary permission you will be taken straight there."
359
+
290
360
  time:
291
361
  formats:
292
362
  date: "%B %e, %Y"
data/lib/message_tags.rb CHANGED
@@ -45,7 +45,7 @@ module MessageTags
45
45
  tag.expand
46
46
  end
47
47
 
48
- [:name, :forename, :email, :description, :login].each do |field|
48
+ [:name, :forename, :surname, :email, :description, :login].each do |field|
49
49
  desc %{
50
50
  Only for use in email messages. Displays the #{field} field of the reader currently being emailed.
51
51
  <pre><code><r:recipient:#{field} /></code></pre>
@@ -58,8 +58,8 @@ module MessageTags
58
58
  desc %{
59
59
  Only for use in email messages. Displays the password of the reader currently being emailed, if we still have it.
60
60
 
61
- (After the first successful login we forget the cleartext version of their password, so you only want to use this
62
- tag in welcome and activation messages.)
61
+ (After the first successful login we forget the cleartext version of their password, so in normal use you would
62
+ only see this tag in welcome and activation messages.)
63
63
 
64
64
  <pre><code><r:recipient:url /></code></pre>
65
65
  }
@@ -1,5 +1,5 @@
1
1
  module RadiantReaderExtension
2
- VERSION = '3.0.0.rc3'
2
+ VERSION = '3.0.0.rc4'
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"
@@ -60,7 +60,7 @@ module ReaderAdminUI
60
60
  OpenStruct.new.tap do |message|
61
61
  message.edit = Radiant::AdminUI::RegionSet.new do |edit|
62
62
  edit.main.concat %w{edit_header edit_form edit_footer}
63
- edit.form.concat %w{edit_subject edit_body edit_group}
63
+ edit.form.concat %w{edit_subject edit_body edit_function}
64
64
  edit.form_bottom.concat %w{edit_timestamp edit_buttons}
65
65
  end
66
66
  message.index = Radiant::AdminUI::RegionSet.new do |index|
@@ -0,0 +1,11 @@
1
+ Toggle.SelectAllBehavior = Behavior.create(Toggle.CheckboxBehavior, {
2
+ toggle: function() {
3
+ var state = this.element.checked;
4
+ this.element.ancestors()[1].select('input.toggled').each(function (el) { el.checked = state; });
5
+ }
6
+ });
7
+
8
+ Event.addBehavior({
9
+ 'div.radio_group': Toggle.RadioGroupBehavior(),
10
+ 'input.select_all': Toggle.SelectAllBehavior()
11
+ });
@@ -19,6 +19,7 @@
19
19
  div#preview
20
20
  float: left
21
21
  width: 65%
22
+ margin-bottom: 50px
22
23
  +box-shadow
23
24
  background-color: white
24
25
  .message_header
@@ -59,6 +60,13 @@ div#deliver
59
60
  float: left
60
61
  width: 27%
61
62
  margin-left: 2%
63
+ ul#select_recipients
64
+ height: 250px
65
+ overflow-y: auto
66
+ overflow-x: hidden
67
+ label.select_all
68
+ color: #c00
69
+ font-size: 80%
62
70
 
63
71
  /* edit pages
64
72
 
@@ -0,0 +1,253 @@
1
+ @import compass
2
+
3
+ #content
4
+ table
5
+ &#groups
6
+ td.name
7
+ width: 35%
8
+ a
9
+ font-size: 160%
10
+ span.notes
11
+ font-size: 80%
12
+ color: #929488
13
+ font-weight: lighter
14
+ line-height: 1.2
15
+ margin-top: 0.25em
16
+ &#import
17
+ th
18
+ text-align: left
19
+ td
20
+ padding: 2px
21
+ form#confirmation_form
22
+ table
23
+ width: 90%
24
+ input
25
+ &.preview
26
+ border: 1px solid #929488
27
+ font-family: 'Lucida Grande'
28
+ font-size: 16px
29
+ padding: 3px
30
+ width: 95%
31
+ &.with_error
32
+ border: 1px solid #c00
33
+ color: #c00
34
+ tr.invite td input
35
+ background-color: #e2e1dc
36
+ p.buttons
37
+ margin-top: 10px
38
+ .form-area
39
+ label.disabled
40
+ color: #929488
41
+ span.formnote
42
+ font-size: 80%
43
+ color: #929488
44
+ #group_pages
45
+ clear: left
46
+ width: 58%
47
+ float: left
48
+ #group_people
49
+ width: 35%
50
+ float: right
51
+ #group_messages
52
+ float: left
53
+ width: 98%
54
+ ul
55
+ list-style: square
56
+ font-size: 85%
57
+ padding-left: 14px
58
+ div.stretcher
59
+ clear: left
60
+ table#group_pages td.page a
61
+ color: black
62
+ text-decoration: none
63
+ &:hover
64
+ color: blue
65
+ text-decoration: underline
66
+ blockquote.messagepreview
67
+ border: 3px solid #999
68
+ background-color: #eee
69
+ margin: 0
70
+ padding: 20px
71
+ font-family: courier, monospace
72
+ font-size: 13px
73
+ line-height: 16px
74
+ .form-area p
75
+ &.description, &.invitation
76
+ margin-top: 10px
77
+ #footnotes
78
+ clear: both
79
+ margin-top: 50px
80
+
81
+ #group_pages ul
82
+ padding-left: 20px
83
+
84
+ #group_people ul
85
+ padding-left: 0
86
+ li
87
+ font-size: 16px
88
+ list-style: none
89
+ line-height: 24px
90
+ margin-top: 2px
91
+ font-family: 'Lucida Grande'
92
+
93
+ #group_pages ul li
94
+ font-size: 16px
95
+ list-style: none
96
+ line-height: 24px
97
+ margin-top: 2px
98
+ font-family: 'Lucida Grande'
99
+
100
+ /*#group_people ul li a, #group_pages ul li a {
101
+ * text-decoration: none;
102
+ * font-weight: normal;
103
+ *}
104
+ /*
105
+ *#group_pages ul li.inherited a {
106
+ * color: #ccc;
107
+ * font-weight: normal;
108
+ *}
109
+ *
110
+ *#group_people ul li.attached a, #group_pages ul li.attached a {
111
+ * color: #060;
112
+ * font-weight: bold;
113
+ *}
114
+
115
+ .fake_checkbox
116
+ padding-left: 20px
117
+ cursor: pointer
118
+ background-repeat: no-repeat
119
+ background-position: 0 3px
120
+ input
121
+ position: absolute
122
+ left: -9999px
123
+ a
124
+ text-decoration: none
125
+ &.checked
126
+ background-image: url(/images/admin/chk_on.png)
127
+ &.unchecked
128
+ background-image: url(/images/admin/chk_off.png)
129
+ &.inherited
130
+ background-image: url(/images/admin/chk_auto.png)
131
+ &.waiting
132
+ background-image: url(/images/admin/spinner.gif)
133
+
134
+ .checked a, .selected a
135
+ color: #5da454
136
+
137
+ .unchecked a, .unselected a
138
+ color: #ccc
139
+ font-weight: normal
140
+
141
+ .waiting a
142
+ color: #8c8d8e
143
+
144
+ .failed a
145
+ color: #c00
146
+
147
+ .inherited
148
+ color: #bfe4b9
149
+
150
+ span.group_actions
151
+ img
152
+ opacity: 0.5
153
+ a img
154
+ opacity: 1
155
+
156
+ .box
157
+ h3
158
+ float: left
159
+ border: 0
160
+ p, ul
161
+ clear: both
162
+ .actions
163
+ float: right
164
+ margin-top: 10px
165
+ a.action, span.action.disabled
166
+ padding: 3px 4px
167
+ margin: 0 25px 0 1px
168
+ img
169
+ vertical-align: auto
170
+ a.action
171
+ color: black
172
+ text-decoration: none
173
+ &:hover
174
+ background: #eee image_url('admin/buttons_background.png') repeat-x
175
+ border: 1px solid #a5c9df
176
+ margin: 0 24px 0 0
177
+ +border-radius
178
+ &.selected
179
+ background: #c5e0f5
180
+ +linear-gradient(color_stops(#e5f5ff, #c5e0ff))
181
+ border: 1px solid #a5c9df
182
+ margin: 0 24px 0 0
183
+ +border-top-radius
184
+ +border-bottom-radius(0)
185
+ span.action.disabled
186
+ color: #ccc
187
+ span.sent
188
+ color: #ccc
189
+
190
+ /* show and send page
191
+
192
+ div#preview
193
+ float: left
194
+ width: 65%
195
+ +box-shadow
196
+ background-color: white
197
+ .message_header
198
+ padding: 10px
199
+ overflow: hidden
200
+ background-color: #eee
201
+ color: #333
202
+ font-size: 80%
203
+ line-height: 1.5
204
+ ul
205
+ margin: 0
206
+ padding: 6px 14px
207
+ list-style-type: none
208
+ li.subject
209
+ font-size: 1.6em
210
+ margin-top: 6px
211
+ li.mime-version, li.content-type
212
+ display: none
213
+ .message_body
214
+ iframe.message_body
215
+ width: 99%
216
+ height: 520px
217
+ margin: 0
218
+ border: 0
219
+ overflow: auto
220
+
221
+ div.preview_controls
222
+ height: 24px
223
+ p
224
+ margin: 2px 14px
225
+ text-align: right
226
+ a
227
+ text-decoration: none
228
+ color: #c00
229
+
230
+ div#deliver
231
+ position: relative
232
+ float: left
233
+ width: 27%
234
+ margin-left: 2%
235
+
236
+ /* edit pages
237
+
238
+ ul.help
239
+ list-style: square
240
+ color: #666
241
+ font-size: 85%
242
+ code
243
+ color: #c00
244
+ font-size: 115%
245
+
246
+
247
+ #content
248
+ form
249
+ p
250
+ textarea
251
+ width: 100%
252
+ height: 8em
253
+
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: radiant-reader-extension
3
3
  version: !ruby/object:Gem::Version
4
- hash: 15424115
4
+ hash: 15424125
5
5
  prerelease: 6
6
6
  segments:
7
7
  - 3
8
8
  - 0
9
9
  - 0
10
10
  - rc
11
- - 3
12
- version: 3.0.0.rc3
11
+ - 4
12
+ version: 3.0.0.rc4
13
13
  platform: ruby
14
14
  authors:
15
15
  - William Ross
@@ -17,7 +17,7 @@ autorequire:
17
17
  bindir: bin
18
18
  cert_chain: []
19
19
 
20
- date: 2011-07-28 00:00:00 +01:00
20
+ date: 2011-08-08 00:00:00 +01:00
21
21
  default_executable:
22
22
  dependencies:
23
23
  - !ruby/object:Gem::Dependency
@@ -201,12 +201,9 @@ files:
201
201
  - app/views/admin/groups/show.html.haml
202
202
  - app/views/admin/memberships/_reader.html.haml
203
203
  - app/views/admin/messages/_form.html.haml
204
- - app/views/admin/messages/_function.haml
205
204
  - app/views/admin/messages/_help.html.haml
206
205
  - app/views/admin/messages/_list_function.haml
207
206
  - app/views/admin/messages/_list_notes.html.haml
208
- - app/views/admin/messages/_message_description.html.haml
209
- - app/views/admin/messages/_message_group.html.haml
210
207
  - app/views/admin/messages/edit.html.haml
211
208
  - app/views/admin/messages/index.haml
212
209
  - app/views/admin/messages/new.html.haml
@@ -296,8 +293,10 @@ files:
296
293
  - public/images/admin/chk_on.png
297
294
  - public/images/admin/delta.png
298
295
  - public/images/furniture/no_gravatar.png
296
+ - public/javascripts/admin/reader.js
299
297
  - public/javascripts/reader.js
300
298
  - public/stylesheets/sass/admin/reader.sass
299
+ - public/stylesheets/sass/admin/reader_group.sass
301
300
  - public/stylesheets/sass/reader.sass
302
301
  - radiant-reader-extension.gemspec
303
302
  - Rakefile
@@ -327,7 +326,7 @@ has_rdoc: true
327
326
  homepage: http://radiant.spanner.org/reader
328
327
  licenses: []
329
328
 
330
- post_install_message: "\n Add this to your radiant project with:\n\n config.gem 'radiant-reader-extension', :version => '~> 3.0.0.rc3'\n\n and please remember to enable ActionMailer in your project's config/environment.rb.\n "
329
+ post_install_message: "\n Add this to your radiant project with:\n\n config.gem 'radiant-reader-extension', :version => '~> 3.0.0.rc4'\n\n and please remember to enable ActionMailer in your project's config/environment.rb.\n "
331
330
  rdoc_options: []
332
331
 
333
332
  require_paths:
@@ -1,31 +0,0 @@
1
- - if @message.administrative?
2
- %p
3
- - if @message.group
4
- = t("reader_extension.group_#{@message.function}")
5
- = t("reader_extension.sent_to_group")
6
- - elsif @message.groups.any?
7
- = t("reader_extension.group_#{@message.function}")
8
- = t("reader_extension.sent_to_these_groups")
9
- %ul
10
- - @message.groups.each do |group|
11
- %li= link_to group.name, admin_group_url(group)
12
- - else
13
- = t("reader_extension.#{@message.function}_sent_automatically")
14
- %ul
15
- %li
16
- = link_to t('reader_extension.edit_message').titlecase, edit_admin_message_url(@message)
17
- %li
18
- - if @message.group
19
- = link_to @message.group.name + ' ' + t('reader_extension.group_page'), admin_group_url(@message.group)
20
- - else
21
- = link_to t('reader_extension.reader_configuration_page').titlecase, admin_reader_configuration_url
22
-
23
- - if @message.group
24
- %p
25
- = t("reader_extension.belongs_to_group", :name => @message.group.name)
26
- - elsif @message.groups.any?
27
- %p
28
- = t("reader_extension.belongs_to_these_groups")
29
- %ul
30
- - @message.groups.each do |group|
31
- %li= link_to group.name, admin_group_url(group)
@@ -1,7 +0,0 @@
1
- - if @message.function
2
- = @message.function
3
- message
4
- - if @message.group
5
- for the
6
- = @message.group.name
7
- group
@@ -1,5 +0,0 @@
1
- %h1 group_id
2
-
3
- - fields_for @message do |f|
4
- - if @message.new_record? && @message.group
5
- = f.hidden_field :group_id