radiant-reader-extension 3.0.0.rc4 → 3.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (100) hide show
  1. data/README.md +105 -38
  2. data/Rakefile +4 -4
  3. data/app/controllers/accounts_controller.rb +24 -11
  4. data/app/controllers/admin/groups_controller.rb +15 -0
  5. data/app/controllers/admin/memberships_controller.rb +13 -7
  6. data/app/controllers/admin/messages_controller.rb +1 -0
  7. data/app/controllers/admin/permissions_controller.rb +15 -8
  8. data/app/controllers/groups_controller.rb +6 -4
  9. data/app/controllers/password_resets_controller.rb +1 -1
  10. data/app/controllers/reader_action_controller.rb +7 -51
  11. data/app/controllers/reader_sessions_controller.rb +9 -11
  12. data/app/helpers/reader_helper.rb +23 -3
  13. data/app/models/group.rb +45 -16
  14. data/app/models/message.rb +4 -11
  15. data/app/models/permission.rb +4 -0
  16. data/app/models/reader.rb +61 -26
  17. data/app/models/reader_notifier.rb +2 -2
  18. data/app/models/reader_page.rb +9 -5
  19. data/app/views/accounts/{_memberships.html.haml → _choose_memberships.html.haml} +0 -0
  20. data/app/views/accounts/_form.html.haml +9 -11
  21. data/app/views/accounts/_preamble.html.haml +14 -0
  22. data/app/views/accounts/_profile_form.html.haml +13 -29
  23. data/app/views/accounts/dashboard.html.haml +0 -1
  24. data/app/views/accounts/edit.html.haml +3 -3
  25. data/app/views/accounts/edit_profile.html.haml +10 -10
  26. data/app/views/admin/groups/_chooser.html.haml +8 -0
  27. data/app/views/admin/groups/_form.html.haml +7 -5
  28. data/app/views/admin/groups/_group.html.haml +29 -0
  29. data/app/views/admin/groups/index.html.haml +2 -28
  30. data/app/views/admin/groups/show.html.haml +3 -2
  31. data/app/views/admin/memberships/_reader.html.haml +2 -6
  32. data/app/views/admin/messages/_form.html.haml +10 -11
  33. data/app/views/admin/messages/_list_function.haml +2 -3
  34. data/app/views/admin/messages/{index.haml → index.html.haml} +21 -11
  35. data/app/views/admin/pages/_page_groups.html.haml +5 -11
  36. data/app/views/admin/permissions/_page.html.haml +6 -12
  37. data/app/views/admin/reader_configuration/edit.html.haml +2 -0
  38. data/app/views/admin/reader_configuration/show.html.haml +2 -0
  39. data/app/views/groups/_group.html.haml +12 -0
  40. data/app/views/groups/show.html.haml +10 -3
  41. data/app/views/readers/_description.html.haml +3 -0
  42. data/app/views/readers/_groups.html.haml +9 -0
  43. data/app/views/{accounts → readers}/_links.html.haml +2 -2
  44. data/app/views/readers/_list.html.haml +23 -0
  45. data/app/views/{accounts/_groups.html.haml → readers/_memberships.html.haml} +0 -1
  46. data/app/views/{accounts/_reader.html.haml → readers/_mugshot.html.haml} +1 -1
  47. data/app/views/readers/_people.html.haml +6 -0
  48. data/app/views/readers/_profile.html.haml +30 -0
  49. data/app/views/readers/_reader.html.haml +28 -0
  50. data/app/views/readers/index.html.haml +20 -0
  51. data/app/views/{accounts → readers}/show.html.haml +1 -2
  52. data/app/views/shared/_standard_reader_parts.html.haml +1 -1
  53. data/app/views/shared/not_allowed.html.haml +16 -0
  54. data/config/initializers/formats.rb +1 -2
  55. data/config/initializers/radiant_config.rb +5 -2
  56. data/config/locales/en.yml +181 -140
  57. data/config/routes.rb +25 -16
  58. data/db/migrate/001_create_readers.rb +0 -1
  59. data/db/migrate/20090921125653_reader_messages.rb +0 -1
  60. data/db/migrate/20090921125654_group_messages.rb +0 -1
  61. data/db/migrate/20110812111934_groups_nested_set.rb +19 -0
  62. data/db/migrate/20110814070858_message_has_many_groups.rb +14 -0
  63. data/db/migrate/20110905194602_group_ancestry.rb +23 -0
  64. data/lib/controller_extensions.rb +49 -0
  65. data/lib/grouped_model.rb +49 -8
  66. data/lib/grouped_page.rb +17 -5
  67. data/lib/message_tags.rb +21 -3
  68. data/lib/radiant-reader-extension.rb +1 -1
  69. data/lib/reader_admin_ui.rb +7 -8
  70. data/lib/reader_tags.rb +1 -1
  71. data/lib/site_controller_extensions.rb +7 -18
  72. data/public/images/furniture/csv.png +0 -0
  73. data/public/images/furniture/csv_tiny.png +0 -0
  74. data/public/images/furniture/vcard.png +0 -0
  75. data/public/images/furniture/vcard_tiny.png +0 -0
  76. data/public/javascripts/admin/reader.js +22 -1
  77. data/public/stylesheets/sass/admin/reader_group.sass +23 -22
  78. data/public/stylesheets/sass/reader.sass +81 -17
  79. data/radiant-reader-extension.gemspec +3 -1
  80. data/reader_extension.rb +7 -9
  81. data/spec/controllers/accounts_controller_spec.rb +8 -22
  82. data/spec/controllers/admin/messages_controller_spec.rb +0 -12
  83. data/spec/datasets/readers_dataset.rb +41 -38
  84. data/spec/lib/reader_tags_spec.rb +1 -1
  85. data/spec/models/group_spec.rb +89 -22
  86. data/spec/models/message_spec.rb +1 -1
  87. data/spec/models/reader_notifier_spec.rb +1 -1
  88. data/spec/models/reader_page_spec.rb +34 -18
  89. data/spec/models/reader_spec.rb +0 -1
  90. data/spec/spec.opts +4 -3
  91. metadata +51 -28
  92. data/app/views/accounts/_contributions.html.haml +0 -2
  93. data/app/views/accounts/_description.html.haml +0 -2
  94. data/app/views/accounts/_list.html.haml +0 -17
  95. data/app/views/accounts/_profile.html.haml +0 -29
  96. data/app/views/accounts/index.html.haml +0 -23
  97. data/app/views/groups/_all.html.haml +0 -10
  98. data/app/views/site/not_allowed.html.haml +0 -4
  99. data/db/migrate/20100922152338_lock_versions.rb +0 -9
  100. data/db/migrate/20101004074945_unlock_version.rb +0 -9
@@ -7,8 +7,8 @@ class ReaderNotifier < ActionMailer::Base
7
7
  prefix = site ? site.abbreviation : Radiant::Config['email.prefix']
8
8
  host = site ? site.base_domain : Radiant::Config['site.host'] || 'www.example.com'
9
9
  default_url_options[:host] = host
10
- sender = Radiant::Config['email.name'] || current_user.name
11
- sender_address = Radiant::Config['email.address'] || current_user.email
10
+ sender = Radiant::Config['email.name'] || message.created_by.name
11
+ sender_address = Radiant::Config['email.address'] || message.created_by.email
12
12
 
13
13
  message_layout(message.layout) if message.layout
14
14
  content_type("text/html")
@@ -21,11 +21,15 @@ class ReaderPage < Page
21
21
  end
22
22
 
23
23
  def cache?
24
- !!Radiant.config['readers.public?']
24
+ public?
25
+ end
26
+
27
+ def public?
28
+ Radiant.config['reader.directory_visibility'] == 'public'
25
29
  end
26
30
 
27
31
  def visible?
28
- Radiant.config['readers.public?'] || current_reader
32
+ public? || current_reader
29
33
  end
30
34
 
31
35
  def url_for(thing)
@@ -46,9 +50,9 @@ class ReaderPage < Page
46
50
  self.group = Group.find_by_slug(params.first) if params.first =~ /\w/
47
51
  self.reader = Reader.find_by_id(params.last) if params.last !~ /\D/
48
52
 
49
- raise ReaderError::AccessDenied if group && !group.visible_to?(current_reader)
50
- raise ReaderError::AccessDenied if reader && !reader.visible_to?(current_reader)
51
- raise ActiveRecord::RecordNotFound if reader && group && !reader.is_in?(group)
53
+ raise ReaderError::AccessDenied, "Group visibility denied" if group && !group.visible_to?(current_reader)
54
+ raise ReaderError::AccessDenied, "Reader visibility denied: #{current_reader} (#{current_reader.name}) cannot see #{reader} (#{reader.name})" if reader && !reader.visible_to?(current_reader)
55
+ raise ActiveRecord::RecordNotFound if reader && group && !reader.has_group?(group)
52
56
 
53
57
  self
54
58
  end
@@ -4,15 +4,6 @@
4
4
  - form_for reader, :html => {:class => 'friendly'} do |f|
5
5
  %input{:type => :hidden, :name => :authentication_type, :value => :user}
6
6
 
7
- - unless @reader.errors.empty?
8
- %p.has_error
9
- = t('reader_extension.sorry').titlecase
10
- = t('reader_extension.form_problem') + '.'
11
- = t('reader_extension.affected_fields_highlighted')
12
- - else
13
- %p
14
- = t('reader_extension.bold_required')
15
-
16
7
  %p
17
8
  = f.label :name, nil, :class => 'required'
18
9
  %br
@@ -69,7 +60,6 @@
69
60
  = f.label :password, nil, :class => 'optional'
70
61
  %span.password
71
62
  &bull;&bull;&bull;&bull;&bull;
72
- %br
73
63
  %span.formnote= link_to t('reader_extension.change_password'), '#', :class => 'toggle', :rel => ".display_password, .new_password"
74
64
 
75
65
  .new_password.hidden
@@ -83,7 +73,15 @@
83
73
  %br
84
74
  = f.password_field :password_confirmation, :class => 'standard', :autocomplete => 'off'
85
75
 
86
- = render :partial => 'memberships'
76
+ - unless reader.new_record?
77
+ %p
78
+ = f.label :description, nil, :class => 'optional'
79
+ %br
80
+ = f.text_area :description, :class => 'standard'
81
+ %br
82
+ %span.formnote= t('reader_extension.form_notes.account.description')
83
+
84
+ = render :partial => 'choose_memberships'
87
85
 
88
86
  %p
89
87
  = submit_tag reader.new_record? ? t('reader_extension.create_account') : t("reader_extension.update_account")
@@ -0,0 +1,14 @@
1
+ - unless @reader.errors.empty?
2
+ %p.has_error
3
+ = t('reader_extension.sorry').titlecase
4
+ = t('reader_extension.form_problem') + '.'
5
+ = t('reader_extension.affected_fields_highlighted')
6
+ - else
7
+ %p
8
+ = t('reader_extension.bold_required')
9
+ - unless @reader.new_record?
10
+ - if controller.action_name == 'edit'
11
+ = t('reader_extension.or_edit_profile', :url => reader_edit_profile_url)
12
+ - else
13
+ = t('reader_extension.or_edit_preferences', :url => reader_account_url)
14
+
@@ -4,59 +4,37 @@
4
4
  - form_for reader, :html => {:class => 'friendly'} do |f|
5
5
  %input{:type => :hidden, :name => :authentication_type, :value => :user}
6
6
 
7
- - unless @reader.errors.empty?
8
- %p.has_error
9
- = t('reader_extension.sorry').titlecase
10
- = t('reader_extension.form_problem') + '.'
11
- = t('reader_extension.affected_fields_highlighted')
12
- - else
13
- %p
14
- = t('reader_extension.bold_required')
15
- = t('reader_extension.checked_fields_public')
16
-
17
7
  - if 1 || Radiant::Config['reader.use_honorifics?']
18
8
  %p
19
9
  = f.label :honorific, nil, :class => 'optional'
20
10
  %br
21
11
  = f.text_field :honorific, :class => 'standard'
22
- %span.formnote= t('reader_extension.form_notes.honorific')
23
-
24
- %p
25
- = f.label :name, nil, :class => 'required'
26
- %br
27
- = f.text_field :name, :class => 'standard'
28
- %span.formnote= t('reader_extension.form_notes.name')
29
-
30
- %p
31
- = f.label :email, nil, :class => 'required'
32
- %br
33
- = f.text_field :email, :class => 'standard'
34
- %span.formnote= t('reader_extension.form_notes.email')
12
+ %span.formnote= t('reader_extension.form_notes.account.honorific')
35
13
 
36
14
  %p
37
15
  = f.label :phone, nil, :class => 'optional'
38
16
  %br
39
17
  = f.text_field :phone, :class => 'standard'
40
- %span.formnote= t('reader_extension.form_notes.phone')
18
+ %span.formnote= t('reader_extension.form_notes.account.phone')
41
19
 
42
20
  %p
43
21
  = f.label :mobile, nil, :class => 'optional'
44
22
  %br
45
23
  = f.text_field :mobile, :class => 'standard'
46
- %span.formnote= t('reader_extension.form_notes.mobile')
24
+ %span.formnote= t('reader_extension.form_notes.account.mobile')
47
25
 
48
26
  %p
49
27
  = f.label :post_country, nil, :class => 'optional'
50
28
  = f.select :post_country, country_options_for_select(reader.post_country)
51
29
  %br
52
- %span.formnote= t('reader_extension.form_notes.post_country')
30
+ %span.formnote= t('reader_extension.form_notes.account.post_country')
53
31
 
54
- - if Radiant::Config['reader.use_postal_organisation?']
32
+ - if Radiant::Config['reader.postal.use_organisation?']
55
33
  %p
56
34
  = f.label :post_organisation, nil, :class => 'optional'
57
35
  = f.text_field :post_organisation, :class => 'standard'
58
36
  %br
59
- %span.formnote= t('reader_extension.form_notes.post_organisation')
37
+ %span.formnote= t('reader_extension.form_notes.account.post_organisation')
60
38
 
61
39
  %p
62
40
  = f.label :post_line1, t('activerecord.attributes.reader.postal_address'), :class => 'optional'
@@ -74,11 +52,17 @@
74
52
  = f.label :postcode, nil, :class => 'optional'
75
53
  = f.text_field :postcode, :class => 'standard'
76
54
 
55
+ %p
56
+ = f.label :description, nil, :class => 'optional'
57
+ %br
58
+ = f.text_area :description, :class => Radiant::Config['forum.toolbar?'] ? 'rte' : 'standard'
59
+ %span.formnote= t('reader_extension.form_notes.account.description')
60
+
77
61
  %p
78
62
  = f.check_box :unshareable, :class => 'reversed'
79
63
  = f.label :unshareable
80
64
  %br
81
- %span.formnote= t('reader_extension.form_notes.unshareable')
65
+ %span.formnote= t('reader_extension.form_notes.account.unshareable')
82
66
 
83
67
  %p
84
68
  = submit_tag reader.new_record? ? t('reader_extension.create_account') : t("reader_extension.update_account")
@@ -24,5 +24,4 @@
24
24
  - render_region :main
25
25
 
26
26
 
27
-
28
27
  = yield :main
@@ -9,7 +9,7 @@
9
9
  &gt;
10
10
  = link_to t('reader_extension.readers').titlecase, readers_url
11
11
  &gt;
12
- = link_to t('reader_extension.you').titlecase, profile_url
12
+ = link_to t('reader_extension.you').titlecase, reader_profile_url
13
13
  &gt;
14
14
  = t('reader_extension.account_settings')
15
15
 
@@ -19,11 +19,11 @@
19
19
  = render :partial => 'shared/standard_reader_parts'
20
20
 
21
21
  - content_for :main do
22
+ / brings in partials _preamble, _form, _gravatar
22
23
  = render_region :main
23
24
 
24
25
  - content_for :sidebar do
26
+ / not defined here
25
27
  = render_region :sidebar
26
-
27
-
28
28
 
29
29
  = yield :main
@@ -8,21 +8,13 @@
8
8
  = t('reader_extension.profile_intro_grouped')
9
9
  - else
10
10
  = t('reader_extension.profile_intro_private')
11
-
12
- - content_for :form do
13
- %pre
14
- = @reader.errors.full_messages
15
- = render :partial => 'profile_form', :locals => {:reader => @reader}
16
- %p
17
- = standard_gravatar_for(@reader, 'http://gravatar.com/site/login')
18
- = link_to t('reader_extension.change_gravatar'), "http://gravatar.com/site/login/"
19
11
 
20
12
  - content_for :breadcrumbs do
21
13
  = link_to t('reader_extension.home').titlecase, '/'
22
14
  &gt;
23
15
  = link_to t('reader_extension.readers').titlecase, readers_url
24
16
  &gt;
25
- = link_to t('reader_extension.you').titlecase, profile_url
17
+ = link_to t('reader_extension.you').titlecase, reader_profile_url
26
18
  &gt;
27
19
  = t('reader_extension.edit_profile')
28
20
 
@@ -31,4 +23,12 @@
31
23
 
32
24
  = render :partial => 'shared/standard_reader_parts'
33
25
 
34
- = yield :form
26
+ - content_for :main do
27
+ / brings in partials _preamble, _profile_form, _gravatar
28
+ = render_region :main
29
+
30
+ - content_for :sidebar do
31
+ / not defined here
32
+ = render_region :sidebar
33
+
34
+ = yield :main
@@ -0,0 +1,8 @@
1
+ // This is going to be a tree of checkboxes with some
2
+ // javascript to make visible the inheritance of permission.
3
+ // It will be used on pages, messages and any other group-linkable object.
4
+
5
+ - Group.roots.each do |group|
6
+ = f.check_box :group_ids, {}, group.id
7
+ = f.label :group_ids, group.name, :class => 'checkbox'
8
+ %br
@@ -1,19 +1,21 @@
1
1
  - form_for [:admin, @group] do |f|
2
2
  .form-area
3
3
  = render_region :form_top
4
- = hidden_field 'group', 'lock_version'
5
4
 
6
5
  - render_region :form do |form|
7
6
  - form.edit_group do
8
7
  #group
9
8
  %p.title
10
9
  = f.label :name
11
- = f.text_field 'name', :maxlength => 100, :class => "textbox"
10
+ = f.text_field :name, :maxlength => 100, :class => "textbox"
11
+ %p.parent
12
+ = f.label :parent_id
13
+ = f.select :parent_id, parent_group_options_for_select(@group)
12
14
  %p.description
13
15
  = f.label :description
14
- = f.text_area 'description'
16
+ = f.text_area :description
15
17
  %p.homepage
16
- = f.label :homepage_id, "Group home page:"
18
+ = f.label :homepage_id
17
19
  = choose_page 'group', 'homepage_id', {:selected =>@group.homepage_id}
18
20
 
19
21
  - form.edit_timestamp do
@@ -23,4 +25,4 @@
23
25
  = save_model_button @group
24
26
  = save_model_and_continue_editing_button @group
25
27
  or
26
- = link_to "Cancel", admin_groups_url
28
+ = link_to t("cancel"), admin_groups_url
@@ -0,0 +1,29 @@
1
+ %tr{:class =>"level_#{level}"}
2
+ - render_region :tbody do |tbody|
3
+ - tbody.name_cell do
4
+ %td.name{:style => "padding-left: #{9 + (24 * level)}px;"}
5
+ = link_to image('group', :alt => '') + ' ' + group.name, admin_group_url(group)
6
+ %br
7
+ %span.notes
8
+ = group.description
9
+ - tbody.home_cell do
10
+ %td.home
11
+ - if group.homepage
12
+ = link_to group.homepage.title, edit_admin_page_url(group.homepage)
13
+ - else
14
+ = t('reader_extension.none')
15
+ - tbody.members_cell do
16
+ %td.members
17
+ = group.readers.count
18
+ - tbody.pages_cell do
19
+ %td.pages
20
+ = group.pages.count
21
+ - tbody.modify_cell do
22
+ %td.actions
23
+ = link_to_unless_current image('plus') + ' ' + t('reader_extension.add_members'), new_admin_group_group_invitation_url(group), :class => 'action'
24
+ = link_to_unless_current image('plus') + ' ' + t('reader_extension.add_subgroup'), new_admin_group_url(:parent_id => group.id), :class => 'action'
25
+ = link_to_unless_current image('delta') + ' ' + t('reader_extension.edit_group'), edit_admin_group_url(group), :class => 'action'
26
+ = link_to_unless_current image('minus') + ' ' + t('reader_extension.delete_group'), admin_group_url(group), :method => 'delete', :confirm => t("reader_extension.really_delete_group", :name => group.name), :class => 'action'
27
+
28
+ = render :partial => 'group', :collection => group.children, :locals => {:level => level+1}
29
+
@@ -7,34 +7,8 @@
7
7
  %thead
8
8
  = render :partial => 'list_head'
9
9
  %tbody
10
- - @groups.each do |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
- = group.description
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('reader_extension.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('reader_extension.add_members'), new_admin_group_group_invitation_url(group), :class => 'action'
35
- = link_to_unless_current image('delta') + ' ' + t('reader_extension.edit_group'), edit_admin_group_url(group), :class => 'action'
36
- = link_to_unless_current image('minus') + ' ' + t('reader_extension.delete_group'), admin_group_url(group), :method => 'delete', :confirm => t("reader_extension.really_delete_group", :name => group.name), :class => 'action'
37
-
10
+ = render :partial => "group", :collection => @groups, :locals => {:level => 0}
11
+
38
12
  - render_region :bottom do |bottom|
39
13
  - bottom.buttons do
40
14
  #actions
@@ -1,3 +1,4 @@
1
+ - include_javascript 'admin/reader'
1
2
  - include_stylesheet 'admin/reader_group'
2
3
  - body_classes << "reversed"
3
4
 
@@ -40,7 +41,7 @@
40
41
  =t('reader_extension.private_pages').titlecase
41
42
  %ul
42
43
  - page = Page.respond_to?(:homepage) ? Page.homepage : Page.find_by_parent_id(nil)
43
- %div{:id => "page_holder_#{page.id}"}
44
+ %li{:id => "page_holder_#{page.id}"}
44
45
  = render :partial => 'admin/permissions/page', :object => page
45
46
 
46
47
  - main.members do
@@ -56,7 +57,7 @@
56
57
  - columns.each do |column|
57
58
  %ul.column
58
59
  - column.each do |reader|
59
- %div{:id => "reader_holder_#{reader.id}"}
60
+ %li{:id => "reader_holder_#{reader.id}"}
60
61
  = render :partial => 'admin/memberships/reader', :object => reader
61
62
 
62
63
  - render_region :footer do |footer|
@@ -1,9 +1,5 @@
1
1
  - reader ||= @reader
2
2
  - group ||= @group
3
+ - cssclass = reader.has_group?(group) ? "fake_checkbox checked" : "fake_checkbox unchecked"
3
4
 
4
- - if membership = group.membership_for(reader)
5
- %li{:class => "fake_checkbox checked", :id => "reader_#{reader.id}"}
6
- = link_to_remote reader.name, :url => admin_group_membership_url(group, membership), :method => 'delete', :loading => "$('reader_#{reader.id}').addClassName('waiting')", :update => "reader_holder_#{reader.id}"
7
- - else
8
- %li{:class => "fake_checkbox unchecked", :id => "reader_#{reader.id}"}
9
- = link_to_remote reader.name, :url => admin_group_memberships_url(group, :reader_id => reader.id), :loading => "$('reader_#{reader.id}').addClassName('waiting')", :update => "reader_holder_#{reader.id}"
5
+ = link_to reader.name, admin_toggle_group_membership_url(:group_id => group.id, :reader_id => reader.id), {:class => cssclass, :id => "toggle_reader_#{reader.id}"}
@@ -17,20 +17,20 @@
17
17
  = form.text_area :body, :class => 'textarea', :style => 'width: 100%'
18
18
 
19
19
  - formpart.edit_function do
20
- - if admin?
21
- %div.function.set
20
+ #message_function.set
21
+ - if admin?
22
22
  %p
23
23
  = form.label :function_id
24
24
  = form.select :function_id, MessageFunction.find_all.map { |mf| [t("message_functions.#{mf.name}"), mf.name] }, :include_blank => true
25
25
  %p
26
- = form.label :group_id
27
- = form.select :group_id, Group.all.map { |g| [g.name, g.id] }, :include_blank => true
28
-
29
- - elsif @message.new_record?
30
- - if @message.group
31
- = f.hidden_field :group_id
32
- - if @message.function
33
- = f.hidden_field :function_id
26
+ = form.label :group_ids
27
+ = render :partial => 'admin/groups/chooser', :locals => {:f => form}
28
+
29
+ - elsif @message.new_record?
30
+ - if @message.function
31
+ = f.hidden_field :function_id
32
+ - if @message.group_ids
33
+ = f.hidden_field :group_ids
34
34
 
35
35
  - render_region :form_bottom do |form_bottom|
36
36
  - form_bottom.edit_timestamp do
@@ -41,4 +41,3 @@
41
41
  = save_model_and_continue_editing_button(@message)
42
42
  = t('or')
43
43
  = link_to t("cancel"), @message.new_record? ? admin_messages_url : admin_message_url(@message)
44
-
@@ -1,7 +1,6 @@
1
1
  %span.function
2
2
  - if message.administrative?
3
3
  = message.function.description
4
- - if message.group
4
+ - if message.groups.any?
5
5
  = t('reader_extension.for')
6
- - if message.group
7
- = link_to message.group.name, admin_group_url(message.group)
6
+ = message.groups.collect { |group| link_to message.group.name, admin_group_url(message.group) }.join(', ')