radiant-reader-extension 0.9.2 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (68) hide show
  1. data/README.md +15 -11
  2. data/VERSION +1 -1
  3. data/app/controllers/admin/messages_controller.rb +45 -6
  4. data/app/controllers/admin/reader_configuration_controller.rb +3 -0
  5. data/app/controllers/password_resets_controller.rb +8 -10
  6. data/app/controllers/reader_action_controller.rb +2 -2
  7. data/app/controllers/reader_activations_controller.rb +6 -7
  8. data/app/controllers/reader_sessions_controller.rb +3 -3
  9. data/app/controllers/readers_controller.rb +9 -10
  10. data/app/models/message.rb +2 -2
  11. data/app/models/message_function.rb +4 -0
  12. data/app/models/reader_notifier.rb +10 -7
  13. data/app/views/admin/messages/_form.html.haml +3 -1
  14. data/app/views/admin/messages/_list_function.haml +3 -0
  15. data/app/views/admin/messages/index.haml +42 -0
  16. data/app/views/admin/messages/preview.html.haml +1 -0
  17. data/app/views/admin/messages/show.html.haml +72 -0
  18. data/app/views/admin/reader_configuration/edit.html.haml +41 -0
  19. data/app/views/admin/reader_configuration/show.html.haml +46 -0
  20. data/app/views/admin/readers/_form.html.haml +2 -1
  21. data/app/views/admin/readers/index.html.haml +33 -2
  22. data/app/views/password_resets/create.html.haml +6 -9
  23. data/app/views/password_resets/edit.html.haml +26 -30
  24. data/app/views/password_resets/new.html.haml +10 -11
  25. data/app/views/reader_activations/show.html.haml +17 -26
  26. data/app/views/reader_sessions/_login_form.html.haml +19 -25
  27. data/app/views/reader_sessions/new.html.haml +17 -15
  28. data/app/views/readers/_flasher.html.haml +2 -2
  29. data/app/views/readers/_form.html.haml +30 -36
  30. data/app/views/readers/edit.html.haml +17 -19
  31. data/app/views/readers/index.html.haml +5 -7
  32. data/app/views/readers/login.html.haml +6 -5
  33. data/app/views/readers/new.html.haml +21 -20
  34. data/app/views/readers/permission_denied.html.haml +13 -9
  35. data/app/views/readers/show.html.haml +12 -9
  36. data/config/initializers/radiant_config.rb +12 -0
  37. data/config/locales/en.yml +147 -0
  38. data/config/routes.rb +5 -6
  39. data/db/migrate/20101019094714_message_sent_date.rb +11 -0
  40. data/lib/reader_admin_ui.rb +25 -10
  41. data/lib/reader_helper.rb +0 -7
  42. data/lib/reader_tags.rb +15 -10
  43. data/public/images/admin/delta.png +0 -0
  44. data/public/stylesheets/sass/admin/reader.sass +72 -81
  45. data/radiant-reader-extension.gemspec +13 -19
  46. data/reader_extension.rb +6 -7
  47. data/spec/controllers/admin/messages_controller_spec.rb +26 -9
  48. data/spec/controllers/readers_controller_spec.rb +1 -1
  49. data/spec/models/message_spec.rb +1 -2
  50. data/spec/models/reader_notifier_spec.rb +1 -2
  51. metadata +16 -22
  52. data/app/controllers/admin/reader_settings_controller.rb +0 -92
  53. data/app/helpers/admin/reader_settings_helper.rb +0 -36
  54. data/app/views/admin/reader_settings/_setting.html.haml +0 -24
  55. data/app/views/admin/reader_settings/edit.html.haml +0 -10
  56. data/app/views/admin/reader_settings/index.html.haml +0 -35
  57. data/app/views/admin/reader_settings/show.html.haml +0 -1
  58. data/app/views/admin/readers/_list_head.html.haml +0 -9
  59. data/app/views/admin/readers/_listed.html.haml +0 -22
  60. data/app/views/reader_activations/_activation_required.html.haml +0 -34
  61. data/app/views/reader_activations/_on_activation.html.haml +0 -4
  62. data/app/views/readers/create.html.haml +0 -28
  63. data/app/views/wrappers/_field_errors.html.haml +0 -5
  64. data/config/settings.rb +0 -9
  65. data/pkg/radiant-reader-extension-0.9.0.gem +0 -0
  66. data/public/images/admin/new-message.png +0 -0
  67. data/public/images/admin/new-reader.png +0 -0
  68. data/public/javascripts/admin/messages.js +0 -13
@@ -0,0 +1 @@
1
+ = @message.preview.body
@@ -0,0 +1,72 @@
1
+ - include_stylesheet('admin/reader')
2
+ - body_classes << "reversed"
3
+
4
+ = render_region :top
5
+
6
+ - render_region :header do |header|
7
+ - header.title do
8
+ %h1
9
+ = t('preview_and_send_message')
10
+
11
+ #preview
12
+ - render_region :preview do |preview|
13
+ - preview.headers do
14
+ .message_header
15
+ %ul
16
+ - @message.preview.each_header do |name, value|
17
+ %li{:class => name}
18
+ = "#{name}:"
19
+ %strong
20
+ = value
21
+
22
+ - preview.body do
23
+ .message_body
24
+ %iframe.message_body{:src => preview_admin_message_url(@message)}
25
+
26
+ - preview.buttons do
27
+ .preview_controls
28
+ %p
29
+ = link_to t('edit_message'), edit_admin_message_url(@message)
30
+
31
+ #deliver
32
+ - render_region :delivery do |delivery|
33
+ - delivery.function do
34
+ - if @message.administrative?
35
+ %p
36
+ = t("#{@message.function}_sent_automatically")
37
+ %ul
38
+ %li
39
+ = link_to t('edit_message').titlecase, edit_admin_message_url(@message)
40
+ %li
41
+ - if @message.group
42
+ = link_to @message.group.name + ' ' + t('group_page'), admin_group_url(@message.group)
43
+ - else
44
+ = link_to t('reader_configuration_page').titlecase, admin_reader_configuration_url
45
+
46
+ - delivery.options do
47
+ - unless @message.administrative?
48
+ - form_for :message, @message, :url => deliver_admin_message_url(@message), :html => {"data-onsubmit_status"=>"Sending email messages&#8230;"} do |f|
49
+ %h3
50
+ = t("send_to").titlecase + ":"
51
+ %p
52
+ = radio_button_tag 'delivery', 'all', true, :id => 'delivery_to_all', :disabled => @message.possible_readers.empty?
53
+ %label.checkbox{:for => 'delivery_to_all', :class => @message.possible_readers.empty? ? 'disabled' : ''}
54
+ = t('everyone')
55
+ = t('count_people', :count => @message.possible_readers.count)
56
+ %p
57
+ = radio_button_tag 'delivery', 'inactive', false, :id => 'delivery_to_inactive', :disabled => @message.inactive_readers.empty?
58
+ %label.checkbox{:for => 'delivery_to_inactive', :class => @message.inactive_readers.empty? ? 'disabled' : ''}
59
+ = t('everyone_inactive')
60
+ = t('count_people', :count => @message.inactive_readers.count)
61
+ %p
62
+ = radio_button_tag 'delivery', 'unsent', false, :id => 'delivery_to_unsent', :disabled => @message.undelivered_readers.empty?
63
+ %label.checkbox{:for => 'delivery_to_unsent', :class => @message.undelivered_readers.empty? ? 'disabled' : ''}
64
+ = t('everyone_unsent')
65
+ = t('count_people', :count => @message.undelivered_readers.count)
66
+
67
+ %p.buttons
68
+ = submit_tag t('send_message')
69
+ = t('or')
70
+ = link_to t('cancel'), @message.group ? admin_group_url(@message.group) : admin_messages_url
71
+
72
+
@@ -0,0 +1,41 @@
1
+ - body_classes << "reversed"
2
+
3
+ - render_region :main do |main|
4
+ - main.edit_header do
5
+ %h1 Reader configuration
6
+
7
+ - main.edit_form do
8
+ - form_for :config, :url => admin_reader_configuration_url, :html => {"data-onsubmit_status"=>"Saving changes&#8230;", :method => :put} do |f|
9
+ = render_region :form_top
10
+ - render_region :form do |form|
11
+ - form.edit_registration do
12
+ %fieldset
13
+ %h3
14
+ = t('registration').titlecase
15
+ %p
16
+ = edit_config('reader.allow_registration?')
17
+ %p
18
+ = edit_config('reader.require_confirmation?')
19
+ %p
20
+ = edit_config('reader.use_honorifics?')
21
+ %p
22
+ = edit_config('reader.layout')
23
+
24
+ - form.edit_sender do
25
+ %fieldset
26
+ %h3 Administrative email
27
+ %p
28
+ = edit_config('email.name')
29
+ %p
30
+ = edit_config('email.address')
31
+ %p
32
+ = edit_config('email.prefix')
33
+ %p
34
+ = edit_config('email.layout')
35
+
36
+ - render_region :form_bottom do |form_bottom|
37
+ - form_bottom.edit_buttons do
38
+ %p.buttons
39
+ %input.button{:type=>"submit", :value=>"Save Changes"}/
40
+ or
41
+ = link_to "Cancel", admin_reader_configuration_url
@@ -0,0 +1,46 @@
1
+ - body_classes << "reversed"
2
+ - include_stylesheet('admin/reader')
3
+
4
+ #reader_settings.box
5
+ %h3
6
+ .actions
7
+ = button_to t("edit"), edit_admin_reader_configuration_url, :method => :get
8
+ =t("reader_admin")
9
+
10
+ - render_region :settings do |settings|
11
+ - settings.registration do
12
+ %p.ruled
13
+ = show_config 'reader.allow_registration?'
14
+ %p.ruled
15
+ = show_config 'reader.require_confirmation?'
16
+ %p.ruled
17
+ = show_config 'reader.use_honorifics?'
18
+ %p.ruled
19
+ = show_config 'reader.layout'
20
+
21
+ - settings.sender do
22
+ %p.ruled
23
+ = show_config 'email.name'
24
+ %p.ruled
25
+ = show_config 'email.address', :class => 'uri'
26
+ %p.ruled
27
+ = show_config 'email.prefix'
28
+ %p.ruled
29
+ = show_config 'email.layout'
30
+
31
+ #message_settings.box
32
+ %h4
33
+ =t("reader_emails")
34
+
35
+ - render_region :messages do |messages|
36
+ - messages.administration do
37
+ - MessageFunction.find_all.each do |func|
38
+ - message = Message.functional(func)
39
+ %p.ruled
40
+ %label= func.description
41
+ - if message
42
+ = link_to message.subject, admin_message_url(message)
43
+ - else
44
+ = link_to image('plus') + " create message", new_admin_message_url(:function => func), :class => 'create'
45
+
46
+
@@ -1,5 +1,4 @@
1
1
  - form_for [:admin, @reader] do |f|
2
- = hidden_field "reader", "lock_version"
3
2
 
4
3
  = render :partial => 'avatar' unless @reader.new_record?
5
4
 
@@ -39,6 +38,8 @@
39
38
  = f.label :notes, t('notes'), :class => "optional"
40
39
  ~ f.text_area "notes", :size => "53x4", :class => "textarea"
41
40
 
41
+ = render_region :form_additions, :locals => {:f => f}
42
+
42
43
  - render_region :form_bottom, :locals => {:f => f} do |form_bottom|
43
44
  - form_bottom.edit_buttons do
44
45
  %p.buttons
@@ -4,10 +4,41 @@
4
4
  #readers_table.outset
5
5
  %table#readers.index{:cellspacing=>"0", :border=>"0", :cellpadding=>"0"}
6
6
  %thead
7
- = render :partial => 'list_head'
7
+ %thead
8
+ %tr
9
+ - render_region :thead do |thead|
10
+ - thead.title_header do
11
+ %th.reader Name / Login
12
+ - thead.description_header do
13
+ %th.reader_description Self-description
14
+ - thead.modify_header do
15
+ %th.modify Modify
16
+
8
17
  %tbody
9
18
  - @readers.each do |reader|
10
- = render :partial => 'listed', :locals => {:reader => reader}
19
+ %tr
20
+ - render_region :tbody do |tbody|
21
+ - tbody.title_cell do
22
+ %td{:class => reader.activated? ? 'name activated' : 'name inactive'}
23
+ = link_to image_tag(gravatar_url(reader.email, :size=>"32px"), :class=>"avatar avatar_32x32", :width=>32, :height=>32, :alt=>""), edit_admin_reader_url(reader)
24
+ = link_to reader.name, edit_admin_reader_url(reader), :class => reader.trusted? ? '' : 'untrusted'
25
+ %span.info
26
+ = "(#{reader.login})"
27
+ - unless reader.notes.blank?
28
+ %p.admin_notes
29
+ %strong
30
+ note:
31
+ = reader.notes
32
+
33
+ - tbody.description_cell do
34
+ %td.reader_description
35
+ = truncate_and_textilize(reader.description, 24)
36
+
37
+ - tbody.modify_cell do
38
+ %td.actions
39
+ - if admin?
40
+ = link_to(image('minus') + ' ' + t('delete_reader'), admin_reader_url(reader), :method => :delete, :class => 'action', :confirm => t('really_delete_reader', :name => reader.name))
41
+
11
42
 
12
43
  - render_region :bottom do |bottom|
13
44
  - bottom.buttons do
@@ -1,13 +1,10 @@
1
1
  %p
2
- Thank you. A message has been sent to
3
- %strong
4
- = params[:email]
5
- containing the instructions for setting a new password.
6
- Remember, it hasn't changed yet and won't until you follow the instructions in the message.
2
+ = t('reset_message_instructions')
7
3
 
8
4
  - content_for :breadcrumbs do
9
- = link_to 'Home', '/'
10
- &gt; Reset password
5
+ = link_to t('home').titlecase, '/'
6
+ &gt;
7
+ = t('reset_password')
11
8
 
12
- - content_for :pagetitle do
13
- Reset message sent
9
+ - content_for :title do
10
+ = t('reset_message_sent')
@@ -3,69 +3,65 @@
3
3
 
4
4
  %p
5
5
  %strong
6
- Hello
6
+ = t('hello')
7
7
  = @reader.name + '.'
8
- Thank you for persevering with the authorization process.
9
- %br
10
- 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.
11
-
8
+ = t('new_password_instructions')
12
9
 
13
10
  - form_for @reader, :url => password_reset_path, :method => :put, :html => {:class => 'friendly', :autocomplete => "off"} do |f|
14
11
 
15
12
  - if @reader.errors.any?
16
- %p.haserror
17
- %strong
18
- Sorry: there was a problem.
19
- = @reader.errors.full_messages.to_sentence
13
+ %p.errornote
14
+ %strong
15
+ = t('sorry').titlecase
16
+ = t('form_problem') + '.'
20
17
 
21
18
  = hidden_field_tag :id, params[:id]
22
19
  = hidden_field_tag :confirmation_code, @reader.perishable_token
23
20
 
24
- %p{:class => @reader.errors.any? ? 'haserror' : ''}
25
- = f.label :password, "New password", :class => 'required'
21
+ %p
22
+ = f.label :password, t('new_password'), :class => 'required'
23
+ %span.formnote= t('password_notes')
26
24
  %br
27
25
  = f.password_field :password, :class => 'titular'
28
26
 
29
- %p{:class => @reader.errors.any? ? 'haserror' : ''}
30
- = f.label :password_confirmation, "Repeat for confirmation", :class => 'required'
27
+ %p
28
+ = f.label :password_confirmation, t('repeat_password'), :class => 'required'
31
29
  %br
32
30
  = f.password_field :password_confirmation, :class => 'titular'
33
31
  %p
34
32
  = f.submit "Update my password and log me in"
35
33
 
36
34
  %p
37
- Your password hasn't changed yet, so if you've just remembered it you can still
38
- = link_to "log in.", reader_login_url
35
+ = t('password_not_yet_changed')
39
36
 
40
- - content_for :pagetitle do
41
- Change my password
37
+ - content_for :title do
38
+ = t('change_password')
42
39
 
43
40
  - else
44
41
 
45
- %p.haserror
46
- Sorry: the system can't find you. That link must have been garbled somewhere along the line.
47
- Please paste the 20-character confirmation code into the box below and we'll try again.
42
+ %p.errornote
43
+ = t('sorry_reset_not_found')
48
44
 
49
45
  - form_tag edit_password_reset_path, :method => 'GET', :class => 'friendly', :autocomplete => "off" do
50
46
  = hidden_field_tag :id, params[:id]
51
47
  %p
52
48
  %label{:for => "confirmation_code"}
53
- confirmation code
49
+ = t('confirmation_code')
54
50
  %br
55
51
  = text_field_tag 'confirmation_code', '', :class => 'titular'
56
52
 
57
53
  %p
58
- = submit_tag 'try again'
54
+ = submit_tag t('continue')
59
55
 
60
- %p
61
- The confirmation code only works for ten minutes, but you can always
62
- = link_to "enter your email address again", new_password_reset_url
63
- and we'll send a new one.
56
+ %ul.actions
57
+ %li
58
+ = link_to t("restart_password_change"), new_password_reset_url
64
59
 
65
- - content_for :pagetitle do
66
- Please enter confirmation code
60
+ - content_for :title do
61
+ = t('enter_code')
67
62
 
68
63
  - content_for :breadcrumbs do
69
- = link_to 'Home', '/'
70
- &gt; Reset password
64
+ = link_to t('home').titlecase, '/'
65
+ &gt;
66
+ = t('reset_password')
71
67
 
@@ -1,31 +1,30 @@
1
1
  - include_stylesheet 'reader'
2
2
 
3
3
  %p
4
- 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).
4
+ =t('password_reset_instructions')
5
5
  %strong
6
- Your password will not change until you fill in that form,
7
- so only you can complete this process.
6
+ =t('password_reset_reassurance')
8
7
 
9
8
  - if @error
10
9
  %p.haserror
11
- = @error
10
+ = t(@error)
12
11
 
13
12
  .password_form
14
-
15
13
  - email = current_reader.email if current_reader
16
14
  - form_tag password_reset_path, :class => 'friendly' do
17
15
  %p
18
16
  %label{:for => "email"}
19
- Email address
17
+ = t('your_email')
20
18
  %br
21
19
  = text_field_tag 'email', email, :class => 'titular'
22
20
 
23
21
  %p
24
- = submit_tag 'send me instructions'
22
+ = submit_tag t('send_reset_button')
25
23
 
26
24
  - content_for :breadcrumbs do
27
- = link_to 'Home', '/'
28
- &gt; Reset password
25
+ = link_to t('home').titlecase, '/'
26
+ &gt;
27
+ = t('reset_password').titlecase
29
28
 
30
- - content_for :pagetitle do
31
- Reset your password
29
+ - content_for :title do
30
+ = t('reset_password').titlecase
@@ -1,41 +1,32 @@
1
1
  = render :partial => 'readers/flasher'
2
2
 
3
3
  - if current_reader && current_reader.activated?
4
-
5
4
  %p
6
- Thank you very much for persevering with the registration process. Your account is now active.
5
+ = t("activation_complete")
7
6
 
8
- = render :partial => 'on_activation'
7
+ - if session[:return_to]
8
+ %p
9
+ = link_to (t("return_to_page"), session[:return_to]) + '?'
9
10
 
10
- - content_for :pagetitle do
11
- Hello
11
+ - content_for :title do
12
+ = t('hello').titlecase
12
13
  = current_reader.name
13
14
 
14
15
  - else
15
16
  %div.activation
17
+ - if @error
18
+ %p.errornotice
19
+ = t(@error)
16
20
  %p
17
- - if current_reader
18
- Thank you for registering. Now please check your email. We have sent a message to
19
- %strong
20
- = current_reader.email
21
- containing a link that will automatically activate your account and log you in. If you can't find the message, we can
22
- = link_to("send it again", new_reader_activation_url) + '.'
23
- - else
24
- Please check your email. You should have received a message containing a link that will automatically activate your account and log you in. If you can't find the message, we can
25
- = link_to("send it again", new_password_reset_url) + ':'
26
- just put your email address in the password reminder form, and if your account has not been activated you'll receive another activation message.
27
-
28
- - if Radiant::Config['reader.allow_registration?']
29
- %p
30
- If you think you might have put the wrong email address in, the easiest thing to do is
31
- = link_to 'register again', new_reader_url
32
- with the right one. The failed registration attempt will be purged after a week or so.
21
+ = t('thanks_and_activation_instructions')
22
+ = link_to("resend_activation", new_reader_activation_url) + '.'
23
+ - unless current_reader
24
+ = t('enter_email_for_reminder')
33
25
 
34
- - content_for :pagetitle do
35
- Activation message sent
26
+ - content_for :title do
27
+ = t('activation_sent')
36
28
 
37
29
  - content_for :breadcrumbs do
38
- = link_to 'Home', '/'
30
+ = link_to t('Home'), '/'
39
31
  &gt;
40
- Activate your account
41
-
32
+ = t('activate_account')
@@ -10,50 +10,44 @@
10
10
  - unless no_title
11
11
  %h2
12
12
  - if purpose
13
- = purpose + ','
14
- please
13
+ = t(purpose) + ','
14
+ = t('please')
15
15
  - else
16
- Please
17
- log in or
18
- = link_to "register", new_reader_url
16
+ = t('please')
17
+ = t('log_in')
18
+ - if Radiant::Config['reader.allow_registration?']
19
+ = t('or')
20
+ = link_to t('register'), new_reader_url
19
21
 
20
22
  - if @error
21
23
  %p.haserror
22
- Sorry: we don't recognise that combination of username and password.
24
+ = t('login_unknown')
23
25
  %br
24
- If you've forgotten your password we can always
25
- = link_to 'make you a new one', repassword_url
26
+ = link_to t('forgotten_password'), new_password_reset_url
26
27
 
27
28
  %p{ :class => @reader_session.errors.on(:login) ? 'haserror' : '' }
28
29
  %label{:for => "reader_session_login"}
29
- Username
30
+ = t('username').titlecase
30
31
  %br
31
32
  = f.text_field :login, :class => 'login'
32
- - if @reader_session.errors.on(:login)
33
- %br
34
- This
35
- = @reader_session.errors.on(:login).to_a.to_sentence
36
33
 
37
34
  %p{ :class => @reader_session.errors.on(:password) ? 'haserror' : '' }
38
35
  %label{:for => "reader_session_password"}
39
- Password
36
+ = t('password').titlecase
40
37
  %br
41
38
  = f.password_field :password, :class => 'login'
42
- - if @reader_session.errors.on(:password)
43
- %br
44
- This
45
- = @reader_session.errors.on(:password).to_a.to_sentence
46
39
 
47
40
  %p.buttons
48
41
  = f.submit ' Log in '
49
42
  = f.check_box :remember_me
50
43
  %label.paranthetical{:for => "reader_session_remember_me"}
51
- Remember me
44
+ = t('remember_me')
52
45
 
53
- %p.quiet
46
+ %ul.quiet
54
47
  - if Radiant::Config['reader.allow_registration?']
55
- If you haven't already, you will need to
56
- = link_to "register", new_reader_url
57
- before you can log in. It only takes a moment.
58
- If you've forgotten your password, you can enter your email address to
59
- = link_to("set a new one", new_password_reset_url) + '.'
48
+ %li
49
+ = link_to "registration".titlecase, new_reader_url
50
+ = t('is_free_and_quick')
51
+ %li
52
+ = link_to t("forgotten_password").titlecase, new_password_reset_url
53
+