radiant-reader_group-extension 0.9.0 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (35) hide show
  1. data/README.markdown +2 -5
  2. data/VERSION +1 -1
  3. data/app/controllers/admin/groups_controller.rb +4 -0
  4. data/app/views/admin/group_invitations/new.html.haml +13 -27
  5. data/app/views/admin/group_invitations/preview.html.haml +52 -57
  6. data/app/views/admin/groups/_form.html.haml +3 -38
  7. data/app/views/admin/groups/edit.html.haml +2 -1
  8. data/app/views/admin/groups/index.html.haml +30 -3
  9. data/app/views/admin/groups/new.html.haml +2 -1
  10. data/app/views/admin/groups/show.html.haml +66 -35
  11. data/app/views/admin/messages/_function.haml +19 -0
  12. data/app/views/admin/messages/_list_function.haml +7 -0
  13. data/app/views/admin/messages/_message_group.html.haml +2 -0
  14. data/app/views/admin/pages/_page_groups.html.haml +9 -15
  15. data/app/views/admin/readers/_reader_groups.html.haml +1 -1
  16. data/app/views/readers/_memberships.html.haml +2 -2
  17. data/app/views/site/not_allowed.html.haml +2 -2
  18. data/config/locales/en.yml +43 -0
  19. data/lib/admin_messages_controller_extensions.rb +2 -1
  20. data/lib/group_ui.rb +11 -4
  21. data/lib/grouped_model.rb +0 -1
  22. data/lib/grouped_page.rb +2 -0
  23. data/lib/grouped_reader.rb +2 -0
  24. data/lib/site_controller_extensions.rb +3 -3
  25. data/public/stylesheets/sass/admin/reader_group.sass +242 -0
  26. data/radiant-reader_group-extension.gemspec +7 -11
  27. data/reader_group_extension.rb +8 -9
  28. metadata +8 -12
  29. data/app/views/admin/groups/_listed.html.haml +0 -25
  30. data/app/views/admin/reader_settings/_group_welcomes.html.haml +0 -11
  31. data/app/views/messages/show.html.haml +0 -11
  32. data/app/views/reader_activations/_on_activation.html.haml +0 -10
  33. data/pkg/radiant-reader_group-extension-0.9.0.gem +0 -0
  34. data/public/stylesheets/sass/admin/group.sass +0 -66
  35. data/spec/controllers/readers_controller_spec.rb +0 -44
data/README.markdown CHANGED
@@ -12,9 +12,6 @@ This works with multi_site. If you use [our fork](https://github.com/spanner/rad
12
12
 
13
13
  * groups can be marked subscribable, which puts a checkbox to subscribe or unsubscribe on the readers' registration and preference forms. Migration required.
14
14
  * messages can each have a different layout
15
- * group-mailer moved into Reader as general purpose reader-mailer, now using radiant layouts for styled group mailouts
16
- * group access control consolidated in `is_grouped` function to simplify maintenance of other extensions
17
- * invitations factored out, made reasonably restful
18
15
 
19
16
  ## Status
20
17
 
@@ -22,7 +19,7 @@ This has been brought across from a previous version that grouped users instead
22
19
 
23
20
  ## Requirements
24
21
 
25
- The [reader](https://github.com/spanner/radiant-reader-extension/tree) and [submenu](https://github.com/spanner/radiant-submenu-extension/tree) extensions.
22
+ Radiant 0.9.x and the [reader](https://github.com/spanner/radiant-reader-extension/tree) extension.
26
23
 
27
24
  ## Installation
28
25
 
@@ -34,7 +31,7 @@ Once you've got the reader extension in, the rest is easy:
34
31
 
35
32
  ## Bugs and comments
36
33
 
37
- In [lighthouse](http://spanner.lighthouseapp.com/projects/26912-radiant-extensions), please, or for little things an email or github message is always welcome.
34
+ On github, please.
38
35
 
39
36
  ## Author and copyright
40
37
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.9.0
1
+ 1.0.0
@@ -1,4 +1,8 @@
1
1
  class Admin::GroupsController < Admin::ResourceController
2
2
  skip_before_filter :load_model
3
3
  before_filter :load_model, :except => :index # we want the filter to run before :show too
4
+
5
+ def show
6
+
7
+ end
4
8
  end
@@ -1,31 +1,19 @@
1
- - include_stylesheet('admin/group')
1
+ - include_stylesheet('admin/reader_group')
2
2
 
3
3
  %h1
4
- Invite people into
5
- = @group.name
6
-
7
- %p
8
- This is a quick way to bring a group of people into the system in one go.
9
- Enter a comma-separated list of names and email addresses below (one person per line)
10
- and each of those people will be invited into the system and issued an account with a vaguely adequate username
11
- and entirely random password. Anyone who is already here will just be added to the group.
4
+ = t('invite_into_group', :name => @group.name)
12
5
 
13
6
  - if message = @group.messages.for_function('invitation').first
14
- %p
15
- %strong
16
- You may want to check the group's
17
- = link_to "invitation message", admin_message_url(message)
18
- before going any further.
19
7
 
20
8
  - form_for :group, @group, :url => admin_group_group_invitations_url(@group), :html => {:id => 'preview_form', :method => 'post'} do
21
9
  .form-area
22
10
  %p
23
11
  %label{:for => "readerlist"}
24
12
  List of people
25
- - if Radiant::Config['reader.use_honorifics?']
26
- title or rank,
27
- name, email, [login], [phone]
28
- %br
13
+ %span.formnote
14
+ - if Radiant::Config['reader.use_honorifics?']
15
+ title or rank,
16
+ name, email, [login], [phone]
29
17
  = text_area_tag "readerlist", params[:readerlist], :class => "textarea", :style => "width: 100%; height: 240px;"
30
18
 
31
19
  %p.buttons
@@ -33,13 +21,11 @@
33
21
  or
34
22
  = link_to "Cancel", admin_group_url(@group)
35
23
 
36
- %p
37
- When you press the 'preview import' button, the list will be repeated back to you to show exactly what reader accounts we are going to create and/or invite into this group.
38
- You can make changes at that stage, but please check the list formatting carefully: be sure there are no commas other than where you want them and that the email addresses are correct.
39
-
24
+ %p
25
+ = t('invitation_instructions')
26
+
40
27
  - else
41
- %p.haserror
42
- Before you can proceed, you will need to
43
- = link_to("create an invitation message", new_admin_group_message_url(@group, :function => 'invitation')) + '.'
44
- for this group.
45
-
28
+ %p
29
+ = t('no_invitation_message')
30
+ = link_to image('plus') + ' ' + t("create_invitation_message"), new_admin_group_message_url(@group, :function => 'invitation'), :class => "action"
31
+
@@ -1,63 +1,58 @@
1
- - include_stylesheet('admin/group')
1
+ - include_stylesheet('admin/reader_group')
2
2
 
3
3
  %h1
4
- Populate:
5
- = link_to @group.name, admin_group_url(@group)
6
- = render :partial => 'admin/groups/actions', :locals => {:group => @group}
4
+ = t('check_invitation_list', :name => @group.name)
7
5
 
8
6
  - form_for :group, @group, :url => admin_group_group_invitations_url(@group), :html => {:id => 'confirmation_form', :method => 'post'} do
9
- .form-area
10
- %h2 Please check the invitation list
11
- %ul
12
- %li 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.
13
- %li 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.
14
- %li Edit anything that needs it, uncheck the box next to anyone that you don't want to invite after all, and hit the 'invite these people' button to send out messages.
15
- %table#import
16
- %thead
17
- %tr
18
- %th
19
- - if Radiant::Config['reader.use_honorifics?']
20
- %th Title or rank
21
- %th Full name
22
- %th Email
23
- %th Login
24
- %th Phone
25
- %tbody
26
- - i = 0
27
- - @readers.each do |reader|
28
- - if reader.new_record?
29
- %tr.import
30
- %td
31
- = check_box_tag "import_reader[]", i, reader.valid?
32
- - if Radiant::Config['reader.use_honorifics?']
33
- %td
34
- = text_field_tag "reader_#{i}[honorific]", reader.honorific, :class => "preview#{ ' with_error' if reader.errors.on(:honorific)}", :title => reader.errors.on(:honorific)
35
- %td
36
- = text_field_tag "reader_#{i}[name]", reader.name, :class => "preview#{ ' with_error' if reader.errors.on(:name)}", :title => reader.errors.on(:name)
37
- %td
38
- = text_field_tag "reader_#{i}[email]", reader.email, :class => "preview#{ ' with_error' if reader.errors.on(:email)}", :title => reader.errors.on(:email)
39
- %td
40
- = text_field_tag "reader_#{i}[login]", reader.login, :class => "preview#{ ' with_error' if reader.errors.on(:login)}", :title => reader.errors.on(:login)
41
- %td
42
- = text_field_tag "reader_#{i}[phone]", reader.phone, :class => "preview#{ ' with_error' if reader.errors.on(:phone)}", :title => reader.errors.on(:phone)
43
- - else
44
- %tr.invite
7
+ %p
8
+ = t('invitation_preview_instructions')
9
+
10
+ %table#import
11
+ %thead
12
+ %tr
13
+ %th
14
+ - if Radiant::Config['reader.use_honorifics?']
15
+ %th= t('honorific')
16
+ %th= t('full_name')
17
+ %th= t('email')
18
+ %th= t('optional_login')
19
+ %th= t('optional_phone')
20
+ %tbody
21
+ - i = 0
22
+ - @readers.each do |reader|
23
+ - if reader.new_record?
24
+ %tr.import
25
+ %td
26
+ = check_box_tag "import_reader[]", i, reader.valid?
27
+ - if Radiant::Config['reader.use_honorifics?']
28
+ %td
29
+ = text_field_tag "reader_#{i}[honorific]", reader.honorific, :class => "preview#{ ' with_error' if reader.errors.on(:honorific)}", :title => reader.errors.on(:honorific)
30
+ %td
31
+ = text_field_tag "reader_#{i}[name]", reader.name, :class => "preview#{ ' with_error' if reader.errors.on(:name)}", :title => reader.errors.on(:name)
32
+ %td
33
+ = text_field_tag "reader_#{i}[email]", reader.email, :class => "preview#{ ' with_error' if reader.errors.on(:email)}", :title => reader.errors.on(:email)
34
+ %td
35
+ = text_field_tag "reader_#{i}[login]", reader.login, :class => "preview#{ ' with_error' if reader.errors.on(:login)}", :title => reader.errors.on(:login)
36
+ %td
37
+ = text_field_tag "reader_#{i}[phone]", reader.phone, :class => "preview#{ ' with_error' if reader.errors.on(:phone)}", :title => reader.errors.on(:phone)
38
+ - else
39
+ %tr.invite
40
+ %td
41
+ = check_box_tag "invite_reader[]", reader.id, {:checked => true}
42
+ - if Radiant::Config['reader.use_honorifics?']
45
43
  %td
46
- = check_box_tag "invite_reader[]", reader.id, {:checked => true}
47
- - if Radiant::Config['reader.use_honorifics?']
48
- %td
49
- = text_field_tag "reader_#{i}[honorific]", reader.honorific, :class => "preview#{ ' with_error' if reader.errors.on(:honorific)}", :title => reader.errors.on(:honorific), :disabled => true
50
- %td
51
- = text_field_tag "reader_#{i}[name]", reader.name, :class => "preview#{ ' with_error' if reader.errors.on(:name)}", :title => reader.errors.on(:name), :disabled => true
52
- %td
53
- = text_field_tag "reader_#{i}[email]", reader.email, :class => "preview#{ ' with_error' if reader.errors.on(:email)}", :title => reader.errors.on(:email), :disabled => true
54
- %td
55
- = text_field_tag "reader_#{i}[login]", reader.login, :class => "preview#{ ' with_error' if reader.errors.on(:login)}", :title => reader.errors.on(:login), :disabled => true
56
- %td
57
- = text_field_tag "reader_#{i}[phone]", reader.phone, :class => "preview#{ ' with_error' if reader.errors.on(:phone)}", :title => reader.errors.on(:phone)
58
- - i = i + 1
44
+ = text_field_tag "reader_#{i}[honorific]", reader.honorific, :class => "preview#{ ' with_error' if reader.errors.on(:honorific)}", :title => reader.errors.on(:honorific), :disabled => true
45
+ %td
46
+ = text_field_tag "reader_#{i}[name]", reader.name, :class => "preview#{ ' with_error' if reader.errors.on(:name)}", :title => reader.errors.on(:name), :disabled => true
47
+ %td
48
+ = text_field_tag "reader_#{i}[email]", reader.email, :class => "preview#{ ' with_error' if reader.errors.on(:email)}", :title => reader.errors.on(:email), :disabled => true
49
+ %td
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
+ %td
52
+ = text_field_tag "reader_#{i}[phone]", reader.phone, :class => "preview#{ ' with_error' if reader.errors.on(:phone)}", :title => reader.errors.on(:phone)
53
+ - i = i + 1
59
54
 
60
- %p.buttons
61
- = submit_tag 'Invite these people into the group', :name => 'confirm', :class => 'button'
62
- or
63
- = link_to 'start again', new_admin_group_group_invitation_url(@group)
55
+ %p.buttons
56
+ = submit_tag 'Invite these people into the group', :name => 'confirm', :class => 'button'
57
+ or
58
+ = link_to 'start again', new_admin_group_group_invitation_url(@group)
@@ -9,6 +9,9 @@
9
9
  %p.title
10
10
  = f.label :name
11
11
  = f.text_field 'name', :maxlength => 100, :class => "textbox"
12
+ %p.description
13
+ = f.label :description
14
+ = f.text_area 'description'
12
15
  %p.homepage
13
16
  = f.label :homepage_id, "Group home page:"
14
17
  = choose_page 'group', 'homepage_id', {:selected =>@group.homepage_id}
@@ -21,41 +24,3 @@
21
24
  = save_model_and_continue_editing_button @group
22
25
  or
23
26
  = link_to "Cancel", admin_groups_url
24
-
25
- - form.edit_membership do
26
- - unless @group.new_record?
27
- #group_people.box.narrow
28
- %h3
29
- Group members
30
- - readers = Reader.find(:all)
31
- - total = readers.count
32
- - column_length = (readers.count-1) / 2
33
- - columns = [readers[0..column_length], readers[column_length+1..readers.count]]
34
- - columns.each do |column|
35
- %ul.column
36
- - column.each do |reader|
37
- %div{:id => "reader_holder_#{reader.id}"}
38
- = render :partial => 'admin/memberships/reader', :object => reader
39
-
40
- - form.edit_pages do
41
- - unless @group.new_record?
42
- #group_pages.box.narrow
43
- %h3
44
- Private pages
45
- %ul
46
- - page = Page.respond_to?(:homepage) ? Page.homepage : Page.find_by_parent_id(nil)
47
- %div{:id => "page_holder_#{page.id}"}
48
- = render :partial => 'admin/permissions/page', :object => page
49
-
50
- :javascript
51
- var h1 = $('group_pages').getHeight();
52
- var h2 = $('group_people').getHeight();
53
- var h = (h1 > h2) ? h1 : h2
54
- $('group_people').setStyle({'height': h + 'px'});
55
- $('group_pages').setStyle({'height': h + 'px'});
56
-
57
- #footnotes
58
- %p
59
- The pages selected on the left are only visible to the people selected on the right.
60
-
61
-
@@ -1,4 +1,5 @@
1
- - include_stylesheet('admin/group')
1
+ - include_stylesheet('admin/reader_group')
2
+
2
3
  - render_region :main do |main|
3
4
  - main.edit_header do
4
5
  %h1
@@ -1,4 +1,4 @@
1
- - include_stylesheet('admin/group')
1
+ - include_stylesheet('admin/reader_group')
2
2
 
3
3
  = render_region :top
4
4
 
@@ -8,7 +8,34 @@
8
8
  = render :partial => 'list_head'
9
9
  %tbody
10
10
  - @groups.each do |group|
11
- = render :partial => 'listed', :locals => {:group => group}
11
+ %tr
12
+ - render_region :tbody do |tbody|
13
+ - tbody.name_cell do
14
+ %td.name
15
+ %p
16
+ = link_to group.name, admin_group_url(group)
17
+ %br
18
+ %span.notes
19
+ = truncate_words(group.description, 40)
20
+ - tbody.home_cell do
21
+ %td.home
22
+ - if group.homepage
23
+ = link_to group.homepage.title, edit_admin_page_url(group.homepage)
24
+ - else
25
+ = t('none')
26
+ - tbody.members_cell do
27
+ %td.members
28
+ = group.readers.count
29
+ - tbody.pages_cell do
30
+ %td.pages
31
+ = group.pages.count
32
+ - tbody.modify_cell do
33
+ %td.actions
34
+ = link_to_unless_current image('plus') + ' ' + t('add_members'), new_admin_group_group_invitation_url(group), :class => 'action'
35
+ = link_to_unless_current image('delta') + ' ' + t('edit_group'), edit_admin_group_url(group), :class => 'action'
36
+ = link_to_unless_current image('minus') + ' ' + t('delete_group'), admin_group_url(group), :method => 'delete', :confirm => t("really_delete_group", :name => group.name), :class => 'action'
37
+
38
+
12
39
 
13
40
  - render_region :bottom do |bottom|
14
41
  - bottom.buttons do
@@ -16,4 +43,4 @@
16
43
  = pagination_for @readers
17
44
  %ul
18
45
  %li
19
- = link_to image('plus') + " " + "new group", new_admin_group_url
46
+ = link_to image('plus') + " " + t("new_group"), new_admin_group_url
@@ -1,4 +1,5 @@
1
- - include_stylesheet('admin/group')
1
+ - include_stylesheet('admin/reader_group')
2
+
2
3
  - render_region :main do |main|
3
4
  - main.edit_header do
4
5
  %h1 New group
@@ -1,41 +1,72 @@
1
- - include_stylesheet 'admin/group'
1
+ - include_stylesheet 'admin/reader_group'
2
2
  - body_classes << "reversed"
3
3
 
4
- %h1
5
- Group:
6
- = @group.name
4
+ - render_region :header do |header|
5
+ - header.title do
6
+ %h1
7
+ = t('group').titlecase + ":"
8
+ = @group.name
7
9
 
8
- = textilize(@group.description)
10
+ - render_region :main do |main|
11
+ - main.messages do
12
+ #group_messages.box
13
+ %h3
14
+ =t('admin_messages').titlecase
15
+ - ['welcome', 'invitation'].each do |func|
16
+ - message = Message.functional(func, @group)
17
+ %p.ruled
18
+ %label
19
+ = t("#{func}_message")
20
+ - if message
21
+ %strong
22
+ = link_to message.subject, admin_message_url(message)
23
+ - else
24
+ = link_to image('plus') + ' ' + t("create_#{func}"), new_admin_group_message_url(@group, :function => func), :class => 'action create'
25
+ %h4
26
+ =t('other_messages').titlecase
27
+ - @group.messages.ordinary.each do |message|
28
+ %p.ruled
29
+ = link_to message.subject, admin_message_url(message)
30
+ %span.sent
31
+ - if message.sent_at
32
+ = t('last_sent')
33
+ = l(message.sent_at, :format => :short)
34
+ %p.ruled
35
+ = link_to image('plus') + ' ' + t("create_new_message"), new_admin_group_message_url(@group), :class => 'action create'
36
+
37
+ - main.pages do
38
+ #group_pages.box
39
+ %h3
40
+ =t('private_pages').titlecase
41
+ %ul
42
+ - page = Page.respond_to?(:homepage) ? Page.homepage : Page.find_by_parent_id(nil)
43
+ %div{:id => "page_holder_#{page.id}"}
44
+ = render :partial => 'admin/permissions/page', :object => page
9
45
 
46
+ - main.members do
47
+ #group_people.box
48
+ %h3
49
+ =t('group_members').titlecase
50
+ - readers = Reader.find(:all)
51
+ - total = readers.count
52
+ - column_length = (readers.count-1) / 2
53
+ - columns = [readers[0..column_length], readers[column_length+1..readers.count]]
54
+ - columns.each do |column|
55
+ %ul.column
56
+ - column.each do |reader|
57
+ %div{:id => "reader_holder_#{reader.id}"}
58
+ = render :partial => 'admin/memberships/reader', :object => reader
10
59
 
11
- #group_pages.box.narrow
12
- %h2
13
- Private pages
14
- %ul
15
- - page = Page.respond_to?(:homepage) ? Page.homepage : Page.find_by_parent_id(nil)
16
- %div{:id => "page_holder_#{page.id}"}
17
- = render :partial => 'admin/permissions/page', :object => page
60
+ - render_region :footer do |footer|
61
+ - footer.notes do
62
+ #footnotes
63
+ %p
64
+ = t('private_page_explanation')
18
65
 
19
- #group_people.box.narrow
20
- %h2
21
- Group members
22
- - readers = Reader.find(:all)
23
- - total = readers.count
24
- - column_length = (readers.count-1) / 2
25
- - columns = [readers[0..column_length], readers[column_length+1..readers.count]]
26
- - columns.each do |column|
27
- %ul.column
28
- - column.each do |reader|
29
- %div{:id => "reader_holder_#{reader.id}"}
30
- = render :partial => 'admin/memberships/reader', :object => reader
31
-
32
- #footnotes
33
- %p
34
- The pages selected on the left are only visible to the people selected on the right.
35
-
36
- :javascript
37
- var h1 = $('group_pages').getHeight();
38
- var h2 = $('group_people').getHeight();
39
- var h = (h1 > h2) ? h1 : h2
40
- $('group_people').setStyle({'height': h + 'px'});
41
- $('group_pages').setStyle({'height': h + 'px'});
66
+ - footer.javascript do
67
+ :javascript
68
+ var h1 = $('group_pages').getHeight();
69
+ var h2 = $('group_people').getHeight();
70
+ var h = (h1 > h2) ? h1 : h2
71
+ $('group_people').setStyle({'height': h + 'px'});
72
+ $('group_pages').setStyle({'height': h + 'px'});
@@ -0,0 +1,19 @@
1
+ - if @message.administrative?
2
+ %p
3
+ - if @message.group
4
+ = t("group_#{@message.function}_sent_automatically", :name => @message.group.name)
5
+ - else
6
+ = t("#{@message.function}_sent_automatically")
7
+ %ul
8
+ %li
9
+ = link_to t('edit_message').titlecase, edit_admin_message_url(@message)
10
+ %li
11
+ - if @message.group
12
+ = link_to @message.group.name + ' ' + t('group_page'), admin_group_url(@message.group)
13
+ - else
14
+ = link_to t('reader_configuration_page').titlecase, admin_reader_configuration_url
15
+
16
+ - if @message.group
17
+ %p
18
+ = t("belongs_to_group", :name => @message.group.name)
19
+