slash_admin 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (117) hide show
  1. checksums.yaml +7 -0
  2. data/README.md +95 -0
  3. data/app/assets/config/relax_admin_manifest.js +2 -0
  4. data/app/assets/images/slash_admin/en.png +0 -0
  5. data/app/assets/images/slash_admin/favicon.png +0 -0
  6. data/app/assets/images/slash_admin/fr.png +0 -0
  7. data/app/assets/javascripts/slash_admin/application.js +344 -0
  8. data/app/assets/javascripts/slash_admin/custom.js +0 -0
  9. data/app/assets/stylesheets/slash_admin/alert.scss +29 -0
  10. data/app/assets/stylesheets/slash_admin/application.scss +1469 -0
  11. data/app/assets/stylesheets/slash_admin/colors.scss +17 -0
  12. data/app/assets/stylesheets/slash_admin/custom.scss +0 -0
  13. data/app/controllers/slash_admin/application_controller.rb +17 -0
  14. data/app/controllers/slash_admin/base_controller.rb +45 -0
  15. data/app/controllers/slash_admin/batch_actions_controller.rb +17 -0
  16. data/app/controllers/slash_admin/dashboard_controller.rb +11 -0
  17. data/app/controllers/slash_admin/models_controller.rb +325 -0
  18. data/app/controllers/slash_admin/security/sessions_controller.rb +29 -0
  19. data/app/controllers/slash_admin/selectize_controller.rb +49 -0
  20. data/app/helpers/slash_admin/application_helper.rb +212 -0
  21. data/app/helpers/slash_admin/menu_helper.rb +14 -0
  22. data/app/helpers/slash_admin/widgets_helper.rb +7 -0
  23. data/app/jobs/slash_admin/application_job.rb +4 -0
  24. data/app/mailers/slash_admin/application_mailer.rb +6 -0
  25. data/app/models/slash_admin/admin.rb +46 -0
  26. data/app/models/slash_admin/admin_ability.rb +11 -0
  27. data/app/models/slash_admin/application_record.rb +5 -0
  28. data/app/views/layouts/slash_admin/admin_user.html.erb +16 -0
  29. data/app/views/layouts/slash_admin/application.html.erb +40 -0
  30. data/app/views/slash_admin/base/_data_belongs_to.html.erb +37 -0
  31. data/app/views/slash_admin/base/_data_list.html.erb +276 -0
  32. data/app/views/slash_admin/base/_data_nestable.html.erb +33 -0
  33. data/app/views/slash_admin/base/_data_new.html.erb +16 -0
  34. data/app/views/slash_admin/base/_data_show.html.erb +72 -0
  35. data/app/views/slash_admin/base/_filters.html.erb +60 -0
  36. data/app/views/slash_admin/base/_translatable_fields.html.erb +23 -0
  37. data/app/views/slash_admin/base/edit.html.erb +26 -0
  38. data/app/views/slash_admin/base/index.html.erb +47 -0
  39. data/app/views/slash_admin/base/index.xls.erb +27 -0
  40. data/app/views/slash_admin/base/nestable.html.erb +28 -0
  41. data/app/views/slash_admin/base/new.html.erb +26 -0
  42. data/app/views/slash_admin/base/show.html.erb +22 -0
  43. data/app/views/slash_admin/custom_fields/_color.html.erb +2 -0
  44. data/app/views/slash_admin/custom_fields/_email.html.erb +2 -0
  45. data/app/views/slash_admin/custom_fields/_google_map.html.erb +72 -0
  46. data/app/views/slash_admin/custom_fields/_nested_belongs_to.html.erb +55 -0
  47. data/app/views/slash_admin/custom_fields/_password.html.erb +2 -0
  48. data/app/views/slash_admin/custom_fields/_select.html.erb +2 -0
  49. data/app/views/slash_admin/custom_fields/_tags.html.erb +2 -0
  50. data/app/views/slash_admin/custom_fields/_wysiwyg.html.erb +2 -0
  51. data/app/views/slash_admin/dashboard/home.html.erb +5 -0
  52. data/app/views/slash_admin/dashboard/widgets/_statistic_chart.html.erb +0 -0
  53. data/app/views/slash_admin/dashboard/widgets/_statistic_progress_tile.html.erb +29 -0
  54. data/app/views/slash_admin/fields/_belongs_to.html.erb +9 -0
  55. data/app/views/slash_admin/fields/_boolean.html.erb +2 -0
  56. data/app/views/slash_admin/fields/_carrierwave.html.erb +15 -0
  57. data/app/views/slash_admin/fields/_date.html.erb +2 -0
  58. data/app/views/slash_admin/fields/_decimal.html.erb +2 -0
  59. data/app/views/slash_admin/fields/_form_group.html.erb +12 -0
  60. data/app/views/slash_admin/fields/_has_many.html.erb +12 -0
  61. data/app/views/slash_admin/fields/_has_many_row.html.erb +18 -0
  62. data/app/views/slash_admin/fields/_has_one.html.erb +24 -0
  63. data/app/views/slash_admin/fields/_integer.html.erb +2 -0
  64. data/app/views/slash_admin/fields/_json.html.erb +14 -0
  65. data/app/views/slash_admin/fields/_nested_has_many.html.erb +14 -0
  66. data/app/views/slash_admin/fields/_number.html.erb +2 -0
  67. data/app/views/slash_admin/fields/_string.html.erb +2 -0
  68. data/app/views/slash_admin/fields/_text.html.erb +2 -0
  69. data/app/views/slash_admin/security/sessions/new.html.erb +30 -0
  70. data/app/views/slash_admin/shared/_batch_actions.html.erb +21 -0
  71. data/app/views/slash_admin/shared/_better_paginate.html.erb +30 -0
  72. data/app/views/slash_admin/shared/_breadcrumb.html.erb +30 -0
  73. data/app/views/slash_admin/shared/_debug.html.erb +24 -0
  74. data/app/views/slash_admin/shared/_errors_data_new.html.erb +12 -0
  75. data/app/views/slash_admin/shared/_header.html.erb +38 -0
  76. data/app/views/slash_admin/shared/_menu.html.erb +57 -0
  77. data/app/views/slash_admin/shared/_new_form_buttons.html.erb +9 -0
  78. data/app/views/slash_admin/shared/_sub_header.html.erb +11 -0
  79. data/config/initializers/validators.rb +13 -0
  80. data/config/locales/slash_admin.en.yml +67 -0
  81. data/config/locales/slash_admin.fr.yml +72 -0
  82. data/config/routes.rb +16 -0
  83. data/db/migrate/20170512104248_create_slash_admin_admins.rb +19 -0
  84. data/lib/batch_translation.rb +19 -0
  85. data/lib/generators/slash_admin/controllers/controllers_generator.rb +16 -0
  86. data/lib/generators/slash_admin/controllers/templates/controllers.erb +9 -0
  87. data/lib/generators/slash_admin/install/install_generator.rb +13 -0
  88. data/lib/generators/slash_admin/install/templates/install.erb +14 -0
  89. data/lib/generators/slash_admin/override_admin/override_admin_generator.rb +13 -0
  90. data/lib/generators/slash_admin/override_admin/templates/admin.erb +46 -0
  91. data/lib/generators/slash_admin/override_session/override_session_generator.rb +13 -0
  92. data/lib/generators/slash_admin/override_session/templates/session.erb +27 -0
  93. data/lib/generators/slash_admin/permissions/permissions_generator.rb +13 -0
  94. data/lib/generators/slash_admin/permissions/templates/permissions.erb +11 -0
  95. data/lib/slash_admin.rb +29 -0
  96. data/lib/slash_admin/engine.rb +8 -0
  97. data/lib/slash_admin/version.rb +3 -0
  98. data/lib/tasks/slash_admin_tasks.rake +4 -0
  99. data/vendor/assets/javascripts/bootstrap-material-datetimepicker.js +1295 -0
  100. data/vendor/assets/javascripts/codemirror/codemirror.js +9657 -0
  101. data/vendor/assets/javascripts/codemirror/lint/json-lint.js +37 -0
  102. data/vendor/assets/javascripts/codemirror/lint/jsonlint.js +432 -0
  103. data/vendor/assets/javascripts/codemirror/lint/lint.js +252 -0
  104. data/vendor/assets/javascripts/codemirror/mode/javascript.js +865 -0
  105. data/vendor/assets/javascripts/jquery.nestable.js +910 -0
  106. data/vendor/assets/javascripts/jquery.tagsinput-revisited.min.js +5 -0
  107. data/vendor/assets/javascripts/toastr.js +6 -0
  108. data/vendor/assets/stylesheets/animate.css +1579 -0
  109. data/vendor/assets/stylesheets/bootstrap-material-datetimepicker.css +82 -0
  110. data/vendor/assets/stylesheets/codemirror/codemirror.css +346 -0
  111. data/vendor/assets/stylesheets/codemirror/lint/lint.css +73 -0
  112. data/vendor/assets/stylesheets/codemirror/theme/relax-seti.css +41 -0
  113. data/vendor/assets/stylesheets/jquery.nestable.css +121 -0
  114. data/vendor/assets/stylesheets/jquery.tagsinput-revisited.min.css +1 -0
  115. data/vendor/assets/stylesheets/sweetalert.css +935 -0
  116. data/vendor/assets/stylesheets/toastr.css +1 -0
  117. metadata +509 -0
@@ -0,0 +1,12 @@
1
+ <%= f.label a, class: "form-control-label #{required?(f.object, a) ? 'required' : ''}" %>
2
+ <%= f.collection_select "#{a.to_s.singularize}_ids",
3
+ class_name_from_association(f.object, a).classify.constantize.all.limit(20), :id,
4
+ object_label(class_name_from_association(f.object, a)),
5
+ {include_blank: true},
6
+ {
7
+ class: 'selectize-model-multiple',
8
+ multiple: 'multiple',
9
+ 'data-model': class_name_from_association(f.object, a).constantize.model_name.to_s.underscore,
10
+ 'data-fields': "SlashAdmin::Models::#{class_name_from_association(f.object, a).classify.pluralize}Controller".constantize.new.autocomplete_params.join(' '),
11
+ required: required?(f.object, a)
12
+ } %>
@@ -0,0 +1,18 @@
1
+ <% nested_params.each do |association| %>
2
+ <% if association.has_key?(model_ref) %>
3
+ <% association[model_ref].each do |attribute| %>
4
+ <div class="form-group
5
+ <% if errors?(f, attribute.to_sym) %>has-danger<% end %>">
6
+ <%= admin_field(f, attribute) %>
7
+ <div class="form-control-feedback">
8
+ <% show_errors(f, attribute.to_sym).each do |msg| %>
9
+ - <%= msg %><br/>
10
+ <% end %>
11
+ </div>
12
+ </div>
13
+ <% end %>
14
+ <%= link_to_remove_association f, class: 'btn btn-danger btn-sm btn-remove' do %>
15
+ <i class="icon-trash"></i> <%= t('slash_admin.view.delete') %>
16
+ <% end %>
17
+ <% end %>
18
+ <% end %>
@@ -0,0 +1,24 @@
1
+ <%= f.label a, class: 'form-control-label label-has-one' %>
2
+
3
+ <% if @model.send(a).blank? %>
4
+ <% @model.send("#{a.to_s}=", a.to_s.classify.constantize.new) %>
5
+ <% end %>
6
+
7
+ <%= f.fields_for a do |association_form| %>
8
+ <% if @model.id.blank? %>
9
+ <% if a.is_a?(Hash) %>
10
+ <% params_assoc = "SlashAdmin::Models::#{class_name_from_association(f.object, a).pluralize}Controller".constantize.new.create_params(from: @model_class).each %>
11
+ <% else %>
12
+ <% params_assoc = "SlashAdmin::Models::#{a.to_s.classify.pluralize}Controller".constantize.new.create_params(from: @model_class).each %>
13
+ <% end %>
14
+ <% else %>
15
+ <% if a.is_a?(Hash) %>
16
+ <% params_assoc = "SlashAdmin::Models::#{class_name_from_association(f.object, a).pluralize}Controller".constantize.new.update_params(from: @model_class).each %>
17
+ <% else %>
18
+ <% params_assoc = "SlashAdmin::Models::#{a.to_s.classify.pluralize}Controller".constantize.new.update_params(from: @model_class).each %>
19
+ <% end %>
20
+ <% end %>
21
+ <% params_assoc.each do |attribute| %>
22
+ <%= render 'slash_admin/fields/form_group', f: association_form, a: attribute %>
23
+ <% end %>
24
+ <% end %>
@@ -0,0 +1,2 @@
1
+ <%= f.label a, class: "form-control-label #{required?(f.object, a) ? 'required' : ''}" %>
2
+ <%= f.number_field a, class: 'form-control', step: '1', required: required?(f.object, a) %>
@@ -0,0 +1,14 @@
1
+ <%= f.label a, class: "form-control-label #{required?(f.object, a) ? 'required' : ''}"%>
2
+ <%= f.text_area a, class: "form-control #{'jsonarea_' + f.object.class.to_s + '_' + a.to_s}", required: required?(f.object, a) %>
3
+
4
+ <script src="https://rawgithub.com/zaach/jsonlint/79b553fb65c192add9066da64043458981b3972b/lib/jsonlint.js"></script>
5
+ <script type="text/javascript">
6
+ var jsonarea_<%= f.object.class.to_s + '_' + a.to_s %> = document.getElementsByClassName("jsonarea_<%= f.object.class.to_s + '_' + a.to_s %>")[0];
7
+ var editor_jsonarea_<%= f.object.class.to_s + '_' + a.to_s %> = CodeMirror.fromTextArea(jsonarea_<%= f.object.class.to_s + '_' + a.to_s %>, {
8
+ lineNumbers: true,
9
+ theme: 'relax-seti',
10
+ mode: "application/json",
11
+ gutters: ["CodeMirror-lint-markers"],
12
+ lint: true
13
+ });
14
+ </script>
@@ -0,0 +1,14 @@
1
+ <%= f.label a, class: 'form-control-label' %>
2
+
3
+ <%= f.fields_for a do |association_model| %>
4
+ <%= render 'slash_admin/fields/has_many_row', f: association_model, model_ref: a.to_sym %>
5
+ <% end %>
6
+
7
+ <div class="links">
8
+ <%= link_to_add_association f, a,
9
+ class: 'btn btn-success btn-sm btn-add-assoc',
10
+ render_options: {locals: {model_ref: a}},
11
+ partial: 'slash_admin/fields/has_many_row' do %>
12
+ <i class="icon-plus"></i> Ajouter un(e) <%= @model_class.human_attribute_name(a).singularize.downcase %>
13
+ <% end %>
14
+ </div>
@@ -0,0 +1,2 @@
1
+ <%= f.label a, class: "form-control-label #{required?(f.object, a) ? 'required' : ''}" %>
2
+ <%= f.number_field a, class: 'form-control', step: '0.01', required: required?(f.object, a) %>
@@ -0,0 +1,2 @@
1
+ <%= f.label a, class: "form-control-label #{required?(f.object, a) ? 'required' : ''}" %>
2
+ <%= f.text_field a, class: 'form-control', required: required?(f.object, a) %>
@@ -0,0 +1,2 @@
1
+ <%= f.label a, class: "form-control-label #{required?(f.object, a) ? 'required' : ''}" %>
2
+ <%= f.text_area a, class: 'form-control', rows: '5', required: required?(f.object, a) %>
@@ -0,0 +1,30 @@
1
+ <div class="container-fluid container-fluid-admin bckg-dark">
2
+ <div class="login-form centered">
3
+ <div class="row">
4
+ <div class="col-sm-12 content bckg-dark-light">
5
+ <h2 class="text-center title-login"><%= t('slash_admin.view.administration') %></h2>
6
+ <%= form_for(:admin, url: '') do |f| %>
7
+ <span class="failed-login">
8
+ <%= @error_messages %>
9
+ </span>
10
+ <div class="input-group">
11
+ <span class="input-group-addon">
12
+ <i class="fa fa-user"></i>
13
+ </span>
14
+ <%= f.text_field :login, required: false, autofocus: true, label: false, placeholder: t('slash_admin.view.username'), class: 'form-control' %>
15
+ </div>
16
+ <div class="input-group">
17
+ <span class="input-group-addon">
18
+ <i class="fa fa-lock"></i>
19
+ </span>
20
+ <%= f.password_field :password, required: false, label: false, placeholder: t('slash_admin.view.password'), class: 'form-control' %>
21
+ </div>
22
+ <div class="form-actions">
23
+ <%= hidden_field_tag :authenticity_token, form_authenticity_token %>
24
+ <%= f.submit t('slash_admin.view.login') %>
25
+ </div>
26
+ <% end %>
27
+ </div>
28
+ </div>
29
+ </div>
30
+ </div>
@@ -0,0 +1,21 @@
1
+ <div class="block-batch pull-right">
2
+ <div class="dropdown">
3
+ <a class="btn btn-circle btn-info btn-sm dropdown-toggle" href="#" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
4
+ <i class="fa fa-share"></i>
5
+ <span class=""><%= t('slash_admin.view.batch_actions') %></span>
6
+ <i class="fa fa-angle-down fix-dropdown"></i>
7
+ </a>
8
+ <div class="dropdown-menu">
9
+ <% if can? :destroy, @model_class %>
10
+ <a
11
+ class="dropdown-item batch-action"
12
+ data-action="<%= slash_admin.batch_delete_path(@model_class.model_name.to_s.underscore) %>"
13
+ data-message="<%= t('slash_admin.view.be_careful') %>" href="#"><i class="icon-trash">
14
+ </i> <%= t('slash_admin.view.delete') %></a>
15
+ <% end %>
16
+ </div>
17
+ </div>
18
+ <div class="count">
19
+ <span class="batch-current-selected">0</span> <%= t('slash_admin.view.selected_elements') %>
20
+ </div>
21
+ </div>
@@ -0,0 +1,30 @@
1
+ <% if @models.total_pages >= 1 %>
2
+ <form method="GET" class="admin-pagination" url="">
3
+ <div class="pagination-panel">
4
+ <%= t('slash_admin.view.page')%>&nbsp;&nbsp;
5
+ <a class="btn btn-sm btn-prev prev-page
6
+ <% if @models.current_page == 1 %>disabled
7
+ <% end %>">
8
+ <i class="fa fa-angle-left"></i>
9
+ </a>
10
+ <input type="text" value="<%= @models.current_page %>" class="integer" name="page"/>
11
+ <a href="<%= request.fullpath %>" class="btn btn-sm btn-next btn-sm next-page
12
+ <% if @models.current_page == @models.total_pages %>disabled<% end %>">
13
+ <i class="fa fa-angle-right"></i>
14
+ </a>
15
+ <%= t('slash_admin.view.of') %>&nbsp;
16
+ <span class="pagination-panel-total"><%= @models.total_pages %></span>|
17
+
18
+ <%= t('slash_admin.view.show_by') %>&nbsp;&nbsp;
19
+ <select class="form-input input-sm form-control" name="per">
20
+ <% @per_values.each do |per| %>
21
+ <option value="<%= per %>"
22
+ <% if params[:per].to_i == per %>selected<% end %>><%= per %></option>
23
+ <% end %>
24
+ </select>
25
+ <%= t('slash_admin.view.total_of') %>&nbsp;
26
+ <span class="pagination-panel-total-count"><%= @models.total_count %></span>
27
+ <%= t('slash_admin.view.result_found') %>
28
+ </div>
29
+ </form>
30
+ <% end %>
@@ -0,0 +1,30 @@
1
+ <div class="page-bar">
2
+ <nav aria-label="breadcrumb">
3
+ <ol class="breadcrumb">
4
+ <li class="breadcrumb-item">
5
+ <a href="<%= slash_admin.dashboard_path %>">
6
+ <i class="icon-home"></i>
7
+ <%= t('slash_admin.view.home') %>
8
+ </a>
9
+ </li>
10
+ <% if params[:action] == 'index' %>
11
+ <li class="breadcrumb-item" aria-current="page">
12
+ <%= @model_name&.pluralize %>
13
+ </li>
14
+ <% elsif params[:action] == 'new' || params[:action] == 'edit' || params[:action] == 'show' %>
15
+ <li class="breadcrumb-item">
16
+ <a href="<%= polymorphic_url([:slash_admin, @model_class]) %>">
17
+ <%= @model_name&.pluralize %>
18
+ </a>
19
+ </li>
20
+ <% end %>
21
+ <% if params[:action] == 'new' %>
22
+ <li class="breadcrumb-item"><%= t('relax_admin.view.new', model_name: @model_class.model_name.human.pluralize.capitalize) %></li>
23
+ <% elsif params[:action] == 'edit' %>
24
+ <li class="breadcrumb-item"><%= t('relax_admin.view.edit', model_name: @model_class.model_name.human.pluralize.capitalize) %></li>
25
+ <% elsif params[:action] == 'show' %>
26
+ <li class="breadcrumb-item"><%= t('relax_admin.view.show', model_name: @model_class.model_name.human.pluralize.capitalize) %></li>
27
+ <% end %>
28
+ </ol>
29
+ </nav>
30
+ </div>
@@ -0,0 +1,24 @@
1
+ <h2>Params</h2>
2
+ <pre>
3
+ <%= debug params.inspect %>
4
+ </pre>
5
+
6
+ <h2>Belongs to</h2>
7
+ <pre>
8
+ <%= debug @belongs_to_fields.inspect %>
9
+ </pre>
10
+
11
+ <h2>Has_many</h2>
12
+ <pre>
13
+ <%= debug @has_many_fields.inspect %>
14
+ </pre>
15
+
16
+ <h2>Has_one</h2>
17
+ <pre>
18
+ <%= debug @has_one_fields.inspect %>
19
+ </pre>
20
+
21
+ <h2>Nested</h2>
22
+ <pre>
23
+ <%= debug @model_class.nested_attributes_options.keys %>
24
+ </pre>
@@ -0,0 +1,12 @@
1
+ <div class="errors">
2
+ <% show_hidden_errors.each do |msg| %>
3
+ <% if msg[1].present? %>
4
+ - <strong><%= msg[0] %> :</strong><br />
5
+ <div style="padding-left: 25px">
6
+ <% msg[1].each do |e| %>
7
+ <%= e.to_s %><br/>
8
+ <% end %>
9
+ </div>
10
+ <% end %>
11
+ <% end %>
12
+ </div>
@@ -0,0 +1,38 @@
1
+ <nav class="navbar navbar-expand-md fixed-top navbar-light bg-light">
2
+ <div class="page-logo">
3
+ <a href="<%= slash_admin.dashboard_path %>" class="navbar-brand">ADMIN</a>
4
+ <a href="<%= slash_admin.toggle_dashboard_path %>" class="menu-toggler sidebar-toggler">
5
+ <i class="icon-menu"></i>
6
+ </a>
7
+ </div>
8
+
9
+ <div class="collapse navbar-collapse" id="navbarTogglerDemo01">
10
+ <div class="navbar-nav mr-auto mt-2 mt-lg-0">
11
+ </div>
12
+ <ul class="nav right-nav-fix">
13
+ <li class="nav-item dropdown">
14
+ <a class="nav-link dropdown-toggle" href="#" id="navbarDropdownMenuLink" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
15
+ <% if current_admin.avatar.present? %>
16
+ <img src="<%= current_admin.avatar.url %>" class="rounded-circle"/>
17
+ <% else %>
18
+ <img src="data:image/png;base64,<%= current_admin.identicon %>" class="rounded-circle"/>
19
+ <% end %>
20
+ <span class=""><%= current_admin.login %></span>
21
+ <!--<i class="fa fa-angle-down"></i>-->
22
+ </a>
23
+ </li>
24
+
25
+ <li class="nav-item">
26
+ <a class="nav-link" href="/" title="Accueil du site" target="_blank">
27
+ <i class="icon-screen-desktop"></i>
28
+ </a>
29
+ </li>
30
+
31
+ <li class="nav-item">
32
+ <a class="nav-link" href="<%= slash_admin.logout_url %>" title="Se déconnecter">
33
+ <i class="icon-logout"></i>
34
+ </a>
35
+ </li>
36
+ </ul>
37
+ </div>
38
+ </nav>
@@ -0,0 +1,57 @@
1
+ <div class="page-sidebar">
2
+ <ul class="nav nav-pills flex-column">
3
+ <% menu_entries.each do |s| %>
4
+ <% if access?(s) %>
5
+ <li
6
+ class="nav-item
7
+ <% if s[:path] %>
8
+ <% if request.fullpath == s[:path] %>
9
+ active
10
+ <% end %>
11
+ <% end %>">
12
+ <a class="nav-link"
13
+ <%= s.key?(:turbolinks) ? "data-turbolinks="+ boolean_to_string(s[:turbolinks]) +"" : '' %>
14
+ href="<%= s[:path].present? ? s[:path] : '#' %>">
15
+ <% if s[:icon] %>
16
+ <i class="<%= s[:icon] %>"></i>
17
+ <% end %>
18
+ <span class="title"><%= s[:title] %></span>
19
+ </a>
20
+ <% if s[:sub_menu] %>
21
+ <ul class="sub-menu">
22
+ <% s[:sub_menu].each do |sub| %>
23
+ <% if sub[:path].present? %>
24
+ <li class="nav-item">
25
+ <a class="nav-link <%= request.fullpath == sub[:path] ? 'active' : '' %>"
26
+ <%= sub.key?(:turbolinks) ? "data-turbolinks="+ boolean_to_string(sub[:turbolinks]) +"" : '' %>
27
+ href="<%= sub[:path] %>">
28
+ <% if sub[:icon] %>
29
+ <i class="<%= sub[:icon] %>"></i>
30
+ <% end %>
31
+ <span class="title"><%= sub[:title] %></span>
32
+ </a>
33
+ </li>
34
+ <% else %>
35
+ <% if access_model?(sub) %>
36
+ <li class="nav-item">
37
+ <a class="nav-link
38
+ <%= controller.controller_name == sub[:model].name.split('::').last.tableize ? 'active' : '' %>"
39
+ <%= sub.key?(:turbolinks) ? "data-turbolinks="+ boolean_to_string(sub[:turbolinks]) +"" : '' %>
40
+ href="<%= polymorphic_url([:slash_admin, sub[:model]]) %>">
41
+ <% if sub[:icon] %>
42
+ <i class="<%= sub[:icon] %>"></i>
43
+ <% end %>
44
+ <span class="title"><%= sub[:model].model_name.human(count: 2) %></span>
45
+ <%# <span class="badge badge-pill badge-success">1</span> %>
46
+ </a>
47
+ </li>
48
+ <% end %>
49
+ <% end %>
50
+ <% end %>
51
+ </ul>
52
+ <% end %>
53
+ </li>
54
+ <% end %>
55
+ <% end %>
56
+ </ul>
57
+ </div>
@@ -0,0 +1,9 @@
1
+ <%= button_tag(type: 'submit', class: 'btn btn btn-primary', name: 'submit_add') do %>
2
+ <i class="fa fa-save"></i> <i class="fa fa-plus"></i> <%= t('slash_admin.view.save_and_add_html') %>
3
+ <% end %>
4
+ <%= button_tag(type: 'submit', class: 'btn btn btn-info pull-right', name: 'submit_redirect') do %>
5
+ <i class="fa fa-save"></i> <i class="icon-action-undo"></i> <%= t('slash_admin.view.save_and_return_html') %>
6
+ <% end %>
7
+ <button type="submit" class="btn btn-primary pull-right" style="margin-right: 15px;">
8
+ <i class="fa fa-save"></i> <%= t('slash_admin.view.save') %>
9
+ </button>
@@ -0,0 +1,11 @@
1
+ <h1 class="page-title">
2
+ <% if content_for?(:page_title) %>
3
+ <%= yield(:page_title) %>
4
+ <% else %>
5
+ -
6
+ <% end %>
7
+
8
+ <% if content_for?(:page_sub_title) %>
9
+ <small><%= yield(:page_sub_title) %></small>
10
+ <% end %>
11
+ </h1>
@@ -0,0 +1,13 @@
1
+ class JsonValidator < ActiveModel::EachValidator
2
+ def validate_each(record, attribute, value)
3
+ record.errors[attribute] << (options[:message] || I18n.t('slash_admin.view.json_not_valid')) unless valid_json?(value)
4
+ end
5
+
6
+ def valid_json?(string)
7
+ begin
8
+ !!JSON.parse(string)
9
+ rescue JSON::ParserError
10
+ false
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,67 @@
1
+ en:
2
+ slash_admin:
3
+ controller:
4
+ create:
5
+ success: "%{model_name} created."
6
+ error: "Error while creating a %{model_name}"
7
+ update:
8
+ success: "%{model_name} updated."
9
+ error: "Error while updating a %{model_name}"
10
+ delete:
11
+ success: "%{model_name} deleted."
12
+ nestable:
13
+ error: Impossible to create '%{model_name}'
14
+ success: Operation successed.
15
+ view:
16
+ administration: Administration
17
+ home: Home
18
+ welcome: Alow you to administrate your application
19
+ login: LOG IN
20
+ create: "New %{model_name}"
21
+ create_success: "%{model_name} successfully created"
22
+ add: "Add a %{model_name}"
23
+ cancel: Cancel
24
+ save: Save
25
+ delete: Delete
26
+ new: New
27
+ edit: "Edit: %{model_name}"
28
+ show: "Show: %{model_name}"
29
+ tools: Tools
30
+ order: Order
31
+ ordering: "Order %{model_name}"
32
+ export_xls: Export XLS
33
+ export_csv: Export CSV
34
+ save_and_return_html: Save &amp; Return to list
35
+ save_and_add_html: Save &amp; Add a new
36
+ actions: Actions
37
+ batch_actions: Batch actions
38
+ total_of: Total
39
+ of: of
40
+ result_found: results found
41
+ show_by: Show by
42
+ be_careful: You won't be able to go back
43
+ selected_elements: element(s) selected
44
+ page: Page
45
+ yes: Yes
46
+ no: No
47
+ filter: Filter
48
+ reset: Reset
49
+ select_model: "Select a %{model_name}"
50
+ list: "%{model_name} list"
51
+ return_to_list: Return to list
52
+ no_image: No image
53
+ translations: Translations
54
+ add_tag: Add a tag
55
+ confirm: Are you sure ?
56
+ no_back: You won't be able to go back
57
+ yes_delete: Yes, delete
58
+ enable_javascript_html: '
59
+ For full functionality of this site it is necessary to enable JavaScript.
60
+ Here are the <a href="https://www.enable-javascript.com/" target="_blank">
61
+ instructions how to enable JavaScript in your web browser</a>.'
62
+ administration_login: Administration - Login
63
+ json_not_valid: JSON is not valid
64
+ username: Username
65
+ password: Password
66
+ sessions:
67
+ login_required: You must be logged to access this page.