radiant-reader-extension 3.0.13 → 3.0.14
Sign up to get free protection for your applications and to get access to all the features.
- data/app/views/admin/groups/_edit_access.html.haml +5 -1
- data/app/views/admin/groups/_popup.html.haml +2 -2
- data/app/views/admin/messages/_form.html.haml +1 -4
- data/app/views/admin/messages/edit.html.haml +3 -1
- data/app/views/admin/messages/new.html.haml +3 -0
- data/lib/controller_extensions.rb +1 -1
- data/lib/grouped_model.rb +6 -2
- data/lib/radiant-reader-extension.rb +1 -1
- data/lib/reader_admin_ui.rb +2 -2
- data/lib/site_controller_extensions.rb +6 -7
- data/public/javascripts/admin/reader.js +5 -9
- data/public/stylesheets/sass/admin/reader_group.sass +25 -2
- data/spec/controllers/site_controller_spec.rb +2 -2
- metadata +5 -6
@@ -1,6 +1,9 @@
|
|
1
1
|
- include_stylesheet 'admin/reader_group'
|
2
2
|
- include_javascript 'admin/reader'
|
3
|
+
- group ||= @group
|
3
4
|
- groupee ||= @page
|
5
|
+
- if group && groupee.new_record?
|
6
|
+
- groupee.groups = [group]
|
4
7
|
|
5
8
|
- groups = Group.find(:all)
|
6
9
|
- if groups.any?
|
@@ -11,6 +14,7 @@
|
|
11
14
|
= link_to t('reader_extension.access_open'), '#groups_popup', :class => 'popup unrestricted', :id => 'group_status_flag'
|
12
15
|
- else
|
13
16
|
= link_to t('reader_extension.access_restricted'), '#groups_popup', :class => 'popup restricted', :id => 'group_status_flag'
|
17
|
+
|
14
18
|
- fields_for groupee do |f|
|
15
|
-
= f.hidden_field :
|
19
|
+
= f.hidden_field :group_id_list
|
16
20
|
|
@@ -6,9 +6,9 @@
|
|
6
6
|
= t('reader_extension.access_control')
|
7
7
|
%p
|
8
8
|
= t('reader_extension.page_access_explanation')
|
9
|
-
%form.group_selection
|
9
|
+
%form.group_selection{:rel => "#{groupee.class.to_s.downcase}_group_id_list"}
|
10
10
|
= render :partial => 'admin/groups/chooser', :object => groupee
|
11
11
|
.buttons
|
12
|
-
= submit_tag t('reader_extension.set_access'), :class=>'button', :id=>'
|
12
|
+
= submit_tag t('reader_extension.set_access'), :class=>'button', :id=>'update_groups_button'
|
13
13
|
= t('or')
|
14
14
|
= link_to_function t('cancel'), "$(this).closePopup()", :class=>"cancel"
|
@@ -37,7 +37,4 @@
|
|
37
37
|
= save_model_button(@message)
|
38
38
|
= save_model_and_continue_editing_button(@message)
|
39
39
|
= t('or')
|
40
|
-
= link_to t("cancel"), @message.new_record? ? admin_messages_url : admin_message_url(@message)
|
41
|
-
|
42
|
-
- form_bottom.edit_popups do
|
43
|
-
= render :partial => 'admin/groups/popup', :locals => {:groupee => @message}
|
40
|
+
= link_to t("cancel"), @message.new_record? ? admin_messages_url : admin_message_url(@message)
|
@@ -2,7 +2,6 @@
|
|
2
2
|
|
3
3
|
= render_region :top
|
4
4
|
- render_region :main do |main|
|
5
|
-
|
6
5
|
- main.edit_header do
|
7
6
|
%h1
|
8
7
|
= t('reader_extension.edit_message')
|
@@ -11,5 +10,8 @@
|
|
11
10
|
- form_for :message, @message, :url => admin_message_url(@message), :html => {:id => 'message_form', :method => 'put'} do |f|
|
12
11
|
= render :partial => 'form', :object => f
|
13
12
|
|
13
|
+
- main.edit_popups do
|
14
|
+
= render :partial => 'admin/groups/popup', :locals => {:groupee => @message}
|
15
|
+
|
14
16
|
- main.edit_footer do
|
15
17
|
= render :partial => 'help'
|
@@ -11,5 +11,8 @@
|
|
11
11
|
- form_for :message, @message, :url => admin_messages_url, :html => {:id => 'message_form', :method => 'post'} do |f|
|
12
12
|
= render :partial => 'form', :object => f
|
13
13
|
|
14
|
+
- main.edit_popups do
|
15
|
+
= render :partial => 'admin/groups/popup', :locals => {:groupee => @message}
|
16
|
+
|
14
17
|
- main.edit_footer do
|
15
18
|
= render :partial => 'help'
|
data/lib/grouped_model.rb
CHANGED
@@ -163,8 +163,12 @@ module GroupedModel
|
|
163
163
|
self.groups << group unless self.has_group?(group)
|
164
164
|
end
|
165
165
|
|
166
|
-
def
|
167
|
-
self.groups
|
166
|
+
def group_id_list
|
167
|
+
self.groups.map(&:id).join(',')
|
168
|
+
end
|
169
|
+
|
170
|
+
def group_id_list=(ids)
|
171
|
+
self.groups = Group.find_these(ids.split(/,\s*/))
|
168
172
|
end
|
169
173
|
end
|
170
174
|
end
|
@@ -1,5 +1,5 @@
|
|
1
1
|
module RadiantReaderExtension
|
2
|
-
VERSION = '3.0.
|
2
|
+
VERSION = '3.0.14'
|
3
3
|
SUMMARY = %q{Reader/viewer/visitor registration, login and access-control for Radiant CMS}
|
4
4
|
DESCRIPTION = %q{Provides reader/member/user registration and management functions including password-reminder, group-based page access control and administrative email.}
|
5
5
|
URL = "http://radiant.spanner.org/reader"
|
data/lib/reader_admin_ui.rb
CHANGED
@@ -59,9 +59,9 @@ module ReaderAdminUI
|
|
59
59
|
def load_default_message_regions
|
60
60
|
OpenStruct.new.tap do |message|
|
61
61
|
message.edit = Radiant::AdminUI::RegionSet.new do |edit|
|
62
|
-
edit.main.concat %w{edit_header edit_form}
|
62
|
+
edit.main.concat %w{edit_header edit_form edit_popups}
|
63
63
|
edit.form.concat %w{edit_subject edit_body edit_function edit_groups}
|
64
|
-
edit.form_bottom.concat %w{edit_timestamp edit_buttons
|
64
|
+
edit.form_bottom.concat %w{edit_timestamp edit_buttons}
|
65
65
|
end
|
66
66
|
message.index = Radiant::AdminUI::RegionSet.new do |index|
|
67
67
|
index.thead.concat %w{subject_header function_header groups_header sent_header modify_header}
|
@@ -5,17 +5,16 @@ module SiteControllerExtensions
|
|
5
5
|
# NB. to control access without disabling the cache we have overridden Page.cache?
|
6
6
|
# to return false for any page that has a group association.
|
7
7
|
|
8
|
-
def find_page_with_group_check(
|
9
|
-
page = find_page_without_group_check(
|
10
|
-
if page
|
11
|
-
raise ReaderError::LoginRequired, t("reader_extension.page_not_public")
|
12
|
-
raise ReaderError::ActivationRequired, t("reader_extension.page_not_public")
|
13
|
-
raise ReaderError::AccessDenied, t("reader_extension.page_permission_denied")
|
8
|
+
def find_page_with_group_check(path)
|
9
|
+
page = find_page_without_group_check(path)
|
10
|
+
if page && page.restricted?
|
11
|
+
raise ReaderError::LoginRequired, t("reader_extension.page_not_public") unless current_reader
|
12
|
+
raise ReaderError::ActivationRequired, t("reader_extension.page_not_public") unless current_reader.activated?
|
13
|
+
raise ReaderError::AccessDenied, t("reader_extension.page_permission_denied") unless page.visible_to?(current_reader)
|
14
14
|
end
|
15
15
|
page
|
16
16
|
end
|
17
17
|
alias_method_chain :find_page, :group_check
|
18
|
-
|
19
18
|
}
|
20
19
|
end
|
21
20
|
end
|
@@ -9,7 +9,6 @@ Toggle.SelectAllBehavior = Behavior.create(Toggle.CheckboxBehavior, {
|
|
9
9
|
|
10
10
|
// This checkbox, when checked, will check and disable all others within the same containing element.
|
11
11
|
// It's useful in a tree view when the checked property will be inherited.
|
12
|
-
// For now I'm also using it to populate a hidden form field, but something more general would be preferable.
|
13
12
|
//
|
14
13
|
Treebox = Behavior.create({
|
15
14
|
onclick: function(e) {
|
@@ -28,17 +27,14 @@ GroupSelection = Behavior.create({
|
|
28
27
|
onsubmit : function(e) {
|
29
28
|
if (e) e.stop();
|
30
29
|
var group_list = this.element.getInputs('checkbox').collect(function(i) { if (i.checked && !i.disabled) return i.value; }).compact();
|
31
|
-
|
30
|
+
var flag = $('group_status_flag');
|
32
31
|
if (group_list.length == 0) {
|
33
|
-
|
34
|
-
$('group_status_flag').addClassName('unrestricted');
|
35
|
-
$('group_status_flag').update('Open');
|
32
|
+
flag.removeClassName('restricted').addClassName('unrestricted').update('Open');
|
36
33
|
} else {
|
37
|
-
|
38
|
-
$('group_status_flag').addClassName('restricted');
|
39
|
-
$('group_status_flag').update('Restricted');
|
34
|
+
flag.removeClassName('unrestricted').addClassName('restricted').update('Restricted');
|
40
35
|
}
|
41
|
-
|
36
|
+
field = $(this.element.readAttribute('rel'));
|
37
|
+
field.value = group_list.join(',');
|
42
38
|
this.element.closePopup();
|
43
39
|
}
|
44
40
|
});
|
@@ -1,5 +1,24 @@
|
|
1
1
|
@import compass
|
2
2
|
|
3
|
+
#content form p.access a
|
4
|
+
text-decoration: none
|
5
|
+
&.restricted
|
6
|
+
color: #a14242
|
7
|
+
font-weight: bold
|
8
|
+
&.unrestricted
|
9
|
+
color: #8de489
|
10
|
+
&:hover
|
11
|
+
color: white
|
12
|
+
|
13
|
+
#groups_popup
|
14
|
+
width: 300px
|
15
|
+
ul
|
16
|
+
padding-left: 0
|
17
|
+
ul
|
18
|
+
padding-left: 20px
|
19
|
+
label
|
20
|
+
display: inline
|
21
|
+
|
3
22
|
#content
|
4
23
|
table
|
5
24
|
&#groups
|
@@ -272,11 +291,15 @@ ul.help
|
|
272
291
|
color: #c00
|
273
292
|
font-size: 115%
|
274
293
|
|
275
|
-
|
276
294
|
#content
|
277
295
|
form
|
278
296
|
p
|
279
297
|
textarea
|
280
298
|
width: 100%
|
281
|
-
height:
|
299
|
+
height: 24em
|
282
300
|
|
301
|
+
table#pages.index td.access
|
302
|
+
font-size: 80%
|
303
|
+
color: #999
|
304
|
+
span.restricted
|
305
|
+
color: #c00
|
@@ -55,8 +55,8 @@ describe SiteController do
|
|
55
55
|
describe "getting a grouped page to which she doesn't have access" do
|
56
56
|
it "should redirect to the permission-denied page" do
|
57
57
|
get :show_page, :url => 'news/'
|
58
|
-
response.should
|
59
|
-
response.should
|
58
|
+
response.should be_success
|
59
|
+
response.should render_template('shared/not_allowed')
|
60
60
|
end
|
61
61
|
end
|
62
62
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: radiant-reader-extension
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 27
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 3
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 3.0.
|
9
|
+
- 14
|
10
|
+
version: 3.0.14
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- William Ross
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-10-
|
18
|
+
date: 2011-10-12 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
name: radiant-layouts-extension
|
@@ -328,7 +328,6 @@ files:
|
|
328
328
|
- public/stylesheets/sass/admin/reader.sass
|
329
329
|
- public/stylesheets/sass/admin/reader_group.sass
|
330
330
|
- public/stylesheets/sass/reader.sass
|
331
|
-
- radiant-reader-extension-3.0.13.gem
|
332
331
|
- radiant-reader-extension.gemspec
|
333
332
|
- Rakefile
|
334
333
|
- reader_extension.rb
|
@@ -357,7 +356,7 @@ files:
|
|
357
356
|
homepage: http://radiant.spanner.org/reader
|
358
357
|
licenses: []
|
359
358
|
|
360
|
-
post_install_message: "\n Add this to your radiant project with a line in your Gemfile:\n\n gem 'radiant-reader-extension', '~> 3.0.
|
359
|
+
post_install_message: "\n Add this to your radiant project with a line in your Gemfile:\n\n gem 'radiant-reader-extension', '~> 3.0.14'\n\n and if you haven't already, remember to enable ActionMailer in your\n project's config/environment.rb.\n "
|
361
360
|
rdoc_options: []
|
362
361
|
|
363
362
|
require_paths:
|