radiant-reader-extension 0.9.2 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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
data/config/routes.rb CHANGED
@@ -1,11 +1,11 @@
1
1
  ActionController::Routing::Routes.draw do |map|
2
- map.namespace :admin do |admin|
3
- admin.resources :readers, :except => [:show]
2
+ map.namespace :admin, :path_prefix => 'admin/readers' do |admin|
3
+ admin.resources :messages, :member => [:preview, :deliver]
4
+ admin.resource :reader_configuration, :controller => 'reader_configuration'
4
5
  end
5
6
 
6
- map.namespace :admin, :path_prefix => 'admin/readers' do |admin|
7
- admin.resources :messages
8
- admin.resources :reader_settings, :except => [:destroy]
7
+ map.namespace :admin do |admin|
8
+ admin.resources :readers, :except => [:show]
9
9
  end
10
10
 
11
11
  map.resources :readers
@@ -13,7 +13,6 @@ ActionController::Routing::Routes.draw do |map|
13
13
  map.resource :reader_activation, :only => [:show, :new]
14
14
  map.resource :password_reset
15
15
 
16
- map.repassword '/password_reset/:id/:confirmation_code', :controller => 'password_resets', :action => 'edit'
17
16
  map.activate_me '/activate/:id/:activation_code', :controller => 'reader_activations', :action => 'update'
18
17
  map.reader_register '/register', :controller => 'readers', :action => 'new'
19
18
  map.reader_login '/login', :controller => 'reader_sessions', :action => 'new'
@@ -0,0 +1,11 @@
1
+ class MessageSentDate < ActiveRecord::Migration
2
+ def self.up
3
+ add_column :messages, :sent_at, :datetime
4
+ Message.reset_column_information
5
+ Message.all.each { |message| message.sent_at = message.updated_at || message.created_at; message.save! }
6
+ end
7
+
8
+ def self.down
9
+ remove_column :messages, :sent_at
10
+ end
11
+ end
@@ -3,15 +3,14 @@ module ReaderAdminUI
3
3
  def self.included(base)
4
4
  base.class_eval do
5
5
 
6
- attr_accessor :reader, :message, :reader_setting
6
+ attr_accessor :reader, :message, :reader_configuration
7
7
  alias_method :readers, :reader
8
8
  alias_method :messages, :message
9
- alias_method :reader_settings, :reader_setting
10
9
 
11
10
  def load_reader_extension_regions
12
- reader = load_default_reader_regions
13
- message = load_default_message_regions
14
- reader_setting = load_default_reader_setting_regions
11
+ @reader = load_default_reader_regions
12
+ @message = load_default_message_regions
13
+ @reader_configuration = load_default_reader_configuration_regions
15
14
  end
16
15
 
17
16
  def load_default_regions_with_reader
@@ -39,11 +38,16 @@ module ReaderAdminUI
39
38
  end
40
39
  end
41
40
 
42
- def load_default_reader_setting_regions
43
- returning OpenStruct.new do |reader_settings|
44
- reader_settings.index = Radiant::AdminUI::RegionSet.new do |index|
45
- index.settings.concat %w{registration site sender}
46
- index.messages.concat %w{administration}
41
+ def load_default_reader_configuration_regions
42
+ returning OpenStruct.new do |reader_configuration|
43
+ reader_configuration.show = Radiant::AdminUI::RegionSet.new do |show|
44
+ show.settings.concat %w{registration sender}
45
+ show.messages.concat %w{administration}
46
+ end
47
+ reader_configuration.edit = Radiant::AdminUI::RegionSet.new do |edit|
48
+ edit.main.concat %w{edit_header edit_form}
49
+ edit.form.concat %w{edit_registration edit_sender}
50
+ edit.form_bottom.concat %w{edit_buttons}
47
51
  end
48
52
  end
49
53
  end
@@ -55,6 +59,17 @@ module ReaderAdminUI
55
59
  edit.form.concat %w{edit_subject edit_body}
56
60
  edit.form_bottom.concat %w{edit_timestamp edit_buttons}
57
61
  end
62
+ message.index = Radiant::AdminUI::RegionSet.new do |index|
63
+ index.thead.concat %w{subject_header sent_header modify_header}
64
+ index.tbody.concat %w{subject_cell sent_cell modify_cell}
65
+ index.bottom.concat %w{buttons}
66
+ end
67
+ message.show = Radiant::AdminUI::RegionSet.new do |show|
68
+ show.header.concat %w{title}
69
+ show.preview.concat %w{headers body buttons}
70
+ show.delivery.concat %w{function options}
71
+ show.footer.concat %w{notes}
72
+ end
58
73
  message.new = message.edit
59
74
  end
60
75
  end
data/lib/reader_helper.rb CHANGED
@@ -3,13 +3,6 @@ module ReaderHelper
3
3
  def self.included(base)
4
4
 
5
5
  base.module_eval do
6
-
7
- # wraps the block in a p with the right class and shows the errors nicely, if there are any
8
-
9
- def with_error_report(errors, &block)
10
- render({:layout => 'wrappers/field_errors', :locals => {:errors => errors}}, {}, &block)
11
- end
12
-
13
6
  def clean_textilize(text)
14
7
  Sanitize.clean(textilize(text), Sanitize::Config::RELAXED)
15
8
  end
data/lib/reader_tags.rb CHANGED
@@ -96,7 +96,7 @@ module ReaderTags
96
96
  <pre><code><r:recipient:repassword_url /></code></pre>
97
97
  }
98
98
  tag "recipient:repassword_url" do |tag|
99
- repassword_url(tag.locals.recipient, :confirmation_code => tag.locals.recipient.perishable_token, :host => @mailer_vars[:@host])
99
+ new_password_reset_url(tag.locals.recipient, :confirmation_code => tag.locals.recipient.perishable_token, :host => @mailer_vars[:@host])
100
100
  end
101
101
 
102
102
  desc %{
@@ -106,18 +106,23 @@ module ReaderTags
106
106
  }
107
107
  tag 'sender' do |tag|
108
108
  raise TagError, "r:sender only works in email" unless @mailer_vars
109
- raise TagError, "no sender" unless tag.locals.sender = @mailer_vars[:@sender]
110
109
  tag.expand
111
110
  end
112
111
 
113
- [:name, :email].each do |field|
114
- desc %{
115
- Only for use in email messages. Displays the #{field} field of the user sending the current message.
116
- <pre><code><r:sender:#{field} /></code></pre>
117
- }
118
- tag "sender:#{field}" do |tag|
119
- tag.locals.sender.send(field)
120
- end
112
+ desc %{
113
+ Only for use in email messages. Displays the name of the email-sender (which is probably configured in `email.name`)
114
+ <pre><code><r:sender:name /></code></pre>
115
+ }
116
+ tag "sender:name" do |tag|
117
+ @mailer_vars['sender']
118
+ end
119
+
120
+ desc %{
121
+ Only for use in email messages. Displays the address of the email-sender (which is probably configured in `email.address`)
122
+ <pre><code><r:sender:address /></code></pre>
123
+ }
124
+ tag "sender:address" do |tag|
125
+ @mailer_vars['reply_to']
121
126
  end
122
127
 
123
128
  # and for referring to messages on pages
Binary file
@@ -1,5 +1,69 @@
1
1
  @import compass
2
2
 
3
+ /* index page
4
+
5
+ #messages_table
6
+ td.message_sent
7
+ color: #666
8
+ font-size: 80%
9
+ td.name
10
+ span.function
11
+ color: #c00
12
+ font-size: 80%
13
+ font-weight: normal
14
+ a
15
+ color: #06c
16
+ font-size: 80%
17
+ font-weight: normal
18
+
19
+ /* show and send page
20
+
21
+ div#preview
22
+ float: left
23
+ width: 65%
24
+ +box-shadow
25
+ background-color: white
26
+ .message_header
27
+ padding: 10px
28
+ overflow: hidden
29
+ background-color: #eee
30
+ color: #333
31
+ font-size: 80%
32
+ line-height: 1.5
33
+ ul
34
+ margin: 0
35
+ padding: 6px 14px
36
+ list-style-type: none
37
+ li.subject
38
+ font-size: 1.6em
39
+ margin-top: 6px
40
+ li.mime-version, li.content-type
41
+ display: none
42
+ .message_body
43
+ iframe.message_body
44
+ width: 99%
45
+ height: 520px
46
+ margin: 0
47
+ border: 0
48
+ overflow: auto
49
+
50
+ div.preview_controls
51
+ height: 24px
52
+ p
53
+ margin: 2px 14px
54
+ text-align: right
55
+ a
56
+ text-decoration: none
57
+ color: #c00
58
+
59
+ div#deliver
60
+ position: relative
61
+ float: left
62
+ width: 27%
63
+ margin-left: 2%
64
+
65
+ /* edit pages
66
+
3
67
  #content
4
68
  form
5
69
  p
@@ -9,87 +73,14 @@
9
73
  text-align: right
10
74
  label
11
75
  display: inline
12
- div.body
13
- padding: 12px 20px 20px
14
- background: image_url('admin/vertical_tan_gradient.png') top left repeat-x #f5f1e2
15
- +box-shadow(rgba(0,0,0,0.15), 2px, 2px, 3px)
16
- p
17
- margin-top: 0
18
- label
19
- color: #333
20
- text-shadow: none
21
76
  textarea
22
- border: 1px solid #ccc
23
-
24
- ul.help
25
- list-style: square
26
- padding-left: 40px
27
- color: #ccc
28
- font-size: 85%
29
- code
30
- color: white
31
- font-size: 115%
32
-
33
- #reader_settings
34
- label
35
- padding-left: 25px
77
+ width: 100%
36
78
 
37
- #message_settings
38
- label
39
- margin-right: 50px
79
+ ul.help
80
+ list-style: square
81
+ color: #666
82
+ font-size: 85%
83
+ code
84
+ color: #c00
85
+ font-size: 115%
40
86
 
41
- .box
42
- span.inplace
43
- a
44
- color: black
45
- &:hover
46
- color: #06c
47
- text-decoration: underline
48
- form
49
- display: inline
50
- padding-left: 25px
51
- background:
52
- image: none
53
- repeat: no-repeat
54
- position: left center
55
- &.waiting
56
- background-image: url(/images/admin/spinner.gif)
57
- a
58
- color: #666
59
- form
60
- opacity: 0.2
61
- span.checkbox
62
- label
63
- width: auto
64
- margin: 0
65
- label
66
- padding-left: 25px
67
- background:
68
- image: none
69
- repeat: no-repeat
70
- position: left center
71
- cursor: pointer
72
- &.true
73
- label
74
- color: #393
75
- background-image: url(/images/admin/chk_on.png)
76
- &.false
77
- label
78
- color: #666
79
- background-image: url(/images/admin/chk_off.png)
80
- &.waiting
81
- label
82
- color: #999
83
- background-image: url(/images/admin/spinner.gif)
84
- input
85
- position: absolute
86
- left: -999px
87
- a
88
- text-decoration: none
89
- a.create
90
- color: #393
91
- span.notes
92
- display: block
93
- margin-left: 25px
94
- font-size: 85%
95
- color: #555
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{radiant-reader-extension}
8
- s.version = "0.9.2"
8
+ s.version = "1.0.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["spanner"]
12
- s.date = %q{2010-10-04}
12
+ s.date = %q{2010-10-19}
13
13
  s.description = %q{Centralises reader/member/user registration and management tasks for the benefit of other extensions}
14
14
  s.email = %q{will@spanner.org}
15
15
  s.extra_rdoc_files = [
@@ -21,14 +21,13 @@ Gem::Specification.new do |s|
21
21
  "Rakefile",
22
22
  "VERSION",
23
23
  "app/controllers/admin/messages_controller.rb",
24
- "app/controllers/admin/reader_settings_controller.rb",
24
+ "app/controllers/admin/reader_configuration_controller.rb",
25
25
  "app/controllers/admin/readers_controller.rb",
26
26
  "app/controllers/password_resets_controller.rb",
27
27
  "app/controllers/reader_action_controller.rb",
28
28
  "app/controllers/reader_activations_controller.rb",
29
29
  "app/controllers/reader_sessions_controller.rb",
30
30
  "app/controllers/readers_controller.rb",
31
- "app/helpers/admin/reader_settings_helper.rb",
32
31
  "app/models/message.rb",
33
32
  "app/models/message_function.rb",
34
33
  "app/models/message_reader.rb",
@@ -37,17 +36,17 @@ Gem::Specification.new do |s|
37
36
  "app/models/reader_session.rb",
38
37
  "app/views/admin/messages/_form.html.haml",
39
38
  "app/views/admin/messages/_help.html.haml",
39
+ "app/views/admin/messages/_list_function.haml",
40
40
  "app/views/admin/messages/_message_description.html.haml",
41
41
  "app/views/admin/messages/edit.html.haml",
42
+ "app/views/admin/messages/index.haml",
42
43
  "app/views/admin/messages/new.html.haml",
43
- "app/views/admin/reader_settings/_setting.html.haml",
44
- "app/views/admin/reader_settings/edit.html.haml",
45
- "app/views/admin/reader_settings/index.html.haml",
46
- "app/views/admin/reader_settings/show.html.haml",
44
+ "app/views/admin/messages/preview.html.haml",
45
+ "app/views/admin/messages/show.html.haml",
46
+ "app/views/admin/reader_configuration/edit.html.haml",
47
+ "app/views/admin/reader_configuration/show.html.haml",
47
48
  "app/views/admin/readers/_avatar.html.haml",
48
49
  "app/views/admin/readers/_form.html.haml",
49
- "app/views/admin/readers/_list_head.html.haml",
50
- "app/views/admin/readers/_listed.html.haml",
51
50
  "app/views/admin/readers/_password_fields.html.haml",
52
51
  "app/views/admin/readers/edit.html.haml",
53
52
  "app/views/admin/readers/index.html.haml",
@@ -57,8 +56,6 @@ Gem::Specification.new do |s|
57
56
  "app/views/password_resets/create.html.haml",
58
57
  "app/views/password_resets/edit.html.haml",
59
58
  "app/views/password_resets/new.html.haml",
60
- "app/views/reader_activations/_activation_required.html.haml",
61
- "app/views/reader_activations/_on_activation.html.haml",
62
59
  "app/views/reader_activations/show.html.haml",
63
60
  "app/views/reader_notifier/message.html.haml",
64
61
  "app/views/reader_sessions/_login_form.html.haml",
@@ -68,16 +65,15 @@ Gem::Specification.new do |s|
68
65
  "app/views/readers/_extra_controls.html.haml",
69
66
  "app/views/readers/_flasher.html.haml",
70
67
  "app/views/readers/_form.html.haml",
71
- "app/views/readers/create.html.haml",
72
68
  "app/views/readers/edit.html.haml",
73
69
  "app/views/readers/index.html.haml",
74
70
  "app/views/readers/login.html.haml",
75
71
  "app/views/readers/new.html.haml",
76
72
  "app/views/readers/permission_denied.html.haml",
77
73
  "app/views/readers/show.html.haml",
78
- "app/views/wrappers/_field_errors.html.haml",
74
+ "config/initializers/radiant_config.rb",
75
+ "config/locales/en.yml",
79
76
  "config/routes.rb",
80
- "config/settings.rb",
81
77
  "db/migrate/001_create_readers.rb",
82
78
  "db/migrate/002_extend_sites.rb",
83
79
  "db/migrate/003_reader_honorifics.rb",
@@ -97,6 +93,7 @@ Gem::Specification.new do |s|
97
93
  "db/migrate/20100922152338_lock_versions.rb",
98
94
  "db/migrate/20100927095703_default_settings.rb",
99
95
  "db/migrate/20101004074945_unlock_version.rb",
96
+ "db/migrate/20101019094714_message_sent_date.rb",
100
97
  "lib/config_extensions.rb",
101
98
  "lib/controller_extensions.rb",
102
99
  "lib/reader_admin_ui.rb",
@@ -105,12 +102,9 @@ Gem::Specification.new do |s|
105
102
  "lib/reader_tags.rb",
106
103
  "lib/rfc822.rb",
107
104
  "lib/tasks/reader_extension_tasks.rake",
108
- "pkg/radiant-reader-extension-0.9.0.gem",
109
105
  "public/images/admin/chk_off.png",
110
106
  "public/images/admin/chk_on.png",
111
- "public/images/admin/new-message.png",
112
- "public/images/admin/new-reader.png",
113
- "public/javascripts/admin/messages.js",
107
+ "public/images/admin/delta.png",
114
108
  "public/stylesheets/sass/admin/reader.sass",
115
109
  "radiant-reader-extension.gemspec",
116
110
  "reader_extension.rb",
data/reader_extension.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  require_dependency 'application_controller'
2
2
 
3
3
  class ReaderExtension < Radiant::Extension
4
- version "0.9.2"
4
+ version "1.0.0"
5
5
  description "Provides reader/member/user registration and management functions"
6
6
  url "http://spanner.org/radiant/reader"
7
7
 
@@ -24,9 +24,6 @@ class ReaderExtension < Radiant::Extension
24
24
  unless defined? admin.reader
25
25
  Radiant::AdminUI.send :include, ReaderAdminUI
26
26
  Radiant::AdminUI.load_reader_extension_regions
27
- admin.reader = Radiant::AdminUI.load_default_reader_regions
28
- admin.message = Radiant::AdminUI.load_default_message_regions
29
- admin.reader_setting = Radiant::AdminUI.load_default_reader_setting_regions
30
27
  if defined? admin.sites
31
28
  admin.sites.edit.add :form, "admin/sites/choose_reader_layout", :after => "edit_homepage"
32
29
  end
@@ -35,16 +32,18 @@ class ReaderExtension < Radiant::Extension
35
32
  if respond_to?(:tab)
36
33
  tab("Readers") do
37
34
  add_item("Readers", "/admin/readers")
38
- add_item("Settings", "/admin/readers/reader_settings")
35
+ add_item("Messages", "/admin/readers/messages")
36
+ add_item("Settings", "/admin/readers/reader_configuration")
39
37
  end
40
38
  tab("Settings") do
41
- add_item("Reader", "/admin/readers/reader_settings")
39
+ add_item("Reader", "/admin/readers/reader_configuration")
42
40
  end
43
41
  else
44
42
  admin.tabs.add "Readers", "/admin/readers", :after => "Layouts", :visibility => [:all]
45
43
  if admin.tabs['Readers'].respond_to?(:add_link)
46
44
  admin.tabs['Readers'].add_link('readers', '/admin/readers')
47
- admin.tabs['Readers'].add_link('settings', '/admin/readers/reader_settings')
45
+ admin.tabs['Readers'].add_link('messages', '/admin/readers/messages')
46
+ admin.tabs['Readers'].add_link('settings', '/admin/readers/reader_configuration')
48
47
  end
49
48
  end
50
49
  end