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.
- data/README.markdown +2 -5
- data/VERSION +1 -1
- data/app/controllers/admin/groups_controller.rb +4 -0
- data/app/views/admin/group_invitations/new.html.haml +13 -27
- data/app/views/admin/group_invitations/preview.html.haml +52 -57
- data/app/views/admin/groups/_form.html.haml +3 -38
- data/app/views/admin/groups/edit.html.haml +2 -1
- data/app/views/admin/groups/index.html.haml +30 -3
- data/app/views/admin/groups/new.html.haml +2 -1
- data/app/views/admin/groups/show.html.haml +66 -35
- data/app/views/admin/messages/_function.haml +19 -0
- data/app/views/admin/messages/_list_function.haml +7 -0
- data/app/views/admin/messages/_message_group.html.haml +2 -0
- data/app/views/admin/pages/_page_groups.html.haml +9 -15
- data/app/views/admin/readers/_reader_groups.html.haml +1 -1
- data/app/views/readers/_memberships.html.haml +2 -2
- data/app/views/site/not_allowed.html.haml +2 -2
- data/config/locales/en.yml +43 -0
- data/lib/admin_messages_controller_extensions.rb +2 -1
- data/lib/group_ui.rb +11 -4
- data/lib/grouped_model.rb +0 -1
- data/lib/grouped_page.rb +2 -0
- data/lib/grouped_reader.rb +2 -0
- data/lib/site_controller_extensions.rb +3 -3
- data/public/stylesheets/sass/admin/reader_group.sass +242 -0
- data/radiant-reader_group-extension.gemspec +7 -11
- data/reader_group_extension.rb +8 -9
- metadata +8 -12
- data/app/views/admin/groups/_listed.html.haml +0 -25
- data/app/views/admin/reader_settings/_group_welcomes.html.haml +0 -11
- data/app/views/messages/show.html.haml +0 -11
- data/app/views/reader_activations/_on_activation.html.haml +0 -10
- data/pkg/radiant-reader_group-extension-0.9.0.gem +0 -0
- data/public/stylesheets/sass/admin/group.sass +0 -66
- 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
|
-
|
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
|
-
|
34
|
+
On github, please.
|
38
35
|
|
39
36
|
## Author and copyright
|
40
37
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
1.0.0
|
@@ -1,31 +1,19 @@
|
|
1
|
-
- include_stylesheet('admin/
|
1
|
+
- include_stylesheet('admin/reader_group')
|
2
2
|
|
3
3
|
%h1
|
4
|
-
|
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
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
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
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
24
|
+
%p
|
25
|
+
= t('invitation_instructions')
|
26
|
+
|
40
27
|
- else
|
41
|
-
%p
|
42
|
-
|
43
|
-
= link_to(
|
44
|
-
|
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/
|
1
|
+
- include_stylesheet('admin/reader_group')
|
2
2
|
|
3
3
|
%h1
|
4
|
-
|
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
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
%
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
%td
|
31
|
-
=
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
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
|
-
=
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
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
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
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,4 @@
|
|
1
|
-
- include_stylesheet('admin/
|
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
|
-
|
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') + " " + "
|
46
|
+
= link_to image('plus') + " " + t("new_group"), new_admin_group_url
|
@@ -1,41 +1,72 @@
|
|
1
|
-
- include_stylesheet 'admin/
|
1
|
+
- include_stylesheet 'admin/reader_group'
|
2
2
|
- body_classes << "reversed"
|
3
3
|
|
4
|
-
|
5
|
-
|
6
|
-
|
4
|
+
- render_region :header do |header|
|
5
|
+
- header.title do
|
6
|
+
%h1
|
7
|
+
= t('group').titlecase + ":"
|
8
|
+
= @group.name
|
7
9
|
|
8
|
-
|
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
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
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
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
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
|
+
|