biovision-base 0.5.170614

Sign up to get free protection for your applications and to get access to all the features.
Files changed (271) hide show
  1. checksums.yaml +7 -0
  2. data/MIT-LICENSE +20 -0
  3. data/README.md +42 -0
  4. data/Rakefile +26 -0
  5. data/app/assets/config/biovision_base_manifest.js +0 -0
  6. data/app/assets/images/biovision/base/icons/alert.svg +15 -0
  7. data/app/assets/images/biovision/base/icons/back.svg +28 -0
  8. data/app/assets/images/biovision/base/icons/create.svg +1 -0
  9. data/app/assets/images/biovision/base/icons/destroy.svg +3 -0
  10. data/app/assets/images/biovision/base/icons/edit.svg +22 -0
  11. data/app/assets/images/biovision/base/icons/exit.svg +1 -0
  12. data/app/assets/images/biovision/base/icons/foreign/facebook.svg +1 -0
  13. data/app/assets/images/biovision/base/icons/gear.svg +4 -0
  14. data/app/assets/images/biovision/base/icons/lock-closed.svg +1 -0
  15. data/app/assets/images/biovision/base/icons/lock-open.svg +1 -0
  16. data/app/assets/images/biovision/base/icons/notice.svg +1 -0
  17. data/app/assets/images/biovision/base/icons/return.svg +1 -0
  18. data/app/assets/images/biovision/base/icons/warning.svg +43 -0
  19. data/app/assets/images/biovision/base/icons/world.svg +4 -0
  20. data/app/assets/images/biovision/base/placeholders/image.svg +19 -0
  21. data/app/assets/images/biovision/base/placeholders/photo.svg +23 -0
  22. data/app/assets/images/biovision/base/placeholders/user.svg +21 -0
  23. data/app/assets/javascripts/biovision/base/biovision.js +238 -0
  24. data/app/assets/stylesheets/biovision/base/admin.scss +58 -0
  25. data/app/assets/stylesheets/biovision/base/biovision.scss +472 -0
  26. data/app/assets/stylesheets/biovision/base/buttons.scss +90 -0
  27. data/app/assets/stylesheets/biovision/base/default.scss +45 -0
  28. data/app/assets/stylesheets/biovision/base/filters.scss +53 -0
  29. data/app/assets/stylesheets/biovision/base/fonts.scss +9 -0
  30. data/app/assets/stylesheets/biovision/base/message-box.scss +60 -0
  31. data/app/assets/stylesheets/biovision/base/pagination.scss +42 -0
  32. data/app/assets/stylesheets/biovision/base/tootik.scss +385 -0
  33. data/app/assets/stylesheets/biovision/base/track.scss +28 -0
  34. data/app/controllers/admin/agents_controller.rb +30 -0
  35. data/app/controllers/admin/browsers_controller.rb +30 -0
  36. data/app/controllers/admin/codes_controller.rb +25 -0
  37. data/app/controllers/admin/editable_pages_controller.rb +25 -0
  38. data/app/controllers/admin/index_controller.rb +5 -0
  39. data/app/controllers/admin/metrics_controller.rb +29 -0
  40. data/app/controllers/admin/privilege_groups_controller.rb +48 -0
  41. data/app/controllers/admin/privileges_controller.rb +5 -0
  42. data/app/controllers/admin/tokens_controller.rb +28 -0
  43. data/app/controllers/admin/users_controller.rb +87 -0
  44. data/app/controllers/admin_controller.rb +10 -0
  45. data/app/controllers/agents_controller.rb +67 -0
  46. data/app/controllers/authentication_controller.rb +70 -0
  47. data/app/controllers/browsers_controller.rb +63 -0
  48. data/app/controllers/codes_controller.rb +60 -0
  49. data/app/controllers/concerns/authentication.rb +19 -0
  50. data/app/controllers/concerns/biovision/admin/privileges.rb +34 -0
  51. data/app/controllers/concerns/entity_priority.rb +7 -0
  52. data/app/controllers/concerns/lockable_entity.rb +23 -0
  53. data/app/controllers/concerns/toggleable_entity.rb +7 -0
  54. data/app/controllers/editable_pages_controller.rb +60 -0
  55. data/app/controllers/index_controller.rb +5 -0
  56. data/app/controllers/metrics_controller.rb +33 -0
  57. data/app/controllers/my/confirmations_controller.rb +37 -0
  58. data/app/controllers/my/index_controller.rb +7 -0
  59. data/app/controllers/my/profiles_controller.rb +81 -0
  60. data/app/controllers/my/recoveries_controller.rb +68 -0
  61. data/app/controllers/privilege_groups_controller.rb +57 -0
  62. data/app/controllers/privileges_controller.rb +74 -0
  63. data/app/controllers/profiles_controller.rb +22 -0
  64. data/app/controllers/tokens_controller.rb +60 -0
  65. data/app/controllers/users_controller.rb +57 -0
  66. data/app/helpers/biovision_helper.rb +81 -0
  67. data/app/helpers/biovision_users_helper.rb +52 -0
  68. data/app/helpers/codes_helper.rb +10 -0
  69. data/app/helpers/editable_pages_helper.rb +20 -0
  70. data/app/helpers/privileges_helper.rb +11 -0
  71. data/app/helpers/tracking_helper.rb +17 -0
  72. data/app/jobs/application_job.rb +7 -0
  73. data/app/jobs/clean_tokens_job.rb +8 -0
  74. data/app/mailers/code_sender.rb +15 -0
  75. data/app/models/agent.rb +38 -0
  76. data/app/models/application_record.rb +3 -0
  77. data/app/models/browser.rb +22 -0
  78. data/app/models/code.rb +58 -0
  79. data/app/models/code_type.rb +11 -0
  80. data/app/models/concerns/biovision/privilege_base.rb +143 -0
  81. data/app/models/concerns/biovision/user_base.rb +124 -0
  82. data/app/models/concerns/biovision/user_privilege_base.rb +46 -0
  83. data/app/models/concerns/has_owner.rb +19 -0
  84. data/app/models/concerns/required_unique_name.rb +13 -0
  85. data/app/models/concerns/required_unique_slug.rb +12 -0
  86. data/app/models/concerns/toggleable.rb +29 -0
  87. data/app/models/editable_page.rb +30 -0
  88. data/app/models/foreign_site.rb +75 -0
  89. data/app/models/foreign_user.rb +26 -0
  90. data/app/models/metric.rb +67 -0
  91. data/app/models/metric_value.rb +15 -0
  92. data/app/models/privilege.rb +3 -0
  93. data/app/models/privilege_group.rb +50 -0
  94. data/app/models/privilege_group_privilege.rb +6 -0
  95. data/app/models/token.rb +75 -0
  96. data/app/models/user.rb +3 -0
  97. data/app/models/user_privilege.rb +3 -0
  98. data/app/services/canonizer.rb +29 -0
  99. data/app/services/code_manager.rb +16 -0
  100. data/app/services/code_manager/confirmation.rb +26 -0
  101. data/app/services/code_manager/invitation.rb +27 -0
  102. data/app/services/code_manager/recovery.rb +31 -0
  103. data/app/uploaders/avatar_uploader.rb +62 -0
  104. data/app/uploaders/editable_page_image_uploader.rb +38 -0
  105. data/app/views/admin/agents/_filter.html.erb +16 -0
  106. data/app/views/admin/agents/_list.html.erb +17 -0
  107. data/app/views/admin/agents/_nav_item.html.erb +6 -0
  108. data/app/views/admin/agents/_toggleable.html.erb +7 -0
  109. data/app/views/admin/agents/entity/_in_list.html.erb +13 -0
  110. data/app/views/admin/agents/index.html.erb +17 -0
  111. data/app/views/admin/agents/show.html.erb +28 -0
  112. data/app/views/admin/browsers/_list.html.erb +17 -0
  113. data/app/views/admin/browsers/_nav_item.html.erb +6 -0
  114. data/app/views/admin/browsers/_toggleable.html.erb +7 -0
  115. data/app/views/admin/browsers/agents/_add.html.erb +79 -0
  116. data/app/views/admin/browsers/entity/_in_list.html.erb +13 -0
  117. data/app/views/admin/browsers/index.html.erb +17 -0
  118. data/app/views/admin/browsers/show.html.erb +29 -0
  119. data/app/views/admin/codes/_list.html.erb +11 -0
  120. data/app/views/admin/codes/_nav_item.html.erb +6 -0
  121. data/app/views/admin/codes/entity/_in_list.html.erb +24 -0
  122. data/app/views/admin/codes/index.html.erb +16 -0
  123. data/app/views/admin/codes/show.html.erb +51 -0
  124. data/app/views/admin/editable_pages/_list.html.erb +11 -0
  125. data/app/views/admin/editable_pages/_nav_item.html.erb +6 -0
  126. data/app/views/admin/editable_pages/entity/_in_list.html.erb +13 -0
  127. data/app/views/admin/editable_pages/index.html.erb +14 -0
  128. data/app/views/admin/editable_pages/show.html.erb +47 -0
  129. data/app/views/admin/index/index.html.erb +25 -0
  130. data/app/views/admin/metrics/_list.html.erb +26 -0
  131. data/app/views/admin/metrics/_nav_item.html.erb +6 -0
  132. data/app/views/admin/metrics/data.jbuilder +6 -0
  133. data/app/views/admin/metrics/index.html.erb +14 -0
  134. data/app/views/admin/metrics/show.html.erb +52 -0
  135. data/app/views/admin/privilege_groups/_list.html.erb +11 -0
  136. data/app/views/admin/privilege_groups/_nav_item.html.erb +6 -0
  137. data/app/views/admin/privilege_groups/entity/_in_list.html.erb +10 -0
  138. data/app/views/admin/privilege_groups/index.html.erb +14 -0
  139. data/app/views/admin/privilege_groups/show.html.erb +31 -0
  140. data/app/views/admin/privileges/_list.html.erb +15 -0
  141. data/app/views/admin/privileges/_nav_item.html.erb +6 -0
  142. data/app/views/admin/privileges/entity/_groups.html.erb +34 -0
  143. data/app/views/admin/privileges/entity/_in_list.html.erb +25 -0
  144. data/app/views/admin/privileges/index.html.erb +20 -0
  145. data/app/views/admin/privileges/show.html.erb +66 -0
  146. data/app/views/admin/privileges/users.html.erb +24 -0
  147. data/app/views/admin/tokens/_filter.html.erb +17 -0
  148. data/app/views/admin/tokens/_list.html.erb +11 -0
  149. data/app/views/admin/tokens/_nav_item.html.erb +6 -0
  150. data/app/views/admin/tokens/_toggleable.html.erb +7 -0
  151. data/app/views/admin/tokens/entity/_in_list.html.erb +25 -0
  152. data/app/views/admin/tokens/index.html.erb +19 -0
  153. data/app/views/admin/tokens/show.html.erb +43 -0
  154. data/app/views/admin/users/_filter.html.erb +22 -0
  155. data/app/views/admin/users/_list.html.erb +17 -0
  156. data/app/views/admin/users/_nav_item.html.erb +6 -0
  157. data/app/views/admin/users/_search.html.erb +5 -0
  158. data/app/views/admin/users/_toggleable.html.erb +7 -0
  159. data/app/views/admin/users/codes.html.erb +24 -0
  160. data/app/views/admin/users/entity/_in_list.html.erb +24 -0
  161. data/app/views/admin/users/entity/_privilege.html.erb +10 -0
  162. data/app/views/admin/users/entity/_privilege_tree.html.erb +17 -0
  163. data/app/views/admin/users/index.html.erb +19 -0
  164. data/app/views/admin/users/privileges.html.erb +35 -0
  165. data/app/views/admin/users/search.jbuilder +10 -0
  166. data/app/views/admin/users/search/_results.html.erb +11 -0
  167. data/app/views/admin/users/show.html.erb +94 -0
  168. data/app/views/admin/users/tokens.html.erb +24 -0
  169. data/app/views/agents/_agent.jbuilder +20 -0
  170. data/app/views/agents/_filter.html.erb +53 -0
  171. data/app/views/agents/_form.html.erb +33 -0
  172. data/app/views/agents/edit.html.erb +17 -0
  173. data/app/views/agents/index.jbuilder +5 -0
  174. data/app/views/agents/new.html.erb +15 -0
  175. data/app/views/agents/show.jbuilder +3 -0
  176. data/app/views/application/not_found.html.erb +9 -0
  177. data/app/views/application/not_found.jbuilder +3 -0
  178. data/app/views/application/service_unavailable.html.erb +9 -0
  179. data/app/views/application/unauthorized.html.erb +11 -0
  180. data/app/views/application/unauthorized.jbuilder +3 -0
  181. data/app/views/authentication/_form.html.erb +16 -0
  182. data/app/views/authentication/_info.html.erb +8 -0
  183. data/app/views/authentication/new.html.erb +10 -0
  184. data/app/views/browsers/_form.html.erb +28 -0
  185. data/app/views/browsers/edit.html.erb +17 -0
  186. data/app/views/browsers/new.html.erb +15 -0
  187. data/app/views/code_sender/email.text.erb +9 -0
  188. data/app/views/code_sender/password.text.erb +10 -0
  189. data/app/views/codes/_form.html.erb +49 -0
  190. data/app/views/codes/edit.html.erb +17 -0
  191. data/app/views/codes/new.html.erb +15 -0
  192. data/app/views/editable_pages/_form.html.erb +63 -0
  193. data/app/views/editable_pages/edit.html.erb +17 -0
  194. data/app/views/editable_pages/form/_ckeditor.html.erb +11 -0
  195. data/app/views/editable_pages/new.html.erb +15 -0
  196. data/app/views/index/index.html.erb +5 -0
  197. data/app/views/layouts/admin.html.erb +23 -0
  198. data/app/views/layouts/admin/_footer.html.erb +0 -0
  199. data/app/views/layouts/admin/_header.html.erb +11 -0
  200. data/app/views/layouts/admin/header/_logo.html.erb +3 -0
  201. data/app/views/metrics/_form.html.erb +41 -0
  202. data/app/views/metrics/edit.html.erb +17 -0
  203. data/app/views/metrics/index.jbuilder +7 -0
  204. data/app/views/metrics/show.jbuilder +3 -0
  205. data/app/views/my/confirmations/show.html.erb +30 -0
  206. data/app/views/my/index/index.html.erb +17 -0
  207. data/app/views/my/profiles/edit.html.erb +10 -0
  208. data/app/views/my/profiles/edit/_form.html.erb +70 -0
  209. data/app/views/my/profiles/new.html.erb +7 -0
  210. data/app/views/my/profiles/new/_form.html.erb +34 -0
  211. data/app/views/my/profiles/show.html.erb +3 -0
  212. data/app/views/my/recoveries/show.html.erb +39 -0
  213. data/app/views/privilege_groups/_form.html.erb +25 -0
  214. data/app/views/privilege_groups/edit.html.erb +17 -0
  215. data/app/views/privilege_groups/new.html.erb +15 -0
  216. data/app/views/privileges/_form.html.erb +42 -0
  217. data/app/views/privileges/edit.html.erb +21 -0
  218. data/app/views/privileges/new.html.erb +14 -0
  219. data/app/views/profiles/_profile.html.erb +48 -0
  220. data/app/views/profiles/show.html.erb +4 -0
  221. data/app/views/shared/_flash_messages.html.erb +7 -0
  222. data/app/views/shared/_list_of_errors.html.erb +11 -0
  223. data/app/views/shared/_meta_texts.html.erb +17 -0
  224. data/app/views/shared/_nothing_found.html.erb +1 -0
  225. data/app/views/shared/_track.html.erb +10 -0
  226. data/app/views/shared/actions/_locks.html.erb +4 -0
  227. data/app/views/shared/actions/_priority_changer.html.erb +4 -0
  228. data/app/views/shared/admin/_breadcrumbs.html.erb +6 -0
  229. data/app/views/shared/editable_pages/_body.html.erb +12 -0
  230. data/app/views/shared/filter/_flag.html.erb +17 -0
  231. data/app/views/tokens/_form.html.erb +30 -0
  232. data/app/views/tokens/edit.html.erb +17 -0
  233. data/app/views/tokens/new.html.erb +15 -0
  234. data/app/views/users/_form.html.erb +78 -0
  235. data/app/views/users/edit.html.erb +18 -0
  236. data/app/views/users/new.html.erb +15 -0
  237. data/config/initializers/carrierwave.rb +22 -0
  238. data/config/initializers/pluralization.rb +2 -0
  239. data/config/locales/common-ru.yml +96 -0
  240. data/config/locales/editable-pages-ru.yml +43 -0
  241. data/config/locales/plurals.rb +17 -0
  242. data/config/locales/track-ru.yml +102 -0
  243. data/config/locales/users-ru.yml +324 -0
  244. data/config/routes.rb +92 -0
  245. data/db/migrate/20170301000001_create_metrics.rb +23 -0
  246. data/db/migrate/20170301000002_create_metric_values.rb +19 -0
  247. data/db/migrate/20170301000101_create_browsers.rb +22 -0
  248. data/db/migrate/20170301000102_create_agents.rb +22 -0
  249. data/db/migrate/20170302000001_create_users.rb +52 -0
  250. data/db/migrate/20170302000002_create_tokens.rb +23 -0
  251. data/db/migrate/20170302000003_create_code_types.rb +20 -0
  252. data/db/migrate/20170302000004_create_codes.rb +24 -0
  253. data/db/migrate/20170302000101_create_privileges.rb +34 -0
  254. data/db/migrate/20170302000102_create_user_privileges.rb +17 -0
  255. data/db/migrate/20170302000103_create_privilege_groups.rb +23 -0
  256. data/db/migrate/20170302000104_create_privilege_group_privileges.rb +24 -0
  257. data/db/migrate/20170320000000_create_editable_pages.rb +22 -0
  258. data/db/migrate/20170425000001_create_foreign_sites.rb +18 -0
  259. data/db/migrate/20170425000002_create_foreign_users.rb +23 -0
  260. data/lib/biovision/base.rb +9 -0
  261. data/lib/biovision/base/base_methods.rb +96 -0
  262. data/lib/biovision/base/engine.rb +17 -0
  263. data/lib/biovision/base/privilege_methods.rb +35 -0
  264. data/lib/biovision/base/version.rb +5 -0
  265. data/lib/tasks/biovision/agents.rake +38 -0
  266. data/lib/tasks/biovision/base_tasks.rake +4 -0
  267. data/lib/tasks/biovision/browsers.rake +38 -0
  268. data/lib/tasks/biovision/codes.rake +49 -0
  269. data/lib/tasks/biovision/tokens.rake +54 -0
  270. data/lib/tasks/biovision/users.rake +67 -0
  271. metadata +467 -0
@@ -0,0 +1,48 @@
1
+ <article class="user">
2
+ <h1><%= user.profile_name %></h1>
3
+ <table>
4
+ <caption><%= t('.user_info') %></caption>
5
+ <tbody>
6
+ <tr>
7
+ <td colspan="2">
8
+ <figure><%= profile_avatar(user) %></figure>
9
+ </td>
10
+ </tr>
11
+ <tr>
12
+ <th><%= t('.registration_date') %></th>
13
+ <td><%= time_tag user.created_at %></td>
14
+ </tr>
15
+ <% unless user.last_seen.blank? %>
16
+ <tr>
17
+ <th><%= t('activerecord.attributes.user.last_seen') %></th>
18
+ <td><%= time_tag user.last_seen %></td>
19
+ </tr>
20
+ <% end %>
21
+ <% unless user.name.blank? %>
22
+ <tr>
23
+ <th><%= t('activerecord.attributes.user.name') %></th>
24
+ <td><%= user.name %></td>
25
+ </tr>
26
+ <% end %>
27
+ <% if current_user == user && !user.email.blank? %>
28
+ <tr>
29
+ <th><%= t('activerecord.attributes.user.email') %></th>
30
+ <td><%= user.email %></td>
31
+ </tr>
32
+ <% end %>
33
+ <% unless user.gender.blank? %>
34
+ <tr>
35
+ <th><%= t('activerecord.attributes.user.gender') %></th>
36
+ <td><%= t("activerecord.attributes.user.genders.#{user.gender}") %></td>
37
+ </tr>
38
+ <% end %>
39
+ </tbody>
40
+ <% if current_user == user %>
41
+ <tfoot>
42
+ <tr>
43
+ <td colspan="2"><%= link_to t(:edit), edit_my_profile_path %></td>
44
+ </tr>
45
+ </tfoot>
46
+ <% end %>
47
+ </table>
48
+ </article>
@@ -0,0 +1,4 @@
1
+ <% content_for :meta_title, @entity.profile_name %>
2
+ <% content_for :meta_image, (request.protocol + request.host_with_port + @entity.image.url) unless @entity.image.blank? %>
3
+
4
+ <%= render partial: 'profile', locals: { user: @entity } %>
@@ -0,0 +1,7 @@
1
+ <% %i(notice warning alert).each do |type| %>
2
+ <% if flash[type] %>
3
+ <div class="message-box-<%= type %>" title="<%= t(".#{type}") %>">
4
+ <%= flash[type] %>
5
+ </div>
6
+ <% end %>
7
+ <% end %>
@@ -0,0 +1,11 @@
1
+ <% if entity.errors.any? %>
2
+ <section class="errors">
3
+ <h2><%= t(:error_count, count: entity.errors.count) %></h2>
4
+
5
+ <ol>
6
+ <% entity.errors.full_messages.each do |message| %>
7
+ <li><%= message %></li>
8
+ <% end %>
9
+ </ol>
10
+ </section>
11
+ <% end %>
@@ -0,0 +1,17 @@
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
+ <% if content_for? :meta_description %>
10
+ <meta name="description" content="<%= yield :meta_description %>" />
11
+ <meta property="og:description" content="<%= yield :meta_description %>" />
12
+ <% end %>
13
+ <meta property="og:site_name" content="<%= t('.site_name') %>" />
14
+ <meta property="twitter:title" content="<%= content_for :meta_title %>" />
15
+ <meta name="twitter:site" content="<%= t('.twitter_site') %>" />
16
+ <meta name="twitter:creator" content="<%= t('.twitter_creator') %>" />
17
+ <%= yield :meta_twitter if content_for? :meta_twitter %>
@@ -0,0 +1 @@
1
+ <div class="message-box-warning"><%= t(:nothing_found) %></div>
@@ -0,0 +1,10 @@
1
+ <% if current_user_has_privilege?(:administrator) %>
2
+ <div class="track">
3
+ <% if item.respond_to?(:agent) && !item.agent.nil? %>
4
+ <div class="agent"><%= item.agent.name %></div>
5
+ <% end %>
6
+ <% if item.respond_to?(:ip) && !item.ip.nil? %>
7
+ <div class="ip"><%= item.ip %></div>
8
+ <% end %>
9
+ </div>
10
+ <% end %>
@@ -0,0 +1,4 @@
1
+ <li class="lock" data-url="<%= path %>">
2
+ <%= link_to image_tag('biovision/base/icons/lock-closed.svg'), '#', class: "unlock #{entity.locked? ? '' : 'hidden'}", data: { tootik: t(:locked) } %>
3
+ <%= link_to image_tag('biovision/base/icons/lock-open.svg'), '#', class: "lock #{entity.locked? ? 'hidden' : ''}", data: { tootik: t(:unlocked) } %>
4
+ </li>
@@ -0,0 +1,4 @@
1
+ <li class="priority-changer" data-url="<%= path %>">
2
+ <button data-delta="-1" type="button">&uarr;</button>
3
+ <button data-delta="1" type="button">&darr;</button>
4
+ </li>
@@ -0,0 +1,6 @@
1
+ <% if content_for? :breadcrumbs %>
2
+ <nav class="admin-breadcrumbs">
3
+ <%= link_to(t('admin.index.index.heading'), admin_path) %>
4
+ <%= yield :breadcrumbs %>
5
+ </nav>
6
+ <% end %>
@@ -0,0 +1,12 @@
1
+ <% content_for :meta_title, entity.title %>
2
+ <% content_for :meta_description, entity.description %>
3
+ <% content_for :meta_keywords, entity.keywords %>
4
+ <% content_for :meta_type_extension do %>
5
+ <meta property="og:article:published_time" content="<%= entity.created_at.strftime('%Y-%m-%d') %>"/>
6
+ <meta property="og:article:modified_time" content="<%= entity.updated_at.strftime('%Y-%m-%d') %>"/>
7
+ <% end %>
8
+ <% unless entity.image.blank? %>
9
+ <% content_for :meta_image, (request.protocol + request.host_with_port + entity.image.url) %>
10
+ <% end %>
11
+
12
+ <%= raw entity.body %>
@@ -0,0 +1,17 @@
1
+ <div>
2
+ <div><%= title %></div>
3
+ <ul>
4
+ <li>
5
+ <%= radio_button_tag "filter[#{name}]", '', state.blank? %>
6
+ <%= label_tag "filter_#{name}_", t(:not_set) %>
7
+ </li>
8
+ <li>
9
+ <%= radio_button_tag "filter[#{name}]", '1', state.to_i == 1 %>
10
+ <%= label_tag "filter_#{name}_1", t(:yes) %>
11
+ </li>
12
+ <li>
13
+ <%= radio_button_tag "filter[#{name}]", '0', state == '0' %>
14
+ <%= label_tag "filter_#{name}_0", t(:no) %>
15
+ </li>
16
+ </ul>
17
+ </div>
@@ -0,0 +1,30 @@
1
+ <%= render partial: 'shared/list_of_errors', locals: { entity: entity } %>
2
+
3
+ <%= form_for entity do |f| %>
4
+ <dl>
5
+ <% if entity.id.blank? %>
6
+ <dt><%= f.label :user_id %></dt>
7
+ <dd>
8
+ <%= f.number_field :user_id, in: User.ids_range %>
9
+ <%= render partial: 'admin/users/search', locals: { target_id: 'token_user_id' } %>
10
+ </dd>
11
+ <% else %>
12
+ <dt><%= t('activerecord.attributes.token.user') %></dt>
13
+ <dd>
14
+ <%= admin_user_link entity.user %>
15
+ </dd>
16
+
17
+ <dt><%= t('activerecord.attributes.token.token') %></dt>
18
+ <dd>
19
+ <%= entity.token %>
20
+ </dd>
21
+ <% end %>
22
+ </dl>
23
+ <ul class="flags">
24
+ <li><%= f.check_box :active %><%= f.label :active %></li>
25
+ </ul>
26
+
27
+ <div class="buttons">
28
+ <%= f.button t(:save), type: :submit %>
29
+ </div>
30
+ <% end %>
@@ -0,0 +1,17 @@
1
+ <% content_for :meta_title, t('.title') %>
2
+ <% content_for :breadcrumbs do %>
3
+ <%= link_to t('admin.tokens.nav_item.text'), admin_tokens_path %>
4
+ <%= admin_token_link(@entity) %>
5
+ <span><%= t(:edit) %></span>
6
+ <% end %>
7
+
8
+ <article class="entity-page">
9
+ <h1><%= t('.title') %></h1>
10
+
11
+ <ul class="actions">
12
+ <li><%= return_icon(admin_token_path(@entity.id)) %></li>
13
+ <li class="danger"><%= destroy_icon @entity %></li>
14
+ </ul>
15
+
16
+ <%= render partial: 'form', locals: { entity: @entity } %>
17
+ </article>
@@ -0,0 +1,15 @@
1
+ <% content_for :meta_title, t('.title') %>
2
+ <% content_for :breadcrumbs do %>
3
+ <%= link_to t('admin.tokens.nav_item.text'), admin_tokens_path %>
4
+ <span><%= t(:create) %></span>
5
+ <% end %>
6
+
7
+ <article class="entity-page">
8
+ <h1><%= t('.title') %></h1>
9
+
10
+ <ul class="actions">
11
+ <li><%= back_icon(admin_tokens_path) %></li>
12
+ </ul>
13
+
14
+ <%= render partial: 'form', locals: { entity: @entity } %>
15
+ </article>
@@ -0,0 +1,78 @@
1
+ <%= render partial: 'shared/list_of_errors', locals: { entity: entity } %>
2
+
3
+ <%= form_for entity do |f| %>
4
+
5
+ <figure class="preview" id="user-image">
6
+ <%= label_tag(:user_image, image_tag(entity.image.profile.url, alt: t(:current_image))) %>
7
+ <figcaption>
8
+ <%= f.label :image %>
9
+ <%= f.file_field :image, accept: 'image/jpeg,image/png', data: { image: 'user-image' } %>
10
+ </figcaption>
11
+ </figure>
12
+
13
+ <dl>
14
+ <dt><%= f.label :screen_name %></dt>
15
+ <dd>
16
+ <%= f.text_field :screen_name, size: 30, maxlength: User::SLUG_LIMIT %>
17
+ </dd>
18
+
19
+ <dt><%= f.label :name %></dt>
20
+ <dd>
21
+ <%= f.text_field :name, size: 30, maxlength: User::NAME_LIMIT %>
22
+ </dd>
23
+
24
+ <dt><%= f.label :patronymic %></dt>
25
+ <dd>
26
+ <%= f.text_field :patronymic, size: 30, maxlength: User::NAME_LIMIT %>
27
+ </dd>
28
+
29
+ <dt><%= f.label :surname %></dt>
30
+ <dd>
31
+ <%= f.text_field :surname, size: 30, maxlength: User::NAME_LIMIT %>
32
+ </dd>
33
+
34
+ <dt><%= f.label :email %></dt>
35
+ <dd>
36
+ <%= f.email_field :email, size: 30, maxlength: User::EMAIL_LIMIT %>
37
+ </dd>
38
+
39
+ <dt><%= f.label :phone %></dt>
40
+ <dd>
41
+ <%= f.phone_field :phone, size: 15, maxlength: User::PHONE_LIMIT %>
42
+ </dd>
43
+
44
+ <% if entity.id.blank? %>
45
+ <dt><%= f.label :password %></dt>
46
+ <dd>
47
+ <%= f.text_field :password, size: nil, maxlength: 70 %>
48
+ </dd>
49
+
50
+ <dt><%= f.label :password_confirmation %></dt>
51
+ <dd>
52
+ <%= f.text_field :password_confirmation, size: nil, maxlength: 70 %>
53
+ </dd>
54
+ <% end %>
55
+
56
+ <dt><%= f.label :gender %></dt>
57
+ <dd>
58
+ <%= f.select :gender, genders_for_select %>
59
+ </dd>
60
+
61
+ <dt><%= f.label :notice %></dt>
62
+ <dd>
63
+ <%= f.text_field :notice, size: nil, maxlength: User::NOTICE_LIMIT %>
64
+ </dd>
65
+ </dl>
66
+
67
+ <ul class="flags">
68
+ <li><%= f.check_box :bot %><%= f.label :bot %></li>
69
+ <li><%= f.check_box :allow_login %><%= f.label :allow_login %></li>
70
+ <li><%= f.check_box :email_confirmed %><%= f.label :email_confirmed %></li>
71
+ <li><%= f.check_box :phone_confirmed %><%= f.label :phone_confirmed %></li>
72
+ <li><%= f.check_box :allow_mail %><%= f.label :allow_mail %></li>
73
+ </ul>
74
+
75
+ <div class="buttons">
76
+ <%= f.button t(:save), type: :submit %>
77
+ </div>
78
+ <% end %>
@@ -0,0 +1,18 @@
1
+ <% content_for :meta_title, t('.title') %>
2
+ <% content_for :breadcrumbs do %>
3
+ <%= link_to(t('admin.users.nav_item.text'), admin_users_path) %>
4
+ <%= admin_user_link(@entity) %>
5
+ <span><%= t(:edit) %></span>
6
+ <% end %>
7
+
8
+ <article class="entity-page">
9
+ <h1><%= t('.heading') %></h1>
10
+ <ul class="actions">
11
+ <li><%= back_icon(admin_user_path(@entity.id)) %></li>
12
+ <% unless @entity.deleted? %>
13
+ <li class="danger"><%= destroy_icon @entity %></li>
14
+ <% end %>
15
+ </ul>
16
+
17
+ <%= render partial: 'form', locals: { entity: @entity } %>
18
+ </article>
@@ -0,0 +1,15 @@
1
+ <% content_for :meta_title, t('.title') %>
2
+ <% content_for :breadcrumbs do %>
3
+ <%= link_to(t('admin.users.nav_item.text'), admin_users_path) %>
4
+ <span><%= t(:create) %></span>
5
+ <% end %>
6
+
7
+ <article class="entity-page">
8
+ <h1><%= t('.title') %></h1>
9
+
10
+ <ul class="actions">
11
+ <li><%= back_icon(admin_users_path) %></li>
12
+ </ul>
13
+
14
+ <%= render partial: 'form', locals: { entity: @entity } %>
15
+ </article>
@@ -0,0 +1,22 @@
1
+ if Rails.env.test? || Rails.env.cucumber?
2
+ Dir["#{Rails.root}/app/uploaders/*.rb"].each { |file| require file }
3
+
4
+ CarrierWave.configure do |config|
5
+ config.storage = :file
6
+ config.enable_processing = false
7
+ end
8
+
9
+ # use different dirs when testing
10
+ CarrierWave::Uploader::Base.descendants.each do |klass|
11
+ next if klass.anonymous?
12
+ klass.class_eval do
13
+ def cache_dir
14
+ "#{Rails.root}/spec/support/uploads/tmp"
15
+ end
16
+
17
+ def store_dir
18
+ "#{Rails.root}/spec/support/uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}"
19
+ end
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,2 @@
1
+ require 'i18n/backend/pluralization'
2
+ I18n::Backend::Simple.send(:include, I18n::Backend::Pluralization)
@@ -0,0 +1,96 @@
1
+ ru:
2
+ error_count:
3
+ zero: "ошибок нет"
4
+ one: "%{count} ошибка"
5
+ few: "%{count} ошибки"
6
+ many: "%{count} ошибок"
7
+ other: "%{count} ошибок"
8
+ errors:
9
+ messages:
10
+ extension_blacklist_error: "имеет недопустимое расширение файла"
11
+ date:
12
+ nominative_months:
13
+ -
14
+ - "январь"
15
+ - "февраль"
16
+ - "март"
17
+ - "апрель"
18
+ - "май"
19
+ - "июнь"
20
+ - "июль"
21
+ - "август"
22
+ - "сентябрь"
23
+ - "октябрь"
24
+ - "ноябрь"
25
+ - "декабрь"
26
+ archive_year: " за %{year} год"
27
+ archive_month: " за %{month} %{year} года"
28
+ nothing_found: "Ничего не нашлось"
29
+ create: "Создать"
30
+ view: "В просмотр"
31
+ list: "К списку"
32
+ edit: "Редактировать"
33
+ update: "Обновить"
34
+ delete: "Удалить"
35
+ submit: "Отправить"
36
+ save: "Сохранить"
37
+ back: "Назад"
38
+ find: "Найти"
39
+ are_you_sure: "Вы уверены?"
40
+ created_at: "Время создания"
41
+ updated_at: "Время обновления"
42
+ not_selected: "Не выбрано"
43
+ not_set: "Не задано"
44
+ filter: "Фильтр"
45
+ "yes": "Да"
46
+ "no": "Нет"
47
+ page: "Страница"
48
+ current_image: "Текущая картинка"
49
+ deleted_entity: "Удалённый объект"
50
+ locked: "Редактирование зарещено"
51
+ unlocked: "Редактирование разрешено"
52
+ home: "Главная"
53
+ untitled: "Без названия"
54
+ hide: "Скрыть"
55
+ view_as_visitor: "Посмотреть на странице"
56
+ view_as_administrator: "Посмотреть в админке"
57
+ views:
58
+ pagination:
59
+ first: "⇤"
60
+ last: "⇥"
61
+ previous: "←"
62
+ next: "→"
63
+ truncate: "…"
64
+ shared:
65
+ flash_messages:
66
+ notice: "Замечание"
67
+ warning: "Предупреждение"
68
+ alert: "Внимание"
69
+ meta_texts:
70
+ site_name: "example.com"
71
+ twitter_site: ""
72
+ twitter_creator: ""
73
+ admin:
74
+ index:
75
+ index:
76
+ title: "Администрирование"
77
+ heading: "Администрирование"
78
+ index:
79
+ navigation:
80
+ index:
81
+ index: "Основной сайт"
82
+ index:
83
+ title: "Главная страница"
84
+ application:
85
+ not_found:
86
+ title: "Страница не найдена"
87
+ heading: "Страница не найдена"
88
+ message: "Страница не существует или была удалена"
89
+ unauthorized:
90
+ title: "Доступ ограничен"
91
+ heading: "Доступ ограничен"
92
+ message: "У вас не хватает прав для доступа к этой странице"
93
+ service_unavailable:
94
+ title: "Сервис недоступен"
95
+ heading: "Сервис недоступен"
96
+ message: "Сервис временно недоступен. Попробуйте повторить попытку позже"