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
@@ -0,0 +1,7 @@
1
+ %span.function
2
+ - if message.administrative?
3
+ = message.function.description
4
+ - if message.group
5
+ = t('for')
6
+ - if message.group
7
+ = link_to message.group.name, admin_group_url(message.group)
@@ -1,3 +1,5 @@
1
+ %h1 group_id
2
+
1
3
  - fields_for @message do |f|
2
4
  - if @message.new_record? && @message.group
3
5
  = f.hidden_field :group_id
@@ -1,17 +1,11 @@
1
- - include_stylesheet('admin/group')
2
- = hidden_field_tag "page[group_ids][]", ""
3
-
4
- .row
1
+ .set
5
2
  %p
6
- Allow access only to:
7
- - Group.find(:all).each do |g|
8
- = check_box_tag "page[group_ids][]", g.id, @page.has_inherited_group?(g), {:id => "page_group_#{g.id}", :disabled => @page.group_is_inherited?(g)}
9
- - if @page.group_is_inherited?(g)
10
- %label{:for => "page_group_#{g.id}", :class => 'disabled', :title => "group is attached higher in the page tree: can't be detached here"}
11
- = g.name
3
+ = t('allowed_groups')
4
+ - Group.find(:all).each do |group|
5
+ = check_box_tag "page[group_ids][]", group.id, @page.has_inherited_group?(group), :id => "page_group_#{group.id}", :disabled => @page.group_is_inherited?(group)
6
+ - if @page.group_is_inherited?(group)
7
+ %label.checkbox{:for => "page_group_#{group.id}", :class => 'disabled', :title => t('inherited_group')}
8
+ = group.name
12
9
  - else
13
- %label{:for => "page_group_#{g.id}"}
14
- = g.name
15
- %br
16
- %span.formnote
17
- Leave all groups unchecked for public access.
10
+ %label.checkbox{:for => "page_group_#{group.id}"}
11
+ = group.name
@@ -3,5 +3,5 @@
3
3
  - Group.find(:all).each do |group|
4
4
  %span.checkbox
5
5
  = check_box_tag "reader[group_ids][]", group.id, @reader.is_in?(group), :id => "reader_group_#{group.id}"
6
- %label{:for => "reader_group_#{group.id}"}
6
+ %label.checkbox{:for => "reader_group_#{group.id}"}
7
7
  = group.name
@@ -1,7 +1,7 @@
1
1
  - if Group.subscribable.any?
2
2
  %h3
3
- Subscriptions
4
- %p{:style => 'margin-top: 0;'}
3
+ = t('subscriptions').titlecase
4
+ %p
5
5
  - Group.subscribable.each do |group|
6
6
  = check_box_tag "reader[group_ids][]", group.id, @reader.is_in?(group), :id => "reader_group_#{group.id}"
7
7
  %label{:for => "reader_group_#{group.id}"}
@@ -1,4 +1,4 @@
1
1
  %h1
2
- Access Denied
2
+ = t('access_denied')
3
3
  %p
4
- Sorry: you don't have permission to view that page.
4
+ = t('page_private')
@@ -0,0 +1,43 @@
1
+ en:
2
+ group: "group"
3
+ subscriptions: "subscriptions"
4
+ inherited_group: "group is attached higher in the page tree: can't be detached here"
5
+ public_if_no_groups: "Leave all groups unchecked for public access"
6
+ allowed_groups: "Allow access only to:"
7
+ page_private: "Sorry: you don't have permission to view that page."
8
+ none: "none"
9
+ new_group: "new group"
10
+ group_members: "Group members"
11
+ private_pages: "Private pages"
12
+ admin_messages: "Administrative messages"
13
+ other_messages: "Ad-hoc messages"
14
+ create_new_message: "Send a new message"
15
+ delete_message: "delete message"
16
+ create_welcome: "create welcome"
17
+ create_invitation: "create invitation"
18
+ last_sent: "last sent"
19
+ private_page_explanation: "The pages selected on the left are only visible to the people selected on the right."
20
+ group_welcome_sent_automatically: "This message is sent automatically when someone joins the %{name} group."
21
+ group_invitation_sent_automatically: "This message is sent automatically when someone is invited into the %{name} group."
22
+ all_in_group: "Everyone in the group"
23
+ inactive_in_group: "Group members who have not activated their account"
24
+ unsent_in_group: "Group members who have not received this message"
25
+ group_page: "group page"
26
+ for_group: "for the %{name} group"
27
+ add_members: "add members"
28
+ delete_group: "delete group"
29
+ really_delete_group: "Are you sure you want to completely remove the '%{name}' group? This cannot be undone."
30
+ edit_group: "edit group"
31
+ belongs_to_group: "This message belongs to the %{name} group."
32
+ invite_into_group: "Invite people into the %{name} group"
33
+ invitation_instructions: "This is a quick way to bring a group of people into the system in one go. Enter a comma-separated list of names and email addresses (one person per line) and after a bit of checking and tweaking on the next page, each of those people will be invited into the system and issued an account with a vaguely adequate username and entirely random password. Anyone who is already here will just be added to the group."
34
+ check_invitation_message: "Preview invitation message"
35
+ no_invitation_message: "This group has no invitation message. You will need to create one before you can invite people into it."
36
+ create_invitation_message: "create invitation message"
37
+ check_invitation_list: "Check the invitation list"
38
+ invitation_preview_instructions: "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. 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."
39
+ full_name: "full name"
40
+ email: "email"
41
+ optional_phone: "[phone]"
42
+ optional_login: "[login]"
43
+ page_not_public: "The page you have requested is not public. Please log in. If your account has the necessary permission you will be taken straight there."
@@ -5,10 +5,11 @@ module AdminMessagesControllerExtensions
5
5
  }
6
6
  end
7
7
 
8
+ protected
9
+
8
10
  def get_group
9
11
  model.group = Group.find(params[:group_id]) if params[:group_id]
10
12
  end
11
-
12
13
  end
13
14
 
14
15
 
data/lib/group_ui.rb CHANGED
@@ -6,11 +6,14 @@ module GroupUI
6
6
  attr_accessor :group
7
7
  alias_method :groups, :group
8
8
 
9
- def load_default_regions_with_group
10
- load_default_regions_without_group
9
+ def load_reader_group_extension_regions
11
10
  @group = load_default_group_regions
12
11
  end
13
12
 
13
+ def load_default_regions_with_group
14
+ load_default_regions_without_group
15
+ load_reader_group_extension_regions
16
+ end
14
17
  alias_method_chain :load_default_regions, :group
15
18
 
16
19
  protected
@@ -19,7 +22,12 @@ module GroupUI
19
22
  returning OpenStruct.new do |group|
20
23
  group.edit = Radiant::AdminUI::RegionSet.new do |edit|
21
24
  edit.main.concat %w{edit_header edit_form}
22
- edit.form.concat %w{edit_group edit_timestamp edit_buttons edit_membership edit_pages}
25
+ edit.form.concat %w{edit_group edit_timestamp edit_buttons}
26
+ end
27
+ group.show = Radiant::AdminUI::RegionSet.new do |show|
28
+ show.header.concat %w{title}
29
+ show.main.concat %w{messages pages members}
30
+ show.footer.concat %w{notes javascript}
23
31
  end
24
32
  group.index = Radiant::AdminUI::RegionSet.new do |index|
25
33
  index.thead.concat %w{name_header home_header members_header pages_header modify_header}
@@ -34,4 +42,3 @@ module GroupUI
34
42
  end
35
43
  end
36
44
  end
37
-
data/lib/grouped_model.rb CHANGED
@@ -23,7 +23,6 @@ module GroupedModel
23
23
  return true if reader.is_in?(group)
24
24
  return false
25
25
  end
26
-
27
26
  }
28
27
 
29
28
  belongs_to :group
data/lib/grouped_page.rb CHANGED
@@ -4,7 +4,9 @@ module GroupedPage
4
4
  base.class_eval {
5
5
  has_many :permissions
6
6
  has_many :groups, :through => :permissions
7
+ accepts_nested_attributes_for :permissions
7
8
  has_one :group, :foreign_key => 'homepage_id'
9
+
8
10
  include InstanceMethods
9
11
 
10
12
  # any page with a group-marker is never cached
@@ -4,6 +4,8 @@ module GroupedReader
4
4
  base.class_eval {
5
5
  has_many :memberships
6
6
  has_many :groups, :through => :memberships
7
+ accepts_nested_attributes_for :memberships
8
+
7
9
  include InstanceMethods
8
10
  alias_method_chain :activate!, :group
9
11
  alias_method_chain :send_functional_message, :group
@@ -17,11 +17,11 @@ module SiteControllerExtensions
17
17
  show_page_without_group_check
18
18
  rescue ReaderGroup::PermissionDenied
19
19
  if current_reader
20
- flash[:error] = "Sorry: you don't have permission to see that page."
20
+ flash[:error] = "sorry_access_denied"
21
21
  redirect_to reader_permission_denied_url
22
22
  else
23
- flash[:explanation] = "The page you have requested is not public. Please log in, and if your account has the necessary permission you will be taken straight there."
24
- flash[:error] = "Please log in."
23
+ flash[:explanation] = "page_not_public"
24
+ flash[:error] = "please_log_in"
25
25
  store_location
26
26
  redirect_to reader_login_url
27
27
  end
@@ -0,0 +1,242 @@
1
+ @import compass
2
+
3
+ #content
4
+ table
5
+ &#groups
6
+ td.name
7
+ width: 35%
8
+ a
9
+ font-size: 160%
10
+ span.notes
11
+ font-size: 80%
12
+ color: #929488
13
+ font-weight: lighter
14
+ line-height: 1.2
15
+ margin-top: 0.25em
16
+ &#import
17
+ th
18
+ text-align: left
19
+ td
20
+ padding: 2px
21
+ form#confirmation_form
22
+ table
23
+ width: 90%
24
+ input
25
+ &.preview
26
+ border: 1px solid #929488
27
+ font-family: 'Lucida Grande'
28
+ font-size: 16px
29
+ padding: 3px
30
+ width: 95%
31
+ &.with_error
32
+ border: 1px solid #c00
33
+ color: #c00
34
+ tr.invite td input
35
+ background-color: #e2e1dc
36
+ p.buttons
37
+ margin-top: 10px
38
+ .form-area
39
+ label.disabled
40
+ color: #929488
41
+ span.formnote
42
+ font-size: 80%
43
+ color: #929488
44
+ #group_pages
45
+ clear: left
46
+ width: 58%
47
+ float: left
48
+ #group_people
49
+ width: 35%
50
+ float: right
51
+ #group_messages
52
+ float: left
53
+ width: 98%
54
+ ul
55
+ list-style: square
56
+ font-size: 85%
57
+ padding-left: 14px
58
+ div.stretcher
59
+ clear: left
60
+ table#group_pages td.page a
61
+ color: black
62
+ text-decoration: none
63
+ &:hover
64
+ color: blue
65
+ text-decoration: underline
66
+ blockquote.messagepreview
67
+ border: 3px solid #999
68
+ background-color: #eee
69
+ margin: 0
70
+ padding: 20px
71
+ font-family: courier, monospace
72
+ font-size: 13px
73
+ line-height: 16px
74
+ .form-area p
75
+ &.description, &.invitation
76
+ margin-top: 10px
77
+ #footnotes
78
+ clear: both
79
+ margin-top: 50px
80
+
81
+ #group_pages ul
82
+ padding-left: 20px
83
+
84
+ #group_people ul
85
+ padding-left: 0
86
+ li
87
+ font-size: 16px
88
+ list-style: none
89
+ line-height: 24px
90
+ margin-top: 2px
91
+ font-family: 'Lucida Grande'
92
+
93
+ #group_pages ul li
94
+ font-size: 16px
95
+ list-style: none
96
+ line-height: 24px
97
+ margin-top: 2px
98
+ font-family: 'Lucida Grande'
99
+
100
+ /*#group_people ul li a, #group_pages ul li a {
101
+ * text-decoration: none;
102
+ * font-weight: normal;
103
+ *}
104
+ /*
105
+ *#group_pages ul li.inherited a {
106
+ * color: #ccc;
107
+ * font-weight: normal;
108
+ *}
109
+ *
110
+ *#group_people ul li.attached a, #group_pages ul li.attached a {
111
+ * color: #060;
112
+ * font-weight: bold;
113
+ *}
114
+
115
+ .fake_checkbox
116
+ padding-left: 20px
117
+ cursor: pointer
118
+ background-repeat: no-repeat
119
+ background-position: 0 3px
120
+ input
121
+ position: absolute
122
+ left: -9999px
123
+ a
124
+ text-decoration: none
125
+ &.checked
126
+ background-image: url(/images/admin/chk_on.png)
127
+ &.unchecked
128
+ background-image: url(/images/admin/chk_off.png)
129
+ &.inherited
130
+ background-image: url(/images/admin/chk_auto.png)
131
+
132
+ .checked a, .selected a
133
+ color: #5da454
134
+
135
+ .unchecked a, .unselected a
136
+ color: #ccc
137
+ font-weight: normal
138
+
139
+ .waiting a
140
+ color: #8c8d8e
141
+
142
+ .failed a
143
+ color: #c00
144
+
145
+ .inherited
146
+ color: #bfe4b9
147
+
148
+ span.group_actions
149
+ img
150
+ opacity: 0.5
151
+ a img
152
+ opacity: 1
153
+
154
+ .box
155
+ a.action, span.action.disabled
156
+ padding: 3px 4px
157
+ margin: 0 25px 0 1px
158
+ img
159
+ vertical-align: auto
160
+ a.action
161
+ color: black
162
+ text-decoration: none
163
+ &:hover
164
+ background: #eee image_url('admin/buttons_background.png') repeat-x
165
+ border: 1px solid #a5c9df
166
+ margin: 0 24px 0 0
167
+ +border-radius
168
+ &.selected
169
+ background: #c5e0f5
170
+ +linear-gradient(color_stops(#e5f5ff, #c5e0ff))
171
+ border: 1px solid #a5c9df
172
+ margin: 0 24px 0 0
173
+ +border-top-radius
174
+ +border-bottom-radius(0)
175
+ span.action.disabled
176
+ color: #ccc
177
+ span.sent
178
+ color: #ccc
179
+
180
+ /* show and send page
181
+
182
+ div#preview
183
+ float: left
184
+ width: 65%
185
+ +box-shadow
186
+ background-color: white
187
+ .message_header
188
+ padding: 10px
189
+ overflow: hidden
190
+ background-color: #eee
191
+ color: #333
192
+ font-size: 80%
193
+ line-height: 1.5
194
+ ul
195
+ margin: 0
196
+ padding: 6px 14px
197
+ list-style-type: none
198
+ li.subject
199
+ font-size: 1.6em
200
+ margin-top: 6px
201
+ li.mime-version, li.content-type
202
+ display: none
203
+ .message_body
204
+ iframe.message_body
205
+ width: 99%
206
+ height: 520px
207
+ margin: 0
208
+ border: 0
209
+ overflow: auto
210
+
211
+ div.preview_controls
212
+ height: 24px
213
+ p
214
+ margin: 2px 14px
215
+ text-align: right
216
+ a
217
+ text-decoration: none
218
+ color: #c00
219
+
220
+ div#deliver
221
+ position: relative
222
+ float: left
223
+ width: 27%
224
+ margin-left: 2%
225
+
226
+ /* edit pages
227
+
228
+ ul.help
229
+ list-style: square
230
+ color: #666
231
+ font-size: 85%
232
+ code
233
+ color: #c00
234
+ font-size: 115%
235
+
236
+
237
+ #content
238
+ form
239
+ p
240
+ textarea
241
+ width: 100%
242
+ height: 8em