biovision-post 0.2.180325 → 0.21.190513.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +79 -13
- data/app/assets/images/biovision/post/icons/time.svg +6 -0
- data/app/assets/images/biovision/post/publisher_logo.png +0 -0
- data/app/assets/javascripts/biovision/post/biovision-posts.js +258 -0
- data/app/assets/stylesheets/biovision/post/admin/posts.scss +93 -0
- data/app/assets/stylesheets/biovision/post/posts.scss +88 -37
- data/app/controllers/admin/editorial_members_controller.rb +43 -0
- data/app/controllers/admin/featured_posts_controller.rb +23 -0
- data/app/controllers/admin/post_group_categories_controller.rb +19 -0
- data/app/controllers/admin/post_group_tags_controller.rb +19 -0
- data/app/controllers/admin/post_groups_controller.rb +62 -0
- data/app/controllers/admin/post_illustrations_controller.rb +26 -0
- data/app/controllers/admin/post_images_controller.rb +33 -0
- data/app/controllers/admin/post_links_controller.rb +19 -0
- data/app/controllers/admin/post_tags_controller.rb +30 -0
- data/app/controllers/admin/post_types_controller.rb +16 -4
- data/app/controllers/admin/posts_controller.rb +26 -2
- data/app/controllers/articles_controller.rb +23 -11
- data/app/controllers/authors_controller.rb +27 -0
- data/app/controllers/blog_posts_controller.rb +23 -11
- data/app/controllers/editorial_members_controller.rb +65 -0
- data/app/controllers/featured_posts_controller.rb +59 -0
- data/app/controllers/my/posts_controller.rb +124 -0
- data/app/controllers/news_controller.rb +23 -11
- data/app/controllers/post_categories_controller.rb +4 -14
- data/app/controllers/post_groups_controller.rb +76 -0
- data/app/controllers/post_illustrations_controller.rb +22 -0
- data/app/controllers/post_images_controller.rb +62 -0
- data/app/controllers/post_links_controller.rb +37 -0
- data/app/controllers/post_tags_controller.rb +41 -0
- data/app/controllers/posts_controller.rb +119 -14
- data/app/helpers/biovision_posts_helper.rb +114 -5
- data/app/jobs/application_job.rb +7 -0
- data/app/jobs/post_body_parser_job.rb +15 -0
- data/app/models/editorial_member.rb +92 -0
- data/app/models/editorial_member_post_type.rb +15 -0
- data/app/models/featured_post.rb +25 -0
- data/app/models/post.rb +203 -38
- data/app/models/post_category.rb +76 -54
- data/app/models/post_group.rb +84 -0
- data/app/models/post_group_category.rb +36 -0
- data/app/models/post_group_tag.rb +32 -0
- data/app/models/post_illustration.rb +62 -0
- data/app/models/post_image.rb +88 -0
- data/app/models/post_layout.rb +14 -0
- data/app/models/post_link.rb +2 -0
- data/app/models/post_post_category.rb +24 -0
- data/app/models/post_post_tag.rb +21 -0
- data/app/models/post_tag.rb +70 -0
- data/app/models/post_translation.rb +7 -0
- data/app/models/post_type.rb +18 -2
- data/app/models/post_zen_category.rb +6 -0
- data/app/models/zen_category.rb +21 -0
- data/app/services/post_manager.rb +52 -15
- data/app/services/post_parser.rb +80 -0
- data/app/uploaders/post_image_uploader.rb +9 -9
- data/app/views/admin/editorial_members/_nav_item.html.erb +2 -0
- data/app/views/admin/editorial_members/entity/_in_list.html.erb +37 -0
- data/app/views/admin/editorial_members/index.html.erb +15 -0
- data/app/views/admin/editorial_members/show.html.erb +71 -0
- data/app/views/admin/featured_posts/_add.html.erb +140 -0
- data/app/views/admin/featured_posts/_language.html.erb +14 -0
- data/app/views/admin/featured_posts/_nav_item.html.erb +2 -0
- data/app/views/admin/featured_posts/entity/_in_list.html.erb +26 -0
- data/app/views/admin/featured_posts/index.html.erb +18 -0
- data/app/views/admin/index/dashboard/_biovision_post.html.erb +32 -25
- data/app/views/admin/post_categories/entity/_in_list.html.erb +22 -6
- data/app/views/admin/post_categories/show.html.erb +6 -1
- data/app/views/admin/post_group_categories/entity/_in_list.html.erb +18 -0
- data/app/views/admin/post_group_tags/entity/_in_list.html.erb +18 -0
- data/app/views/admin/post_groups/_nav_item.html.erb +6 -0
- data/app/views/admin/post_groups/entity/_categories.html.erb +33 -0
- data/app/views/admin/post_groups/entity/_in_list.html.erb +25 -0
- data/app/views/admin/post_groups/index.html.erb +22 -0
- data/app/views/admin/post_groups/show.html.erb +65 -0
- data/app/views/admin/post_groups/tags.jbuilder +12 -0
- data/app/views/admin/post_illustrations/_nav_item.html.erb +6 -0
- data/app/views/admin/post_illustrations/entity/_in_list.html.erb +19 -0
- data/app/views/admin/post_illustrations/index.html.erb +23 -0
- data/app/views/admin/post_illustrations/show.html.erb +32 -0
- data/app/views/admin/post_images/_nav_item.html.erb +2 -0
- data/app/views/admin/post_images/entity/_in_list.html.erb +30 -0
- data/app/views/admin/post_images/index.html.erb +16 -0
- data/app/views/admin/post_images/show.html.erb +49 -0
- data/app/views/admin/post_links/entity/_in_list.html.erb +43 -0
- data/app/views/admin/post_tags/_nav_item.html.erb +2 -0
- data/app/views/admin/post_tags/entity/_in_list.html.erb +23 -0
- data/app/views/admin/post_tags/index.html.erb +16 -0
- data/app/views/admin/post_tags/posts.html.erb +18 -0
- data/app/views/admin/post_tags/show.html.erb +37 -0
- data/app/views/admin/post_types/authors.html.erb +23 -0
- data/app/views/admin/post_types/post_categories.html.erb +15 -4
- data/app/views/admin/post_types/post_tags.html.erb +18 -0
- data/app/views/admin/post_types/show.html.erb +28 -5
- data/app/views/admin/posts/_filter.html.erb +19 -0
- data/app/views/admin/posts/_nav_item.html.erb +3 -0
- data/app/views/admin/posts/_search_form.html.erb +13 -0
- data/app/views/admin/posts/entity/_in_list.html.erb +31 -7
- data/app/views/admin/posts/entity/_in_search.html.erb +8 -0
- data/app/views/admin/posts/entity/_links.html.erb +125 -0
- data/app/views/admin/posts/images.html.erb +22 -0
- data/app/views/admin/posts/index.html.erb +4 -0
- data/app/views/admin/posts/search.html.erb +21 -0
- data/app/views/admin/posts/search.jbuilder +26 -0
- data/app/views/admin/posts/show.html.erb +118 -18
- data/app/views/articles/category.html.erb +9 -9
- data/app/views/articles/index.html.erb +12 -9
- data/app/views/articles/show.html.erb +2 -4
- data/app/views/articles/tagged.html.erb +14 -0
- data/app/views/authors/_list.html.erb +18 -0
- data/app/views/authors/entity/_in_list.html.erb +9 -0
- data/app/views/authors/index.html.erb +10 -0
- data/app/views/authors/show.html.erb +31 -0
- data/app/views/blog_posts/category.html.erb +9 -9
- data/app/views/blog_posts/index.html.erb +12 -9
- data/app/views/blog_posts/show.html.erb +2 -4
- data/app/views/blog_posts/tagged.html.erb +14 -0
- data/app/views/editorial_members/_form.html.erb +107 -0
- data/app/views/editorial_members/edit.html.erb +17 -0
- data/app/views/editorial_members/new.html.erb +15 -0
- data/app/views/featured_posts/create.jbuilder +10 -0
- data/app/views/index/dashboard/_biovision_post.html.erb +18 -2
- data/app/views/my/index/dashboard/_biovision_post.html.erb +43 -0
- data/app/views/my/posts/_form.html.erb +357 -0
- data/app/views/my/posts/_list.html.erb +9 -0
- data/app/views/my/posts/_post.html.erb +80 -0
- data/app/views/my/posts/_preview.html.erb +35 -0
- data/app/views/my/posts/articles.html.erb +24 -0
- data/app/views/my/posts/blog_posts.html.erb +24 -0
- data/app/views/my/posts/edit.html.erb +19 -0
- data/app/views/my/posts/index.html.erb +14 -0
- data/app/views/my/posts/index/_navigation.html.erb +29 -0
- data/app/views/my/posts/new.html.erb +14 -0
- data/app/views/my/posts/news_index.html.erb +24 -0
- data/app/views/my/posts/show.html.erb +7 -0
- data/app/views/news/category.html.erb +9 -9
- data/app/views/news/index.html.erb +12 -9
- data/app/views/news/show.html.erb +2 -4
- data/app/views/news/tagged.html.erb +14 -0
- data/app/views/post_categories/_form.html.erb +82 -43
- data/app/views/post_groups/_form.html.erb +79 -0
- data/app/views/post_groups/edit.html.erb +17 -0
- data/app/views/post_groups/new.html.erb +15 -0
- data/app/views/post_groups/show.html.erb +10 -0
- data/app/views/post_images/_form.html.erb +121 -0
- data/app/views/post_images/edit.html.erb +19 -0
- data/app/views/post_images/new.html.erb +18 -0
- data/app/views/post_links/create.jbuilder +20 -0
- data/app/views/post_tags/_form.html.erb +26 -0
- data/app/views/post_tags/edit.html.erb +18 -0
- data/app/views/post_tags/new.html.erb +18 -0
- data/app/views/posts/_archive_dates.jbuilder +13 -0
- data/app/views/posts/_breadcrumbs.html.erb +4 -8
- data/app/views/posts/_calendar.html.erb +9 -0
- data/app/views/posts/_collection.html.erb +5 -0
- data/app/views/posts/_form.html.erb +204 -64
- data/app/views/posts/_list.html.erb +1 -1
- data/app/views/{articles/index.jbuilder → posts/_list.jbuilder} +3 -3
- data/app/views/posts/_post.html.erb +43 -16
- data/app/views/posts/_preview.html.erb +32 -21
- data/app/views/posts/_search.html.erb +6 -0
- data/app/views/posts/_wysiwyg.html.erb +25 -0
- data/app/views/posts/archive.jbuilder +3 -0
- data/app/views/posts/archive_day.html.erb +12 -0
- data/app/views/posts/category.html.erb +18 -0
- data/app/views/posts/entity/_gallery.html.erb +54 -0
- data/app/views/posts/entity/_linked_posts.html.erb +7 -0
- data/app/views/posts/entity/_metadata.html.erb +35 -12
- data/app/views/posts/entity/_publisher.html.erb +3 -1
- data/app/views/posts/form/_category_links.html.erb +32 -0
- data/app/views/posts/form/_gallery.html.erb +163 -0
- data/app/views/posts/index.html.erb +13 -0
- data/app/views/posts/index.jbuilder +1 -0
- data/app/views/posts/post_type/_category.html.erb +7 -0
- data/app/views/posts/post_type/_post_page.html.erb +9 -0
- data/app/views/posts/post_type/_posts.html.erb +5 -0
- data/app/views/posts/post_type/_tagged.html.erb +7 -0
- data/app/views/posts/rss.xml.erb +47 -0
- data/app/views/posts/search.html.erb +15 -0
- data/app/views/posts/show.html.erb +5 -3
- data/app/views/posts/tagged.html.erb +10 -0
- data/app/views/posts/tagged.jbuilder +1 -0
- data/app/views/posts/zen.xml.erb +42 -0
- data/config/locales/posts-en.yml +257 -19
- data/config/locales/posts-ru.yml +380 -14
- data/config/locales/posts-sv.yml +416 -0
- data/config/routes.rb +111 -15
- data/db/{migrate → amends}/20180124111113_add_language_to_posts.rb +0 -0
- data/db/{migrate → amends}/20180318215555_add_active_to_post_types.rb +0 -0
- data/db/amends/20180606120000_add_original_title_to_posts.rb +9 -0
- data/db/amends/20180606120001_add_time_required_to_posts.rb +11 -0
- data/db/amends/20180611111111_add_pubdate_and_translator_to_posts.rb +19 -0
- data/db/amends/20180618111111_add_default_category_name_to_post_types.rb +15 -0
- data/db/amends/20180703191919_add_rating_to_posts.rb +14 -0
- data/db/amends/20180810111111_add_explicit_to_posts.rb +11 -0
- data/db/amends/20180825111111_add_meta_description_to_post_categories.rb +11 -0
- data/db/amends/20180927111111_amend_editorial_member_about.rb +13 -0
- data/db/migrate/20170930000001_create_post_types.rb +98 -20
- data/db/migrate/20170930000010_create_posts.rb +194 -0
- data/db/migrate/20180706000000_create_editorial_members.rb +37 -0
- data/db/migrate/20180808000000_create_zen_categories.rb +42 -0
- data/db/migrate/20190202232323_add_spam_to_posts.rb +11 -0
- data/db/migrate/20190224212121_add_data_to_posts.rb +13 -0
- data/db/migrate/20190224212122_rename_post_image_source.rb +26 -0
- data/db/migrate/20190224212123_add_uuid_to_post_images.rb +10 -0
- data/db/migrate/20190313141414_convert_json_post_columns.rb +25 -0
- data/db/migrate/20190401101010_create_post_illustrations.rb +20 -0
- data/db/migrate/20190407101010_create_editorial_member_post_types.rb +18 -0
- data/db/migrate/20190410101010_add_avoid_parsing_to_posts.rb +14 -0
- data/db/migrate/20190410120000_create_post_groups.rb +47 -0
- data/db/migrate/20190412191919_add_nav_text_to_post_categories.rb +14 -0
- data/db/migrate/20190412212121_add_url_part_to_post_types.rb +26 -0
- data/db/migrate/20190420212121_create_post_layouts.rb +27 -0
- data/db/migrate/20190424161616_create_post_post_categories.rb +31 -0
- data/lib/biovision/post/version.rb +3 -1
- data/lib/tasks/posts.rake +6 -0
- metadata +170 -25
- data/app/assets/images/biovision/post/publisher_logo.svg +0 -3
- data/app/services/post_manager/article_handler.rb +0 -10
- data/app/services/post_manager/blog_post_handler.rb +0 -10
- data/app/services/post_manager/news_handler.rb +0 -10
- data/app/views/admin/index/dashboard/biovision_post/_additional_items.html.erb +0 -0
- data/app/views/blog_posts/index.jbuilder +0 -11
- data/app/views/news/index.jbuilder +0 -11
- data/app/views/post_categories/edit.jbuilder +0 -3
- data/app/views/post_categories/edit.js.erb +0 -1
- data/app/views/post_categories/new.jbuilder +0 -3
- data/app/views/post_categories/new.js.erb +0 -1
- data/db/migrate/20170930000002_create_post_categories.rb +0 -29
- data/db/migrate/20170930000003_create_posts.rb +0 -60
- data/db/migrate/20171218111111_add_meta_fields_to_posts.rb +0 -15
- data/db/migrate/20171219111112_add_author_fields_to_posts.rb +0 -11
- data/db/migrate/20180321100000_create_post_references.rb +0 -21
- data/db/migrate/20180321100001_create_post_notes.rb +0 -18
- data/db/migrate/20180321100002_create_post_links.rb +0 -20
@@ -0,0 +1,15 @@
|
|
1
|
+
<% content_for :meta_title, t('.title') %>
|
2
|
+
<% content_for :breadcrumbs do %>
|
3
|
+
<span><%= t('admin.editorial_members.nav_item.text') %></span>
|
4
|
+
<% end %>
|
5
|
+
|
6
|
+
<article>
|
7
|
+
<h1><%= t('.heading') %></h1>
|
8
|
+
|
9
|
+
<ul class="actions">
|
10
|
+
<li><%= back_icon(admin_path) %></li>
|
11
|
+
<li><%= create_icon(new_editorial_member_path) %></li>
|
12
|
+
</ul>
|
13
|
+
|
14
|
+
<%= render partial: 'shared/admin/list_with_priority', locals: { collection: @collection } %>
|
15
|
+
</article>
|
@@ -0,0 +1,71 @@
|
|
1
|
+
<% content_for :meta_title, t('.title', name: @entity.name) %>
|
2
|
+
<% content_for :breadcrumbs do %>
|
3
|
+
<%= link_to(t('admin.editorial_members.nav_item.text'), admin_editorial_members_path) %>
|
4
|
+
<span><%= @entity.name %></span>
|
5
|
+
<% end %>
|
6
|
+
|
7
|
+
<article>
|
8
|
+
<h1><%= @entity.name %></h1>
|
9
|
+
|
10
|
+
<ul class="actions">
|
11
|
+
<li><%= back_icon(admin_editorial_members_path) %></li>
|
12
|
+
<% if @entity.visible? %>
|
13
|
+
<li><%= world_icon(author_path(slug: @entity.slug)) %></li>
|
14
|
+
<% end %>
|
15
|
+
<li><%= edit_icon(edit_editorial_member_path(id: @entity.id)) %></li>
|
16
|
+
</ul>
|
17
|
+
|
18
|
+
<dl>
|
19
|
+
<dt><%= t('activerecord.attributes.editorial_member.user') %></dt>
|
20
|
+
<dd><%= admin_user_link(@entity.user) %></dd>
|
21
|
+
|
22
|
+
<dt><%= t('activerecord.attributes.editorial_member.title') %></dt>
|
23
|
+
<dd><%= @entity.title %></dd>
|
24
|
+
|
25
|
+
<% unless @entity.lead.blank? %>
|
26
|
+
<dt><%= t('activerecord.attributes.editorial_member.lead') %></dt>
|
27
|
+
<dd><%= @entity.lead %></dd>
|
28
|
+
<% end %>
|
29
|
+
|
30
|
+
<% unless @entity.about.blank? %>
|
31
|
+
<dt><%= t('activerecord.attributes.editorial_member.about') %></dt>
|
32
|
+
<dd>
|
33
|
+
<%= raw(@entity.about) %>
|
34
|
+
</dd>
|
35
|
+
<% end %>
|
36
|
+
</dl>
|
37
|
+
|
38
|
+
<%=
|
39
|
+
render(
|
40
|
+
partial: 'shared/admin/toggleable',
|
41
|
+
locals: {
|
42
|
+
entity: @entity,
|
43
|
+
url: toggle_admin_editorial_member_path(id: @entity.id)
|
44
|
+
}
|
45
|
+
)
|
46
|
+
%>
|
47
|
+
|
48
|
+
<section>
|
49
|
+
<h2><%= t('.post_types') %></h2>
|
50
|
+
|
51
|
+
<ul class="entity-links">
|
52
|
+
<% PostType.list_for_administration.each do |post_type| %>
|
53
|
+
<li>
|
54
|
+
<% entity_id = "post_type_#{post_type.id}" %>
|
55
|
+
<%=
|
56
|
+
check_box_tag(
|
57
|
+
"post_types[#{post_type.id}]",
|
58
|
+
post_type.id,
|
59
|
+
@entity.post_type?(post_type),
|
60
|
+
id: entity_id,
|
61
|
+
data: {
|
62
|
+
url: post_type_admin_editorial_member_path(id: @entity.id, post_type_id: post_type.id)
|
63
|
+
}
|
64
|
+
)
|
65
|
+
%>
|
66
|
+
<%= label_tag(entity_id, post_type.name) %>
|
67
|
+
</li>
|
68
|
+
<% end %>
|
69
|
+
</ul>
|
70
|
+
</section>
|
71
|
+
</article>
|
@@ -0,0 +1,140 @@
|
|
1
|
+
<section>
|
2
|
+
<h2><%= t('admin.featured_posts.index.add') %></h2>
|
3
|
+
|
4
|
+
<%=
|
5
|
+
form_with(
|
6
|
+
url: search_admin_posts_path(format: :json),
|
7
|
+
local: true,
|
8
|
+
method: :get,
|
9
|
+
id: 'featured-post-search',
|
10
|
+
data: {
|
11
|
+
create_url: featured_posts_path
|
12
|
+
}
|
13
|
+
) do
|
14
|
+
%>
|
15
|
+
<div>
|
16
|
+
<%= label_tag(:q, t('admin.posts.entity.links.search')) %>
|
17
|
+
<%= text_field_tag(:q) %>
|
18
|
+
<%= button_tag t(:submit), type: :submit, class: 'button-action' %>
|
19
|
+
</div>
|
20
|
+
<div class="results">
|
21
|
+
</div>
|
22
|
+
<% end %>
|
23
|
+
</section>
|
24
|
+
|
25
|
+
<script>
|
26
|
+
'use strict';
|
27
|
+
|
28
|
+
document.addEventListener('DOMContentLoaded', function () {
|
29
|
+
const searchForm = document.getElementById('featured-post-search');
|
30
|
+
// const listContainer = document.getElementById('post-link-list-container');
|
31
|
+
if (searchForm) {
|
32
|
+
const sections = document.querySelectorAll('section[data-language-id]');
|
33
|
+
const createUrl = searchForm.getAttribute('data-create-url');
|
34
|
+
// const postId = listContainer.getAttribute('data-post-id');
|
35
|
+
const searchResultContainer = searchForm.querySelector('.results');
|
36
|
+
|
37
|
+
searchForm.addEventListener('submit', function (event) {
|
38
|
+
event.preventDefault();
|
39
|
+
|
40
|
+
let existingIds = [];
|
41
|
+
sections.forEach(function (section) {
|
42
|
+
section.querySelectorAll('[data-post-id]').forEach(function (item) {
|
43
|
+
existingIds.push(parseInt(item.getAttribute('data-post-id')));
|
44
|
+
});
|
45
|
+
});
|
46
|
+
|
47
|
+
const addLinkToList = function (data) {
|
48
|
+
let listContainer;
|
49
|
+
const attr = data['attributes'];
|
50
|
+
sections.forEach(function (section) {
|
51
|
+
if (listContainer) {
|
52
|
+
return;
|
53
|
+
}
|
54
|
+
if (parseInt(section.getAttribute('data-language-id')) === attr.language_id) {
|
55
|
+
listContainer = section.querySelector('.list-container');
|
56
|
+
}
|
57
|
+
});
|
58
|
+
if (listContainer) {
|
59
|
+
let list = listContainer.querySelector('ol.list-of-entities');
|
60
|
+
if (!list) {
|
61
|
+
listContainer.innerHTML = '';
|
62
|
+
list = document.createElement('ol');
|
63
|
+
list.classList.add('list-of-entities');
|
64
|
+
listContainer.append(list);
|
65
|
+
} else {
|
66
|
+
const firstItem = list.querySelector("li:first-of-type");
|
67
|
+
if (firstItem) {
|
68
|
+
const priority = parseInt(firstItem.getAttribute("data-number"));
|
69
|
+
|
70
|
+
if (priority === 1) {
|
71
|
+
list.querySelectorAll("li").forEach(function (element) {
|
72
|
+
const oldPriority = parseInt(element.getAttribute("data-number"));
|
73
|
+
element.setAttribute("data-number", String(oldPriority + 1));
|
74
|
+
});
|
75
|
+
}
|
76
|
+
}
|
77
|
+
}
|
78
|
+
|
79
|
+
const li = document.createElement('li');
|
80
|
+
li.setAttribute('data-id', data.id);
|
81
|
+
li.setAttribute('data-number', attr['priority']);
|
82
|
+
li.innerHTML = data.meta.html;
|
83
|
+
|
84
|
+
list.prepend(li);
|
85
|
+
} else {
|
86
|
+
console.log('Cannot find list container');
|
87
|
+
}
|
88
|
+
};
|
89
|
+
|
90
|
+
const createFeaturedPost = function () {
|
91
|
+
const button = this;
|
92
|
+
const data = {
|
93
|
+
post_id: button.getAttribute('data-post-id')
|
94
|
+
};
|
95
|
+
|
96
|
+
const request = Biovision.jsonAjaxRequest('post', createUrl, function () {
|
97
|
+
const response = JSON.parse(this.responseText);
|
98
|
+
|
99
|
+
if (response.hasOwnProperty('data')) {
|
100
|
+
addLinkToList(response.data);
|
101
|
+
} else {
|
102
|
+
console.log('No data in response');
|
103
|
+
}
|
104
|
+
});
|
105
|
+
|
106
|
+
request.send(JSON.stringify(data));
|
107
|
+
button.parentNode.remove();
|
108
|
+
};
|
109
|
+
|
110
|
+
const query = document.getElementById('q').value;
|
111
|
+
const url = `${this.getAttribute('action')}?q=${query}`;
|
112
|
+
const request = Biovision.newAjaxRequest('get', url, function () {
|
113
|
+
const response = JSON.parse(this.responseText);
|
114
|
+
searchResultContainer.innerHTML = '';
|
115
|
+
|
116
|
+
if (response.hasOwnProperty('data')) {
|
117
|
+
const data = response.data;
|
118
|
+
data.forEach(function (item) {
|
119
|
+
if (item.attributes.language_id && !existingIds.includes(item['id'])) {
|
120
|
+
const div = document.createElement('div');
|
121
|
+
const button = document.createElement('button');
|
122
|
+
|
123
|
+
div.setAttribute('data-id', item['id']);
|
124
|
+
button.classList.add('button-save');
|
125
|
+
button.setAttribute('data-post-id', item.id);
|
126
|
+
button.innerHTML = '+';
|
127
|
+
div.append(button);
|
128
|
+
div.insertAdjacentHTML('beforeend', item.meta.html);
|
129
|
+
searchResultContainer.append(div);
|
130
|
+
button.addEventListener('click', createFeaturedPost);
|
131
|
+
}
|
132
|
+
})
|
133
|
+
}
|
134
|
+
});
|
135
|
+
|
136
|
+
request.send();
|
137
|
+
});
|
138
|
+
}
|
139
|
+
});
|
140
|
+
</script>
|
@@ -0,0 +1,14 @@
|
|
1
|
+
<section data-language-id="<%= language.id %>">
|
2
|
+
<h2><%= language_name(language) %></h2>
|
3
|
+
|
4
|
+
<div class="list-container">
|
5
|
+
<%=
|
6
|
+
render(
|
7
|
+
partial: 'shared/admin/list_with_priority',
|
8
|
+
locals: {
|
9
|
+
collection: FeaturedPost.list_for_language(language)
|
10
|
+
}
|
11
|
+
)
|
12
|
+
%>
|
13
|
+
</div>
|
14
|
+
</section>
|
@@ -0,0 +1,26 @@
|
|
1
|
+
<div class="image">
|
2
|
+
<%= post_image_preview(entity.post) %>
|
3
|
+
</div>
|
4
|
+
<div class="data" data-post-id="<%= entity.post_id %>">
|
5
|
+
<div><%= admin_post_link(entity.post) %></div>
|
6
|
+
<% unless entity.post.lead.blank? %>
|
7
|
+
<div class="secondary info">
|
8
|
+
<%= entity.post.lead %>
|
9
|
+
</div>
|
10
|
+
<% end %>
|
11
|
+
<div class="secondary info">
|
12
|
+
<%= t('activerecord.attributes.post.rating') %>: <%= entity.post.rating %>
|
13
|
+
</div>
|
14
|
+
|
15
|
+
<ul class="actions">
|
16
|
+
<%=
|
17
|
+
render(
|
18
|
+
partial: 'shared/actions/priority_changer',
|
19
|
+
locals: { path: priority_admin_featured_post_path(id: entity.id) }
|
20
|
+
)
|
21
|
+
%>
|
22
|
+
<li class="danger">
|
23
|
+
<button class="destroy" data-url="<%= featured_post_path(id: entity.id) %>">×</button>
|
24
|
+
</li>
|
25
|
+
</ul>
|
26
|
+
</div>
|
@@ -0,0 +1,18 @@
|
|
1
|
+
<% content_for :meta_title, t('.title') %>
|
2
|
+
<% content_for :breadcrumbs do %>
|
3
|
+
<span><%= t('admin.featured_posts.nav_item.text') %></span>
|
4
|
+
<% end %>
|
5
|
+
|
6
|
+
<article>
|
7
|
+
<h1><%= t('.heading') %></h1>
|
8
|
+
|
9
|
+
<ul class="actions">
|
10
|
+
<li><%= back_icon(admin_path) %></li>
|
11
|
+
</ul>
|
12
|
+
|
13
|
+
<% @languages.each do |language| %>
|
14
|
+
<%= render partial: 'language', locals: { language: language } %>
|
15
|
+
<% end %>
|
16
|
+
|
17
|
+
<%= render 'add' %>
|
18
|
+
</article>
|
@@ -1,29 +1,36 @@
|
|
1
1
|
<% if current_user_in_group?(:editors) %>
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
<
|
8
|
-
|
9
|
-
|
10
|
-
|
2
|
+
<nav>
|
3
|
+
<h3><%= t('.heading') %></h3>
|
4
|
+
<ul>
|
5
|
+
<li>
|
6
|
+
<%= render 'admin/post_types/nav_item' %>
|
7
|
+
<ul>
|
8
|
+
<% PostType.list_for_administration.each do |post_type| %>
|
9
|
+
<li>
|
10
|
+
<div><%= admin_post_type_link(post_type) %></div>
|
11
|
+
<div class="description">
|
12
|
+
<%= t(:post_count, count: post_type.posts_count) %>
|
13
|
+
</div>
|
14
|
+
<ul class="actions">
|
11
15
|
<li>
|
12
|
-
|
13
|
-
<div class="description">
|
14
|
-
<%= t(:post_count, count: post_type.posts_count) %>
|
15
|
-
</div>
|
16
|
-
<ul class="actions">
|
17
|
-
<li>
|
18
|
-
<%= create_icon(new_post_admin_post_type_path(id: post_type.id)) %>
|
19
|
-
</li>
|
20
|
-
</ul>
|
16
|
+
<%= create_icon(new_post_admin_post_type_path(id: post_type.id)) %>
|
21
17
|
</li>
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
18
|
+
</ul>
|
19
|
+
</li>
|
20
|
+
<% end %>
|
21
|
+
</ul>
|
22
|
+
</li>
|
23
|
+
<li><%= render 'admin/posts/nav_item' %></li>
|
24
|
+
<% if current_user_has_privilege?(:chief_editor) %>
|
25
|
+
<li><%= render 'admin/featured_posts/nav_item' %></li>
|
26
|
+
<li><%= render 'admin/post_groups/nav_item' %></li>
|
27
|
+
<% end %>
|
28
|
+
<li><%= render 'admin/post_tags/nav_item' %></li>
|
29
|
+
<li><%= render 'admin/post_illustrations/nav_item' %></li>
|
30
|
+
<li><%= render 'admin/post_images/nav_item' %></li>
|
31
|
+
<% if current_user_has_privilege?(:chief_editor) %>
|
32
|
+
<li><%= render 'admin/editorial_members/nav_item' %></li>
|
33
|
+
<% end %>
|
34
|
+
</ul>
|
35
|
+
</nav>
|
29
36
|
<% end %>
|
@@ -4,18 +4,34 @@
|
|
4
4
|
<%= entity.long_slug %>,
|
5
5
|
<%= t(:post_count, count: entity.posts_count) %>
|
6
6
|
</div>
|
7
|
+
<% unless entity.meta_description.blank? %>
|
8
|
+
<div class="secondary info">
|
9
|
+
<%= entity.meta_description %>
|
10
|
+
</div>
|
11
|
+
<% end %>
|
7
12
|
|
8
13
|
<ul class="actions">
|
9
14
|
<li class="lockable <%= entity.locked? ? 'hidden' : '' %>">
|
10
15
|
<%= edit_icon edit_post_category_path(id: entity.id) %>
|
11
16
|
</li>
|
12
|
-
<%=
|
13
|
-
|
17
|
+
<%=
|
18
|
+
render(
|
19
|
+
partial: 'shared/actions/priority_changer',
|
20
|
+
locals: { path: priority_admin_post_category_path(id: entity.id) }
|
21
|
+
)
|
22
|
+
%>
|
14
23
|
</ul>
|
15
|
-
|
24
|
+
|
16
25
|
<% if entity.child_categories.any? %>
|
17
|
-
|
18
|
-
|
19
|
-
|
26
|
+
<div class="children">
|
27
|
+
<%=
|
28
|
+
render(
|
29
|
+
partial: 'shared/admin/list_with_priority',
|
30
|
+
locals: {
|
31
|
+
collection: PostCategory.for_tree(entity.post_type_id, entity.id)
|
32
|
+
}
|
33
|
+
)
|
34
|
+
%>
|
35
|
+
</div>
|
20
36
|
<% end %>
|
21
37
|
</div>
|
@@ -2,10 +2,10 @@
|
|
2
2
|
<% content_for :breadcrumbs do %>
|
3
3
|
<%= link_to(t('admin.post_types.nav_item.text'), admin_post_types_path) %>
|
4
4
|
<%= admin_post_type_link(@entity.post_type) %>
|
5
|
+
<%= link_to(t('admin.post_types.post_categories.heading'), post_categories_admin_post_type_path(id: @entity.post_type_id)) %>
|
5
6
|
<% @entity.parents.each do |parent| %>
|
6
7
|
<%= admin_post_category_link(parent) %>
|
7
8
|
<% end %>
|
8
|
-
<%= link_to(t('admin.post_types.post_categories.heading'), post_categories_admin_post_type_path(id: @entity.post_type_id)) %>
|
9
9
|
<span><%= @entity.name %></span>
|
10
10
|
<% end %>
|
11
11
|
|
@@ -31,6 +31,11 @@
|
|
31
31
|
<dt><%= t('activerecord.attributes.post_category.slug') %></dt>
|
32
32
|
<dd><%= @entity.slug %> (<%= @entity.long_slug %>)</dd>
|
33
33
|
|
34
|
+
<% unless @entity.nav_text.blank? %>
|
35
|
+
<dt><%= t('activerecord.attributes.post_category.nav_text') %></dt>
|
36
|
+
<dd><%= @entity.nav_text %></dd>
|
37
|
+
<% end %>
|
38
|
+
|
34
39
|
<dt><%= t('activerecord.attributes.post_category.priority') %></dt>
|
35
40
|
<dd><%= @entity.priority %></dd>
|
36
41
|
|
@@ -0,0 +1,18 @@
|
|
1
|
+
<div class="data">
|
2
|
+
<div><%= admin_post_category_link(entity.post_category) %></div>
|
3
|
+
|
4
|
+
<div class="info">
|
5
|
+
<%= entity.post_category.long_slug %>
|
6
|
+
</div>
|
7
|
+
|
8
|
+
<ul class="actions">
|
9
|
+
<%=
|
10
|
+
render(
|
11
|
+
partial: 'shared/actions/priority_changer',
|
12
|
+
locals: {
|
13
|
+
path: admin_priority_post_group_category_path(id: entity.id)
|
14
|
+
}
|
15
|
+
)
|
16
|
+
%>
|
17
|
+
</ul>
|
18
|
+
</div>
|