biovision-post 0.1.180127 → 0.2.180325
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/articles_controller.rb +2 -2
- data/app/controllers/blog_posts_controller.rb +2 -2
- data/app/controllers/news_controller.rb +2 -2
- data/app/controllers/post_categories_controller.rb +4 -4
- data/app/controllers/posts_controller.rb +5 -15
- data/app/helpers/biovision_posts_helper.rb +4 -4
- data/app/models/concerns/post_child_with_priority.rb +49 -0
- data/app/models/post.rb +21 -15
- data/app/models/post_link.rb +15 -0
- data/app/models/post_note.rb +16 -0
- data/app/models/post_reference.rb +19 -0
- data/app/models/post_type.rb +3 -1
- data/app/services/post_manager.rb +9 -6
- data/app/services/post_manager/article_handler.rb +2 -2
- data/app/services/post_manager/blog_post_handler.rb +2 -2
- data/app/services/post_manager/news_handler.rb +2 -2
- data/app/views/admin/index/dashboard/_biovision_post.html.erb +1 -1
- data/app/views/admin/post_categories/entity/_in_list.html.erb +3 -3
- data/app/views/admin/post_categories/show.html.erb +3 -3
- data/app/views/admin/post_types/entity/_in_list.html.erb +1 -1
- data/app/views/admin/post_types/new_post.html.erb +1 -1
- data/app/views/admin/post_types/show.html.erb +2 -2
- data/app/views/admin/posts/entity/_in_list.html.erb +17 -3
- data/app/views/admin/posts/show.html.erb +4 -2
- data/app/views/articles/category.html.erb +1 -1
- data/app/views/blog_posts/category.html.erb +1 -1
- data/app/views/index/dashboard/_biovision_post.html.erb +5 -0
- data/app/views/news/category.html.erb +1 -1
- data/app/views/post_categories/edit.html.erb +1 -1
- data/app/views/posts/_form.html.erb +160 -22
- data/app/views/posts/_post.html.erb +1 -1
- data/app/views/posts/edit.html.erb +1 -1
- data/app/views/posts/entity/_metadata.html.erb +10 -6
- data/config/locales/posts-en.yml +4 -3
- data/config/locales/posts-ru.yml +3 -2
- data/config/routes.rb +39 -35
- data/db/migrate/20170930000001_create_post_types.rb +1 -0
- data/db/migrate/20170930000003_create_posts.rb +2 -0
- data/db/migrate/20171218111111_add_meta_fields_to_posts.rb +1 -1
- data/db/migrate/20171219111112_add_author_fields_to_posts.rb +1 -1
- data/db/migrate/20180124111113_add_language_to_posts.rb +1 -1
- data/db/migrate/20180318215555_add_active_to_post_types.rb +11 -0
- data/db/migrate/20180321100000_create_post_references.rb +21 -0
- data/db/migrate/20180321100001_create_post_notes.rb +18 -0
- data/db/migrate/20180321100002_create_post_links.rb +20 -0
- data/lib/biovision/post/engine.rb +2 -3
- data/lib/biovision/post/version.rb +1 -1
- metadata +11 -6
- data/app/views/index/index/_recent_posts.html.erb +0 -5
- data/app/views/posts/edit.js.erb +0 -1
- data/app/views/posts/form/_wysiwyg.html.erb +0 -14
- data/app/views/posts/new.js.erb +0 -1
@@ -4,7 +4,7 @@
|
|
4
4
|
<% if post.editable_by? current_user %>
|
5
5
|
<ul class="actions">
|
6
6
|
<% if UserPrivilege.user_in_group?(current_user, :editors) %>
|
7
|
-
<li><%= gear_icon(admin_post_path(post.id)) %></li>
|
7
|
+
<li><%= gear_icon(admin_post_path(id: post.id)) %></li>
|
8
8
|
<% end %>
|
9
9
|
<% unless post.locked? %>
|
10
10
|
<li><%= edit_icon(handler.edit_path) %></li>
|
@@ -1,12 +1,16 @@
|
|
1
1
|
<% content_for :meta_description, (entity.meta_description.blank? ? entity.lead : entity.meta_description) %>
|
2
2
|
<% content_for :meta_type, 'article' %>
|
3
3
|
<% content_for :meta_type_extension do %>
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
4
|
+
<meta property="og:article:published_time" content="<%= entity.created_at.strftime('%Y-%m-%d') %>"/>
|
5
|
+
<meta property="og:article:modified_time" content="<%= entity.updated_at.strftime('%Y-%m-%d') %>"/>
|
6
|
+
<% if entity.show_owner? %>
|
7
|
+
<meta property="og:article:author" content="<%= entity.user.screen_name %>"/>
|
8
|
+
<% end %>
|
9
9
|
<% end %>
|
10
10
|
<% content_for :meta_image, (request.protocol + request.host_with_port + entity.image.url) unless entity.image.blank? %>
|
11
|
-
<%
|
11
|
+
<% if entity.meta_title.blank? %>
|
12
|
+
<% content_for :meta_title, entity.title %>
|
13
|
+
<% else %>
|
14
|
+
<% content_for :meta_title, entity.meta_title %>
|
15
|
+
<% end %>
|
12
16
|
<% content_for :meta_keywords, entity.meta_keywords unless entity.meta_keywords.blank? %>
|
data/config/locales/posts-en.yml
CHANGED
@@ -132,11 +132,12 @@ en:
|
|
132
132
|
author_name: "If specified, shown instead of current user"
|
133
133
|
author_title: "For example, occupation of status"
|
134
134
|
author_url: "If specified, author name will link here"
|
135
|
-
image: "Maximum dimensions
|
135
|
+
image: "Maximum dimensions are 3000×3000, format — JPG or PNG."
|
136
136
|
image_alt_text: "Brief description of image. Maximum 200 chars."
|
137
137
|
image_author_link: "Will be opened when one clicks on author name."
|
138
138
|
image_author_name: "Person or organization name. Will be shown near image."
|
139
139
|
image_name: "Will be shown as image caption."
|
140
|
+
language_id: "Language"
|
140
141
|
lead: "Post essence, maximum 350 chars."
|
141
142
|
meta_description: "50–55 words. Maximum 250 chars"
|
142
143
|
meta_keywords: "Maximum 250 chars."
|
@@ -151,8 +152,8 @@ en:
|
|
151
152
|
post:
|
152
153
|
source: "Source"
|
153
154
|
index:
|
154
|
-
|
155
|
-
|
155
|
+
dashboard:
|
156
|
+
biovision_post:
|
156
157
|
heading: "Recent posts"
|
157
158
|
articles:
|
158
159
|
index:
|
data/config/locales/posts-ru.yml
CHANGED
@@ -137,6 +137,7 @@ ru:
|
|
137
137
|
image_author_link: "Будет открываться при нажатии на имя автора картинки."
|
138
138
|
image_author_name: "ФИО или название организации. Будет отображаться в подписи к картинке."
|
139
139
|
image_name: "Будет отображаться в качестве подписи к картинке."
|
140
|
+
language_id: "Язык"
|
140
141
|
lead: "Краткая суть, максимум 350 символов."
|
141
142
|
meta_description: "50–55 слов. Максимум 250 символов."
|
142
143
|
meta_keywords: "Максимум 250 символов."
|
@@ -151,8 +152,8 @@ ru:
|
|
151
152
|
post:
|
152
153
|
source: "Источник"
|
153
154
|
index:
|
154
|
-
|
155
|
-
|
155
|
+
dashboard:
|
156
|
+
biovision_post:
|
156
157
|
heading: "Недавние публикации"
|
157
158
|
articles:
|
158
159
|
index:
|
data/config/routes.rb
CHANGED
@@ -2,47 +2,51 @@ Rails.application.routes.draw do
|
|
2
2
|
category_slug_pattern = /[a-z]+[-_0-9a-z]*[0-9a-z]/
|
3
3
|
post_slug_pattern = /[a-z0-9]+[-_.a-z0-9]*[a-z0-9]+/
|
4
4
|
|
5
|
-
resources :post_categories,
|
6
|
-
resources :posts, except: [:new]
|
5
|
+
resources :post_categories, :posts, only: [:update, :destroy]
|
7
6
|
|
8
|
-
scope :
|
9
|
-
|
10
|
-
|
11
|
-
get '/:post_id-:post_slug' => :show, as: :show_article, constraints: { post_id: /\d+/, post_slug: post_slug_pattern }
|
12
|
-
end
|
7
|
+
scope '/(:locale)', constraints: { locale: /[a-z]{2}/ } do
|
8
|
+
resources :post_categories, except: [:index, :show, :update, :destroy]
|
9
|
+
resources :posts, except: [:new, :update, :destroy]
|
13
10
|
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
11
|
+
scope :articles, controller: :articles do
|
12
|
+
get '/' => :index, as: :articles
|
13
|
+
get '/:category_slug' => :category, as: :articles_category, constraints: { category_slug: category_slug_pattern }
|
14
|
+
get '/:post_id-:post_slug' => :show, as: :show_article, constraints: { post_id: /\d+/, post_slug: post_slug_pattern }
|
15
|
+
end
|
19
16
|
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
17
|
+
scope :news, controller: :news do
|
18
|
+
get '/' => :index, as: :news_index
|
19
|
+
get '/:category_slug' => :category, as: :news_category, constraints: { category_slug: category_slug_pattern }
|
20
|
+
get '/:post_id-:post_slug' => :show, as: :show_news, constraints: { post_id: /\d+/, post_slug: post_slug_pattern }
|
21
|
+
end
|
25
22
|
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
get :new_post
|
31
|
-
end
|
23
|
+
scope :blog_posts, controller: :blog_posts do
|
24
|
+
get '/' => :index, as: :blog_posts
|
25
|
+
get '/:category_slug' => :category, as: :blog_posts_category, constraints: { category_slug: category_slug_pattern }
|
26
|
+
get '/:post_id-:post_slug' => :show, as: :show_blog_post, constraints: { post_id: /\d+/, post_slug: post_slug_pattern }
|
32
27
|
end
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
28
|
+
|
29
|
+
namespace :admin do
|
30
|
+
resources :post_types, only: [:index, :show] do
|
31
|
+
member do
|
32
|
+
get :post_categories
|
33
|
+
get :new_post
|
34
|
+
end
|
39
35
|
end
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
36
|
+
resources :post_categories, only: [:show] do
|
37
|
+
member do
|
38
|
+
put 'lock', defaults: { format: :json }
|
39
|
+
delete 'lock', action: :unlock, defaults: { format: :json }
|
40
|
+
post 'priority', defaults: { format: :json }
|
41
|
+
post 'toggle', defaults: { format: :json }
|
42
|
+
end
|
43
|
+
end
|
44
|
+
resources :posts, only: [:index, :show] do
|
45
|
+
member do
|
46
|
+
put 'lock', defaults: { format: :json }
|
47
|
+
delete 'lock', action: :unlock, defaults: { format: :json }
|
48
|
+
post 'toggle', defaults: { format: :json }
|
49
|
+
end
|
46
50
|
end
|
47
51
|
end
|
48
52
|
end
|
@@ -3,6 +3,7 @@ class CreatePostTypes < ActiveRecord::Migration[5.1]
|
|
3
3
|
unless PostType.table_exists?
|
4
4
|
create_table :post_types do |t|
|
5
5
|
t.timestamps
|
6
|
+
t.boolean :active, default: true, null: false
|
6
7
|
t.integer :posts_count, default: 0, null: false
|
7
8
|
t.integer :category_depth, limit: 2, default: 0
|
8
9
|
t.string :name, null: false
|
@@ -47,6 +47,8 @@ class CreatePosts < ActiveRecord::Migration[5.1]
|
|
47
47
|
execute "create index posts_created_at_month_idx on posts using btree (date_trunc('month', created_at), post_type_id, user_id);"
|
48
48
|
|
49
49
|
add_foreign_key :posts, :posts, column: :original_post_id, on_update: :cascade, on_delete: :nullify
|
50
|
+
|
51
|
+
add_index :posts, :created_at
|
50
52
|
end
|
51
53
|
end
|
52
54
|
|
@@ -0,0 +1,21 @@
|
|
1
|
+
class CreatePostReferences < ActiveRecord::Migration[5.1]
|
2
|
+
def up
|
3
|
+
unless PostReference.table_exists?
|
4
|
+
create_table :post_references do |t|
|
5
|
+
t.timestamps
|
6
|
+
t.references :post, null: false, foreign_key: { on_update: :cascade, on_delete: :cascade }
|
7
|
+
t.integer :priority, limit: 2, default: 1, null: false
|
8
|
+
t.string :authors
|
9
|
+
t.string :title, null: false
|
10
|
+
t.string :url
|
11
|
+
t.string :publishing_info
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
def down
|
17
|
+
if PostReference.table_exists?
|
18
|
+
drop_table :post_references
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
class CreatePostNotes < ActiveRecord::Migration[5.1]
|
2
|
+
def up
|
3
|
+
unless PostNote.table_exists?
|
4
|
+
create_table :post_notes do |t|
|
5
|
+
t.timestamps
|
6
|
+
t.references :post, null: false, foreign_key: { on_update: :cascade, on_delete: :cascade }
|
7
|
+
t.integer :priority, limit: 2, default: 1, null: false
|
8
|
+
t.text :text, null: false
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
def down
|
14
|
+
if PostNote.table_exists?
|
15
|
+
drop_table :post_notes
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
class CreatePostLinks < ActiveRecord::Migration[5.1]
|
2
|
+
def up
|
3
|
+
unless PostLink.table_exists?
|
4
|
+
create_table :post_links do |t|
|
5
|
+
t.timestamps
|
6
|
+
t.references :post, null: false, foreign_key: { on_update: :cascade, on_delete: :cascade }
|
7
|
+
t.integer :other_post_id, null: false
|
8
|
+
t.integer :priority, limit: 2, default: 1, null: false
|
9
|
+
end
|
10
|
+
|
11
|
+
add_foreign_key :post_links, :posts, column: :other_post_id, on_update: :cascade, on_delete: :cascade
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
def down
|
16
|
+
if PostLink.table_exists?
|
17
|
+
drop_table :post_links
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -8,12 +8,11 @@ module Biovision
|
|
8
8
|
class Engine < ::Rails::Engine
|
9
9
|
config.generators do |g|
|
10
10
|
g.test_framework :rspec
|
11
|
-
g.fixture_replacement :
|
11
|
+
g.fixture_replacement :factory_bot, :dir => 'spec/factories'
|
12
12
|
end
|
13
13
|
|
14
14
|
config.assets.precompile << %w(admin.scss)
|
15
|
-
config.assets.precompile << %w(biovision/base
|
16
|
-
config.assets.precompile << %w(biovision/base/placeholders/*)
|
15
|
+
config.assets.precompile << %w(biovision/base/**/*)
|
17
16
|
end
|
18
17
|
end
|
19
18
|
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.
|
4
|
+
version: 0.2.180325
|
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: 2018-
|
11
|
+
date: 2018-03-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -138,8 +138,12 @@ files:
|
|
138
138
|
- app/mailers/biovision/post/application_mailer.rb
|
139
139
|
- app/models/application_record.rb
|
140
140
|
- app/models/biovision/post/application_record.rb
|
141
|
+
- app/models/concerns/post_child_with_priority.rb
|
141
142
|
- app/models/post.rb
|
142
143
|
- app/models/post_category.rb
|
144
|
+
- app/models/post_link.rb
|
145
|
+
- app/models/post_note.rb
|
146
|
+
- app/models/post_reference.rb
|
143
147
|
- app/models/post_type.rb
|
144
148
|
- app/services/post_manager.rb
|
145
149
|
- app/services/post_manager/article_handler.rb
|
@@ -168,7 +172,7 @@ files:
|
|
168
172
|
- app/views/blog_posts/index.html.erb
|
169
173
|
- app/views/blog_posts/index.jbuilder
|
170
174
|
- app/views/blog_posts/show.html.erb
|
171
|
-
- app/views/index/
|
175
|
+
- app/views/index/dashboard/_biovision_post.html.erb
|
172
176
|
- app/views/layouts/biovision/post/application.html.erb
|
173
177
|
- app/views/news/category.html.erb
|
174
178
|
- app/views/news/index.html.erb
|
@@ -187,11 +191,8 @@ files:
|
|
187
191
|
- app/views/posts/_post.html.erb
|
188
192
|
- app/views/posts/_preview.html.erb
|
189
193
|
- app/views/posts/edit.html.erb
|
190
|
-
- app/views/posts/edit.js.erb
|
191
194
|
- app/views/posts/entity/_metadata.html.erb
|
192
195
|
- app/views/posts/entity/_publisher.html.erb
|
193
|
-
- app/views/posts/form/_wysiwyg.html.erb
|
194
|
-
- app/views/posts/new.js.erb
|
195
196
|
- app/views/posts/show.html.erb
|
196
197
|
- config/locales/posts-en.yml
|
197
198
|
- config/locales/posts-ru.yml
|
@@ -202,6 +203,10 @@ files:
|
|
202
203
|
- db/migrate/20171218111111_add_meta_fields_to_posts.rb
|
203
204
|
- db/migrate/20171219111112_add_author_fields_to_posts.rb
|
204
205
|
- db/migrate/20180124111113_add_language_to_posts.rb
|
206
|
+
- db/migrate/20180318215555_add_active_to_post_types.rb
|
207
|
+
- db/migrate/20180321100000_create_post_references.rb
|
208
|
+
- db/migrate/20180321100001_create_post_notes.rb
|
209
|
+
- db/migrate/20180321100002_create_post_links.rb
|
205
210
|
- lib/biovision/post.rb
|
206
211
|
- lib/biovision/post/engine.rb
|
207
212
|
- lib/biovision/post/version.rb
|
data/app/views/posts/edit.js.erb
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
<%= render partial: 'shared/forms/list_of_errors', locals: { entity: @entity, form_id: 'post-form' } %>
|
@@ -1,14 +0,0 @@
|
|
1
|
-
<script src="//cdn.ckeditor.com/4.7.3/full/ckeditor.js"></script>
|
2
|
-
<script>
|
3
|
-
'use strict';
|
4
|
-
|
5
|
-
document.addEventListener('DOMContentLoaded', function () {
|
6
|
-
const editor = document.getElementById('post_body');
|
7
|
-
|
8
|
-
CKEDITOR.replace(editor, {
|
9
|
-
filebrowserUploadUrl: '/media_files/ckeditor',
|
10
|
-
removePlugins: 'forms,save,preview,flash,bidi,language,print,templates,newpage,iframe,about,scayt,wsc',
|
11
|
-
// extraPlugins: 'embed'
|
12
|
-
});
|
13
|
-
});
|
14
|
-
</script>
|
data/app/views/posts/new.js.erb
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
<%= render partial: 'shared/forms/list_of_errors', locals: { entity: @entity, form_id: 'post-form' } %>
|