biovision-post 0.26.191013.0 → 0.28.191126.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0df3d21cefcd77f482394c4b8f72245a2cb543e9963e993e22e9d010e9178228
4
- data.tar.gz: a74d55c6455fe9506305cabc57253a02098edf5003b5ee928356d38142b80f2c
3
+ metadata.gz: 4c0d863ab2108741c9a77e174dac0f5594b3ca41d966a286e74ffd1476239d58
4
+ data.tar.gz: 85c93cc74bc7b4f372a1f7bc6093f10ef38f8af7e8359eaa3a076481a7f765f4
5
5
  SHA512:
6
- metadata.gz: ed8a50e26c8181f9a9f5a1128652cc60bbf4f05d5eed30e5841142ac0f612e8f03d7a1691b3bbf8ea64f6fa636983d8045f6a8766d20db27086989a3518305d7
7
- data.tar.gz: 3e71cc4ac3149e09528cab8893407f0a866a7ac3b0762615d9821903671962f2a033f27a093500308770abf316179ccaf9989640f37c9ab8aa8c46264af8614b
6
+ metadata.gz: 683e5308e4e32a2f70d21095e8832480e676347c584c7040344138df02793126d18ec9856fd062b765be42fefd5d9743e311157f44710276fd8ddbb1f7939bfe
7
+ data.tar.gz: 200cfb8832309fa195a011356ee76b6261d9d8f3d97f293d654436b27ccca2494bc5fbd0bf745adc7f89e7b08f463c4d082893268f42556b4fb744faa08d003c
@@ -91,3 +91,11 @@
91
91
  padding-left: 1rem;
92
92
  }
93
93
  }
94
+
95
+ .biovision-post-type-flag {
96
+ &:not(:checked) {
97
+ ~ ul {
98
+ display: none;
99
+ }
100
+ }
101
+ }
@@ -13,6 +13,22 @@ class Admin::PostCategoriesController < AdminController
13
13
  @collection = @entity.posts.page_for_administration(current_page)
14
14
  end
15
15
 
16
+ # put /admin/post_categories/:id/users/:user_id
17
+ def add_user
18
+ component_handler.user = User.find_by(id: params[:user_id])
19
+ component_handler.allow_post_category(@entity)
20
+
21
+ head :no_content
22
+ end
23
+
24
+ # delete /admin/post_categories/:id/users/:user_id
25
+ def remove_user
26
+ component_handler.user = User.find_by(id: params[:user_id])
27
+ component_handler.disallow_post_category(@entity)
28
+
29
+ head :no_content
30
+ end
31
+
16
32
  private
17
33
 
18
34
  def component_slug
@@ -33,6 +33,26 @@ class Admin::PostTypesController < AdminController
33
33
  def new_post
34
34
  end
35
35
 
36
+ # put /admin/post_types/:id/users/:user_id
37
+ def add_user
38
+ if component_handler.allow?('chief_editor')
39
+ component_handler.user = User.find_by(id: params[:user_id])
40
+ component_handler.allow_post_type(@entity)
41
+ end
42
+
43
+ head :no_content
44
+ end
45
+
46
+ # delete /admin/post_types/:id/users/:user_id
47
+ def remove_user
48
+ if component_handler.allow?('chief_editor')
49
+ component_handler.user = User.find_by(id: params[:user_id])
50
+ component_handler.disallow_post_type(@entity)
51
+ end
52
+
53
+ head :no_content
54
+ end
55
+
36
56
  private
37
57
 
38
58
  def component_slug
@@ -30,6 +30,7 @@ class My::PostsController < ProfileController
30
30
  @entity = Post.new(creation_parameters)
31
31
  if component_handler.allow_post_type?(@entity.post_type) && @entity.save
32
32
  apply_post_tags
33
+ apply_post_categories
33
34
  form_processed_ok(my_post_path(id: @entity.id))
34
35
  else
35
36
  form_processed_with_error(:new)
@@ -48,6 +49,7 @@ class My::PostsController < ProfileController
48
49
  def update
49
50
  if @entity.update(entity_parameters)
50
51
  apply_post_tags
52
+ apply_post_categories
51
53
  form_processed_ok(my_post_path(id: @entity.id))
52
54
  else
53
55
  form_processed_with_error(:edit)
@@ -118,4 +120,12 @@ class My::PostsController < ProfileController
118
120
  def apply_post_tags
119
121
  @entity.tags_string = param_from_request(:tags_string)
120
122
  end
123
+
124
+ def apply_post_categories
125
+ if params.key?(:post_category_ids)
126
+ @entity.post_category_ids = Array(params[:post_category_ids])
127
+ else
128
+ @entity.post_post_categories.destroy_all
129
+ end
130
+ end
121
131
  end
@@ -39,11 +39,63 @@ module Biovision
39
39
  return true if user.super_user?
40
40
  return true if group?(:chief)
41
41
 
42
- criteria = {
43
- editorial_member: EditorialMember[user],
44
- post_type: type.is_a?(PostType) ? type : PostType[type]
45
- }
46
- EditorialMemberPostType.where(criteria).exists?
42
+ entity = type.is_a?(PostType) ? type : PostType[type]
43
+
44
+ types = Array(user_link!.data.dig('settings', 'types'))
45
+ types.include?(entity.slug)
46
+ end
47
+
48
+ # @param [PostCategory|Integer] entity
49
+ def allow_post_category?(entity)
50
+ return false if user.nil?
51
+ return true if user.super_user?
52
+ return true if group?(:chief)
53
+
54
+ ids = Array(user_link!.data.dig('settings', 'categories'))
55
+ ids.map(&:to_i).include?(entity.respond_to?(:id) ? entity.id : entity)
56
+ end
57
+
58
+ # @param [PostType] entity
59
+ def allow_post_type(entity)
60
+ return if user.nil?
61
+
62
+ link = user_link!
63
+ prepare_link_settings!(link)
64
+ link.data['settings']['types'] += [entity.slug]
65
+ link.data['settings']['types'].uniq!
66
+ link.save
67
+ end
68
+
69
+ # @param [PostType] entity
70
+ def disallow_post_type(entity)
71
+ return if user.nil?
72
+
73
+ link = user_link!
74
+ prepare_link_settings!(link)
75
+ link.data['settings']['types'] -= [entity.slug]
76
+ link.save
77
+ end
78
+
79
+ # @param [PostCategory] entity
80
+ def allow_post_category(entity)
81
+ return if user.nil?
82
+
83
+ link = user_link!
84
+ prepare_link_settings!(link)
85
+ ids = link.data['settings']['categories'] + entity.subbranch_ids
86
+ link.data['settings']['categories'] = ids.map(&:to_i).uniq
87
+ link.save
88
+ end
89
+
90
+ # @param [PostCategory] entity
91
+ def disallow_post_category(entity)
92
+ return if user.nil?
93
+
94
+ link = user_link!
95
+ prepare_link_settings!(link)
96
+ categories = link.data['settings']['categories'].map(&:to_i)
97
+ link.data['settings']['categories'] = categories - [entity.id]
98
+ link.save
47
99
  end
48
100
 
49
101
  def editable?(entity)
@@ -60,6 +112,13 @@ module Biovision
60
112
  "/my/posts/#{entity.id}/edit"
61
113
  end
62
114
  end
115
+
116
+ # @param [BiovisionComponentUser] link
117
+ def prepare_link_settings!(link)
118
+ link.data['settings'] ||= {}
119
+ link.data['settings']['types'] ||= []
120
+ link.data['settings']['categories'] ||= []
121
+ end
63
122
  end
64
123
  end
65
124
  end
@@ -0,0 +1,43 @@
1
+ <h4><%= t('.heading') %></h4>
2
+
3
+ <ul class="user-post-types entity-links">
4
+ <% PostType.list_for_administration.each do |post_type| %>
5
+ <li>
6
+ <% element_id = "post_type_user_#{post_type.id}" %>
7
+ <%=
8
+ check_box_tag(
9
+ 'user_post_type',
10
+ post_type.id,
11
+ handler.allow_post_type?(post_type),
12
+ class: 'biovision-post-type-flag',
13
+ data: {
14
+ url: user_admin_post_type_path(
15
+ id: post_type.id,
16
+ user_id: handler.user.id
17
+ )
18
+ },
19
+ id: element_id
20
+ )
21
+ %>
22
+ <%=
23
+ label_tag(
24
+ element_id,
25
+ post_type.name
26
+ )
27
+ %>
28
+ <% categories = PostCategory.list_for_tree(post_type.id) %>
29
+ <% if categories.any? %>
30
+ <%=
31
+ render(
32
+ partial: 'admin/components/user_settings/posts/post_categories',
33
+ locals: {
34
+ categories: categories,
35
+ collection: categories.select { |_, i| i[:parent_id].nil? },
36
+ handler: handler
37
+ }
38
+ )
39
+ %>
40
+ <% end %>
41
+ </li>
42
+ <% end %>
43
+ </ul>
@@ -0,0 +1,38 @@
1
+ <% if collection.any? %>
2
+ <ul class="post-category-tree">
3
+ <% collection.each do |category_id, item| %>
4
+ <li>
5
+ <% element_id = "post_category_#{category_id}" %>
6
+ <%=
7
+ check_box_tag(
8
+ "post_category_ids[]",
9
+ category_id,
10
+ handler.allow_post_category?(item[:item]),
11
+ data: {
12
+ url: user_admin_post_category_path(
13
+ id: category_id,
14
+ user_id: handler.user.id
15
+ )
16
+ },
17
+ id: element_id
18
+ )
19
+ %>
20
+ <%= label_tag element_id, item[:item].name %>
21
+ <% collection.delete(category_id) %>
22
+ <% children = categories.select { |_, i| i[:parent_id] == category_id } %>
23
+ <% if children.any? %>
24
+ <%=
25
+ render(
26
+ partial: 'admin/components/user_settings/posts/post_categories',
27
+ locals: {
28
+ categories: categories,
29
+ collection: children,
30
+ handler: handler
31
+ }
32
+ )
33
+ %>
34
+ <% end %>
35
+ </li>
36
+ <% end %>
37
+ </ul>
38
+ <% end %>
@@ -31,7 +31,9 @@
31
31
  <% unless @entity.about.blank? %>
32
32
  <dt><%= t('activerecord.attributes.editorial_member.about') %></dt>
33
33
  <dd>
34
- <%= raw(@entity.about) %>
34
+ <div class="text">
35
+ <%= raw(@entity.about) %>
36
+ </div>
35
37
  </dd>
36
38
  <% end %>
37
39
  </dl>
@@ -45,28 +47,4 @@
45
47
  }
46
48
  )
47
49
  %>
48
-
49
- <section>
50
- <h2><%= t('.post_types') %></h2>
51
-
52
- <ul class="entity-links">
53
- <% PostType.list_for_administration.each do |post_type| %>
54
- <li>
55
- <% entity_id = "post_type_#{post_type.id}" %>
56
- <%=
57
- check_box_tag(
58
- "post_types[#{post_type.id}]",
59
- post_type.id,
60
- @entity.post_type?(post_type),
61
- id: entity_id,
62
- data: {
63
- url: post_type_admin_editorial_member_path(id: @entity.id, post_type_id: post_type.id)
64
- }
65
- )
66
- %>
67
- <%= label_tag(entity_id, post_type.name) %>
68
- </li>
69
- <% end %>
70
- </ul>
71
- </section>
72
50
  </article>
@@ -54,7 +54,15 @@
54
54
  <%= render partial: 'admin/posts/filter' %>
55
55
 
56
56
  <%= paginate @collection %>
57
- <%= render partial: 'shared/admin/list', locals: { collection: @collection } %>
57
+ <%=
58
+ render(
59
+ partial: 'shared/admin/list',
60
+ locals: {
61
+ collection: @collection,
62
+ handler: component_handler
63
+ }
64
+ )
65
+ %>
58
66
  <%= paginate @collection %>
59
67
  </section>
60
68
  </article>
@@ -14,6 +14,14 @@
14
14
  <%= render partial: 'admin/posts/filter' %>
15
15
 
16
16
  <%= paginate @collection %>
17
- <%= render partial: 'shared/admin/list', locals: { collection: @collection } %>
17
+ <%=
18
+ render(
19
+ partial: 'shared/admin/list',
20
+ locals: {
21
+ collection: @collection,
22
+ handler: component_handler
23
+ }
24
+ )
25
+ %>
18
26
  <%= paginate @collection %>
19
27
  </article>
@@ -75,27 +75,6 @@
75
75
  <%= render partial: 'shared/forms/entity_flags', locals: { f: f } %>
76
76
  </dl>
77
77
 
78
- <section>
79
- <h2><%= t('.post_types') %></h2>
80
-
81
- <ul class="flags">
82
- <% PostType.list_for_administration.each do |post_type| %>
83
- <li>
84
- <% field_id = "post_type_#{post_type.id}" %>
85
- <%=
86
- check_box_tag(
87
- 'post_type_ids[]',
88
- post_type.id,
89
- entity.post_type?(post_type),
90
- id: field_id
91
- )
92
- %>
93
- <%= label_tag(field_id, post_type.name) %>
94
- </li>
95
- <% end %>
96
- </ul>
97
- </section>
98
-
99
78
  <%= render 'shared/forms/state_container' %>
100
79
 
101
80
  <div class="buttons">
@@ -1,4 +1,7 @@
1
- <% model_name = entity.class.to_s.underscore %>
1
+ <%
2
+ handler ||= Biovision::Components::BaseComponent.handler('post', current_user)
3
+ model_name = entity.class.to_s.underscore
4
+ %>
2
5
  <%=
3
6
  form_with(
4
7
  model: entity,
@@ -11,184 +14,209 @@
11
14
  <%= render partial: 'shared/list_of_errors', locals: { entity: entity } %>
12
15
 
13
16
  <dl>
14
- <dt><%= f.label :publication_time %></dt>
15
- <dd>
16
- <%=
17
- f.datetime_local_field(
18
- :publication_time,
19
- id: "#{model_name}_publication_time",
20
- required: true
21
- )
22
- %>
23
- </dd>
17
+ <div>
18
+ <dt><%= f.label :publication_time %></dt>
19
+ <dd>
20
+ <%=
21
+ f.datetime_local_field(
22
+ :publication_time,
23
+ id: "#{model_name}_publication_time",
24
+ required: true
25
+ )
26
+ %>
27
+ </dd>
28
+ </div>
24
29
 
25
- <dt><%= f.label :title %></dt>
26
- <dd>
27
- <%=
28
- f.text_field(
29
- :title,
30
- id: "#{model_name}_title",
31
- size: nil,
32
- maxlength: Post::TITLE_LIMIT,
33
- required: true,
34
- data: { transliterate: "#{model_name}_slug" }
35
- )
36
- %>
37
- <div class="guideline"><%= t('posts.form.guidelines.title') %></div>
38
- </dd>
30
+ <div>
31
+ <dt><%= f.label :title %></dt>
32
+ <dd>
33
+ <%=
34
+ f.text_field(
35
+ :title,
36
+ id: "#{model_name}_title",
37
+ size: nil,
38
+ maxlength: Post::TITLE_LIMIT,
39
+ required: true,
40
+ data: { transliterate: "#{model_name}_slug" }
41
+ )
42
+ %>
43
+ <div class="guideline"><%= t('posts.form.guidelines.title') %></div>
44
+ </dd>
45
+ </div>
39
46
 
40
47
  <% categories = PostCategory.list_for_tree(entity.post_type_id) %>
41
48
  <% if categories.any? %>
42
- <dt><label><%= t('.categories') %></label></dt>
49
+ <div>
50
+ <dt><label><%= t('.categories') %></label></dt>
51
+ <dd>
52
+ <%=
53
+ render(
54
+ partial: 'posts/form/category_links',
55
+ locals: {
56
+ categories: categories,
57
+ collection: categories.select { |_, i| i[:parent_id].nil? },
58
+ entity: entity,
59
+ handler: handler
60
+ }
61
+ )
62
+ %>
63
+ </dd>
64
+ </div>
65
+ <% end %>
66
+
67
+ <div>
68
+ <dt><%= f.label :lead %></dt>
43
69
  <dd>
44
70
  <%=
45
- render(
46
- partial: 'posts/form/category_links',
47
- locals: {
48
- entity: entity,
49
- collection: categories.select { |_, i| i[:parent_id].nil? },
50
- categories: categories
51
- }
71
+ f.text_area(
72
+ :lead,
73
+ id: "#{model_name}_lead",
74
+ cols: 80,
75
+ rows: 3,
76
+ maxlength: Post::LEAD_LIMIT
52
77
  )
53
78
  %>
79
+ <div class="guideline"><%= t('posts.form.guidelines.lead') %></div>
54
80
  </dd>
55
- <% end %>
56
-
57
- <dt><%= f.label :lead %></dt>
58
- <dd>
59
- <%=
60
- f.text_area(
61
- :lead,
62
- id: "#{model_name}_lead",
63
- cols: 80,
64
- rows: 3,
65
- maxlength: Post::LEAD_LIMIT
66
- )
67
- %>
68
- <div class="guideline"><%= t('posts.form.guidelines.lead') %></div>
69
- </dd>
81
+ </div>
70
82
 
71
- <dt><%= f.label :body %></dt>
72
- <dd>
73
- <%=
74
- f.text_area(
75
- :body,
76
- id: "#{model_name}_body",
77
- cols: 20,
78
- rows: 25,
79
- required: true,
80
- data: {
81
- wysiwyg: 1
82
- }
83
- )
84
- %>
85
- </dd>
83
+ <div>
84
+ <dt><%= f.label :body %></dt>
85
+ <dd>
86
+ <%=
87
+ f.text_area(
88
+ :body,
89
+ id: "#{model_name}_body",
90
+ cols: 20,
91
+ rows: 25,
92
+ required: true,
93
+ data: {
94
+ wysiwyg: 1
95
+ }
96
+ )
97
+ %>
98
+ </dd>
99
+ </div>
86
100
 
87
- <dt><%= f.label :image %></dt>
88
- <dd>
89
- <% figure_id = "#{model_name}-image" %>
90
- <figure role="group" class="preview" id="<%= figure_id %>">
91
- <% if entity.image.blank? %>
92
- <%= f.label :image, image_tag('biovision/base/placeholders/3x2.svg') %>
93
- <% else %>
94
- <%= f.label :image, image_tag(entity.image.big.url) %>
95
- <% end %>
96
- <figcaption>
97
- <%=
98
- f.file_field(
99
- :image,
100
- accept: 'image/jpeg,image/png',
101
- data: { image: figure_id },
102
- id: "#{model_name}_image"
103
- )
104
- %>
105
- </figcaption>
106
- </figure>
107
- <div class="guideline"><%= t('posts.form.guidelines.image') %></div>
108
- </dd>
101
+ <div>
102
+ <dt><%= f.label :image %></dt>
103
+ <dd>
104
+ <% figure_id = "#{model_name}-image" %>
105
+ <figure role="group" class="preview" id="<%= figure_id %>">
106
+ <% if entity.image.blank? %>
107
+ <%= f.label :image, image_tag('biovision/base/placeholders/3x2.svg') %>
108
+ <% else %>
109
+ <%= f.label :image, image_tag(entity.image.big.url) %>
110
+ <% end %>
111
+ <figcaption>
112
+ <%=
113
+ f.file_field(
114
+ :image,
115
+ accept: 'image/jpeg,image/png',
116
+ data: { image: figure_id },
117
+ id: "#{model_name}_image"
118
+ )
119
+ %>
120
+ </figcaption>
121
+ </figure>
122
+ <div class="guideline"><%= t('posts.form.guidelines.image') %></div>
123
+ </dd>
124
+ </div>
109
125
 
110
- <dt><%= f.label :image_alt_text %></dt>
111
- <dd>
112
- <%=
113
- f.text_field(
114
- :image_alt_text,
115
- id: "#{model_name}_image_alt_text",
116
- size: nil,
117
- maxlength: Post::META_LIMIT
118
- )
119
- %>
120
- <div class="guideline"><%= t('posts.form.guidelines.image_alt_text') %></div>
121
- </dd>
126
+ <div>
127
+ <dt><%= f.label :image_alt_text %></dt>
128
+ <dd>
129
+ <%=
130
+ f.text_field(
131
+ :image_alt_text,
132
+ id: "#{model_name}_image_alt_text",
133
+ size: nil,
134
+ maxlength: Post::META_LIMIT
135
+ )
136
+ %>
137
+ <div class="guideline"><%= t('posts.form.guidelines.image_alt_text') %></div>
138
+ </dd>
139
+ </div>
122
140
 
123
- <dt><%= f.label :image_name %></dt>
124
- <dd>
125
- <%=
126
- f.text_field(
127
- :image_name,
128
- id: "#{model_name}_image_name",
129
- size: nil,
130
- maxlength: Post::IMAGE_NAME_LIMIT
131
- )
132
- %>
133
- <div class="guideline"><%= t('posts.form.guidelines.image_name') %></div>
134
- </dd>
141
+ <div>
142
+ <dt><%= f.label :image_name %></dt>
143
+ <dd>
144
+ <%=
145
+ f.text_field(
146
+ :image_name,
147
+ id: "#{model_name}_image_name",
148
+ size: nil,
149
+ maxlength: Post::IMAGE_NAME_LIMIT
150
+ )
151
+ %>
152
+ <div class="guideline"><%= t('posts.form.guidelines.image_name') %></div>
153
+ </dd>
154
+ </div>
135
155
 
136
- <dt><%= f.label :image_source_name %></dt>
137
- <dd>
138
- <%=
139
- f.text_field(
140
- :image_source_name,
141
- id: "#{model_name}_image_source_name",
142
- size: nil,
143
- maxlength: Post::META_LIMIT
144
- )
145
- %>
146
- <div class="guideline"><%= t('posts.form.guidelines.image_source_name') %></div>
147
- </dd>
156
+ <div>
157
+ <dt><%= f.label :image_source_name %></dt>
158
+ <dd>
159
+ <%=
160
+ f.text_field(
161
+ :image_source_name,
162
+ id: "#{model_name}_image_source_name",
163
+ size: nil,
164
+ maxlength: Post::META_LIMIT
165
+ )
166
+ %>
167
+ <div class="guideline"><%= t('posts.form.guidelines.image_source_name') %></div>
168
+ </dd>
169
+ </div>
148
170
 
149
- <dt><%= f.label :image_source_link %></dt>
150
- <dd>
151
- <%=
152
- f.url_field(
153
- :image_source_link,
154
- id: "#{model_name}_image_source_link",
155
- size: nil,
156
- maxlength: Post::META_LIMIT,
157
- placeholder: t('posts.form.placeholders.image_source_link')
158
- )
159
- %>
160
- <div class="guideline"><%= t('posts.form.guidelines.image_source_link') %></div>
161
- </dd>
171
+ <div>
172
+ <dt><%= f.label :image_source_link %></dt>
173
+ <dd>
174
+ <%=
175
+ f.url_field(
176
+ :image_source_link,
177
+ id: "#{model_name}_image_source_link",
178
+ size: nil,
179
+ maxlength: Post::META_LIMIT,
180
+ placeholder: t('posts.form.placeholders.image_source_link')
181
+ )
182
+ %>
183
+ <div class="guideline"><%= t('posts.form.guidelines.image_source_link') %></div>
184
+ </dd>
185
+ </div>
162
186
 
163
- <dt><%= f.label :source_link %></dt>
164
- <dd>
165
- <%=
166
- f.url_field(
167
- :source_link,
168
- id: "#{model_name}_source_link",
169
- size: nil,
170
- maxlength: Post::META_LIMIT,
171
- placeholder: t('posts.form.placeholders.source_link')
172
- )
173
- %>
174
- <div class="guideline"><%= t('posts.form.guidelines.source_link') %></div>
175
- </dd>
187
+ <div>
188
+ <dt><%= f.label :source_link %></dt>
189
+ <dd>
190
+ <%=
191
+ f.url_field(
192
+ :source_link,
193
+ id: "#{model_name}_source_link",
194
+ size: nil,
195
+ maxlength: Post::META_LIMIT,
196
+ placeholder: t('posts.form.placeholders.source_link')
197
+ )
198
+ %>
199
+ <div class="guideline"><%= t('posts.form.guidelines.source_link') %></div>
200
+ </dd>
201
+ </div>
176
202
 
177
- <dt><%= t(:flags) %></dt>
178
- <dd>
179
- <ul class="flags">
180
- <li>
181
- <%= f.check_box :visible, id: "#{model_name}_visible" %>
182
- <%= f.label :visible %>
183
- </li>
184
- <% if Gem.loaded_specs.key?('biovision-comment') %>
203
+ <div>
204
+ <dt><%= t(:flags) %></dt>
205
+ <dd>
206
+ <ul class="flags">
185
207
  <li>
186
- <%= f.check_box :allow_comments, id: :post_allow_comments %>
187
- <%= f.label :allow_comments %>
208
+ <%= f.check_box :visible, id: "#{model_name}_visible" %>
209
+ <%= f.label :visible %>
188
210
  </li>
189
- <% end %>
190
- </ul>
191
- </dd>
211
+ <% if Gem.loaded_specs.key?('biovision-comment') %>
212
+ <li>
213
+ <%= f.check_box :allow_comments, id: :post_allow_comments %>
214
+ <%= f.label :allow_comments %>
215
+ </li>
216
+ <% end %>
217
+ </ul>
218
+ </dd>
219
+ </div>
192
220
  </dl>
193
221
 
194
222
  <%= render 'shared/forms/state_container' %>