radiant-group_forum-extension 0.4.1 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore ADDED
@@ -0,0 +1 @@
1
+ pkg/*
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.4.1
1
+ 0.5.0
@@ -1,14 +1,14 @@
1
1
  - include_stylesheet('admin/group')
2
2
 
3
- - groups = Group.find(:all)
4
3
  - if @group && @forum.new_record?
5
- - @forum.group = @group
4
+ - @forum.groups = [@group]
6
5
 
7
6
  - fields_for @forum do |f|
8
- .row
9
- %p.group
10
- = f.label :group_id, "Restrict to group:"
11
- = f.select :group_id, groups.map { |g| [g.name, g.id] }, {:include_blank => true}
12
- %br
13
- %span.formnote
14
- Leave blank for open access.
7
+ .set
8
+ %p
9
+ = t('allowed_groups')
10
+ - Group.find(:all).each do |group|
11
+ = check_box_tag "forum[group_ids][]", group.id, @forum.has_group?(group), :id => "forum_group_#{group.id}"
12
+ %label.checkbox{:for => "forum_group_#{group.id}"}
13
+ = group.name
14
+
@@ -1,17 +1,12 @@
1
1
  class GroupForumExtension < Radiant::Extension
2
- version "0.4.1"
2
+ version "0.5.0"
3
3
  description "Just a bit of access-control glue joining reader_groups to forum"
4
4
  url "http://spanner.org/radiant/group_forums"
5
5
 
6
6
  def activate
7
- Forum.send :include, GroupedForum
8
- Topic.send :include, GroupedTopic
9
- Post.send :include, GroupedPost
7
+ Forum.send :has_groups
10
8
  Page.send :include, GroupForumTags # a few tags for listing forums and latest topics on group pages
11
-
12
- ForumsController.send :include, ForumsControllerExtensions
13
- TopicsController.send :include, TopicsControllerExtensions
14
- PostsController.send :include, PostsControllerExtensions
9
+ ForumBaseController.send :include, GroupedControllerExtensions
15
10
 
16
11
  unless admin.forum.edit.form && admin.forum.edit.form.include?("forum_group")
17
12
  admin.forum.edit.add :form, "forum_group"
@@ -5,18 +5,19 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{radiant-group_forum-extension}
8
- s.version = "0.4.1"
8
+ s.version = "0.5.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{2011-01-27}
12
+ s.date = %q{2011-02-15}
13
13
  s.description = %q{A bit of glue to add group-based access control to the radiant forum.}
14
14
  s.email = %q{will@spanner.org}
15
15
  s.extra_rdoc_files = [
16
16
  "README.markdown"
17
17
  ]
18
18
  s.files = [
19
- "README.markdown",
19
+ ".gitignore",
20
+ "README.markdown",
20
21
  "Rakefile",
21
22
  "VERSION",
22
23
  "app/views/admin/forums/_forum_group.html.haml",
@@ -24,14 +25,8 @@ Gem::Specification.new do |s|
24
25
  "db/migrate/001_forums_groups.rb",
25
26
  "db/migrate/20091008101339_simple_ownership.rb",
26
27
  "group_forum_extension.rb",
27
- "lib/forums_controller_extensions.rb",
28
28
  "lib/group_forum_tags.rb",
29
- "lib/grouped_forum.rb",
30
- "lib/grouped_post.rb",
31
- "lib/grouped_topic.rb",
32
- "lib/posts_controller_extensions.rb",
33
29
  "lib/tasks/group_forum_extension_tasks.rake",
34
- "lib/topics_controller_extensions.rb",
35
30
  "radiant-group_forum-extension.gemspec",
36
31
  "spec/datasets/group_forum_forums_dataset.rb",
37
32
  "spec/datasets/group_forum_groups_dataset.rb",
@@ -7,8 +7,8 @@ describe Forum do
7
7
  @site = Page.current_site = sites(:test) if defined? Site
8
8
  end
9
9
 
10
- it "should have a group association" do
11
- Forum.reflect_on_association(:group).should_not be_nil
10
+ it "should have a groups association" do
11
+ Forum.reflect_on_association(:groups).should_not be_nil
12
12
  end
13
13
 
14
14
  it "should normally list only the ungrouped forums" do
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: radiant-group_forum-extension
3
3
  version: !ruby/object:Gem::Version
4
- hash: 13
4
+ hash: 11
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
- - 4
9
- - 1
10
- version: 0.4.1
8
+ - 5
9
+ - 0
10
+ version: 0.5.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - spanner
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-01-27 00:00:00 +00:00
18
+ date: 2011-02-15 00:00:00 +00:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -71,6 +71,7 @@ extensions: []
71
71
  extra_rdoc_files:
72
72
  - README.markdown
73
73
  files:
74
+ - .gitignore
74
75
  - README.markdown
75
76
  - Rakefile
76
77
  - VERSION
@@ -79,14 +80,8 @@ files:
79
80
  - db/migrate/001_forums_groups.rb
80
81
  - db/migrate/20091008101339_simple_ownership.rb
81
82
  - group_forum_extension.rb
82
- - lib/forums_controller_extensions.rb
83
83
  - lib/group_forum_tags.rb
84
- - lib/grouped_forum.rb
85
- - lib/grouped_post.rb
86
- - lib/grouped_topic.rb
87
- - lib/posts_controller_extensions.rb
88
84
  - lib/tasks/group_forum_extension_tasks.rake
89
- - lib/topics_controller_extensions.rb
90
85
  - radiant-group_forum-extension.gemspec
91
86
  - spec/datasets/group_forum_forums_dataset.rb
92
87
  - spec/datasets/group_forum_groups_dataset.rb
@@ -1,22 +0,0 @@
1
- module ForumsControllerExtensions
2
-
3
- def self.included(base)
4
- base.class_eval {
5
- before_filter :require_visibility_of_forum
6
-
7
- def index
8
- @forums = Forum.visible_to(current_reader).paginate(:all, :order => "position", :page => params[:page] || 1, :per_page => params[:per_page]) #nb. visible_to is a named_scope defined in GroupedModel (in reader_group)
9
- end
10
-
11
- protected
12
-
13
- def require_visibility_of_forum
14
- if @forum && !@forum.visible_to?(current_reader)
15
- flash[:error] = "Sorry: you don't have permission to see that discussion category."
16
- redirect_to reader_permission_denied_url
17
- return false
18
- end
19
- end
20
- }
21
- end
22
- end
data/lib/grouped_forum.rb DELETED
@@ -1,10 +0,0 @@
1
- module GroupedForum
2
-
3
- def self.included(base)
4
- base.class_eval {
5
- has_group
6
- gives_group_to :topics # which in turn give it to posts
7
- }
8
- end
9
-
10
- end
data/lib/grouped_post.rb DELETED
@@ -1,10 +0,0 @@
1
- module GroupedPost
2
-
3
- def self.included(base)
4
- base.class_eval {
5
- has_group
6
- gets_group_from :topic
7
- }
8
- end
9
-
10
- end
data/lib/grouped_topic.rb DELETED
@@ -1,11 +0,0 @@
1
- module GroupedTopic
2
-
3
- def self.included(base)
4
- base.class_eval {
5
- has_group
6
- gets_group_from :forum
7
- gives_group_to :posts
8
- }
9
- end
10
-
11
- end
@@ -1,26 +0,0 @@
1
- module PostsControllerExtensions
2
-
3
- def self.included(base)
4
- base.class_eval {
5
- before_filter :require_visibility_of_topic_and_page
6
-
7
- protected
8
-
9
- def require_visibility_of_topic_and_page
10
- if @page && !@page.visible_to?(current_reader)
11
- flash[:error] = "Sorry: you don't have permission to see that page."
12
- redirect_to reader_permission_denied_url
13
- return false
14
- end
15
- if @topic && !@topic.visible_to?(current_reader)
16
- flash[:error] = "Sorry: you don't have permission to see that discussion."
17
- redirect_to reader_permission_denied_url
18
- return false
19
- end
20
- end
21
- }
22
- end
23
- end
24
-
25
-
26
-
@@ -1,26 +0,0 @@
1
- module TopicsControllerExtensions
2
-
3
- def self.included(base)
4
- base.class_eval {
5
- before_filter :require_visibility_of_forum_and_page
6
-
7
- protected
8
-
9
- def require_visibility_of_forum_and_page
10
- if @page && !@page.visible_to?(current_reader)
11
- flash[:error] = "Sorry: you don't have permission to see that page."
12
- redirect_to reader_permission_denied_url
13
- return false
14
- end
15
- if @forum && !@forum.visible_to?(current_reader)
16
- flash[:error] = "Sorry: you don't have permission to see that discussion."
17
- redirect_to reader_permission_denied_url
18
- return false
19
- end
20
- end
21
- }
22
- end
23
- end
24
-
25
-
26
-