radiant-reader-extension 1.3.13 → 2.0.0.rc4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (107) hide show
  1. data/README.md +2 -2
  2. data/Rakefile +0 -19
  3. data/app/controllers/admin/group_invitations_controller.rb +78 -0
  4. data/app/controllers/admin/groups_controller.rb +8 -0
  5. data/app/controllers/admin/memberships_controller.rb +42 -0
  6. data/app/controllers/admin/messages_controller.rb +8 -3
  7. data/app/controllers/admin/permissions_controller.rb +42 -0
  8. data/app/controllers/admin/reader_configuration_controller.rb +0 -1
  9. data/app/controllers/admin/readers_controller.rb +1 -1
  10. data/app/controllers/password_resets_controller.rb +5 -5
  11. data/app/controllers/reader_action_controller.rb +13 -33
  12. data/app/controllers/reader_activations_controller.rb +4 -8
  13. data/app/controllers/reader_sessions_controller.rb +15 -26
  14. data/app/controllers/readers_controller.rb +26 -9
  15. data/app/helpers/reader_helper.rb +45 -17
  16. data/app/models/group.rb +80 -0
  17. data/app/models/membership.rb +13 -0
  18. data/app/models/message.rb +10 -7
  19. data/app/models/permission.rb +11 -0
  20. data/app/models/reader.rb +79 -35
  21. data/app/models/reader_notifier.rb +1 -0
  22. data/app/views/admin/group_invitations/new.html.haml +31 -0
  23. data/app/views/admin/group_invitations/preview.html.haml +58 -0
  24. data/app/views/admin/groups/_add_readers.html.haml +0 -0
  25. data/app/views/admin/groups/_form.html.haml +26 -0
  26. data/app/views/admin/groups/_list_head.html.haml +12 -0
  27. data/app/views/admin/groups/edit.html.haml +9 -0
  28. data/app/views/admin/groups/index.html.haml +44 -0
  29. data/app/views/admin/groups/new.html.haml +7 -0
  30. data/app/views/admin/groups/remove.html.haml +31 -0
  31. data/app/views/admin/groups/show.html.haml +74 -0
  32. data/app/views/admin/memberships/_reader.html.haml +9 -0
  33. data/app/views/admin/messages/_function.haml +31 -0
  34. data/app/views/admin/messages/_list_function.haml +7 -3
  35. data/app/views/admin/messages/_list_notes.html.haml +9 -0
  36. data/app/views/admin/messages/_message_description.html.haml +5 -1
  37. data/app/views/admin/messages/_message_group.html.haml +5 -0
  38. data/app/views/admin/messages/index.haml +4 -4
  39. data/app/views/admin/messages/show.html.haml +15 -15
  40. data/app/views/admin/pages/_listed.html.haml +16 -0
  41. data/app/views/admin/pages/_page_groups.html.haml +13 -0
  42. data/app/views/admin/permissions/_page.html.haml +24 -0
  43. data/app/views/admin/reader_configuration/edit.html.haml +3 -1
  44. data/app/views/admin/reader_configuration/show.html.haml +4 -2
  45. data/app/views/admin/readers/_form.html.haml +7 -7
  46. data/app/views/admin/readers/_password_fields.html.haml +6 -6
  47. data/app/views/admin/readers/_reader_groups.html.haml +7 -0
  48. data/app/views/admin/readers/edit.html.haml +2 -1
  49. data/app/views/admin/readers/index.html.haml +5 -2
  50. data/app/views/password_resets/create.html.haml +13 -8
  51. data/app/views/password_resets/edit.html.haml +26 -26
  52. data/app/views/password_resets/new.html.haml +28 -25
  53. data/app/views/reader_activations/_activation_required.haml +2 -2
  54. data/app/views/reader_activations/show.html.haml +11 -13
  55. data/app/views/reader_sessions/_login_form.html.haml +13 -12
  56. data/app/views/reader_sessions/new.html.haml +6 -8
  57. data/app/views/readers/_controls.html.haml +11 -9
  58. data/app/views/readers/_form.html.haml +32 -33
  59. data/app/views/readers/_memberships.html.haml +11 -0
  60. data/app/views/readers/edit.html.haml +11 -11
  61. data/app/views/readers/index.html.haml +9 -10
  62. data/app/views/readers/login.html.haml +10 -12
  63. data/app/views/readers/new.html.haml +11 -13
  64. data/app/views/readers/permission_denied.html.haml +7 -7
  65. data/app/views/readers/show.html.haml +7 -8
  66. data/app/views/shared/_standard_reader_parts.html.haml +14 -0
  67. data/app/views/site/not_allowed.html.haml +4 -0
  68. data/config/initializers/authlogic_connect_config.rb +12 -0
  69. data/config/initializers/radiant_config.rb +1 -0
  70. data/config/locales/en.yml +217 -177
  71. data/config/routes.rb +5 -0
  72. data/db/migrate/20090921125654_group_messages.rb +35 -0
  73. data/db/migrate/20091120083119_groups_public.rb +11 -0
  74. data/db/migrate/20110214101339_multiple_ownership.rb +13 -0
  75. data/lib/controller_extensions.rb +1 -1
  76. data/lib/group_tags.rb +65 -0
  77. data/lib/grouped_model.rb +125 -0
  78. data/lib/grouped_page.rb +39 -0
  79. data/lib/message_tags.rb +183 -0
  80. data/lib/radiant-reader-extension.rb +8 -0
  81. data/lib/reader_admin_ui.rb +29 -6
  82. data/lib/reader_tags.rb +7 -183
  83. data/lib/sanitize/config/generous.rb +49 -0
  84. data/lib/site_controller_extensions.rb +35 -0
  85. data/public/javascripts/reader.js +1 -1
  86. data/public/stylesheets/sass/reader.sass +18 -8
  87. data/radiant-reader-extension.gemspec +30 -176
  88. data/reader_extension.rb +31 -23
  89. data/spec/controllers/admin/messages_controller_spec.rb +1 -1
  90. data/spec/controllers/admin/readers_controller_spec.rb +0 -1
  91. data/spec/controllers/password_resets_controller_spec.rb +1 -1
  92. data/spec/controllers/reader_activations_controller_spec.rb +1 -1
  93. data/spec/controllers/readers_controller_spec.rb +67 -40
  94. data/spec/controllers/site_controller_spec.rb +63 -0
  95. data/spec/datasets/readers_dataset.rb +100 -11
  96. data/spec/models/group_spec.rb +46 -0
  97. data/spec/models/message_spec.rb +40 -15
  98. data/spec/models/page_spec.rb +81 -0
  99. data/spec/models/reader_notifier_spec.rb +1 -1
  100. data/spec/models/reader_spec.rb +17 -12
  101. metadata +99 -67
  102. data/.gitignore +0 -2
  103. data/VERSION +0 -1
  104. data/app/views/readers/_standard_parts.html.haml +0 -23
  105. data/spec/datasets/messages_dataset.rb +0 -49
  106. data/spec/datasets/reader_layouts_dataset.rb +0 -26
  107. data/spec/datasets/reader_sites_dataset.rb +0 -10
@@ -1,192 +1,232 @@
1
1
  en:
2
- access_denied: "Access denied"
3
- account_settings: "Account settings"
4
- account_updated: "Your account has been updated"
5
- activate_account: "Activate your account"
6
- activation_complete: "Thank you very much for persevering with the registration process. Your account is now active."
7
- activation_message_sent: "Account activation instructions have been emailed to you."
8
- activation_required: "Please check your email for an activation message"
9
- activation_required_header: "Please check your email"
10
- activation_required_explanation: "You should have received a confirmation message containing a link that will activate your account."
11
- activation_sent: "Activation message sent"
12
- affected_fields_highlighted: "The affected fields are highlighted below."
13
- all_deliveries_failed: "All deliveries failed"
14
- already_active: "Your account is already active."
15
- already_logged_in: "You're already logged in!"
16
- already_registered: "If you've already registered, you should only need to"
17
- and_try_again: "and try again."
18
- bold_required: "Fields with bold headings are required and will cause grumbling if left blank:"
19
- but_not_active: 'but your account is not yet activated. Please check your email for our activation message.'
20
- cancel: "cancel"
21
- cannot_delete_readers: "To delete readers, please log in as an administrator"
22
- cannot_edit_others: "You are not allowed to edit other people's accounts."
23
- change_gravatar: "change gravatar image"
24
- change_password: "Change your password"
25
- check_email: "Please check your email for an activation message"
2
+ activerecord:
3
+ attributes:
4
+ reader:
5
+ description: "Text for your profile page"
6
+ email: "Email address"
7
+ honorific: "Title or rank"
8
+ login: "Login username (optional)"
9
+ name: "Your name"
10
+ password: "Password"
11
+ password_confirmation: "Confirm password"
12
+ errors:
13
+ models:
14
+ reader:
15
+ attributes:
16
+ name:
17
+ blank: "please enter a name"
18
+ too_long: "this is too long: 100 characters max"
19
+ email:
20
+ blank: "please enter your email address"
21
+ invalid: "this doesn't look like an email address"
22
+ taken: "this address is already registered here"
23
+ taken_by_author: "this address belongs to an author here. You don't need to register here: just log in to admin."
24
+ login:
25
+ taken: "this login is already in use here"
26
+ password:
27
+ too_short: "this must have at least six characters"
28
+ invalid: "this must include at least one non-letter"
29
+ password_confirmation:
30
+
31
+
26
32
  config:
27
33
  reader:
28
34
  allow_registration?: "Allow registration"
29
35
  require_confirmation?: "Confirm email addresses"
30
36
  use_honorifics?: "Use honorifics"
31
37
  layout: "Layout for forms"
38
+ get_profile?: "As for profile text"
32
39
  email:
33
40
  name: "Message sender"
34
41
  address: "Message reply-to"
35
42
  prefix: "Subject prefix"
36
43
  layout: "Email layout"
37
- confirm_new_password: "Confirm new password"
38
- confirm_password: "Confirm password"
39
- confirmation_code: "Confirmation code"
40
- confirming_email: "When you press the 'register' button we will send a confirmation email to the address you enter above. Click on a link in that message, and you're in."
41
- continue: "Continue"
42
- create_message: "create message"
43
- dont_fill: "Don't fill this in!"
44
- edit_profile: "edit your profile"
45
- email_unknown: "Sorry. That email address is not known here."
46
- enter_code: "Please enter confirmation code"
47
- enter_email_for_reminder: "enter your email address and we will send the message again"
48
- enter_own_password: "First, just to make sure you're you, please enter your current password:"
49
- everyone_in_group: "Everyone in the group"
50
- forgotten_password: "Forgotten your password?"
51
- form_notes:
52
- description: "you can fill this in later. Textile formatting is allowed."
53
- email: "we will send activation instructions to this address"
54
- existing_password: "leave blank to keep present password. If changing, at least four characters."
55
- login: "you can always use your email address instead"
56
- name: "this is how you will be credited on the site"
57
- new_password: "at least four characters, please"
58
- honorific: "this is prepended to your name when you are credited"
59
- form_problem: "there was a problem with the form"
60
- getting_gravatar: "If you would like a picture to appear next to your messages, give yourself a gravatar at"
61
- hello: "hello"
62
- honorific: "Title or rank"
63
- invitation_message: "Invitation message"
64
- invite_description: '<a href="%{url}">Edit your preferences to put some text about yourself here.'
65
- if_cant_find: "If you can't find the message, we can"
66
- if_mistake_see_admin: "If this is a mistake, please talk to the site administrator about your account."
67
- if_not_you: "If that's not you, please"
68
- is_free_and_quick: " is free and only takes a moment"
69
- joined_on: "Joined on"
70
- label:
71
- reader:
72
- name: "Your name"
73
- honorific: "Title"
74
- login: "Login username"
75
- email: "Email address"
76
- password: "Password"
77
- repeat_password: "Confirm password"
78
- current_password: "Current password"
79
- log_in: 'log in'
80
- log_in_or_register: "To use this part of the site you need to be logged in. It's easy to get an account: if you have received an invitation, please follow the instructions in that message. Otherwise, please <a href='/register'>register here</a>. It only takes a moment."
81
- log_out: "log out"
82
- login_name: "Login name"
83
- login_or_email: "Login name or email address"
84
- login_unknown: "Sorry: we don't recognise that combination of username and password."
85
- logout_message: "You are logged out. Bye!"
86
- message_delivered: "Message delivered"
87
- must_be_empty: "must be empty"
88
- navigation:
89
- account: "Your account"
90
- activate: "Activate account"
91
- admin: "Admin"
92
- readers: "People"
93
- preferences: "Preferences"
94
- profile: "Profile"
95
- log_in: "Log in"
96
- log_out: "Log out"
97
- loading: "Loading..."
98
- register: "Register"
99
- your_account: "Your account"
100
- new_account: "Create an account"
101
- new_password: "New password"
102
- new_password_instructions: "Please enter and confirm the new password you would like to use. It must be at least four characters long, nothing obvious or typical and ideally a mixture of numbers and letters."
103
- 'no': "no"
104
- no_description: "No description available"
105
- notes: "notes"
106
- page_permission_denied: "You don't have permission to see the page that you have requested."
107
- password: "password"
108
- password_incorrect: "Sorry. Wrong password."
109
- password_mismatch: "Passwords don't match! Please try again."
110
- password_not_yet_changed: "Your password hasn't changed yet, so if you've just remembered it please <a href='%{url}'>log in as usual</a>."
111
- password_reset_instructions: "Please enter your email address below. If we recognise it, we'll send you a message with a confirmation link (or if your account is not yet active, we'll send the activation message again)."
112
- password_reset_reassurance: "Your password will not change until you fill in that form, so only you can complete this process."
113
- password_updated_notice: "Thank you. Your password has been updated and you are now logged in."
114
- people: "people"
115
- permission_denied: "Permission denied"
116
- please: "please"
117
- please_avoid_spam_trap: "Please don't fill in the spam trap field"
118
- please_check_message: "Sorry: something was wrong in that link. Please check your email message and make sure it is giving you the whole address."
119
- please_log_in: "Please log in"
120
- please_log_out: "Please log out"
121
- please_read_our: "Please read our"
122
- please_register: "Please take a moment to register an account."
123
- please_use_form: "Please use the registration form"
124
- preferences_intro: "You can use this form to change your preferences and enter a bit more information about yourself."
125
- reader_admin: "Reader administration"
126
- reader_emails: "Administrative messages"
127
- reader: 'Reader'
128
- reader_logged_in_as: "You are logged in as %{name}."
129
- reader_saved: "Reader saved"
130
- readers: 'People'
131
- register: "register"
132
- registration: "registration"
133
- registration_disallowed: "Sorry. This site does not allow visitors to register"
134
- remember_me: "remember me"
135
- resend_activation: "Resend activation message"
136
- reset_message_instructions: "Thank you. A message has been sent containing the instructions for setting a new password. Remember it hasn't changed yet and won't until you follow the instructions in the message. If you remember your old password, you can just carry on using it and ignore the reset message."
137
- reset_message_sent: "Password-reset instructions have been emailed to you"
138
- reset_not_found: "Password-reset code not found"
139
- sorry_reset_not_found: "Sorry: the system can't find you. That link must have been garbled somewhere along the line. Please paste the 20-character confirmation code into the box below and we'll try again."
140
- reset_password: "Reset your password"
141
- restart_password_change: "Send another password-reset message"
142
- return_to_page: "return to the page you were looking at before you started registering"
143
- send_it_again: "send it again"
144
- send_reset_button: "send me instructions"
145
- set_new_password: "set new password"
146
- some_deliveries_failed: "Some deliveries failed"
147
- sorry: "sorry"
148
- sorry_access_denied: "Sorry: access denied"
149
- spam_trap: "it's a spam trap and shouldn't be visible"
150
- status_check: "Please wait: loading controls"
151
- terms_and_conditions: "terms and conditions"
152
- thanks_activated: "Thank you! Your account has been activated."
153
- thanks_and_activation_instructions: "Thank you for registering. Now please check your email. We have sent a message containing a link that will automatically activate your account and log you in."
154
- this_is_your_page: "This is the page that other (logged-in) site visitors will see when they click on your name."
44
+ reader: "reader"
45
+ readers: "Readers"
46
+ groups: "Groups"
47
+ messages: "Messages"
48
+ settings: "Settings"
49
+ reader_extension:
50
+ access_denied: "Access denied"
51
+ account_settings: "Account settings"
52
+ account_updated: "Your account has been updated"
53
+ activate_account: "Activate your account"
54
+ activation_complete: "Thank you very much for persevering with the registration process. Your account is now active."
55
+ activation_message_sent: "Account activation instructions have been emailed to you."
56
+ activation_required: "Please check your email for an activation message"
57
+ activation_required_header: "Please check your email"
58
+ activation_required_explanation: "You should have received a confirmation message containing a link that will activate your account."
59
+ activation_sent: "Activation message sent"
60
+ affected_fields_highlighted: "The affected fields are highlighted below."
61
+ all_deliveries_failed: "All deliveries failed"
62
+ already_active: "Your account is already active."
63
+ already_logged_in: "You're already logged in!"
64
+ already_registered: "If you've already registered, you should only need to"
65
+ and_try_again: "and try again."
66
+ bold_required: "Fields with bold headings are required and will cause grumbling if left blank."
67
+ but_not_active: 'but your account is not yet activated. Please check your email for our activation message.'
68
+ cancel: "cancel"
69
+ cannot_delete_readers: "To delete readers, please log in as an administrator"
70
+ cannot_edit_others: "You are not allowed to edit other people's accounts."
71
+ change_gravatar: "change gravatar image"
72
+ change_password: "Change your password"
73
+ check_email: "Please check your email for an activation message"
74
+ confirm_new_password: "Confirm new password"
75
+ confirm_password: "Confirm password"
76
+ confirmation_code: "Confirmation code"
77
+ confirming_email: "When you press the 'register' button we will send a confirmation email to the address you enter above. Click on a link in that message, and you're in."
78
+ continue: "Continue"
79
+ create_message: "create message"
80
+ dont_fill: "Don't fill this in!"
81
+ edit_profile: "edit your profile"
82
+ email_unknown: "Sorry. That email address is not known here."
83
+ enter_code: "Please enter confirmation code"
84
+ enter_email_for_reminder: "enter your email address and we will send the message again"
85
+ everyone_in_group: "Everyone in the group"
86
+ forgotten_password: "Forgotten your password?"
87
+ form_notes:
88
+ description: "you can fill this in later. Textile formatting is allowed."
89
+ email: "we will send activation instructions to this address"
90
+ existing_password: "leave blank to keep present password. If changing, at least four characters."
91
+ login: "you can always use your email address instead"
92
+ name: "this is how you will be credited on the site"
93
+ new_password: "at least six characters, please, and with at least one non-letter character"
94
+ honorific: "this is prepended to your name when you are credited"
95
+ form_problem: "there was a problem with the form"
96
+ getting_gravatar: "If you would like a picture to appear next to your messages, give yourself a gravatar at"
97
+ hello: "hello"
98
+ honorific: "Title or rank"
99
+ invitation_message: "Invitation message"
100
+ invite_description: '<a href="%{url}">Edit your preferences to put some text about yourself here.'
101
+ if_cant_find: "If you can't find the message, we can"
102
+ if_mistake_see_admin: "If this is a mistake, please talk to the site administrator about your account."
103
+ if_not_you: "If that's not you, please"
104
+ is_free_and_quick: " is free and only takes a moment"
105
+ joined_on: "Joined on"
106
+ label:
107
+ reader:
108
+ name: "Your name"
109
+ honorific: "Title"
110
+ login: "Login username"
111
+ email: "Email address"
112
+ password: "Password"
113
+ repeat_password: "Confirm password"
114
+ current_password: "Current password"
115
+ log_in: 'log in'
116
+ log_in_or_register: "Please log in here. If you haven't already, you will need to <a href='/register'>register</a> first."
117
+ log_out: "log out"
118
+ login_name: "Login name"
119
+ login_or_email: "Login name or email address"
120
+ login_unknown: "Sorry: we don't recognise that combination of username and password."
121
+ logout_message: "You are logged out. Bye!"
122
+ message_delivered: "Message delivered"
123
+ must_be_empty: "must be empty"
124
+ navigation:
125
+ account: "Your account"
126
+ activate: "Activate account"
127
+ admin: "Admin"
128
+ greeting: "Hello %{name}"
129
+ readers: "Readers"
130
+ preferences: "Preferences"
131
+ profile: "Profile"
132
+ log_in: "Log in"
133
+ log_out: "Log out"
134
+ loading: "Loading..."
135
+ register: "Register"
136
+ your_account: "Preferences"
137
+ new_account: "Register here"
138
+ new_password: "New password"
139
+ new_password_instructions: "Please enter and confirm the new password you would like to use. It must be at least four characters long, nothing obvious or typical and ideally a mixture of numbers and letters."
140
+ 'no': "no"
141
+ no_description: "No description available"
142
+ notes: "notes"
143
+ page_permission_denied: "You don't have permission to see the page that you have requested."
144
+ password: "Password"
145
+ password_incorrect: "Sorry. Wrong password."
146
+ password_mismatch: "Passwords don't match! Please try again."
147
+ password_not_yet_changed: "Your password hasn't changed yet, so if you've just remembered it please <a href='%{url}'>log in as usual</a>."
148
+ password_reset_instructions: "Please enter your email address below. If we recognise it, we'll send you a message with a confirmation link (or if your account is not yet active, we'll send the activation message again)."
149
+ password_reset_reassurance: "Your password will not change until you fill in that form, so only you can complete this process."
150
+ password_updated_notice: "Thank you. Your password has been updated and you are now logged in."
151
+ people: "people"
152
+ permission_denied: "Permission denied"
153
+ permitted_groups: "Permitted groups"
154
+ please: "please"
155
+ please_avoid_spam_trap: "Please don't fill in the spam trap field"
156
+ please_check_message: "Sorry: something was wrong in that link. Please check your email message and make sure it is giving you the whole address."
157
+ please_log_in: "Please log in"
158
+ please_log_out: "Please log out"
159
+ please_read_our: "Please read our"
160
+ please_register: "Please take a moment to register an account."
161
+ please_use_form: "Please use the registration form"
162
+ preferences_intro: "You can use this form to change your preferences and enter a bit more information about yourself."
163
+ reader_admin: "Reader administration"
164
+ reader_emails: "Administrative messages"
165
+ reader: 'Reader'
166
+ reader_logged_in_as: "You are logged in as %{name}."
167
+ reader_saved: "Reader saved"
168
+ readers: 'People'
169
+ readers_introduction: "This is a list of everyone who has joined the site. It's only visible to logged-in users."
170
+ register: "register"
171
+ registration: "registration"
172
+ registration_disallowed: "Sorry. This site does not allow visitors to register"
173
+ remember_me: "remember me"
174
+ resend_activation: "Resend activation message"
175
+ reset_message_instructions: "Thank you. A message has been sent containing the instructions for setting a new password. Remember it hasn't changed yet and won't until you follow the instructions in the message. If you remember your old password, you can just carry on using it and ignore the reset message."
176
+ reset_message_sent: "Password-reset instructions have been emailed to you"
177
+ reset_not_found: "Password-reset code not found"
178
+ sorry_reset_not_found: "Sorry: the system can't find you. That link must have been garbled somewhere along the line. Please paste the 20-character confirmation code into the box below and we'll try again."
179
+ reset_password: "Reset your password"
180
+ restart_password_change: "Send another password-reset message"
181
+ return_to_page: "return to the page you were looking at before you started registering"
182
+ send_it_again: "send it again"
183
+ send_reset_button: "send me instructions"
184
+ set_new_password: "set new password"
185
+ some_deliveries_failed: "Some deliveries failed"
186
+ sorry: "sorry"
187
+ sorry_access_denied: "Sorry: access denied"
188
+ spam_trap: "it's a spam trap and shouldn't be visible"
189
+ status_check: "Please wait: loading controls"
190
+ terms_and_conditions: "terms and conditions"
191
+ thanks_activated: "Thank you! Your account has been activated."
192
+ thanks_and_activation_instructions: "Thank you for registering. Now please check your email. We have sent a message containing a link that will automatically activate your account and log you in."
193
+ this_is_your_page: "This is the page that other (logged-in) site visitors will see when they click on your name."
194
+ username: "username"
195
+ welcome_back: "Welcome back"
196
+ welcome_message: "Welcome message"
197
+ wrong_email: "you think you might have put the wrong email address in,"
198
+ 'yes': "yes"
199
+ your_description: "Some text for your profile page"
200
+ your_email: "Your email address"
201
+ your_name: "Your name"
202
+ count_people:
203
+ zero: "(nobody)"
204
+ one: "(one person)"
205
+ other: "(%{count} people)"
206
+ send_to: "Send to"
207
+ reader_configuration_page: "reader settings"
208
+ welcome_sent_automatically: "This message is sent automatically when someone completes the registration and email-confirmation process."
209
+ password_reset_sent_automatically: "This message is sent automatically when someone asks to reset their password."
210
+ activation_sent_automatically: "This message is sent automatically when someone begins to register."
211
+ invitation_sent_automatically: "This message is sent automatically when someone is invited to the site."
212
+ everyone_unsent: "anyone who has not received this message"
213
+ everyone_inactive: "anyone who has not activated their account"
214
+ everyone: "Everyone"
215
+ send_message: "Send Message"
216
+ edit_message: "edit message"
217
+ delete_message: "delete message"
218
+ this_message_functional: "This is the %{function} message."
219
+ preview_and_send_message: "Preview and send message"
220
+ really_delete_message: "Are you sure you want to delete the message '%{title}'? This cannot be undone."
221
+ delete_reader: "delete reader"
222
+ really_delete_reader: "Are you sure you want to remove the reader %{name}? This cannot be undone."
223
+ never_sent: 'never sent'
224
+ for: 'for'
225
+ home: 'home'
226
+ reader_required: "Sorry: this part of the site requires an account."
227
+ update_account: "Save changes"
228
+ create_account: "Register"
229
+ separator: " &raquo; "
155
230
  time:
156
231
  formats:
157
232
  date: "%B %e, %Y"
158
- username: "username"
159
- welcome_back: "Welcome back"
160
- welcome_message: "Welcome message"
161
- wrong_email: "you think you might have put the wrong email address in,"
162
- 'yes': "yes"
163
- your_description: "A little about yourself"
164
- your_email: "Your email address"
165
- your_name: "Your name"
166
- count_people:
167
- zero: "(nobody)"
168
- one: "(one person)"
169
- other: "(%{count} people)"
170
- send_to: "Send to"
171
- reader_configuration_page: "reader settings"
172
- welcome_sent_automatically: "This message is sent automatically when someone completes the registration and email-confirmation process."
173
- password_reset_sent_automatically: "This message is sent automatically when someone asks to reset their password."
174
- activation_sent_automatically: "This message is sent automatically when someone begins to register."
175
- invitation_sent_automatically: "This message is sent automatically when someone is invited to the site."
176
- everyone_unsent: "anyone who has not received this message"
177
- everyone_inactive: "anyone who has not activated their account"
178
- everyone: "Everyone"
179
- send_message: "Send Message"
180
- edit_message: "edit message"
181
- delete_message: "delete message"
182
- this_message_functional: "This is the %{function} message."
183
- preview_and_send_message: "Preview and send message"
184
- really_delete_message: "Are you sure you want to delete the message '%{title}'? This cannot be undone."
185
- delete_reader: "delete reader"
186
- really_delete_reader: "Are you sure you want to remove the reader %{name}? This cannot be undone."
187
- never_sent: 'never sent'
188
- for: 'for'
189
- home: 'home'
190
- reader_required: "Sorry: this part of the site requires an account."
191
- update_account: "Save changes"
192
- create_account: "Register"
data/config/routes.rb CHANGED
@@ -1,6 +1,7 @@
1
1
  ActionController::Routing::Routes.draw do |map|
2
2
  map.namespace :admin, :path_prefix => 'admin/readers' do |admin|
3
3
  admin.resources :messages, :member => [:preview, :deliver]
4
+ admin.resources :groups, :has_many => [:memberships, :permissions, :group_invitations, :messages]
4
5
  admin.resource :reader_configuration, :controller => 'reader_configuration'
5
6
  end
6
7
 
@@ -10,6 +11,10 @@ ActionController::Routing::Routes.draw do |map|
10
11
 
11
12
  map.resources :readers
12
13
  map.resources :messages, :only => [:index, :show], :member => [:preview]
14
+ map.resources :groups, :only => [] do |group|
15
+ group.resources :messages, :only => [:index, :show], :member => [:preview]
16
+ end
17
+
13
18
  map.resource :reader_session
14
19
  map.resource :reader_activation, :only => [:show, :new]
15
20
  map.resource :password_reset
@@ -0,0 +1,35 @@
1
+ class GroupMessages < ActiveRecord::Migration
2
+ create_table :groups do |t|
3
+ t.column :name, :string
4
+ t.column :description, :text
5
+ t.column :notes, :text
6
+ t.column :created_at, :datetime
7
+ t.column :updated_at, :datetime
8
+ t.column :created_by_id, :integer
9
+ t.column :updated_by_id, :integer
10
+ t.column :homepage_id, :integer
11
+ t.column :site_id, :integer
12
+ t.column :lock_version, :integer
13
+ end
14
+
15
+ create_table :memberships do |t|
16
+ t.column :group_id, :integer
17
+ t.column :reader_id, :integer
18
+ end
19
+
20
+ create_table :permissions do |t|
21
+ t.column :group_id, :integer
22
+ t.column :page_id, :integer
23
+ end
24
+
25
+ def self.up
26
+ add_column :messages, :group_id, :integer
27
+ end
28
+
29
+ def self.down
30
+ drop_table :groups
31
+ drop_table :memberships
32
+ drop_table :permissions
33
+ remove_column :messages, :group_id
34
+ end
35
+ end
@@ -0,0 +1,11 @@
1
+ class GroupsPublic < ActiveRecord::Migration
2
+ def self.up
3
+ add_column :groups, :public, :boolean
4
+ add_column :groups, :invitation, :text
5
+ end
6
+
7
+ def self.down
8
+ remove_column :groups, :public
9
+ remove_column :groups, :invitation
10
+ end
11
+ end
@@ -0,0 +1,13 @@
1
+ class MultipleOwnership < ActiveRecord::Migration
2
+ def self.up
3
+ rename_column :permissions, :page_id, :permitted_id
4
+ add_column :permissions, :permitted_type, :string
5
+ Permission.reset_column_information
6
+ Permission.all.each {|p| p.update_attributes(:permitted_type => 'Page') }
7
+ end
8
+
9
+ def self.down
10
+ rename_column :permissions, :permitted_id, :page_id
11
+ remove_column :permissions, :permitted_type
12
+ end
13
+ end
@@ -35,7 +35,7 @@ module ControllerExtensions # for inclusion into ApplicationController
35
35
 
36
36
  def set_reader_for_user
37
37
  if current_user
38
- current_reader_session = ReaderSession.create!(Reader.find_or_create_for_user(current_user))
38
+ current_reader_session = ReaderSession.create!(Reader.for_user(current_user))
39
39
  end
40
40
  end
41
41
 
data/lib/group_tags.rb ADDED
@@ -0,0 +1,65 @@
1
+ module GroupTags
2
+ include Radiant::Taggable
3
+ include ReaderHelper
4
+
5
+ class TagError < StandardError; end
6
+ desc %{
7
+ The root 'group' tag is not meant to be called directly.
8
+ All it does is summon a group object so that its fields can be displayed with eg.
9
+ <pre><code><r:group:name /></code></pre>
10
+
11
+ This tag will not throw an exception if there is no group; it will just disappear.
12
+ }
13
+ tag 'group' do |tag|
14
+ tag.locals.group = @mailer_vars ? @mailer_vars[:@group] : tag.locals.page.group
15
+ tag.expand if tag.locals.group
16
+ end
17
+
18
+ [:name, :description, :url].each do |field|
19
+ desc %{
20
+ Displays the #{field} field of the currently relevant group. Works in email messages too.
21
+
22
+ <pre><code><r:group:#{field} /></code></pre>
23
+ }
24
+ tag "group:#{field}" do |tag|
25
+ tag.locals.group.send(field)
26
+ end
27
+ end
28
+
29
+ desc %{
30
+ Expands if this group has messages.
31
+
32
+ <pre><code><r:group:if_messages>...</r:group:if_messages /></code></pre>
33
+ }
34
+ tag "group:if_messages" do |tag|
35
+ tag.expand if tag.locals.group.messages.ordinary.published.any?
36
+ end
37
+
38
+ desc %{
39
+ Expands if this group does not have messages.
40
+
41
+ <pre><code><r:group:unless_messages>...</r:group:unless_messages /></code></pre>
42
+ }
43
+ tag "group:unless_messages" do |tag|
44
+ tag.expand unless tag.locals.group.messages.ordinary.published.any?
45
+ end
46
+
47
+ desc %{
48
+ Loops through the non-functional messages (ie not welcomes and reminders) that belong to this group
49
+ and that have been sent, though not necessarily to the present reader (which is the point, really).
50
+
51
+ <pre><code><r:group:messages:each>...</r:group:messages:each /></code></pre>
52
+ }
53
+ tag "group:messages" do |tag|
54
+ tag.locals.messages = tag.locals.group.messages.ordinary.published
55
+ tag.expand
56
+ end
57
+ tag "group:messages:each" do |tag|
58
+ result = []
59
+ tag.locals.messages.each do |message|
60
+ tag.locals.message = message
61
+ result << tag.expand
62
+ end
63
+ result
64
+ end
65
+ end