biovision-courses 0.0.180221
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/MIT-LICENSE +20 -0
- data/README.md +28 -0
- data/Rakefile +26 -0
- data/app/assets/config/biovision_courses_manifest.js +2 -0
- data/app/assets/javascripts/biovision/courses/application.js +13 -0
- data/app/assets/stylesheets/biovision/courses/application.css +15 -0
- data/app/controllers/admin/course_categories_controller.rb +28 -0
- data/app/controllers/admin/course_tags_controller.rb +28 -0
- data/app/controllers/admin/courses_controller.rb +29 -0
- data/app/controllers/biovision/courses/application_controller.rb +7 -0
- data/app/controllers/course_categories_controller.rb +70 -0
- data/app/controllers/course_tags_controller.rb +66 -0
- data/app/controllers/courses_controller.rb +94 -0
- data/app/helpers/biovision/courses/application_helper.rb +6 -0
- data/app/helpers/biovision_courses_helper.rb +80 -0
- data/app/jobs/biovision/courses/application_job.rb +6 -0
- data/app/mailers/biovision/courses/application_mailer.rb +8 -0
- data/app/models/application_record.rb +3 -0
- data/app/models/biovision/courses/application_record.rb +7 -0
- data/app/models/course.rb +109 -0
- data/app/models/course_category.rb +137 -0
- data/app/models/course_course_tag.rb +13 -0
- data/app/models/course_tag.rb +49 -0
- data/app/uploaders/course_image_uploader.rb +46 -0
- data/app/views/admin/course_categories/_nav_item.html.erb +2 -0
- data/app/views/admin/course_categories/entity/_in_list.html.erb +43 -0
- data/app/views/admin/course_categories/index.html.erb +17 -0
- data/app/views/admin/course_categories/show.html.erb +85 -0
- data/app/views/admin/course_tags/_nav_item.html.erb +2 -0
- data/app/views/admin/course_tags/entity/_in_list.html.erb +21 -0
- data/app/views/admin/course_tags/index.html.erb +19 -0
- data/app/views/admin/course_tags/show.html.erb +39 -0
- data/app/views/admin/courses/_nav_item.html.erb +2 -0
- data/app/views/admin/courses/entity/_in_list.html.erb +40 -0
- data/app/views/admin/courses/index.html.erb +17 -0
- data/app/views/admin/courses/show.html.erb +117 -0
- data/app/views/admin/index/dashboard/_biovision_courses.html.erb +12 -0
- data/app/views/course_categories/_form.html.erb +96 -0
- data/app/views/course_categories/edit.html.erb +22 -0
- data/app/views/course_categories/edit.js.erb +1 -0
- data/app/views/course_categories/new.html.erb +15 -0
- data/app/views/course_categories/new.js.erb +1 -0
- data/app/views/course_tags/_form.html.erb +72 -0
- data/app/views/course_tags/edit.html.erb +17 -0
- data/app/views/course_tags/edit.js.erb +1 -0
- data/app/views/course_tags/new.html.erb +15 -0
- data/app/views/course_tags/new.js.erb +1 -0
- data/app/views/courses/_form.html.erb +244 -0
- data/app/views/courses/edit.html.erb +17 -0
- data/app/views/courses/edit.js.erb +1 -0
- data/app/views/courses/form/_wysiwyg.html.erb +14 -0
- data/app/views/courses/new.html.erb +15 -0
- data/app/views/courses/new.js.erb +1 -0
- data/app/views/layouts/biovision/courses/application.html.erb +14 -0
- data/config/locales/courses-ru.yml +138 -0
- data/config/routes.rb +26 -0
- data/db/migrate/20180218120000_prepare_course_privileges.rb +19 -0
- data/db/migrate/20180218120005_create_course_categories.rb +28 -0
- data/db/migrate/20180218120010_create_course_tags.rb +20 -0
- data/db/migrate/20180218120015_create_courses.rb +42 -0
- data/db/migrate/20180218120020_create_course_course_tags.rb +17 -0
- data/lib/biovision/courses.rb +7 -0
- data/lib/biovision/courses/engine.rb +18 -0
- data/lib/biovision/courses/version.rb +5 -0
- data/lib/tasks/biovision/courses_tasks.rake +4 -0
- metadata +207 -0
@@ -0,0 +1,43 @@
|
|
1
|
+
<div class="image">
|
2
|
+
<%= course_image_preview(entity) %>
|
3
|
+
</div>
|
4
|
+
<div class="data">
|
5
|
+
<div><%= admin_course_category_link(entity) %></div>
|
6
|
+
<div class="info">
|
7
|
+
<%= entity.long_slug %>,
|
8
|
+
<%= t(:course_count, count: entity.courses_count) %>
|
9
|
+
</div>
|
10
|
+
|
11
|
+
<%=
|
12
|
+
render(
|
13
|
+
partial: 'shared/admin/toggleable',
|
14
|
+
locals: {
|
15
|
+
entity: entity,
|
16
|
+
url: toggle_admin_course_category_path(entity.id)
|
17
|
+
}
|
18
|
+
)
|
19
|
+
%>
|
20
|
+
|
21
|
+
<% if current_user_has_privilege?(:chief_course_manager) %>
|
22
|
+
<ul class="actions">
|
23
|
+
<li><%= edit_icon edit_course_category_path(entity.id) %></li>
|
24
|
+
<%=
|
25
|
+
render(
|
26
|
+
partial: 'shared/actions/priority_changer',
|
27
|
+
locals: { path: priority_admin_course_category_path(entity.id) }
|
28
|
+
)
|
29
|
+
%>
|
30
|
+
</ul>
|
31
|
+
<% end %>
|
32
|
+
|
33
|
+
<% if entity.child_categories.any? %>
|
34
|
+
<div class="children">
|
35
|
+
<%=
|
36
|
+
render(
|
37
|
+
partial: 'shared/admin/list_with_priority',
|
38
|
+
locals: { collection: CourseCategory.for_tree(entity.id) }
|
39
|
+
)
|
40
|
+
%>
|
41
|
+
</div>
|
42
|
+
<% end %>
|
43
|
+
</div>
|
@@ -0,0 +1,17 @@
|
|
1
|
+
<% content_for :meta_title, t('.title') %>
|
2
|
+
<% content_for :breadcrumbs do %>
|
3
|
+
<span><%= t('admin.course_categories.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
|
+
<% if current_user_has_privilege?(:chief_course_manager) %>
|
12
|
+
<li><%= create_icon(new_course_category_path) %></li>
|
13
|
+
<% end %>
|
14
|
+
</ul>
|
15
|
+
|
16
|
+
<%= render partial: 'shared/admin/list_with_priority', locals: { collection: CourseCategory.for_tree } %>
|
17
|
+
</article>
|
@@ -0,0 +1,85 @@
|
|
1
|
+
<% content_for :meta_title, t('.title', name: @entity.name) %>
|
2
|
+
<% content_for :breadcrumbs do %>
|
3
|
+
<%= link_to(t('admin.course_categories.nav_item.text'), admin_course_categories_path) %>
|
4
|
+
<% @entity.parents.each do |parent| %>
|
5
|
+
<%= admin_course_category_link(parent) %>
|
6
|
+
<% end %>
|
7
|
+
<span><%= @entity.name %></span>
|
8
|
+
<% end %>
|
9
|
+
|
10
|
+
<article>
|
11
|
+
<h1><%= @entity.name %></h1>
|
12
|
+
|
13
|
+
<ul class="actions">
|
14
|
+
<li><%= return_icon(admin_course_categories_path) %></li>
|
15
|
+
<% if current_user_has_privilege?(:chief_course_manager) %>
|
16
|
+
<li><%= edit_icon(edit_course_category_path(@entity.id)) %></li>
|
17
|
+
<% end %>
|
18
|
+
</ul>
|
19
|
+
|
20
|
+
<dl>
|
21
|
+
<dt><%= t('activerecord.attributes.course_category.priority') %></dt>
|
22
|
+
<dd><%= @entity.priority %></dd>
|
23
|
+
|
24
|
+
<% unless @entity.image.blank? %>
|
25
|
+
<dt><%= t('activerecord.attributes.course_category.image') %></dt>
|
26
|
+
<dd>
|
27
|
+
<figure>
|
28
|
+
<%= link_to(course_image_small(@entity), @entity.image.url) %>
|
29
|
+
</figure>
|
30
|
+
</dd>
|
31
|
+
<% end %>
|
32
|
+
|
33
|
+
<% unless @entity.parent.nil? %>
|
34
|
+
<dt><%= t('activerecord.attributes.course_category.parent_id') %></dt>
|
35
|
+
<dd><%= admin_course_category_link(@entity.parent) %></dd>
|
36
|
+
<% end %>
|
37
|
+
|
38
|
+
<dt><%= t('activerecord.attributes.course_category.slug') %></dt>
|
39
|
+
<dd><%= @entity.slug %> (<%= @entity.long_slug %>)</dd>
|
40
|
+
|
41
|
+
<% unless @entity.parents_cache.blank? %>
|
42
|
+
<dt><%= t('activerecord.attributes.course_category.parents_cache') %></dt>
|
43
|
+
<dd><%= @entity.parents_cache %></dd>
|
44
|
+
<% end %>
|
45
|
+
|
46
|
+
<% unless @entity.children_cache.blank? %>
|
47
|
+
<dt><%= t('activerecord.attributes.course_category.children_cache') %></dt>
|
48
|
+
<dd><%= @entity.children_cache %></dd>
|
49
|
+
<% end %>
|
50
|
+
</dl>
|
51
|
+
|
52
|
+
<%=
|
53
|
+
render(
|
54
|
+
partial: 'shared/admin/toggleable',
|
55
|
+
locals: {
|
56
|
+
entity: @entity,
|
57
|
+
url: toggle_admin_course_category_path(@entity.id)
|
58
|
+
}
|
59
|
+
)
|
60
|
+
%>
|
61
|
+
|
62
|
+
<% if @entity.child_categories.any? %>
|
63
|
+
<section>
|
64
|
+
<h2><%= t('.children') %></h2>
|
65
|
+
|
66
|
+
<%= render partial: 'shared/admin/list_with_priority', locals: { collection: CourseCategory.for_tree(@entity.id) } %>
|
67
|
+
</section>
|
68
|
+
<% end %>
|
69
|
+
|
70
|
+
<% if @entity.depth < 2 %>
|
71
|
+
<section>
|
72
|
+
<h2><%= t('.new_child') %></h2>
|
73
|
+
|
74
|
+
<%= render partial: 'course_categories/form', locals: { entity: CourseCategory.new(parent: @entity) } %>
|
75
|
+
</section>
|
76
|
+
<% end %>
|
77
|
+
|
78
|
+
<section>
|
79
|
+
<h2><%= t(:course_count, count: @entity.courses_count) %></h2>
|
80
|
+
|
81
|
+
<%= paginate @collection %>
|
82
|
+
<%= render partial: 'shared/admin/list_with_priority', locals: { collection: @collection } %>
|
83
|
+
<%= paginate @collection %>
|
84
|
+
</section>
|
85
|
+
</article>
|
@@ -0,0 +1,21 @@
|
|
1
|
+
<div class="image">
|
2
|
+
<%= course_image_preview(entity) %>
|
3
|
+
</div>
|
4
|
+
<div class="data">
|
5
|
+
<div><%= admin_course_tag_link(entity) %></div>
|
6
|
+
<div class="secondary info">
|
7
|
+
<%= entity.slug %>,
|
8
|
+
<%= t(:course_count, count: entity.courses_count) %>
|
9
|
+
</div>
|
10
|
+
|
11
|
+
<%=
|
12
|
+
render(
|
13
|
+
partial: 'shared/admin/toggleable',
|
14
|
+
locals: { entity: entity, url: toggle_admin_course_tag_path(entity.id) }
|
15
|
+
)
|
16
|
+
%>
|
17
|
+
|
18
|
+
<ul class="actions">
|
19
|
+
<li><%= edit_icon(edit_course_tag_path(entity.id)) %></li>
|
20
|
+
</ul>
|
21
|
+
</div>
|
@@ -0,0 +1,19 @@
|
|
1
|
+
<% content_for :meta_title, t('.title', page: current_page) %>
|
2
|
+
<% content_for :breadcrumbs do %>
|
3
|
+
<span><%= t('admin.course_tags.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
|
+
<% if current_user_has_privilege?(:chief_course_manager) %>
|
12
|
+
<li><%= create_icon(new_course_tag_path) %></li>
|
13
|
+
<% end %>
|
14
|
+
</ul>
|
15
|
+
|
16
|
+
<%= paginate @collection %>
|
17
|
+
<%= render partial: 'shared/admin/list', locals: { collection: @collection } %>
|
18
|
+
<%= paginate @collection %>
|
19
|
+
</article>
|
@@ -0,0 +1,39 @@
|
|
1
|
+
<% content_for :meta_title, t('.title', name: @entity.name) %>
|
2
|
+
<% content_for :breadcrumbs do %>
|
3
|
+
<%= link_to(t('admin.course_tags.nav_item.text'), admin_course_tags_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_course_tags_path) %></li>
|
12
|
+
<% if current_user_has_privilege?(:chief_course_manager) %>
|
13
|
+
<li><%= create_icon(new_course_tag_path(@entity.id)) %></li>
|
14
|
+
<li><%= edit_icon(edit_course_tag_path(@entity.id)) %></li>
|
15
|
+
<% end %>
|
16
|
+
</ul>
|
17
|
+
|
18
|
+
<dl>
|
19
|
+
<% unless @entity.image.blank? %>
|
20
|
+
<dt><%= t('activerecord.attributes.course_tag.image') %></dt>
|
21
|
+
<dd>
|
22
|
+
<figure>
|
23
|
+
<%= link_to(course_image_medium(@entity), @entity.image.url) %>
|
24
|
+
</figure>
|
25
|
+
</dd>
|
26
|
+
<% end %>
|
27
|
+
|
28
|
+
<dt><%= t('activerecord.attributes.course_tag.slug') %></dt>
|
29
|
+
<dd><%= @entity.slug %></dd>
|
30
|
+
</dl>
|
31
|
+
|
32
|
+
<section>
|
33
|
+
<h2><%= t(:course_count, count: @entity.courses_count) %></h2>
|
34
|
+
|
35
|
+
<%= paginate @collection %>
|
36
|
+
<%= render partial: 'shared/admin/list', locals: { collection: @collection } %>
|
37
|
+
<%= paginate @collection %>
|
38
|
+
</section>
|
39
|
+
</article>
|
@@ -0,0 +1,40 @@
|
|
1
|
+
<div class="image">
|
2
|
+
<%= course_image_preview(entity) %>
|
3
|
+
</div>
|
4
|
+
<div class="data">
|
5
|
+
<div><%= admin_course_link(entity) %></div>
|
6
|
+
<div class="secondary info">
|
7
|
+
<%= entity.slug %><br/>
|
8
|
+
<%= admin_course_category_link(entity.course_category, entity.course_category.full_title) %>
|
9
|
+
</div>
|
10
|
+
|
11
|
+
<%=
|
12
|
+
render(
|
13
|
+
partial: 'shared/admin/toggleable',
|
14
|
+
locals: { entity: entity, url: toggle_admin_course_path(entity.id) }
|
15
|
+
)
|
16
|
+
%>
|
17
|
+
|
18
|
+
<ul class="actions">
|
19
|
+
<% if entity.editable_by?(current_user) %>
|
20
|
+
<% if entity.lockable_by?(current_user) %>
|
21
|
+
<%=
|
22
|
+
render(
|
23
|
+
partial: 'shared/actions/locks',
|
24
|
+
locals: {
|
25
|
+
entity: entity,
|
26
|
+
path: lock_admin_course_path(entity.id)
|
27
|
+
}
|
28
|
+
)
|
29
|
+
%>
|
30
|
+
<% end %>
|
31
|
+
<li class="lockable <%= entity.locked? ? 'hidden' : '' %>"><%= edit_icon(edit_course_path(entity.id)) %></li>
|
32
|
+
<%=
|
33
|
+
render(
|
34
|
+
partial: 'shared/actions/priority_changer',
|
35
|
+
locals: { path: priority_admin_course_path(entity.id) }
|
36
|
+
)
|
37
|
+
%>
|
38
|
+
<% end %>
|
39
|
+
</ul>
|
40
|
+
</div>
|
@@ -0,0 +1,17 @@
|
|
1
|
+
<% content_for :meta_title, t('.title', page: current_page) %>
|
2
|
+
<% content_for :breadcrumbs do %>
|
3
|
+
<span><%= t('admin.courses.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_course_path) %></li>
|
12
|
+
</ul>
|
13
|
+
|
14
|
+
<%= paginate @collection %>
|
15
|
+
<%= render partial: 'shared/admin/list', locals: { collection: @collection } %>
|
16
|
+
<%= paginate @collection %>
|
17
|
+
</article>
|
@@ -0,0 +1,117 @@
|
|
1
|
+
<% content_for :meta_title, t('.title', name: @entity.title) %>
|
2
|
+
<% content_for :breadcrumbs do %>
|
3
|
+
<%= link_to(t('admin.courses.nav_item.text'), admin_courses_path) %>
|
4
|
+
<span><%= @entity.title %></span>
|
5
|
+
<% end %>
|
6
|
+
|
7
|
+
<article>
|
8
|
+
<h1><%= @entity.title %></h1>
|
9
|
+
|
10
|
+
<ul class="actions">
|
11
|
+
<li><%= back_icon(admin_courses_path) %></li>
|
12
|
+
<% if @entity.editable_by?(current_user) && !@entity.locked? %>
|
13
|
+
<li><%= edit_icon(edit_course_path(@entity.id)) %></li>
|
14
|
+
<% end %>
|
15
|
+
</ul>
|
16
|
+
|
17
|
+
<dl>
|
18
|
+
<% unless @entity.image.blank? %>
|
19
|
+
<dt><%= t('activerecord.attributes.course.image') %></dt>
|
20
|
+
<dd>
|
21
|
+
<figure>
|
22
|
+
<%= link_to(course_image_medium(@entity), @entity.image.url) %>
|
23
|
+
<% unless @entity.image_alt_text.blank? %>
|
24
|
+
<figcaption><%= @entity.image_alt_text %></figcaption>
|
25
|
+
<% end %>
|
26
|
+
</figure>
|
27
|
+
</dd>
|
28
|
+
<% end %>
|
29
|
+
|
30
|
+
<dt><%= t('activerecord.attributes.course.title') %></dt>
|
31
|
+
<dd><%= @entity.title %></dd>
|
32
|
+
|
33
|
+
<% unless @entity.subtitle.blank? %>
|
34
|
+
<dt><%= t('activerecord.attributes.course.subtitle') %></dt>
|
35
|
+
<dd><%= @entity.subtitle %></dd>
|
36
|
+
<% end %>
|
37
|
+
|
38
|
+
<dt><%= t('activerecord.attributes.course.slug') %></dt>
|
39
|
+
<dd><%= @entity.slug %></dd>
|
40
|
+
|
41
|
+
<dt><%= t('activerecord.attributes.course.course_category') %></dt>
|
42
|
+
<dd><%= admin_course_category_link(@entity.course_category) %></dd>
|
43
|
+
|
44
|
+
<dt><%= t('activerecord.attributes.course.priority') %></dt>
|
45
|
+
<dd><%= @entity.priority %></dd>
|
46
|
+
|
47
|
+
<% unless @entity.duration.blank? %>
|
48
|
+
<dt><%= t('activerecord.attributes.course.duration') %></dt>
|
49
|
+
<dd><%= @entity.duration %></dd>
|
50
|
+
<% end %>
|
51
|
+
|
52
|
+
<% unless @entity.price.blank? %>
|
53
|
+
<dt><%= t('activerecord.attributes.course.price') %></dt>
|
54
|
+
<dd><%= @entity.price %></dd>
|
55
|
+
<% end %>
|
56
|
+
|
57
|
+
<% unless @entity.special_price.blank? %>
|
58
|
+
<dt><%= t('activerecord.attributes.course.special_price') %></dt>
|
59
|
+
<dd><%= @entity.special_price %></dd>
|
60
|
+
|
61
|
+
<% unless @entity.special_price_end.blank? %>
|
62
|
+
<dt><%= t('activerecord.attributes.course.special_price_end') %></dt>
|
63
|
+
<dd><%= time_tag(@entity.special_price_end) %></dd>
|
64
|
+
<% end %>
|
65
|
+
<% end %>
|
66
|
+
|
67
|
+
<% unless @entity.lead.blank? %>
|
68
|
+
<dt><%= t('activerecord.attributes.course.lead') %></dt>
|
69
|
+
<dd>
|
70
|
+
<div>
|
71
|
+
<%= simple_format(@entity.lead) %>
|
72
|
+
</div>
|
73
|
+
</dd>
|
74
|
+
<% end %>
|
75
|
+
|
76
|
+
<% unless @entity.description.blank? %>
|
77
|
+
<dt><%= t('activerecord.attributes.course.description') %></dt>
|
78
|
+
<dd>
|
79
|
+
<div>
|
80
|
+
<%= raw(@entity.description) %>
|
81
|
+
</div>
|
82
|
+
</dd>
|
83
|
+
<% end %>
|
84
|
+
|
85
|
+
<% unless @entity.meta_title.blank? %>
|
86
|
+
<dt><%= t('activerecord.attributes.course.meta_title') %></dt>
|
87
|
+
<dd><%= @entity.meta_title %></dd>
|
88
|
+
<% end %>
|
89
|
+
|
90
|
+
<% unless @entity.meta_description.blank? %>
|
91
|
+
<dt><%= t('activerecord.attributes.course.meta_description') %></dt>
|
92
|
+
<dd><%= @entity.meta_description %></dd>
|
93
|
+
<% end %>
|
94
|
+
|
95
|
+
<% unless @entity.meta_keywords.blank? %>
|
96
|
+
<dt><%= t('activerecord.attributes.course.meta_keywords') %></dt>
|
97
|
+
<dd><%= @entity.meta_keywords %></dd>
|
98
|
+
<% end %>
|
99
|
+
|
100
|
+
<% unless @entity.tags_cache.blank? %>
|
101
|
+
<dt><%= t('activerecord.attributes.course.tags_cache') %></dt>
|
102
|
+
<dd><%= @entity.tags_cache.join(', ') %></dd>
|
103
|
+
<% end %>
|
104
|
+
</dl>
|
105
|
+
|
106
|
+
<%=
|
107
|
+
render(
|
108
|
+
partial: 'shared/admin/toggleable',
|
109
|
+
locals: {
|
110
|
+
entity: @entity,
|
111
|
+
url: toggle_admin_course_path(@entity.id)
|
112
|
+
}
|
113
|
+
)
|
114
|
+
%>
|
115
|
+
|
116
|
+
<%= render partial: 'shared/track', locals: { item: @entity } %>
|
117
|
+
</article>
|
@@ -0,0 +1,12 @@
|
|
1
|
+
<% if current_user_in_group?(:course_managers) %>
|
2
|
+
<nav>
|
3
|
+
<div class="heading" id="biovision-courses-nav-heading">
|
4
|
+
<%= t('.heading') %>
|
5
|
+
</div>
|
6
|
+
<ul aria-labelledby="biovision-courses-nav-heading">
|
7
|
+
<li><%= render 'admin/course_categories/nav_item' %></li>
|
8
|
+
<li><%= render 'admin/course_tags/nav_item' %></li>
|
9
|
+
<li><%= render 'admin/courses/nav_item' %></li>
|
10
|
+
</ul>
|
11
|
+
</nav>
|
12
|
+
<% end %>
|
@@ -0,0 +1,96 @@
|
|
1
|
+
<%= form_with model: entity, html: { id: 'course_category-form' } do |f| %>
|
2
|
+
<%= render partial: 'shared/list_of_errors', locals: { entity: entity } %>
|
3
|
+
|
4
|
+
<dl>
|
5
|
+
<% unless entity.id.nil? %>
|
6
|
+
<% unless entity.parent_id.nil? %>
|
7
|
+
<dt><%= t('activerecord.attributes.course_category.parent_id') %></dt>
|
8
|
+
<dd>
|
9
|
+
<%= admin_course_category_link(entity.parent) %>
|
10
|
+
</dd>
|
11
|
+
<% end %>
|
12
|
+
<% end %>
|
13
|
+
|
14
|
+
<dt><%= f.label :image %></dt>
|
15
|
+
<dd>
|
16
|
+
<figure role="group" class="preview" id="course_category-image">
|
17
|
+
<% if entity.image.blank? %>
|
18
|
+
<%= f.label :image, image_tag('biovision/base/placeholders/image.svg') %>
|
19
|
+
<% else %>
|
20
|
+
<%= f.label :image, image_tag(entity.image.big.url) %>
|
21
|
+
<% end %>
|
22
|
+
<figcaption>
|
23
|
+
<%=
|
24
|
+
f.file_field(
|
25
|
+
:image,
|
26
|
+
id: :course_category_image,
|
27
|
+
accept: 'image/jpeg,image/png',
|
28
|
+
data: { image: 'course_category-image' }
|
29
|
+
)
|
30
|
+
%>
|
31
|
+
</figcaption>
|
32
|
+
</figure>
|
33
|
+
<div class="guideline"><%= t('.guidelines.image') %></div>
|
34
|
+
</dd>
|
35
|
+
|
36
|
+
<dt><%= f.label :priority %></dt>
|
37
|
+
<dd>
|
38
|
+
<%=
|
39
|
+
f.number_field(
|
40
|
+
:priority,
|
41
|
+
id: :course_category_priority,
|
42
|
+
in: CourseCategory::PRIORITY_RANGE,
|
43
|
+
required: true
|
44
|
+
)
|
45
|
+
%>
|
46
|
+
</dd>
|
47
|
+
|
48
|
+
<dt><%= f.label :name %></dt>
|
49
|
+
<dd>
|
50
|
+
<%=
|
51
|
+
f.text_field(
|
52
|
+
:name,
|
53
|
+
id: :course_category_name,
|
54
|
+
size: nil,
|
55
|
+
maxlength: CourseCategory::NAME_LIMIT,
|
56
|
+
required: true,
|
57
|
+
data: { transliterate: 'course_category_slug' }
|
58
|
+
)
|
59
|
+
%>
|
60
|
+
<div class="guideline"><%= t('.guidelines.name') %></div>
|
61
|
+
</dd>
|
62
|
+
|
63
|
+
<dt><%= f.label :slug %></dt>
|
64
|
+
<dd>
|
65
|
+
<%=
|
66
|
+
f.text_field(
|
67
|
+
:slug,
|
68
|
+
id: :course_category_slug,
|
69
|
+
size: nil,
|
70
|
+
maxlength: CourseCategory::SLUG_LIMIT,
|
71
|
+
pattern: CourseCategory::SLUG_PATTERN_HTML,
|
72
|
+
title: t('.guidelines.slug'),
|
73
|
+
required: true
|
74
|
+
)
|
75
|
+
%>
|
76
|
+
<div class="guideline"><%= t('.guidelines.slug') %></div>
|
77
|
+
</dd>
|
78
|
+
|
79
|
+
<dt><%= t(:flags) %></dt>
|
80
|
+
<dd>
|
81
|
+
<ul class="flags">
|
82
|
+
<li>
|
83
|
+
<%= f.check_box :visible, id: :course_category_visible %>
|
84
|
+
<%= f.label :visible %>
|
85
|
+
</li>
|
86
|
+
</ul>
|
87
|
+
</dd>
|
88
|
+
</dl>
|
89
|
+
|
90
|
+
<div class="buttons">
|
91
|
+
<% if entity.id.nil? %>
|
92
|
+
<%= f.hidden_field :parent_id %>
|
93
|
+
<% end %>
|
94
|
+
<%= f.button t(:save), type: :submit, class: 'button-save' %>
|
95
|
+
</div>
|
96
|
+
<% end %>
|