aerogel-admin 1.4.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (126) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +17 -0
  3. data/Gemfile +4 -0
  4. data/LICENSE.txt +22 -0
  5. data/README.md +13 -0
  6. data/Rakefile +1 -0
  7. data/aerogel-admin.gemspec +31 -0
  8. data/app/helpers/admin.rb +54 -0
  9. data/app/helpers/decorators.rb +29 -0
  10. data/app/helpers/icons.rb +11 -0
  11. data/app/helpers/table_builder.rb +8 -0
  12. data/app/helpers/tabs_builder.rb +7 -0
  13. data/app/routes/admin.rb +37 -0
  14. data/app/routes/users.rb +71 -0
  15. data/app/routes/users_access.rb +54 -0
  16. data/app/routes/users_roles.rb +53 -0
  17. data/assets/fonts/aerogel-icons.css +28 -0
  18. data/assets/fonts/aerogel-icons.eot +0 -0
  19. data/assets/fonts/aerogel-icons.svg +11 -0
  20. data/assets/fonts/aerogel-icons.ttf +0 -0
  21. data/assets/fonts/aerogel-icons.woff +0 -0
  22. data/assets/javascripts/.gitkeep +0 -0
  23. data/assets/javascripts/controllers/admin-modal.js.coffee +7 -0
  24. data/assets/javascripts/controllers/admin-modal/admin-modal-form-buttons.js.coffee +56 -0
  25. data/assets/javascripts/controllers/admin.js.coffee +13 -0
  26. data/assets/javascripts/controllers/admin/selectize-inputs.js.coffee +7 -0
  27. data/assets/javascripts/controllers/admin/top-menu-shadow.js.coffee +9 -0
  28. data/assets/javascripts/utils/ajax-spinner.js.coffee +26 -0
  29. data/assets/javascripts/utils/ajax-watcher.js.coffee +18 -0
  30. data/assets/javascripts/utils/bootstrap-modal-reload.js.coffee +8 -0
  31. data/assets/javascripts/utils/form-data-async.js.coffee +27 -0
  32. data/assets/javascripts/utils/i18n.js.coffee +27 -0
  33. data/assets/javascripts/utils/on-future-elements.js.coffee +15 -0
  34. data/assets/stylesheets/admin/bootstrap-settings.css.scss +33 -0
  35. data/assets/stylesheets/admin/global.css.scss +61 -0
  36. data/assets/stylesheets/admin/styles/ajax-indicator.css.scss +26 -0
  37. data/assets/stylesheets/admin/styles/bootstrap-modal.css.scss +24 -0
  38. data/assets/stylesheets/admin/styles/language-selector.css.scss +5 -0
  39. data/assets/stylesheets/admin/styles/page-header.css.scss +7 -0
  40. data/assets/stylesheets/admin/styles/sticky-footer-navbar.css.scss +34 -0
  41. data/assets/stylesheets/admin/styles/table.css.scss +3 -0
  42. data/assets/stylesheets/admin/styles/top-menu.css.scss +3 -0
  43. data/assets/stylesheets/admin/utils/center-absolutely.css.scss +5 -0
  44. data/assets/stylesheets/controllers/admin.css.scss +14 -0
  45. data/assets/vendor/bootstrap-datetimepicker.css.scss +1 -0
  46. data/assets/vendor/bootstrap-datetimepicker.js.coffee +1 -0
  47. data/assets/vendor/bootstrap-datetimepicker/bootstrap-datetimepicker.min.css +5 -0
  48. data/assets/vendor/bootstrap-datetimepicker/bootstrap-datetimepicker.min.js +1 -0
  49. data/assets/vendor/bootstrap-datetimepicker/bootstrap-datetimepicker.ru.js +163 -0
  50. data/assets/vendor/moment.js.coffee +1 -0
  51. data/assets/vendor/momentjs/moment-with-langs.min.js +9 -0
  52. data/assets/vendor/selectize.css.scss +2 -0
  53. data/assets/vendor/selectize.js.coffee +1 -0
  54. data/assets/vendor/selectize/selectize.bootstrap3.css +385 -0
  55. data/assets/vendor/selectize/selectize.css +311 -0
  56. data/assets/vendor/selectize/selectize.default.css +381 -0
  57. data/assets/vendor/selectize/selectize.js +3345 -0
  58. data/assets/vendor/smart-list-table.css.scss +42 -0
  59. data/assets/vendor/smart-list-table.js.coffee +1 -0
  60. data/assets/vendor/smart-list-table/smart-list-table-row.js.coffee +63 -0
  61. data/assets/vendor/smart-list-table/smart-list-table.css.scss +54 -0
  62. data/assets/vendor/smart-list-table/smart-list-table.js.coffee +133 -0
  63. data/assets/vendor/smart-tree-table.css.scss +42 -0
  64. data/assets/vendor/smart-tree-table.js.coffee +1 -0
  65. data/assets/vendor/smart-tree-table/smart-tree-table-drag-n-drop.js.coffee +190 -0
  66. data/assets/vendor/smart-tree-table/smart-tree-table-row.js.coffee +78 -0
  67. data/assets/vendor/smart-tree-table/smart-tree-table.css.scss +54 -0
  68. data/assets/vendor/smart-tree-table/smart-tree-table.js.coffee +267 -0
  69. data/assets/vendor/spin.js +353 -0
  70. data/config/README.md +3 -0
  71. data/config/development/.keep +0 -0
  72. data/config/production/.keep +0 -0
  73. data/db/model/README.md +1 -0
  74. data/db/model/admin/user_new_form.rb +40 -0
  75. data/db/model/user.rb +26 -0
  76. data/db/seed/01_admin_roles.seed +8 -0
  77. data/db/seed/02_admin_access.seed +24 -0
  78. data/db/seed/development/.keep +0 -0
  79. data/db/seed/development/20_users.seed +45 -0
  80. data/db/seed/development/admin_users.seed +38 -0
  81. data/db/seed/production/.keep +0 -0
  82. data/lib/aerogel/admin.rb +25 -0
  83. data/lib/aerogel/admin/core.rb +14 -0
  84. data/lib/aerogel/admin/menu.rb +38 -0
  85. data/lib/aerogel/admin/table_builder.rb +100 -0
  86. data/lib/aerogel/admin/tabs_builder.rb +69 -0
  87. data/lib/aerogel/admin/version.rb +5 -0
  88. data/locales/actions.en.yml +27 -0
  89. data/locales/actions.ru.yml +28 -0
  90. data/locales/admin.en.yml +14 -0
  91. data/locales/admin.ru.yml +14 -0
  92. data/locales/models.en.yml +8 -0
  93. data/locales/models.ru.yml +8 -0
  94. data/locales/views.en.yml +46 -0
  95. data/locales/views.ru.yml +46 -0
  96. data/public/README.md +1 -0
  97. data/rake/README.md +3 -0
  98. data/views/admin/index.html.erb +3 -0
  99. data/views/admin/table_builder/standard/_table_column.html.erb +3 -0
  100. data/views/admin/table_builder/standard/_table_row.html.erb +7 -0
  101. data/views/admin/table_builder/standard/table.html.erb +10 -0
  102. data/views/admin/tabs_builder/standard/_tab.html.erb +3 -0
  103. data/views/admin/tabs_builder/standard/tabs.html.erb +3 -0
  104. data/views/admin/users/_tabs.html.erb +8 -0
  105. data/views/admin/users/access/delete.html.erb +12 -0
  106. data/views/admin/users/access/edit.html.erb +9 -0
  107. data/views/admin/users/access/index.html.erb +23 -0
  108. data/views/admin/users/access/new.html.erb +9 -0
  109. data/views/admin/users/delete.html.erb +12 -0
  110. data/views/admin/users/edit.html.erb +46 -0
  111. data/views/admin/users/index.html.erb +31 -0
  112. data/views/admin/users/new.html.erb +11 -0
  113. data/views/admin/users/roles/delete.html.erb +12 -0
  114. data/views/admin/users/roles/edit.html.erb +9 -0
  115. data/views/admin/users/roles/index.html.erb +21 -0
  116. data/views/admin/users/roles/new.html.erb +7 -0
  117. data/views/form_builder/standard/field_multiselect.erb +14 -0
  118. data/views/form_builder/standard/field_select.erb +17 -0
  119. data/views/layouts/admin.html.erb +63 -0
  120. data/views/layouts/admin/_ajax_indicator.html.erb +4 -0
  121. data/views/layouts/admin/_alerts.html.erb +22 -0
  122. data/views/layouts/admin/_menu.html.erb +50 -0
  123. data/views/layouts/admin/_menu_item.html.erb +5 -0
  124. data/views/layouts/admin/_modals.html.erb +8 -0
  125. data/views/layouts/admin/modal.html.erb +38 -0
  126. metadata +280 -0
@@ -0,0 +1,5 @@
1
+ module Aerogel
2
+ module Admin
3
+ VERSION = "1.4.4"
4
+ end
5
+ end
@@ -0,0 +1,27 @@
1
+ en:
2
+ aerogel:
3
+ admin:
4
+ actions:
5
+ delete: Delete
6
+ logout: Log out
7
+ view_current_user: Account details
8
+
9
+ users:
10
+ create: Create new user
11
+ delete: Delete user
12
+ created: User %{name} created
13
+ updated: User %{name} updated
14
+ deleted: User %{name} deleted
15
+ failed_to_delete_self: "No, you cannot delete self"
16
+ users_roles:
17
+ create: Create new role
18
+ delete: Delete role
19
+ created: Role %{name} created
20
+ updated: Role %{name} updated
21
+ deleted: Role %{name} deleted
22
+ users_access:
23
+ create: Create new access rule
24
+ delete: Delete access rule
25
+ created: Access rule %{name} created
26
+ updated: Åccess rule %{name} updated
27
+ deleted: Access rule %{name} deleted
@@ -0,0 +1,28 @@
1
+ ru:
2
+ aerogel:
3
+ admin:
4
+ actions:
5
+ delete: Удалить
6
+ logout: Выйти
7
+ view_current_user: Учётная запись
8
+
9
+ users:
10
+ create: Создать нового пользователя
11
+ delete: Удалить пользователя
12
+ created: Пользователь <b>%{name}</b> создан
13
+ updated: Пользователь <b>%{name}</b> обновлён
14
+ deleted: Пользователь <b>%{name}</b> удалён
15
+ failed_to_delete_self: "Нет, вы не можете удалить самого себя"
16
+ users_roles:
17
+ create: Создать новую роль
18
+ delete: Удалить роль
19
+ created: Роль <b>%{name}</b> создана
20
+ updated: Роль <b>%{name}</b> обновлена
21
+ deleted: Роль <b>%{name}</b> удалена
22
+ users_access:
23
+ create: Создать новое правило доступа
24
+ delete: Удалить правило доступа
25
+ created: Правило доступа <b>%{name}</b> создано
26
+ updated: Правило доступа <b>%{name}</b> обновлено
27
+ deleted: Правило доступа <b>%{name}</b> удалено
28
+
@@ -0,0 +1,14 @@
1
+ en:
2
+ aerogel:
3
+ admin:
4
+ homepage: Home
5
+ panes:
6
+ users: Users
7
+ users_roles: Roles
8
+ users_access: Access rules
9
+
10
+ decorators:
11
+ confirmed: confirmed
12
+ not_confirmed: not confirmed
13
+
14
+ warning_permanent_action: This is permanent action.
@@ -0,0 +1,14 @@
1
+ ru:
2
+ aerogel:
3
+ admin:
4
+ homepage: Главная страница
5
+ panes:
6
+ users: Пользователи
7
+ users_roles: Роли
8
+ users_access: Правила доступа
9
+
10
+ decorators:
11
+ confirmed: подтверждён
12
+ not_confirmed: не подтверждён
13
+
14
+ warning_permanent_action: Это действие необратимо.
@@ -0,0 +1,8 @@
1
+ en:
2
+ mongoid:
3
+ models:
4
+ user_new_form: New user form
5
+
6
+ attributes:
7
+ 'admin/user_new_form':
8
+ roles: Roles
@@ -0,0 +1,8 @@
1
+ ru:
2
+ mongoid:
3
+ models:
4
+ user_new_form: Форма создания пользователя
5
+
6
+ attributes:
7
+ 'admin/user_new_form':
8
+ roles: Роли
@@ -0,0 +1,46 @@
1
+ en:
2
+ aerogel:
3
+ admin:
4
+ views:
5
+ dashboard:
6
+ title: Dashboard
7
+ text: |
8
+ <p>
9
+ #dashboard
10
+ </p>
11
+
12
+ users:
13
+ create:
14
+ title: Create new user
15
+ edit:
16
+ title: Edit user
17
+ delete:
18
+ title: Delete user?
19
+ text: |
20
+ <p>
21
+ Do you really want to delete <b>%{name}</b>?
22
+ </p>
23
+
24
+ users_roles:
25
+ create:
26
+ title: Create new role
27
+ edit:
28
+ title: Edit role
29
+ delete:
30
+ title: Delete role?
31
+ text: |
32
+ <p>
33
+ Do you really want to delete <b>%{name}</b>?
34
+ </p>
35
+
36
+ users_access:
37
+ create:
38
+ title: Create new access rule
39
+ edit:
40
+ title: Edit access rule
41
+ delete:
42
+ title: Delete access rule?
43
+ text: |
44
+ <p>
45
+ Do you really want to delete <b>%{name}</b>?
46
+ </p>
@@ -0,0 +1,46 @@
1
+ ru:
2
+ aerogel:
3
+ admin:
4
+ views:
5
+ dashboard:
6
+ title: Панель управления
7
+ text: |
8
+ <p>
9
+ #dashboard по-русски
10
+ </p>
11
+
12
+ users:
13
+ create:
14
+ title: Создать нового пользователя
15
+ edit:
16
+ title: Редактировать пользователя
17
+ delete:
18
+ title: Удалить пользователя?
19
+ text: |
20
+ <p>
21
+ Вы действительно хотите удалить <b>%{name}</b>?
22
+ </p>
23
+
24
+ users_roles:
25
+ create:
26
+ title: Создать новую роль
27
+ edit:
28
+ title: Редактировать роль
29
+ delete:
30
+ title: Удалить роль?
31
+ text: |
32
+ <p>
33
+ Вы действительно хотите удалить <b>%{name}</b>?
34
+ </p>
35
+
36
+ users_access:
37
+ create:
38
+ title: Создать новое правило доступа
39
+ edit:
40
+ title: Редактировать правило доступа
41
+ delete:
42
+ title: Удалить правило доступа?
43
+ text: |
44
+ <p>
45
+ Вы действительно хотите удалить <b>%{name}</b>?
46
+ </p>
@@ -0,0 +1 @@
1
+ A place for static files.
@@ -0,0 +1,3 @@
1
+ A place for module rake tasks.
2
+
3
+ *.rake files found in this folder are included into an end application's Rakefile
@@ -0,0 +1,3 @@
1
+ <% page_title t.aerogel.admin.views.dashboard.title %>
2
+
3
+ <%= t.aerogel.admin.views.dashboard.text %>
@@ -0,0 +1,3 @@
1
+ <th <%= table_column.html_params %> >
2
+ <%= table_column.human_label %>
3
+ </th>
@@ -0,0 +1,7 @@
1
+ <tr>
2
+ <% table.columns.each do |col| %>
3
+ <td <%= col.html_params %>>
4
+ <%= col.block.present? ? col.block.call( table_row ) : h( table_row.send col.field ) %>
5
+ </td>
6
+ <% end %>
7
+ </tr>
@@ -0,0 +1,10 @@
1
+ <table class="table table-striped" <%= table.html_params %> >
2
+ <thead>
3
+ <tr>
4
+ <%= partial table.template("table_column"), locals: { table: table }, collection: table.columns %>
5
+ </tr>
6
+ </thead>
7
+ <tbody>
8
+ <%= partial table.template("table_row"), locals: { table: table }, collection: table.object %>
9
+ </tbody>
10
+ </table>
@@ -0,0 +1,3 @@
1
+ <li <%= current_url == tab.url ? 'class="active"' : '' %> >
2
+ <%= link_to tab.url, tab.human_label %>
3
+ </li>
@@ -0,0 +1,3 @@
1
+ <ul class="nav nav-tabs">
2
+ <%= partial tabs.template("tab"), locals: { tabs: tabs }, collection: tabs.tabs %>
3
+ </ul>
@@ -0,0 +1,8 @@
1
+
2
+ <%
3
+ tabs do
4
+ tab "/admin/users/", label: :'aerogel.admin.panes.users'
5
+ tab "/admin/users/roles/", label: :'aerogel.admin.panes.users_roles'
6
+ tab "/admin/users/access/", label: :'aerogel.admin.panes.users_access'
7
+ end
8
+ %>
@@ -0,0 +1,12 @@
1
+ <% page_title t.aerogel.admin.views.users_access.delete.title %>
2
+
3
+ <% form @access, action: "/admin/users/access/#{@access.id}/delete" do %>
4
+
5
+ <%= t.aerogel.admin.views.users_access.delete.text name: "#{object.path}:#{object.access}:#{object.role}" %>
6
+
7
+ <p class="alert alert-warning">
8
+ <%= icon_warning %> <%= t.aerogel.admin.warning_permanent_action %>
9
+ </p>
10
+ <%= button :cancel, url: '/admin/users/access/' %>
11
+ <%= button :danger_submit, label: t.aerogel.admin.actions.users_access.delete %>
12
+ <% end %>
@@ -0,0 +1,9 @@
1
+ <% page_title t.aerogel.admin.views.users_access.edit.title %>
2
+
3
+ <% form @access, action: "/admin/users/access/#{@access.id}/edit" do %>
4
+ <%= field :path %>
5
+ <%= field :access, as: :radio_buttons, values: %w(R RW), labels: ['Read', 'Read & Write'] %>
6
+ <%= field :role, as: :select, from: Role, values: :slug, labels: :name %>
7
+ <%= button :cancel, url: '/admin/users/access/' %>
8
+ <%= button :save %>
9
+ <% end %>
@@ -0,0 +1,23 @@
1
+ <% page_title t.aerogel.admin.panes.users_access %>
2
+
3
+ <%= partial "admin/users/tabs" %>
4
+
5
+ <%
6
+ table Access.all do
7
+ column :path do |row|
8
+ link_to_modal_if_can "#{row.id}/edit", h( row.path )
9
+ end
10
+ column :access
11
+ column :role
12
+ column :actions, label: '' do |row|
13
+ link_to_modal_if_can "#{row.id}/delete", icon_delete
14
+ end
15
+ end
16
+ %>
17
+
18
+
19
+ <div class="table-actions">
20
+ <%= link_to_modal_if_can 'new',
21
+ icon("fa-plus")+" "+t.aerogel.admin.actions.users_access.create.to_s, class: "btn btn-default"
22
+ %>
23
+ </div>
@@ -0,0 +1,9 @@
1
+ <% page_title t.aerogel.admin.views.users_access.create.title %>
2
+
3
+ <% form @access, action: "/admin/users/access/new" do %>
4
+ <%= field :path %>
5
+ <%= field :access, as: :radio_buttons, values: %w(R RW), labels: ['Read', 'Read & Write'] %>
6
+ <%= field :role, as: :select, from: Role, values: :slug, labels: :name %>
7
+ <%= button :cancel, url: '/admin/users/access/' %>
8
+ <%= button :create %>
9
+ <% end %>
@@ -0,0 +1,12 @@
1
+ <% page_title t.aerogel.admin.views.users.delete.title %>
2
+
3
+ <% form @user, action: "/admin/users/#{@user.id}/delete" do %>
4
+
5
+ <%= t.aerogel.admin.views.users.delete.text name: h( object.full_name ) %>
6
+
7
+ <p class="alert alert-warning">
8
+ <%= icon_warning %> <%= t.aerogel.admin.warning_permanent_action %>
9
+ </p>
10
+ <%= button :cancel, url: '/admin/users/' %>
11
+ <%= button :danger_submit, label: t.aerogel.admin.actions.users.delete %>
12
+ <% end %>
@@ -0,0 +1,46 @@
1
+ <% page_title t.aerogel.admin.views.users.edit.title %>
2
+
3
+ <% form @user, action: "/admin/users/#{@user.id}/edit" do %>
4
+ <%= field :full_name %>
5
+ <% table object.emails do
6
+ column :email
7
+ column :confirmed, label: '' do |e|
8
+ user_email_confirmed_as_label( e )
9
+ end
10
+ column :confirmation_link, label: '' do |e|
11
+ e.confirmed ? '' : link_to(
12
+ "#request_email_confirmation",
13
+ t.aerogel.admin.actions.user_email.request_confirmation.to_s
14
+ )
15
+ end
16
+ end
17
+ %>
18
+ <% table object.authentications do
19
+ column :provider, label: object.model_name.human do |a|
20
+ auth_provider_as_icon( a.provider )+" #{auth_provider_as_text a.provider}"
21
+ end
22
+ column :uid
23
+ end
24
+ %>
25
+ <%= field :roles, as: :multiselect, from: Role, values: :slug, labels: :name %>
26
+
27
+ <p>
28
+ <em>
29
+ <%= User.human_attribute_name :created_at %>
30
+ <%= l object.created_at, default: :never, format: :short %>
31
+ </em><br/>
32
+ <em>
33
+ <%= User.human_attribute_name :updated_at %>
34
+ <%= l object.updated_at, default: :never, format: :short %>
35
+ </em><br/>
36
+ <em>
37
+ <%= User.human_attribute_name :authenticated_at %>
38
+ <%= l object.authenticated_at, default: :never, format: :short %>
39
+ </em><br/>
40
+ </p>
41
+
42
+ <%= button :cancel, url: '/admin/users/' %>
43
+ <%= button :save %>
44
+
45
+
46
+ <% end %>
@@ -0,0 +1,31 @@
1
+ <% page_title t.aerogel.admin.panes.users %>
2
+
3
+ <%= partial "admin/users/tabs" %>
4
+
5
+
6
+ <%
7
+ table User.all do
8
+ column :authentications, label: '' do |u|
9
+ u.authentications.map{|a| auth_provider_as_icon a.provider }.join
10
+ end
11
+ column :full_name do |u|
12
+ link_to_modal_if_can "#{u.id}/edit", h( u.full_name )
13
+ end
14
+ column :email do |u|
15
+ email = u.emails.first
16
+ h( email.email)+" "+user_email_confirmed_as_icon( email )
17
+ end
18
+ column :roles do |u|
19
+ u.roles.map{|v| v.to_s}.join(", ")
20
+ end
21
+ column :actions, label: '' do |u|
22
+ link_to_modal "#{u.id}/delete", icon_delete
23
+ end
24
+ end
25
+ %>
26
+
27
+ <div class="table-actions">
28
+ <%= link_to_modal_if_can 'new',
29
+ icon("fa-plus")+" "+t.aerogel.admin.actions.users.create.to_s, class: "btn btn-default"
30
+ %>
31
+ </div>
@@ -0,0 +1,11 @@
1
+ <% page_title t.aerogel.admin.views.users.create.title %>
2
+
3
+ <% form @admin_user_new_form, action: "/admin/users/new" do %>
4
+ <%= field :full_name %>
5
+ <%= field :email %>
6
+ <%= field :roles, as: :multiselect, from: Role, values: :slug, labels: :name %>
7
+
8
+
9
+ <%= button :cancel, url: '/admin/users/' %>
10
+ <%= button :create %>
11
+ <% end %>
@@ -0,0 +1,12 @@
1
+ <% page_title t.aerogel.admin.views.users_roles.delete.title %>
2
+
3
+ <% form @role, action: "/admin/users/roles/#{@role.id}/delete" do %>
4
+
5
+ <%= t.aerogel.admin.views.users_roles.delete.text name: h( object.name ) %>
6
+
7
+ <p class="alert alert-warning">
8
+ <%= icon_warning %> <%= t.aerogel.admin.warning_permanent_action %>
9
+ </p>
10
+ <%= button :cancel, url: '/admin/users/roles/' %>
11
+ <%= button :danger_submit, label: t.aerogel.admin.actions.users_roles.delete %>
12
+ <% end %>