biovision-post 0.26.191013.0 → 0.28.191126.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -2,7 +2,7 @@ json.data collection do |entity|
2
2
  json.id entity.id
3
3
  json.type entity.class.table_name
4
4
  json.attributes do
5
- json.call(entity, :title, :lead, :post_category_id)
5
+ json.call(entity, :title, :lead)
6
6
  end
7
7
  json.meta do
8
8
  json.html_preview render(partial: 'posts/preview', formats: [:html], locals: { entity: entity })
@@ -2,13 +2,17 @@
2
2
  <ul class="post-category-tree">
3
3
  <% collection.each do |category_id, item| %>
4
4
  <li>
5
- <% element_id = "post_category_#{category_id}" %>
5
+ <%
6
+ element_id = "post_category_#{category_id}"
7
+ allowed = handler.allow_post_category?(category_id)
8
+ %>
6
9
  <%=
7
10
  check_box_tag(
8
11
  "post_category_ids[]",
9
12
  category_id,
10
13
  item[:item].post?(entity),
11
- id: element_id
14
+ id: element_id,
15
+ disabled: !allowed
12
16
  )
13
17
  %>
14
18
  <%= label_tag element_id, item[:item].name %>
@@ -19,9 +23,10 @@
19
23
  render(
20
24
  partial: 'posts/form/category_links',
21
25
  locals: {
22
- entity: entity,
26
+ categories: categories,
23
27
  collection: children,
24
- categories: categories
28
+ entity: entity,
29
+ handler: handler
25
30
  }
26
31
  )
27
32
  %>
@@ -304,6 +304,10 @@ ru:
304
304
  entity:
305
305
  in_list:
306
306
  post_categories: "Категории публикаций"
307
+ components:
308
+ user_settings:
309
+ posts:
310
+ heading: "Разрешённые типы и категории"
307
311
  biovision:
308
312
  components:
309
313
  posts:
@@ -91,10 +91,17 @@ Rails.application.routes.draw do
91
91
  get :new_post
92
92
  get :post_tags
93
93
  get :authors
94
+ put 'users/:user_id' => :add_user, as: :user
95
+ delete 'users/:user_id' => :remove_user
94
96
  end
95
97
  end
96
98
 
97
- resources :post_categories, only: :show, concerns: %i[toggle priority]
99
+ resources :post_categories, only: :show, concerns: %i[toggle priority] do
100
+ member do
101
+ put 'users/:user_id' => :add_user, as: :user
102
+ delete 'users/:user_id' => :remove_user
103
+ end
104
+ end
98
105
 
99
106
  resources :posts, only: %i[index show], concerns: %i[lock toggle] do
100
107
  get 'search', on: :collection
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Convert editorial_member_post_types to component settings
4
+ class ConvertEditorialPrivileges < ActiveRecord::Migration[5.2]
5
+ def up
6
+ slug = Biovision::Components::PostsComponent::SLUG
7
+ handler = Biovision::Components::BaseComponent.handler(slug)
8
+ EditorialMemberPostType.order('id asc').each do |link|
9
+ handler.user = link.editorial_member.user
10
+ handler.allow_post_type(link.post_type)
11
+ end
12
+ end
13
+
14
+ def down
15
+ # No rollback needed
16
+ end
17
+ end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Biovision
4
4
  module Post
5
- VERSION = '0.26.191013.0'
5
+ VERSION = '0.28.191126.0'
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: biovision-post
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.26.191013.0
4
+ version: 0.28.191126.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Maxim Khan-Magomedov
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-10-13 00:00:00.000000000 Z
11
+ date: 2019-11-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -190,6 +190,8 @@ files:
190
190
  - app/services/post_parser.rb
191
191
  - app/uploaders/post_image_uploader.rb
192
192
  - app/views/admin/components/links/_posts.html.erb
193
+ - app/views/admin/components/user_settings/_posts.html.erb
194
+ - app/views/admin/components/user_settings/posts/_post_categories.html.erb
193
195
  - app/views/admin/editorial_members/_nav_item.html.erb
194
196
  - app/views/admin/editorial_members/entity/_in_list.html.erb
195
197
  - app/views/admin/editorial_members/index.html.erb
@@ -357,6 +359,7 @@ files:
357
359
  - db/migrate/20190801161616_add_posts_component.rb
358
360
  - db/migrate/20190822121212_create_post_attachments.rb
359
361
  - db/migrate/20190914212121_convert_post_privileges.rb
362
+ - db/migrate/20191124232323_convert_editorial_privileges.rb
360
363
  - lib/biovision/post.rb
361
364
  - lib/biovision/post/engine.rb
362
365
  - lib/biovision/post/version.rb