biovision-base 0.5.170614 → 0.7.170709

Sign up to get free protection for your applications and to get access to all the features.
Files changed (136) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +12 -0
  3. data/app/assets/images/biovision/base/placeholders/image.svg +1 -1
  4. data/app/assets/images/biovision/base/placeholders/region_image.svg +1 -0
  5. data/app/assets/stylesheets/biovision/base/admin.scss +226 -31
  6. data/app/assets/stylesheets/biovision/base/biovision.scss +45 -104
  7. data/app/assets/stylesheets/biovision/base/buttons.scss +3 -2
  8. data/app/assets/stylesheets/biovision/base/default.scss +66 -45
  9. data/app/assets/stylesheets/biovision/base/default_admin.scss +10 -0
  10. data/app/assets/stylesheets/biovision/base/default_application.scss +8 -0
  11. data/app/assets/stylesheets/biovision/base/filters.scss +4 -4
  12. data/app/assets/stylesheets/biovision/base/layout.scss +113 -0
  13. data/app/assets/stylesheets/biovision/base/message-box.scss +3 -3
  14. data/app/assets/stylesheets/biovision/base/regions.scss +9 -0
  15. data/app/assets/stylesheets/biovision/base/tootik.scss +6 -6
  16. data/app/assets/stylesheets/biovision/base/track.scss +7 -6
  17. data/app/assets/stylesheets/biovision/base/users.scss +64 -0
  18. data/app/controllers/admin/login_attempts_controller.rb +6 -0
  19. data/app/controllers/admin/privileges_controller.rb +37 -1
  20. data/app/controllers/admin/regions_controller.rb +37 -0
  21. data/app/controllers/admin/users_controller.rb +2 -2
  22. data/app/controllers/authentication_controller.rb +27 -26
  23. data/app/controllers/concerns/authentication.rb +20 -0
  24. data/app/controllers/my/confirmations_controller.rb +8 -3
  25. data/app/controllers/my/login_attempts_controller.rb +9 -0
  26. data/app/controllers/my/profiles_controller.rb +10 -2
  27. data/app/controllers/my/tokens_controller.rb +20 -0
  28. data/app/controllers/regions_controller.rb +73 -0
  29. data/app/helpers/biovision_regions_helper.rb +22 -0
  30. data/app/mailers/application_mailer.rb +5 -0
  31. data/app/mailers/user_mailer.rb +8 -0
  32. data/app/models/central_region.rb +49 -0
  33. data/app/models/concerns/required_unique_name.rb +1 -1
  34. data/app/models/concerns/required_unique_slug.rb +1 -1
  35. data/app/models/login_attempt.rb +24 -0
  36. data/app/models/privilege.rb +176 -1
  37. data/app/models/region.rb +100 -0
  38. data/app/models/user.rb +118 -1
  39. data/app/models/user_privilege.rb +52 -1
  40. data/app/services/code_manager/confirmation.rb +1 -1
  41. data/app/services/user_bouncer.rb +37 -0
  42. data/app/uploaders/header_image_uploader.rb +50 -0
  43. data/app/uploaders/region_image_uploader.rb +53 -0
  44. data/app/views/admin/agents/entity/_preview.jbuilder +8 -0
  45. data/app/views/admin/codes/index.html.erb +1 -1
  46. data/app/views/admin/editable_pages/index.html.erb +1 -1
  47. data/app/views/admin/index/index.html.erb +4 -0
  48. data/app/views/admin/login_attempts/_nav_item.html.erb +6 -0
  49. data/app/views/admin/login_attempts/entity/_in_list.html.erb +16 -0
  50. data/app/views/admin/login_attempts/included/_agents.jbuilder +3 -0
  51. data/app/views/admin/login_attempts/included/_users.jbuilder +3 -0
  52. data/app/views/admin/login_attempts/index.html.erb +16 -0
  53. data/app/views/admin/login_attempts/index.jbuilder +28 -0
  54. data/app/views/admin/privilege_groups/index.html.erb +1 -1
  55. data/app/views/admin/privileges/_toggleable.html.erb +7 -0
  56. data/app/views/admin/privileges/entity/_in_list.html.erb +1 -0
  57. data/app/views/admin/privileges/entity/_region.html.erb +12 -0
  58. data/app/views/admin/privileges/regions.jbuilder +10 -0
  59. data/app/views/admin/privileges/show.html.erb +2 -0
  60. data/app/views/admin/regions/_nav_item.html.erb +2 -0
  61. data/app/views/admin/regions/_toggleable.html.erb +7 -0
  62. data/app/views/admin/regions/entity/_in_list.html.erb +32 -0
  63. data/app/views/admin/regions/index.html.erb +22 -0
  64. data/app/views/admin/regions/show.html.erb +95 -0
  65. data/app/views/admin/tokens/index.html.erb +1 -1
  66. data/app/views/admin/users/_search.html.erb +1 -1
  67. data/app/views/admin/users/entity/_preview.jbuilder +12 -0
  68. data/app/views/admin/users/entity/_privilege.html.erb +23 -7
  69. data/app/views/admin/users/entity/_privilege_tree.html.erb +2 -2
  70. data/app/views/admin/users/privileges.html.erb +47 -12
  71. data/app/views/admin/users/show.html.erb +17 -1
  72. data/app/views/admin/users/tokens.html.erb +1 -1
  73. data/app/views/authentication/new.html.erb +1 -2
  74. data/app/views/layouts/admin/_footer.html.erb +8 -0
  75. data/app/views/layouts/application/_footer.html.erb +5 -0
  76. data/app/views/layouts/application/_header.html.erb +9 -0
  77. data/app/views/layouts/application/header/_authentication.html.erb +7 -0
  78. data/app/views/layouts/application/header/_logo.html.erb +3 -0
  79. data/app/views/layouts/application/header/_navigation.html.erb +0 -0
  80. data/app/views/layouts/application/header/authentication/_links.html.erb +4 -0
  81. data/app/views/layouts/application/header/authentication/_plate.html.erb +4 -0
  82. data/app/views/layouts/mailer.html.erb +13 -0
  83. data/app/views/layouts/mailer.text.erb +1 -0
  84. data/app/views/my/confirmations/show.html.erb +11 -1
  85. data/app/views/my/index/index.html.erb +6 -4
  86. data/app/views/{admin/tokens → my/login_attempts}/_list.html.erb +1 -1
  87. data/app/views/my/login_attempts/_nav_item.html.erb +6 -0
  88. data/app/views/my/login_attempts/entity/_in_list.html.erb +13 -0
  89. data/app/views/my/login_attempts/included/_agents.jbuilder +7 -0
  90. data/app/views/my/login_attempts/index.html.erb +13 -0
  91. data/app/views/my/login_attempts/index.jbuilder +22 -0
  92. data/app/views/my/profiles/_nav_item.html.erb +6 -0
  93. data/app/views/my/profiles/new/_form.html.erb +49 -23
  94. data/app/views/my/profiles/new.html.erb +2 -2
  95. data/app/views/{admin/codes → my/tokens}/_list.html.erb +1 -1
  96. data/app/views/my/tokens/_nav_item.html.erb +6 -0
  97. data/app/views/my/tokens/_toggleable.html.erb +7 -0
  98. data/app/views/my/tokens/entity/_in_list.html.erb +18 -0
  99. data/app/views/my/tokens/index.html.erb +13 -0
  100. data/app/views/privileges/_form.html.erb +7 -0
  101. data/app/views/regions/_form.html.erb +73 -0
  102. data/app/views/regions/edit.html.erb +20 -0
  103. data/app/views/regions/new.html.erb +17 -0
  104. data/app/views/shared/_counters.html.erb +0 -0
  105. data/app/views/shared/_pagination.jbuilder +9 -0
  106. data/app/views/{admin/editable_pages → shared/admin}/_list.html.erb +2 -2
  107. data/app/views/user_mailer/login_attempt.html.erb +7 -0
  108. data/config/locales/common-ru.yml +5 -0
  109. data/config/locales/editable-pages-ru.yml +1 -1
  110. data/config/locales/regions-ru.yml +62 -0
  111. data/config/locales/users-ru.yml +48 -6
  112. data/config/routes.rb +19 -2
  113. data/db/migrate/20170301000201_create_regions.rb +32 -0
  114. data/db/migrate/20170302000001_create_users.rb +1 -0
  115. data/db/migrate/20170302000101_create_privileges.rb +2 -0
  116. data/db/migrate/20170302000102_create_user_privileges.rb +1 -0
  117. data/db/migrate/20170302000103_create_privilege_groups.rb +1 -0
  118. data/db/migrate/20170302000104_create_privilege_group_privileges.rb +4 -0
  119. data/db/migrate/20170629120000_create_login_attempts.rb +19 -0
  120. data/lib/biovision/base/engine.rb +6 -0
  121. data/lib/biovision/base/privilege_methods.rb +21 -3
  122. data/lib/biovision/base/version.rb +1 -1
  123. data/lib/tasks/{biovision/agents.rake → agents.rake} +0 -0
  124. data/lib/tasks/{biovision/browsers.rake → browsers.rake} +0 -0
  125. data/lib/tasks/{biovision/codes.rake → codes.rake} +0 -0
  126. data/lib/tasks/regions.rake +70 -0
  127. data/lib/tasks/{biovision/tokens.rake → tokens.rake} +0 -0
  128. data/lib/tasks/{biovision/users.rake → users.rake} +0 -0
  129. metadata +75 -17
  130. data/app/assets/stylesheets/biovision/base/fonts.scss +0 -9
  131. data/app/controllers/concerns/biovision/admin/privileges.rb +0 -34
  132. data/app/models/concerns/biovision/privilege_base.rb +0 -143
  133. data/app/models/concerns/biovision/user_base.rb +0 -124
  134. data/app/models/concerns/biovision/user_privilege_base.rb +0 -46
  135. data/app/views/admin/privilege_groups/_list.html.erb +0 -11
  136. data/app/views/authentication/_info.html.erb +0 -8
@@ -0,0 +1,3 @@
1
+ <div class="logo">
2
+ <%= link_to(t('shared.meta_texts.site_name'), root_path) %>
3
+ </div>
@@ -0,0 +1,4 @@
1
+ <div class="links">
2
+ <%= link_to(t('authentication.nav_item.log_in'), login_path) %>
3
+ <%= link_to(t('authentication.nav_item.join'), new_my_profile_path) %>
4
+ </div>
@@ -0,0 +1,4 @@
1
+ <div class="plate">
2
+ <%= link_to current_user.profile_name, my_path, class: "profile" %>
3
+ <%= link_to t('authentication.info.logout'), logout_path, method: :delete, class: 'logout' %>
4
+ </div>
@@ -0,0 +1,13 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
5
+ <style>
6
+ /* Email styles need to be inline */
7
+ </style>
8
+ </head>
9
+
10
+ <body>
11
+ <%= yield %>
12
+ </body>
13
+ </html>
@@ -0,0 +1 @@
1
+ <%= yield %>
@@ -5,7 +5,7 @@
5
5
  <% if current_user&.email_confirmed? %>
6
6
  <div class="message-box-notice"><%= t('activerecord.attributes.user.email_confirmed') %></div>
7
7
  <% else %>
8
- <section>
8
+ <section id="confirmation-container">
9
9
  <h2><%= t('.got_code') %></h2>
10
10
  <%= form_tag my_confirmation_path, method: :patch do %>
11
11
  <div>
@@ -18,6 +18,16 @@
18
18
  <% end %>
19
19
  </section>
20
20
 
21
+ <% unless param_from_request(:instant).blank? %>
22
+ <script>
23
+ 'use strict';
24
+
25
+ $(function () {
26
+ $('#confirmation-container').find('form').submit();
27
+ });
28
+ </script>
29
+ <% end %>
30
+
21
31
  <section>
22
32
  <h2><%= t('.no_code') %></h2>
23
33
  <%= form_tag my_confirmation_path, method: :post do %>
@@ -6,10 +6,12 @@
6
6
  <div class="dashboard">
7
7
  <nav>
8
8
  <ul>
9
- <li>
10
- <div><%= link_to t('my.profiles.show.heading'), my_profile_path %></div>
11
- <div class="description"><%= t('my.profiles.show.description') %></div>
12
- </li>
9
+ <li><%= render 'my/profiles/nav_item' %></li>
10
+ <li><%= render 'my/tokens/nav_item' %></li>
11
+ <li><%= render 'my/login_attempts/nav_item' %></li>
12
+ <% if UserPrivilege.user_has_any_privilege?(current_user) %>
13
+ <li><%= link_to t('admin.index.index.heading'), admin_path %></li>
14
+ <% end %>
13
15
  <li><%= link_to t(:logout), logout_path, method: :delete %></li>
14
16
  </ul>
15
17
  </nav>
@@ -2,7 +2,7 @@
2
2
  <ul class="list-of-entities">
3
3
  <% collection.each do |entity| %>
4
4
  <li data-id="<%= entity.id %>">
5
- <%= render partial: 'admin/tokens/entity/in_list', locals: { entity: entity } %>
5
+ <%= render partial: 'my/login_attempts/entity/in_list', locals: { entity: entity } %>
6
6
  </li>
7
7
  <% end %>
8
8
  </ul>
@@ -0,0 +1,6 @@
1
+ <div>
2
+ <%= link_to t('.text'), my_login_attempts_path %>
3
+ </div>
4
+ <div class="description">
5
+ <%= t('.description') %>
6
+ </div>
@@ -0,0 +1,13 @@
1
+ <div class="data">
2
+ <div><%= time_tag(entity.created_at) %></div>
3
+ <div class="info">
4
+ <%= t('activerecord.attributes.login_attempt.password') %>:
5
+ <%= entity.password %>
6
+ </div>
7
+ <div class="secondary info">
8
+ <div><%= entity.ip %></div>
9
+ <% unless entity.agent.blank? %>
10
+ <div class="truncate"><%= entity.agent.name %></div>
11
+ <% end %>
12
+ </div>
13
+ </div>
@@ -0,0 +1,7 @@
1
+ json.(agents) do |agent|
2
+ json.id agent.id
3
+ json.type agent.class.table_name
4
+ json.attributes do
5
+ json.(agent, :name)
6
+ end
7
+ end
@@ -0,0 +1,13 @@
1
+ <% content_for :meta_title, t('.title', page: current_page) %>
2
+ <% content_for :breadcrumbs do %>
3
+ <%= link_to(t('my.profiles.nav_item.text'), my_profile_path) %>
4
+ <span><%= t('my.login_attempts.nav_item.text') %></span>
5
+ <% end %>
6
+
7
+ <article class="entity-page">
8
+ <h1><%= t('.heading') %></h1>
9
+
10
+ <%= paginate @collection %>
11
+ <%= render partial: 'list', locals: { collection: @collection } %>
12
+ <%= paginate @collection %>
13
+ </article>
@@ -0,0 +1,22 @@
1
+ json.data @collection do |entity|
2
+ json.id entity.id
3
+ json.type entity.class.table_name
4
+ json.attributes do
5
+ json.(entity, :created_at, :password)
6
+ json.ip entity.ip.to_s
7
+ end
8
+ unless entity.agent.nil?
9
+ json.relationships do
10
+ json.agent do
11
+ json.data do
12
+ json.id entity.agent_id
13
+ json.type entity.agent.class.table_name
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end
19
+ json.included do
20
+ json.partial! 'my/login_attempts/included/agents', locals: { agents: Agent.where(id: @collection.pluck(:agent_id).uniq) }
21
+ end
22
+ json.partial! 'shared/pagination', locals: { collection: @collection }
@@ -0,0 +1,6 @@
1
+ <div>
2
+ <%= link_to t('.text'), my_profile_path %>
3
+ </div>
4
+ <div class="description">
5
+ <%= t('.description') %>
6
+ </div>
@@ -1,34 +1,60 @@
1
- <section class="form">
2
- <h2><%= t('.registration_form') %></h2>
3
-
1
+ <section>
4
2
  <%= render partial: 'shared/list_of_errors', locals: { entity: entity } %>
5
3
 
6
4
  <%= form_tag my_profile_path do %>
7
- <div>
8
- <div><%= label_tag :user_screen_name, t('activerecord.attributes.user.screen_name') %></div>
9
- <%= text_field_tag 'user[screen_name]', entity.screen_name, required: true, size: 30, maxlength: 30 %>
10
- </div>
11
- <div>
12
- <div><%= label_tag :user_password, t('activerecord.attributes.user.password') %></div>
13
- <%= password_field_tag 'user[password]', '', required: true, size: 30, maxlength: 70 %>
14
- </div>
15
- <div>
16
- <div><%= label_tag :user_password_confirmation, t('activerecord.attributes.user.password_confirmation') %></div>
17
- <%= password_field_tag 'user[password_confirmation]', '', required: true, size: 30, maxlength: 70 %>
18
- </div>
19
- <div>
20
- <div><%= label_tag :user_email, t('activerecord.attributes.user.email') %></div>
21
- <%= email_field_tag 'user[email]', entity.email, size: 50, maxlength: User::EMAIL_LIMIT %>
22
- </div>
23
- <div>
5
+ <dl>
6
+ <dt>
7
+ <%= label_tag :user_screen_name, t('activerecord.attributes.user.screen_name') %>
8
+ </dt>
9
+ <dd>
10
+ <%= text_field_tag 'user[screen_name]', entity.screen_name, required: true, size: 30, maxlength: 30 %>
11
+ <div class="guideline"><%= t('.guidelines.screen_name') %></div>
12
+ </dd>
13
+
14
+ <dt>
15
+ <%= label_tag :user_password, t('activerecord.attributes.user.password') %>
16
+ </dt>
17
+ <dd>
18
+ <%= password_field_tag 'user[password]', '', required: true, size: nil, maxlength: 70 %>
19
+ <div class="guideline"><%= t('.guidelines.password') %></div>
20
+ </dd>
21
+
22
+ <dt>
23
+ <%= label_tag :user_password_confirmation, t('activerecord.attributes.user.password_confirmation') %>
24
+ </dt>
25
+ <dd>
26
+ <%= password_field_tag 'user[password_confirmation]', '', required: true, size: nil, maxlength: 70 %>
27
+ <div class="guideline"><%= t('.guidelines.password_confirmation') %></div>
28
+ </dd>
29
+
30
+ <dt>
31
+ <%= label_tag :user_email, t('activerecord.attributes.user.email') %>
32
+ </dt>
33
+ <dd>
34
+ <%= email_field_tag 'user[email]', entity.email, size: nil, maxlength: User::EMAIL_LIMIT, required: true %>
35
+ <div class="guideline"><%= t('.guidelines.email') %></div>
36
+ </dd>
37
+ </dl>
38
+
39
+ <ul class="flags">
40
+ <li>
41
+ <%= check_box_tag 'user[consent]', '1', false, required: true %>
42
+ <%= label_tag :user_consent, t('.consent') %>
43
+ </li>
44
+ <li>
45
+ <%= check_box_tag 'user[allow_mail]', '1', entity.allow_mail %>
46
+ <%= label_tag :user_allow_mail, t('activerecord.attributes.user.allow_mail') %>
47
+ </li>
48
+ </ul>
49
+
50
+ <div class="trap">
24
51
  <%= check_box_tag :agree %>
25
52
  <%= label_tag :agree, t('.i_am_bot') %>
26
53
  </div>
27
- <div>
28
- <p><%= t('.you_accept_terms_of_service') %></p>
29
- </div>
54
+
30
55
  <div>
31
56
  <%= button_tag t('my.profiles.new.title'), type: :submit, name: 'button' %>
57
+ <%= link_to t('authentication.nav_item.log_in'), login_path, class: 'nav-button' %>
32
58
  </div>
33
59
  <% end %>
34
60
  </section>
@@ -1,7 +1,7 @@
1
1
  <% content_for :meta_title, t('.title') %>
2
2
 
3
- <article class="new-profile">
4
- <h1><%= t('.title') %></h1>
3
+ <article class="my-profile-new">
4
+ <h1><%= t('.heading') %></h1>
5
5
 
6
6
  <%= render partial: 'my/profiles/new/form', locals: { entity: @user } %>
7
7
  </article>
@@ -2,7 +2,7 @@
2
2
  <ul class="list-of-entities">
3
3
  <% collection.each do |entity| %>
4
4
  <li data-id="<%= entity.id %>">
5
- <%= render partial: 'admin/codes/entity/in_list', locals: { entity: entity } %>
5
+ <%= render partial: 'my/tokens/entity/in_list', locals: { entity: entity } %>
6
6
  </li>
7
7
  <% end %>
8
8
  </ul>
@@ -0,0 +1,6 @@
1
+ <div>
2
+ <%= link_to t('.text'), my_tokens_path %>
3
+ </div>
4
+ <div class="description">
5
+ <%= t('.description') %>
6
+ </div>
@@ -0,0 +1,7 @@
1
+ <div class="toggleable" data-url="<%= toggle_my_token_path(entity.id) %>">
2
+ <% Token.toggleable_attributes.each do |flag| %>
3
+ <span class="<%= entity.attributes[flag.to_s] ? 'active' : 'inactive' %>" data-flag="<%= flag %>">
4
+ <%= t("activerecord.attributes.token.#{flag}") %>
5
+ </span>
6
+ <% end %>
7
+ </div>
@@ -0,0 +1,18 @@
1
+ <div class="data">
2
+ <div><%= "#{entity.ip}/#{entity.token}" %></div>
3
+ <div class="info">
4
+ <% unless entity.last_used.nil? %>
5
+ <div>
6
+ <%= t('activerecord.attributes.token.last_used') %>
7
+ <%= time_tag entity.last_used %>
8
+ </div>
9
+ <% end %>
10
+ </div>
11
+ <div class="secondary info">
12
+ <div><%= t(:created_at) %>: <%= time_tag(entity.created_at) %></div>
13
+ <% unless entity.agent.blank? %>
14
+ <div class="truncate"><%= entity.agent.name %></div>
15
+ <% end %>
16
+ </div>
17
+ <%= render partial: 'my/tokens/toggleable', locals: { entity: entity } %>
18
+ </div>
@@ -0,0 +1,13 @@
1
+ <% content_for :meta_title, t('.title', page: current_page) %>
2
+ <% content_for :breadcrumbs do %>
3
+ <%= link_to(t('my.profiles.nav_item.text'), my_profile_path) %>
4
+ <span><%= t('my.tokens.nav_item.text') %></span>
5
+ <% end %>
6
+
7
+ <article class="entity-page">
8
+ <h1><%= t('.heading') %></h1>
9
+
10
+ <%= paginate @collection %>
11
+ <%= render partial: 'list', locals: { collection: @collection } %>
12
+ <%= paginate @collection %>
13
+ </article>
@@ -35,6 +35,13 @@
35
35
  </dd>
36
36
  </dl>
37
37
 
38
+ <ul class="flags">
39
+ <li>
40
+ <%= f.check_box :regional %>
41
+ <%= f.label :regional %>
42
+ </li>
43
+ </ul>
44
+
38
45
  <div class="buttons">
39
46
  <%= f.hidden_field :parent_id if entity.id.nil? %>
40
47
  <%= f.button t(:save), type: :submit %>
@@ -0,0 +1,73 @@
1
+ <%= render partial: 'shared/list_of_errors', locals: { entity: entity } %>
2
+
3
+ <%= form_for entity do |f| %>
4
+ <dl>
5
+ <dt><%= f.label :image %></dt>
6
+ <dd>
7
+ <figure class="preview" id="region-image">
8
+ <% if entity.image.blank? %>
9
+ <% image = image_tag('biovision/base/placeholders/region_image.svg') %>
10
+ <% else %>
11
+ <% image = image_tag(entity.image.url) %>
12
+ <% end %>
13
+ <%= label_tag('region_image', image) %>
14
+ <figcaption>
15
+ <%= f.file_field :image, accept: 'image/jpeg,image/png', data: { image: 'region-image' } %>
16
+ </figcaption>
17
+ </figure>
18
+ </dd>
19
+ <dt><%= f.label :header_image %></dt>
20
+ <dd>
21
+ <figure class="preview" id="region-header-image">
22
+ <% if entity.header_image.blank? %>
23
+ <% header_image = image_tag('biovision/base/placeholders/image.svg') %>
24
+ <% else %>
25
+ <% header_image = image_tag(entity.header_image.medium.url) %>
26
+ <% end %>
27
+ <%= label_tag('region_header_image', header_image) %>
28
+ <figcaption>
29
+ <%= f.file_field :header_image, accept: 'image/jpeg,image/png', data: { image: 'region-header-image' } %>
30
+ <div class="guideline"><%= t('.guidelines.header_image') %></div>
31
+ </figcaption>
32
+ </figure>
33
+ </dd>
34
+
35
+ <dt><%= f.label :name %></dt>
36
+ <dd>
37
+ <%= f.text_field :name, required: true, size: nil, maxlength: Region::NAME_LIMIT %>
38
+ </dd>
39
+
40
+ <dt><%= f.label :short_name %></dt>
41
+ <dd>
42
+ <%= f.text_field :short_name, required: true, size: nil, maxlength: Region::NAME_LIMIT %>
43
+ <div class="guideline">
44
+ <%= t('.guidelines.short_name') %>
45
+ </div>
46
+ </dd>
47
+
48
+ <dt><%= f.label :locative %></dt>
49
+ <dd>
50
+ <%= f.text_field :locative, required: true, size: nil, maxlength: Region::NAME_LIMIT, placeholder: t('.placeholders.locative') %>
51
+ <div class="guideline">
52
+ <%= t('.guidelines.locative') %>
53
+ </div>
54
+ </dd>
55
+
56
+ <dt><%= f.label :slug %></dt>
57
+ <dd>
58
+ <%= f.text_field :slug, required: true, size: nil, maxlength: Region::SLUG_LIMIT %>
59
+ <div class="guideline">
60
+ <%= t('.guidelines.slug') %>
61
+ </div>
62
+ </dd>
63
+ </dl>
64
+
65
+ <ul class="flags">
66
+ <li><%= f.check_box :visible %><%= f.label :visible %></li>
67
+ </ul>
68
+
69
+ <div class="buttons">
70
+ <%= f.hidden_field :parent_id if entity.id.nil? %>
71
+ <%= f.button t(:save), type: :submit %>
72
+ </div>
73
+ <% end %>
@@ -0,0 +1,20 @@
1
+ <% content_for :meta_title, t('.title') %>
2
+ <% content_for :breadcrumbs do %>
3
+ <%= link_to(t('admin.regions.nav_item.text'), admin_regions_path) %>
4
+ <% @entity.parents.each do |parent| %>
5
+ <%= admin_region_link(parent) %>
6
+ <% end %>
7
+ <%= admin_region_link(@entity) %>
8
+ <span><%= t(:edit) %></span>
9
+ <% end %>
10
+
11
+ <article class="entity-page">
12
+ <h1><%= t('.title') %></h1>
13
+
14
+ <ul class="actions">
15
+ <li><%= return_icon(admin_region_path(@entity.id)) %></li>
16
+ <li class="danger"><%= destroy_icon(@entity) %></li>
17
+ </ul>
18
+
19
+ <%= render partial: 'form', locals: { entity: @entity } %>
20
+ </article>
@@ -0,0 +1,17 @@
1
+ <% content_for :meta_title, t('.title') %>
2
+ <% content_for :breadcrumbs do %>
3
+ <%= link_to(t('admin.regions.nav_item.text'), admin_regions_path) %>
4
+ <span><%= t(:create) %></span>
5
+ <% end %>
6
+
7
+ <article class="entity-page">
8
+ <h1><%= t('.heading') %></h1>
9
+
10
+ <% unless @entity.parent.nil? %>
11
+ <ul class="actions">
12
+ <li><%= return_icon(admin_region_path(@entity.parent_id)) %></li>
13
+ </ul>
14
+ <% end %>
15
+
16
+ <%= render partial: 'form', locals: { entity: @entity } %>
17
+ </article>
File without changes
@@ -0,0 +1,9 @@
1
+ if collection.respond_to?(:current_page)
2
+ json.links do
3
+ json.self url_for(page: collection.current_page)
4
+ unless collection.next_page.nil?
5
+ json.next url_for(page: collection.next_page)
6
+ end
7
+ json.last url_for(page: collection.total_pages)
8
+ end
9
+ end
@@ -1,8 +1,8 @@
1
1
  <% if collection.any? %>
2
2
  <ul class="list-of-entities">
3
3
  <% collection.each do |entity| %>
4
- <li>
5
- <%= render partial: 'admin/editable_pages/entity/in_list', locals: { entity: entity } %>
4
+ <li data-id="<%= entity.id %>">
5
+ <%= render partial: "admin/#{entity.class.table_name}/entity/in_list", locals: { entity: entity } %>
6
6
  </li>
7
7
  <% end %>
8
8
  </ul>
@@ -0,0 +1,7 @@
1
+ <h1><%= t('.greeting', name: @user.profile_name) %></h1>
2
+
3
+ <p><%= t('.message') %></p>
4
+ <p>
5
+ <%= t('.you_can_recover_password') %>:
6
+ <%= link_to(my_recovery_url, my_recovery_url) %>
7
+ </p>
@@ -52,6 +52,7 @@ ru:
52
52
  home: "Главная"
53
53
  untitled: "Без названия"
54
54
  hide: "Скрыть"
55
+ copyright: "2017"
55
56
  view_as_visitor: "Посмотреть на странице"
56
57
  view_as_administrator: "Посмотреть в админке"
57
58
  views:
@@ -94,3 +95,7 @@ ru:
94
95
  title: "Сервис недоступен"
95
96
  heading: "Сервис недоступен"
96
97
  message: "Сервис временно недоступен. Попробуйте повторить попытку позже"
98
+ layouts:
99
+ admin:
100
+ footer:
101
+ support: "Поддержка"
@@ -29,7 +29,7 @@ ru:
29
29
  title: "Редактирование редактируемой страницы"
30
30
  heading: "Редактирование редактируемой страницы"
31
31
  update:
32
- success: "Редактируемая страница успешно изменера"
32
+ success: "Редактируемая страница успешно изменена"
33
33
  destroy:
34
34
  success: "Редактируемая страница успешно удалена"
35
35
  form:
@@ -0,0 +1,62 @@
1
+ ru:
2
+ activerecord:
3
+ models:
4
+ region: "Регион"
5
+ attributes:
6
+ region:
7
+ parent_id: "Родительский регион"
8
+ visible: "Показывать"
9
+ name: "Название"
10
+ slug: "Код"
11
+ long_slug: "Код для пути в URL"
12
+ image: "Герб"
13
+ header_image: "Картинка для шапки"
14
+ parents_cache: "Кеш родителей"
15
+ children_cache: "Кеш дочек"
16
+ latitude: "Широта центральной точки"
17
+ longitude: "Долгота центральной точки"
18
+ short_name: "Короткое название"
19
+ locative: "Локатив"
20
+ central_region:
21
+ name: "Центр"
22
+ short_name: "Центр"
23
+ locative: "в центре"
24
+ admin:
25
+ regions:
26
+ nav_item:
27
+ text: "Регионы"
28
+ description: "Управление регионами"
29
+ index:
30
+ title: "Регионы"
31
+ heading: "Регионы"
32
+ show:
33
+ title: "Регион «%{name}»"
34
+ children: "Дочерние регионы"
35
+ users:
36
+ entity:
37
+ privilege:
38
+ select_regions: "Выбрать регионы…"
39
+ privileges:
40
+ entity:
41
+ region:
42
+ deeper_level: "Уровни глубже…"
43
+ regions:
44
+ new:
45
+ title: "Новый регион"
46
+ heading: "Добавление региона"
47
+ edit:
48
+ title: "Редактирование региона"
49
+ heading: "Редактирование региона"
50
+ forbidden: "Редактирование этого региона запрещено"
51
+ update:
52
+ success: "Регион успешно изменён"
53
+ destroy:
54
+ success: "Регион успешно удалён"
55
+ form:
56
+ placeholders:
57
+ locative: "в Москве"
58
+ guidelines:
59
+ header_image: "Картинка в формате JPG или PNG размером 1000×220 (лишнее будет обрезано автоматически)"
60
+ slug: "Используется адресной строке. Только латинские буквы, дефис (кроме границ) и цифры, до 63 символов."
61
+ short_name: "Используется в списках"
62
+ locative: "Используется в предложениях вида «в таком-то регионе»"