biovision-base 0.15.180502 → 0.17.180619

Sign up to get free protection for your applications and to get access to all the features.
Files changed (61) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/images/biovision/base/placeholders/user.svg +4 -21
  3. data/app/assets/javascripts/biovision/base/biovision-sliders.js +24 -1
  4. data/app/assets/javascripts/biovision/base/biovision.js +27 -5
  5. data/app/assets/stylesheets/biovision/base/biovision.scss +8 -1
  6. data/app/assets/stylesheets/biovision/base/default.scss +13 -5
  7. data/app/controllers/about_controller.rb +8 -3
  8. data/app/controllers/admin/editable_pages_controller.rb +3 -1
  9. data/app/controllers/editable_pages_controller.rb +1 -5
  10. data/app/controllers/fallback_controller.rb +11 -0
  11. data/app/controllers/media_files_controller.rb +9 -1
  12. data/app/controllers/my/profiles_controller.rb +6 -1
  13. data/app/models/concerns/checkable.rb +20 -0
  14. data/app/models/editable_page.rb +27 -10
  15. data/app/models/feedback_request.rb +4 -3
  16. data/app/models/foreign_site.rb +7 -4
  17. data/app/models/media_file.rb +0 -1
  18. data/app/models/privilege.rb +2 -2
  19. data/app/models/user.rb +4 -4
  20. data/app/views/about/contact.html.erb +24 -0
  21. data/app/views/admin/editable_pages/entity/_in_list.html.erb +16 -0
  22. data/app/views/admin/editable_pages/index.html.erb +1 -1
  23. data/app/views/admin/editable_pages/show.html.erb +10 -1
  24. data/app/views/admin/index/_biovision_base.html.erb +1 -0
  25. data/app/views/admin/users/entity/_custom_nav.html.erb +0 -0
  26. data/app/views/admin/users/entity/_in_list.html.erb +19 -3
  27. data/app/views/admin/users/show.html.erb +18 -9
  28. data/app/views/application/error.jbuilder +3 -0
  29. data/app/views/editable_pages/_editable_page.html.erb +2 -4
  30. data/app/views/editable_pages/_form.html.erb +50 -11
  31. data/app/views/editable_pages/edit.html.erb +3 -3
  32. data/app/views/editable_pages/entity/_content.html.erb +11 -0
  33. data/app/views/editable_pages/entity/_metadata.html.erb +1 -4
  34. data/app/views/fallback/show.html.erb +1 -0
  35. data/app/views/feedback_requests/_form.html.erb +38 -27
  36. data/app/views/my/profiles/check.jbuilder +4 -0
  37. data/app/views/my/profiles/new/_form.html.erb +11 -10
  38. data/app/views/shared/_meta_texts.html.erb +26 -12
  39. data/app/views/shared/forms/_entity_flags.html.erb +11 -0
  40. data/app/views/shared/forms/_wysiwyg.html.erb +1 -1
  41. data/app/views/shared/forms/check.jbuilder +4 -0
  42. data/app/views/users/_form.html.erb +32 -39
  43. data/config/locales/common-en.yml +6 -4
  44. data/config/locales/common-ru.yml +7 -4
  45. data/config/locales/editable-pages-ru.yml +12 -4
  46. data/config/locales/feedback-en.yml +6 -1
  47. data/config/locales/feedback-ru.yml +5 -5
  48. data/config/locales/users-en.yml +1 -0
  49. data/config/locales/users-ru.yml +1 -0
  50. data/config/routes.rb +11 -2
  51. data/db/migrate/20170302000101_create_privileges.rb +1 -0
  52. data/db/migrate/20170320000000_create_editable_pages.rb +25 -12
  53. data/db/migrate/20171211000000_create_feedback_requests.rb +7 -1
  54. data/db/migrate/20180610222222_add_consent_to_feedback_requests.rb +15 -0
  55. data/db/migrate/20180612111111_add_administrative_to_privilege.rb +11 -0
  56. data/db/migrate/20180619121212_add_image_alt_text_to_editable_page.rb +11 -0
  57. data/lib/biovision/base/base_methods.rb +3 -2
  58. data/lib/biovision/base/version.rb +1 -1
  59. metadata +15 -4
  60. data/db/migrate/20171025222222_add_new_fields_171026.rb +0 -21
  61. data/db/migrate/20171217222222_add_fields_to_feedback_requests.rb +0 -10
@@ -3,10 +3,7 @@
3
3
  <% content_for(:meta_description, entity.description) unless entity.description.blank? %>
4
4
  <% unless entity.image.blank? %>
5
5
  <% content_for :meta_image, (request.protocol + request.host_with_port + entity.image.url) %>
6
- <% end %>
7
- <% content_for :meta_type_extension do %>
8
- <meta property="og:article:published_time" content="<%= entity.created_at.strftime('%F') %>"/>
9
- <meta property="og:article:modified_time" content="<%= entity.updated_at.strftime('%F') %>"/>
6
+ <% content_for :meta_image_alt, entity.image_alt_text %>
10
7
  <% end %>
11
8
  <% content_for :meta_twitter do %>
12
9
  <meta name="twitter:card" content="summary_large_image"/>
@@ -0,0 +1 @@
1
+ <%= render partial: 'editable_pages/editable_page', locals: { entity: @editable_page } %>
@@ -1,4 +1,7 @@
1
- <% form_id = 'feedback-request-form' unless local_assigns[:form_id] %>
1
+ <%
2
+ form_id = 'feedback_request-form' unless local_assigns[:form_id]
3
+ entity = FeedbackRequest.new unless local_assigns[:entity]
4
+ %>
2
5
  <%= form_with model: entity, html: { id: form_id } do |f| %>
3
6
  <div class="fields">
4
7
  <%=
@@ -11,31 +14,35 @@
11
14
  required: true
12
15
  )
13
16
  %>
14
- <%=
15
- f.phone_field(
16
- :phone,
17
- size: nil,
18
- maxlength: FeedbackRequest::PHONE_LIMIT,
19
- placeholder: t('activerecord.attributes.feedback_request.phone'),
20
- aria: {
21
- label: t('activerecord.attributes.feedback_request.phone')
22
- },
23
- required: true
24
- )
25
- %>
26
- <%=
27
- f.email_field(
28
- :email,
29
- size: nil,
30
- maxlength: FeedbackRequest::EMAIL_LIMIT,
31
- placeholder: t('activerecord.attributes.feedback_request.email'),
32
- aria: {
33
- label: t('activerecord.attributes.feedback_request.email')
34
- },
35
- required: true
36
- )
37
- %>
38
- <% if local_assigns[:accept_comment] %>
17
+ <% unless local_assigns[:hide_phone] %>
18
+ <%=
19
+ f.phone_field(
20
+ :phone,
21
+ size: nil,
22
+ maxlength: FeedbackRequest::PHONE_LIMIT,
23
+ placeholder: t('activerecord.attributes.feedback_request.phone'),
24
+ aria: {
25
+ label: t('activerecord.attributes.feedback_request.phone')
26
+ },
27
+ required: true
28
+ )
29
+ %>
30
+ <% end %>
31
+ <% unless local_assigns[:hide_email] %>
32
+ <%=
33
+ f.email_field(
34
+ :email,
35
+ size: nil,
36
+ maxlength: FeedbackRequest::EMAIL_LIMIT,
37
+ placeholder: t('activerecord.attributes.feedback_request.email'),
38
+ aria: {
39
+ label: t('activerecord.attributes.feedback_request.email')
40
+ },
41
+ required: true
42
+ )
43
+ %>
44
+ <% end %>
45
+ <% unless local_assigns[:hide_comment] %>
39
46
  <%= f.text_area(
40
47
  :comment,
41
48
  cols: 20,
@@ -48,9 +55,13 @@
48
55
  )
49
56
  %>
50
57
  <% end %>
51
- <%= hidden_field_tag 'form_id', form_id %>
58
+ <div>
59
+ <%= f.check_box :consent, id: :feedback_request_consent %>
60
+ <%= f.label :consent %>
61
+ </div>
52
62
  </div>
53
63
  <div class="buttons">
64
+ <%= hidden_field_tag 'form_id', form_id %>
54
65
  <%= button_tag(t(:submit), type: :submit) %>
55
66
  </div>
56
67
 
@@ -0,0 +1,4 @@
1
+ json.meta do
2
+ json.valid @entity.valid?
3
+ json.errors @entity.errors
4
+ end
@@ -1,11 +1,12 @@
1
+ <% model_name = entity.class.to_s.underscore %>
1
2
  <%=
2
3
  form_with(
3
4
  model: entity,
4
- scope: 'user',
5
+ scope: model_name,
5
6
  url: my_profile_path,
6
7
  class: 'new-my-profile',
7
- id: 'user-form',
8
- data: { check_url: check_users_path }
8
+ id: "#{model_name}-form",
9
+ data: { check_url: check_my_profile_path }
9
10
  ) do |f|
10
11
  %>
11
12
  <%= render partial: 'shared/list_of_errors', locals: { entity: entity } %>
@@ -17,7 +18,7 @@
17
18
  <%=
18
19
  f.text_field(
19
20
  :screen_name,
20
- id: :user_screen_name,
21
+ id: "#{model_name}_screen_name",
21
22
  required: true,
22
23
  maxlength: User::SCREEN_NAME_LIMIT,
23
24
  pattern: User::SCREEN_NAME_PATTERN_HTML,
@@ -36,7 +37,7 @@
36
37
  <%=
37
38
  f.password_field(
38
39
  :password,
39
- id: :user_password,
40
+ id: "#{model_name}_password",
40
41
  required: true,
41
42
  size: nil,
42
43
  maxlength: 70,
@@ -54,7 +55,7 @@
54
55
  <%=
55
56
  f.password_field(
56
57
  :password_confirmation,
57
- id: :user_password_confirmation,
58
+ id: "#{model_name}_password_confirmation",
58
59
  required: true,
59
60
  size: nil,
60
61
  maxlength: 70,
@@ -72,7 +73,7 @@
72
73
  <%=
73
74
  f.email_field(
74
75
  :email,
75
- id: :user_email,
76
+ id: "#{model_name}_email",
76
77
  size: nil,
77
78
  maxlength: User::EMAIL_LIMIT,
78
79
  required: true,
@@ -86,8 +87,8 @@
86
87
 
87
88
  <ul class="flags">
88
89
  <li>
89
- <%= check_box_tag 'user[consent]', '1', false, required: true %>
90
- <%= label_tag :user_consent, t('.consent') %>
90
+ <%= f.check_box :consent, id: "#{model_name}_consent", required: true %>
91
+ <%= f.label :consent, t('.consent') %>
91
92
  </li>
92
93
  <li>
93
94
  <%= f.check_box :allow_mail, id: :user_allow_mail %>
@@ -95,7 +96,7 @@
95
96
  </li>
96
97
  </ul>
97
98
 
98
- <div class="trap">
99
+ <div class="visually-hidden">
99
100
  <%= check_box_tag :agree, '1', false, tabindex: '-1' %>
100
101
  <%= label_tag :agree, t('.i_am_bot') %>
101
102
  </div>
@@ -1,20 +1,34 @@
1
- <meta property="og:title" content="<%= content_for :meta_title %>" />
2
- <meta property="og:type" content="<%= content_for?(:meta_type) ? (yield :meta_type) : 'website' %>" />
3
- <meta property="og:url" content="<%= url_for(only_path: false) %>" />
4
- <%= yield :meta_type_extension if content_for? :meta_type_extension %>
5
- <% if content_for? :meta_image %>
6
- <meta property="og:image" content="<%= yield :meta_image %>" />
7
- <meta name="twitter:image" content="<%= yield :meta_image %>" />
8
- <% end %>
9
1
  <% if content_for? :meta_description %>
10
- <meta name="description" content="<%= yield :meta_description %>" />
11
- <meta property="og:description" content="<%= yield :meta_description %>" />
2
+ <meta name="description" content="<%= yield :meta_description %>" />
12
3
  <% end %>
13
4
  <% if content_for? :meta_keywords %>
14
5
  <meta name="keywords" content="<%= yield :meta_keywords %>" />
15
6
  <% end %>
16
7
  <meta property="og:site_name" content="<%= t('.site_name') %>" />
17
- <meta property="twitter:title" content="<%= content_for :meta_title %>" />
8
+ <% if content_for? :meta_opengraph %>
9
+ <%= yield :meta_opengraph %>
10
+ <% else %>
11
+ <meta property="og:url" content="<%= url_for(only_path: false) %>" />
12
+ <meta property="og:title" content="<%= content_for :meta_title %>" />
13
+ <meta property="og:type" content="<%= content_for?(:meta_type) ? (yield :meta_type) : 'website' %>" />
14
+ <% if content_for? :meta_image %>
15
+ <meta property="og:image" content="<%= yield :meta_image %>" />
16
+ <% if content_for? :meta_image_alt %>
17
+ <meta property="og:image:alt" content="<%= yield :meta_image_alt %>" />
18
+ <% end %>
19
+ <% end %>
20
+ <%= yield :meta_type_extension if content_for? :meta_type_extension %>
21
+ <% if content_for? :meta_description %>
22
+ <meta property="og:description" content="<%= yield :meta_description %>" />
23
+ <% end %>
24
+ <% end %>
25
+ <% if content_for? :meta_twitter %>
26
+ <%= yield :meta_twitter %>
27
+ <% else %>
28
+ <meta property="twitter:title" content="<%= content_for :meta_title %>" />
29
+ <% if content_for? :meta_image %>
30
+ <meta name="twitter:image" content="<%= yield :meta_image %>" />
31
+ <% end %>
32
+ <% end %>
18
33
  <meta name="twitter:site" content="<%= t('.twitter_site') %>" />
19
34
  <meta name="twitter:creator" content="<%= t('.twitter_creator') %>" />
20
- <%= yield :meta_twitter if content_for? :meta_twitter %>
@@ -0,0 +1,11 @@
1
+ <dt><%= t(:flags) %></dt>
2
+ <dd>
3
+ <ul class="flags">
4
+ <% entity.class.toggleable_attributes.each do |flag| %>
5
+ <li>
6
+ <%= f.check_box flag, id: "#{model_name}_flag" %>
7
+ <%= f.label flag %>
8
+ </li>
9
+ <% end %>
10
+ </ul>
11
+ </dd>
@@ -1,4 +1,4 @@
1
- <script src="//cdn.ckeditor.com/4.8.0/full/ckeditor.js"></script>
1
+ <script src="//cdn.ckeditor.com/4.9.2/standard/ckeditor.js"></script>
2
2
  <script>
3
3
  document.addEventListener('DOMContentLoaded', function () {
4
4
  document.querySelectorAll('form [data-wysiwyg]').forEach(function(editor) {
@@ -0,0 +1,4 @@
1
+ json.meta do
2
+ json.valid @entity.valid?
3
+ json.errors @entity.errors
4
+ end
@@ -1,19 +1,19 @@
1
- <% entity_type = entity.class.to_s.underscore %>
2
- <%= form_with(model: entity, html: { id: "#{entity_type}-form" }) do |f| %>
1
+ <% model_name = entity.class.to_s.underscore %>
2
+ <%= form_with(model: entity, html: { id: "#{model_name}-form" }) do |f| %>
3
3
  <%= render partial: 'shared/list_of_errors', locals: { entity: entity } %>
4
4
 
5
5
  <dl>
6
6
  <dt><%= f.label :image %></dt>
7
7
  <dd>
8
- <figure id="<%= entity_type %>-image" role="group" class="preview">
8
+ <figure id="<%= model_name %>-image" role="group" class="preview">
9
9
  <%= f.label(:image, image_tag(entity.image.profile.url)) %>
10
10
  <figcaption>
11
11
  <%=
12
12
  f.file_field(
13
13
  :image,
14
- id: :user_image,
14
+ id: "#{model_name}_image",
15
15
  accept: 'image/jpeg,image/png',
16
- data: { image: "#{entity_type}-image" }
16
+ data: { image: "#{model_name}-image" }
17
17
  )
18
18
  %>
19
19
  </figcaption>
@@ -25,6 +25,7 @@
25
25
  <%=
26
26
  f.text_field(
27
27
  :screen_name,
28
+ id: "#{model_name}_screen_name",
28
29
  maxlength: User::SCREEN_NAME_LIMIT,
29
30
  pattern: User::SCREEN_NAME_PATTERN_HTML,
30
31
  title: t('.guidelines.screen_name'),
@@ -39,10 +40,10 @@
39
40
  <%=
40
41
  f.email_field(
41
42
  :email,
42
- id: :user_email,
43
+ id: "#{model_name}_email",
43
44
  size: nil,
44
45
  maxlength: User::EMAIL_LIMIT,
45
- readonly: entity.super_user?
46
+ readonly: entity.super_user?
46
47
  )
47
48
  %>
48
49
  </dd>
@@ -52,10 +53,21 @@
52
53
  <%=
53
54
  f.phone_field(
54
55
  :phone,
55
- id: :user_phone,
56
+ id: "#{model_name}_phone",
56
57
  size: 15,
57
58
  maxlength: User::PHONE_LIMIT,
58
- readonly: entity.super_user?
59
+ readonly: entity.super_user?
60
+ )
61
+ %>
62
+ </dd>
63
+
64
+ <dt><%= f.label :balance %></dt>
65
+ <dd>
66
+ <%=
67
+ f.number_field(
68
+ :balance,
69
+ id: "#{model_name}_balance",
70
+ size: 7
59
71
  )
60
72
  %>
61
73
  </dd>
@@ -65,7 +77,7 @@
65
77
  <%=
66
78
  f.date_field(
67
79
  :birthday,
68
- id: :user_birthday,
80
+ id: "#{model_name}_birthday",
69
81
  size: 10
70
82
  )
71
83
  %>
@@ -77,7 +89,7 @@
77
89
  <%=
78
90
  f.text_field(
79
91
  :password,
80
- id: :user_password,
92
+ id: "#{model_name}_password",
81
93
  size: nil,
82
94
  maxlength: 70,
83
95
  required: entity.id.nil?
@@ -90,7 +102,7 @@
90
102
  <%=
91
103
  f.text_field(
92
104
  :password_confirmation,
93
- id: :user_password_confirmation,
105
+ id: "#{model_name}_password_confirmation",
94
106
  size: nil,
95
107
  maxlength: 70,
96
108
  required: entity.id.nil?
@@ -106,39 +118,20 @@
106
118
  <%=
107
119
  f.text_field(
108
120
  :notice,
109
- id: :user_notice,
110
- size: nil,
121
+ id: "#{model_name}_notice",
122
+ size: nil,
111
123
  maxlength: User::NOTICE_LIMIT
112
124
  )
113
125
  %>
114
126
  <div class="guideline"><%= t('.guidelines.notice') %></div>
115
127
  </dd>
116
128
 
117
- <dt><%= t(:flags) %></dt>
118
- <dd>
119
- <ul>
120
- <li>
121
- <%= f.check_box :bot, id: :user_bot %>
122
- <%= f.label :bot %>
123
- </li>
124
- <li>
125
- <%= f.check_box :allow_login, id: :user_allow_login %>
126
- <%= f.label :allow_login %>
127
- </li>
128
- <li>
129
- <%= f.check_box :email_confirmed, id: :user_email_confirmed %>
130
- <%= f.label :email_confirmed %>
131
- </li>
132
- <li>
133
- <%= f.check_box :phone_confirmed, id: :user_phone_confirmed %>
134
- <%= f.label :phone_confirmed %>
135
- </li>
136
- <li>
137
- <%= f.check_box :allow_mail, id: :user_allow_mail %>
138
- <%= f.label :allow_mail %>
139
- </li>
140
- </ul>
141
- </dd>
129
+ <%=
130
+ render(
131
+ partial: 'shared/forms/entity_flags',
132
+ locals: { f: f, entity: entity, model_name: model_name }
133
+ )
134
+ %>
142
135
  </dl>
143
136
 
144
137
  <div class="buttons">
@@ -151,12 +151,14 @@ en:
151
151
  footer:
152
152
  support: "Support"
153
153
  about:
154
- index:
155
- nav_text: "About us"
156
- tos:
157
- nav_text: "Terms of service"
154
+ contact:
155
+ nav_text: "Contact"
158
156
  editable:
159
157
  title: "In progress"
160
158
  heading: "Content is not ready"
161
159
  message: "Page content is not ready, please come back later."
160
+ index:
161
+ nav_text: "About us"
162
+ tos:
163
+ nav_text: "Terms of service"
162
164
  total: "Total"
@@ -15,6 +15,7 @@ ru:
15
15
  errors:
16
16
  messages:
17
17
  extension_blacklist_error: "имеет недопустимое расширение файла"
18
+ extension_whitelist_error: "имеет недопустимое расширение файла"
18
19
  error:
19
20
  bad_request:
20
21
  title: "Плохой запрос"
@@ -151,12 +152,14 @@ ru:
151
152
  footer:
152
153
  support: "Поддержка"
153
154
  about:
154
- index:
155
- nav_text: "О проекте"
156
- tos:
157
- nav_text: "Пользовательское соглашение"
155
+ contact:
156
+ nav_text: "Контакты"
158
157
  editable:
159
158
  title: "Раздел в разработке"
160
159
  heading: "Раздел наполняется"
161
160
  message: "Информация ещё не готова, зайдите позже"
161
+ index:
162
+ nav_text: "О проекте"
163
+ tos:
164
+ nav_text: "Пользовательское соглашение"
162
165
  total: "Всего"
@@ -8,12 +8,16 @@ ru:
8
8
  body: "Содержимое"
9
9
  description: "Метаописание"
10
10
  image: "Картинка"
11
+ image_alt_text: "Текст для атрибута alt для картинки"
11
12
  keywords: "Ключевые слова"
12
13
  language: "Язык"
13
14
  language_id: "Язык"
14
15
  name: "Название"
16
+ nav_group: "Название группы навигации"
17
+ priority: "Порядок сортировки"
15
18
  slug: "Идентификатор"
16
19
  title: "Заголовок"
20
+ url: "URL для страницы"
17
21
  stored_value:
18
22
  description: "Описание"
19
23
  name: "Название"
@@ -51,13 +55,17 @@ ru:
51
55
  success: "Редактируемая страница успешно удалена"
52
56
  form:
53
57
  guidelines:
58
+ body: "HTML для вставки внутри сайта. Максимум 64кБ текста."
59
+ description: "Метаописание для поисковых роботов, результатов поиска и расшаривания. Максимум 250 символов."
54
60
  image: "Картинка в формате JPG или PNG размером около 640×640 для иллюстрации при расшаривании."
55
- slug: "Используется для вставки внутри сайта. Максимум 100 символов."
61
+ image_alt_text: "Максимум 250 символов."
62
+ keywords: "Значение для meta keywords (для поисковых роботов). Максимум 250 символов."
56
63
  name: "Внутреннее название для удобства. Максимум 100 символов."
57
64
  title: "Будет отображаться в заголовке окна. Максимум 250 символов."
58
- keywords: "Значение для meta keywords (для поисковых роботов). Максимум 250 символов."
59
- description: "Метаописание для поисковых роботов, результатов поиска и расшаривания. Максимум 250 символов."
60
- body: "HTML для вставки внутри сайта. Максимум 64кБ текста."
65
+ slug: "Используется для вставки внутри сайта. Максимум 100 символов."
66
+ url: "Абсолютный путь"
67
+ placeholders:
68
+ url: "/about/editable-pages"
61
69
  stored_values:
62
70
  new:
63
71
  heading: "Новое хранимое значение"