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,23 @@
1
+ <% if should_add_translatable? %>
2
+ <h3 class="translations"><%= t('slash_admin.view.translations') %></h3>
3
+ <nav class="nav nav-tabs" id="language-tabs" role="tablist">
4
+ <% I18n.available_locales.each do |locale| %>
5
+ <a class="nav-item nav-link <%= I18n.available_locales.first == locale ? 'active' : '' %>" id="nav-language-<%= locale %>" data-toggle="tab" href="#language-<%= locale %>" role="tab" aria-controls="language-<%= locale %>">
6
+ <img src='<%= image_path("slash_admin/#{locale.to_s}.png") %>' style="margin-right: 5px; max-width: 25px;">
7
+ </a>
8
+ </li>
9
+ <% end %>
10
+ </nav>
11
+ <div class="tab-content">
12
+ <% I18n.available_locales.each do |locale| %>
13
+ <div class="tab-pane fade <%= I18n.available_locales.first == locale ? 'show active' : '' %>" id="language-<%= locale %>" role="tabpanel" aria-labelledby="language-<%= locale %>-tab">
14
+ <%= f.globalize_fields_for locale do |g| %>
15
+ <% translatable_params.each do |a| %>
16
+ <%= render 'slash_admin/fields/form_group', f: g, a: a %>
17
+ <% end %>
18
+ <% end %>
19
+ </div>
20
+ <% end %>
21
+ </div>
22
+ <div class="separator"></div>
23
+ <% end %>
@@ -0,0 +1,26 @@
1
+ <% page_title(@model_name.pluralize) %>
2
+ <% page_sub_title(@sub_title) %>
3
+
4
+ <div class="row">
5
+ <div class="col-sm-12">
6
+ <div class="portlet">
7
+ <div class="portlet-title">
8
+ <div class="caption">
9
+ <%= t('slash_admin.view.edit', model_name: @model_name.pluralize) %>
10
+ </div>
11
+ <div class="actions">
12
+ <%= link_to(polymorphic_url([:slash_admin, @model_class]), class: 'btn btn-circle btn-primary btn-sm') do %>
13
+ <i class="icon-action-undo"></i> <%= t('slash_admin.view.return_to_list') %>
14
+ <% end %>
15
+ </div>
16
+ </div>
17
+ <div class="portlet-body">
18
+ <div class="row">
19
+ <div class="col-sm-12">
20
+ <%= render 'data_new', params: update_params %>
21
+ </div>
22
+ </div>
23
+ </div>
24
+ </div>
25
+ </div>
26
+ </div>
@@ -0,0 +1,47 @@
1
+ <% page_title(@title) %>
2
+ <% page_sub_title(@sub_title) %>
3
+
4
+ <div class="row">
5
+ <div class="col-sm-12">
6
+ <div class="portlet">
7
+ <div class="portlet-title">
8
+ <div class="caption">
9
+ <% if @is_nestable %>
10
+ <%= link_to(polymorphic_url([:nestable, :slash_admin, @model_class]), class: 'btn btn-circle btn-info btn-sm') do %>
11
+ <i class="fa fa-outdent"></i> <%= t('slash_admin.view.order') %>
12
+ <% end %>
13
+ <% end %>
14
+
15
+ <%= t('slash_admin.view.list', model_name: @model_class.model_name.human(count: 2)) %>
16
+ </div>
17
+ <div class="actions">
18
+ <% if can? :create, @model_class %>
19
+ <%= link_to(new_polymorphic_url([:slash_admin, @model_class]), class: 'btn btn-circle btn-primary btn-sm') do %>
20
+ <i class="fa fa-plus"></i> <%= t('slash_admin.view.new') %>
21
+ <% end rescue nil %>
22
+ <% end %>
23
+ <div class="dropdown">
24
+ <a class="btn btn-circle btn-secondary btn-sm dropdown-toggle" href="#" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
25
+ <i class="fa fa-share"></i>
26
+ <span class=""><%= t('slash_admin.view.tools') %></span>
27
+ <i class="fa fa-angle-down fix-dropdown"></i>
28
+ </a>
29
+ <div class="dropdown-menu">
30
+ <a class="dropdown-item" href="<%= polymorphic_url([:slash_admin, @model_class], format: 'csv') %>"><%= t('slash_admin.view.export_csv') %></a>
31
+ <a class="dropdown-item" href="<%= polymorphic_url([:slash_admin, @model_class], format: 'xls') %>"><%= t('slash_admin.view.export_xls') %></a>
32
+ </div>
33
+ </div>
34
+ </div>
35
+ </div>
36
+ <div class="portlet-body">
37
+ <div class="datatable_wrapper">
38
+ <div class="row">
39
+ <div class="col-sm-12">
40
+ <%= render 'data_list' %>
41
+ </div>
42
+ </div>
43
+ </div>
44
+ </div>
45
+ </div>
46
+ </div>
47
+ </div>
@@ -0,0 +1,27 @@
1
+ <?xml version="1.0"?>
2
+ <Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet"
3
+ xmlns:o="urn:schemas-microsoft-com:office:office"
4
+ xmlns:x="urn:schemas-microsoft-com:office:excel"
5
+ xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet"
6
+ xmlns:html="http://www.w3.org/TR/REC-html40">
7
+ <Worksheet ss:Name="Sheet1">
8
+ <Table>
9
+ <Row>
10
+ <% @fields.each do |f| %>
11
+ <Cell>
12
+ <Data ss:Type="String"><%= @model_class.human_attribute_name(f) %></Data>
13
+ </Cell>
14
+ <% end %>
15
+ </Row>
16
+ <% @models_export.each do |m| %>
17
+ <Row>
18
+ <% @fields.each do |f| %>
19
+ <Cell>
20
+ <Data ss:Type="String"><%= m.read_attribute(f).to_s %></Data>
21
+ </Cell>
22
+ <% end %>
23
+ </Row>
24
+ <% end %>
25
+ </Table>
26
+ </Worksheet>
27
+ </Workbook>
@@ -0,0 +1,28 @@
1
+ <% page_title(@model_name.pluralize) %>
2
+ <% page_sub_title(@sub_title) %>
3
+
4
+ <div class="row">
5
+ <div class="col-sm-12">
6
+ <div class="portlet">
7
+ <div class="portlet-title">
8
+ <div class="caption">
9
+ <%= t('slash_admin.view.ordering', model_name: @model_name.pluralize) %>
10
+ </div>
11
+ <div class="actions">
12
+ <%= link_to(polymorphic_url([:slash_admin, @model_class]), class: 'btn btn-circle btn-primary btn-sm') do %>
13
+ <i class="icon-action-undo"></i> <%= t('slash_admin.view.return_to_list') %>
14
+ <% end %>
15
+ </div>
16
+ </div>
17
+ <div class="portlet-body">
18
+ <div class="datatable_wrapper">
19
+ <div class="row">
20
+ <div class="col-sm-12">
21
+ <%= render 'data_nestable' %>
22
+ </div>
23
+ </div>
24
+ </div>
25
+ </div>
26
+ </div>
27
+ </div>
28
+ </div>
@@ -0,0 +1,26 @@
1
+ <% page_title(@model_name.pluralize) %>
2
+ <% page_sub_title(@sub_title) %>
3
+
4
+ <div class="row">
5
+ <div class="col-sm-12">
6
+ <div class="portlet">
7
+ <div class="portlet-title">
8
+ <div class="caption">
9
+ <%= t('slash_admin.view.create', model_name: @model_name.pluralize) %>
10
+ </div>
11
+ <div class="actions">
12
+ <%= link_to(polymorphic_url([:slash_admin, @model_class]), class: 'btn btn-circle btn-primary btn-sm') do %>
13
+ <i class="icon-action-undo"></i> <%= t('slash_admin.view.return_to_list') %>
14
+ <% end %>
15
+ </div>
16
+ </div>
17
+ <div class="portlet-body">
18
+ <div class="row">
19
+ <div class="col-sm-12">
20
+ <%= render 'data_new', params: create_params %>
21
+ </div>
22
+ </div>
23
+ </div>
24
+ </div>
25
+ </div>
26
+ </div>
@@ -0,0 +1,22 @@
1
+ <% page_title(@model_name.pluralize) %>
2
+ <% page_sub_title(@sub_title) %>
3
+
4
+ <div class="row">
5
+ <div class="col-sm-12">
6
+ <div class="portlet">
7
+ <div class="portlet-title">
8
+ <div class="caption">
9
+ <%= t('slash_admin.view.show', model_name: @model_name.pluralize) %>
10
+ </div>
11
+ <div class="actions">
12
+ <%= link_to(polymorphic_url([:slash_admin, @model_class]), class: 'btn btn-circle btn-primary btn-sm') do %>
13
+ <i class="icon-action-undo"></i> <%= t('slash_admin.view.return_to_list') %>
14
+ <% end %>
15
+ </div>
16
+ </div>
17
+ <div class="portlet-body">
18
+ <%= render 'data_show' %>
19
+ </div>
20
+ </div>
21
+ </div>
22
+ </div>
@@ -0,0 +1,2 @@
1
+ <%= f.label a.keys.first, class: "form-control-label #{required?(f.object, a) ? 'required' : ''}" %>
2
+ <%= f.text_field a.keys.first, class: 'form-control colorpicker', required: required?(f.object, a) %>
@@ -0,0 +1,2 @@
1
+ <%= f.label a.keys.first, class: "form-control-label #{required?(f.object, a) ? 'required' : ''}" %>
2
+ <%= f.email_field a.keys.first, class: 'form-control', required: required?(f.object, a) %>
@@ -0,0 +1,72 @@
1
+ <%= f.label a.keys.first, class: "form-control-label #{required?(f.object, a).present? ? 'required' : ''}" %>
2
+ <input type="text" class="form-control" id="<%= f.options[:html][:id] %>_search" />
3
+ <script async defer
4
+ src="https://maps.googleapis.com/maps/api/js?key=<%= a[a.keys.first.to_sym][:google_api_key] %>&libraries=places&callback=initMap">
5
+ </script>
6
+ <div class="google-map-container" id="<%= f.options[:html][:id] %>_map" style="width:100%; min-height:350px"></div>
7
+ <%= f.hidden_field a.keys.first, class: 'form-control', id: f.options[:html][:id] + '_' + a.keys.first.to_s, required: required?(f.object, a) %>
8
+
9
+ <script type="text/javascript">
10
+ var map = {};
11
+ var markers;
12
+ function initMap() {
13
+ markers = [];
14
+ var myOptions = {
15
+ zoom: <%= a[a.keys.first.to_sym][:default_zoom_level] %>,
16
+ center: new google.maps.LatLng(<%= a[a.keys.first.to_sym][:default_latitude] %>, <%= a[a.keys.first.to_sym][:default_longitude] %>),
17
+ mapTypeId: google.maps.MapTypeId.ROADMAP,
18
+ scrollwheel: false
19
+ };
20
+ map = new google.maps.Map(document.getElementById("<%= f.options[:html][:id] %>_map"), myOptions);
21
+ document.getElementById("<%= f.options[:html][:id] %>_search").value = '';
22
+ initializeAutocomplete('<%= f.options[:html][:id] %>_search');
23
+ function initializeAutocomplete(id) {
24
+ var element = document.getElementById(id);
25
+ if (element) {
26
+ var autocomplete = new google.maps.places.Autocomplete(element, {types: ['geocode']});
27
+ google.maps.event.addListener(autocomplete, 'place_changed', onPlaceChanged);
28
+ }
29
+ }
30
+ updateMarker();
31
+ }
32
+ function onPlaceChanged() {
33
+ cleanAllMarkers();
34
+ var final_datas = {}
35
+ var place = this.getPlace();
36
+ if (place.length == 0) {
37
+ return;
38
+ }
39
+ var location = place.geometry.location;
40
+ final_datas.location = {
41
+ latitude: location.lat(),
42
+ longitude: location.lng()
43
+ };
44
+ final_datas.formatted_address = place.formatted_address;
45
+ for (var i in place.address_components) {
46
+ var component = place.address_components[i];
47
+ for (var j in component.types) {
48
+ final_datas[component.types[j]] = component.long_name;
49
+ }
50
+ }
51
+ document.getElementById("<%= f.options[:html][:id] + '_' + a.keys.first.to_s %>").value = JSON.stringify(final_datas);
52
+ updateMarker();
53
+ }
54
+ function updateMarker() {
55
+ if (document.getElementById("<%= f.options[:html][:id] + '_' + a.keys.first.to_s %>").value.length > 0) {
56
+ var json = JSON.parse(document.getElementById("<%= f.options[:html][:id] + '_' + a.keys.first.to_s %>").value);
57
+ if (json.location) {
58
+ var marker = new google.maps.Marker({
59
+ position: new google.maps.LatLng(json.location.latitude, json.location.longitude),
60
+ map: map
61
+ });
62
+ markers.push(marker);
63
+ map.setCenter(new google.maps.LatLng(json.location.latitude, json.location.longitude));
64
+ }
65
+ }
66
+ }
67
+ function cleanAllMarkers() {
68
+ for (var i = 0; i < markers.length; i++) {
69
+ markers[i].setMap(null);
70
+ }
71
+ }
72
+ </script>
@@ -0,0 +1,55 @@
1
+ <%= f.label a.keys.first, class: "form-control-label #{required?(f.object, a).present? ? 'required' : ''}" %>
2
+ <%= f.collection_select a.keys.first.to_s + '_id',
3
+ class_name_from_association(f.object, a).constantize.all.limit(20), :id, object_label(a),
4
+ {
5
+ prompt: t('slash_admin.view.select_model', model_name: class_name_from_association(f.object, a).constantize.model_name.human.downcase),
6
+ },
7
+ 'data-model': class_name_from_association(f.object, a).constantize.model_name.to_s.underscore,
8
+ 'data-fields': "SlashAdmin::Models::#{a.keys.first.to_s.classify.pluralize}Controller".constantize.new.autocomplete_params.join(' '),
9
+ class: "selectize-model-single #{a.keys.first.to_s}_id", required: required?(f.object, a).present? %>
10
+
11
+ <a href="#" class="add-belongs-to" style="font-size: .9em;"><%= t('slash_admin.view.add', class_name_from_association(f.object, a).constantize.model_name.human.downcase) %></a>
12
+
13
+ <script type="text/javascript">
14
+ $(function() {
15
+ $('.add-belongs-to').on('click', function(e) {
16
+ e.preventDefault();
17
+ $('.modal-belongs-to').html();
18
+ $('.modal-belongs-to').html("<%= escape_javascript(render 'slash_admin/base/data_belongs_to', a: a) %>");
19
+ $('.modal-belongs-to').modal('show');
20
+
21
+ var id = "form#new_<%= a.keys.first.to_s.singularize %>";
22
+
23
+ function closeModals() {
24
+ $(".modal").modal("hide");
25
+ $("body").removeClass("modal-open");
26
+ $(".modal-backdrop").remove();
27
+ }
28
+
29
+ $(id)
30
+ .on('ajax:complete', function(xhr, status) {
31
+ // console.log(status);
32
+ })
33
+ .on('ajax:error', function(xhr, status, err) {
34
+ console.log(status);
35
+ console.log(err);
36
+ })
37
+ .on("ajax:success", function(xhr, data, status) {
38
+ if (data.errors) {
39
+ var errors_html = "";
40
+ data.errors.map(function(item, index) {
41
+ errors_html += item + '<br />';
42
+ });
43
+ $('.errors-json').html(errors_html)
44
+ } else {
45
+ toastr.success("<%= t('slash_admin.view.create_success', model_name: class_name_from_association(f.object, a).constantize.model_name.human) %>");
46
+ $(id).trigger("reset");
47
+ closeModals();
48
+ var select = $('.<%= a.keys.first.to_s + '_id' %>')[0].selectize;
49
+ select.addOption({value: data.id, text: data.title});
50
+ select.addItem(data.id);
51
+ }
52
+ });
53
+ });
54
+ });
55
+ </script>
@@ -0,0 +1,2 @@
1
+ <%= f.label a.keys.first, class: "form-control-label #{required?(f.object, a) ? 'required' : ''}" %>
2
+ <%= f.password_field a.keys.first, class: 'form-control', required: required?(f.object, a) %>
@@ -0,0 +1,2 @@
1
+ <%= f.label a.keys.first, class: "form-control-label #{required?(f.object, a) ? 'required' : ''}" %>
2
+ <%= f.select(a.keys.first, a[a.keys.first][:choices], { include_blank: a[a.keys.first][:include_blank], required: required?(f.object, a) }, class: 'selectize-single') %>
@@ -0,0 +1,2 @@
1
+ <%= f.label a.keys.first, class: "form-control-label #{required?(f.object, a) ? 'required' : ''}" %>
2
+ <%= f.text_field a.keys.first, class: 'form-control tagsinput tags', required: required?(f.object, a) %>
@@ -0,0 +1,2 @@
1
+ <%= f.label a.keys.first, class: "form-control-label #{required?(f.object, a) ? 'required' : ''}" %>
2
+ <%= f.text_area a.keys.first, class: 'form-control froala-editor', rows: '5', required: required?(f.object, a) %>
@@ -0,0 +1,5 @@
1
+ <% page_title('Dashboard') %>
2
+ <% page_sub_title(t('slash_admin.view.welcome')) %>
3
+
4
+ <div class="separator">
5
+ </div>
@@ -0,0 +1,29 @@
1
+ <div class="dashboard-stat">
2
+ <div class="display">
3
+ <div class="number">
4
+ <h3 class="font-green-sharp">
5
+ <span data-counter="counterup" data-value="<%= options[:number] %>"></span><!--
6
+ --><% if options[:currency].present? %><small><%= options[:currency] %></small><% end %>
7
+ </h3>
8
+ <small><%= options[:title] %></small>
9
+ </div>
10
+ <div class="icon">
11
+ <i class="<%= options[:icon] %>"></i>
12
+ </div>
13
+ </div>
14
+ <div class="progress-info">
15
+ <div class="progress">
16
+ <span style="width: <%= options[:percent] %>%;" class="progress-bar bg-<%= options[:status] %>">
17
+ <span class="sr-only"><%= options[:percent] %>% progress</span>
18
+ </span>
19
+ </div>
20
+ <div class="status">
21
+ <div class="status-title">
22
+ <%= options[:progress_label] %>
23
+ </div>
24
+ <div class="status-number">
25
+ <%= options[:percent] %>%
26
+ </div>
27
+ </div>
28
+ </div>
29
+ </div>
@@ -0,0 +1,9 @@
1
+ <%= f.label a, class: "form-control-label #{required?(f.object, a).present? ? 'required' : ''}" %>
2
+ <%= f.collection_select a.to_s + '_id',
3
+ class_name_from_association(f.object, a).constantize.all.limit(20), :id, object_label(class_name_from_association(f.object, a)),
4
+ {
5
+ prompt: t('slash_admin.view.select_model', model_name: class_name_from_association(f.object, a).constantize.model_name.human.downcase),
6
+ },
7
+ 'data-model': class_name_from_association(f.object, a).constantize.model_name.to_s.underscore,
8
+ 'data-fields': "SlashAdmin::Models::#{class_name_from_association(f.object, a).classify.pluralize}Controller".constantize.new.autocomplete_params.join(' '),
9
+ class: 'selectize-model-single', required: required?(f.object, a).present? %>
@@ -0,0 +1,2 @@
1
+ <%= f.check_box a, class: 'form-control-label' %>
2
+ <%= f.label a %>
@@ -0,0 +1,15 @@
1
+ <%= f.label a.to_sym, class: "form-control-label #{required?(f.object, a).present? ? 'required' : ''}" %>
2
+
3
+ <div class="image-field">
4
+ <%# TODO handle file that are not image eg pdf %>
5
+ <% if f.object.send(a).try(:url).present? %>
6
+ <img src="<%= f.object.send(a) %>" class="image"/>
7
+ <% end %>
8
+ <%= f.hidden_field (a.to_s + '_cache').to_sym %>
9
+ <%= f.file_field a %>
10
+ </div>
11
+
12
+ <% if f.object.send(a).try(:url).present? && required?(f.object, a).blank? %>
13
+ <%= f.check_box ('remove_' + a.to_s).to_sym %>
14
+ Supprimer l'image
15
+ <% end %>
@@ -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 bootstrap-material-#{@model_class.type_for_attribute(a.to_s).type.to_s}", required: required?(f.object, a) %>
@@ -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,12 @@
1
+ <div class="form-group
2
+ <% if errors?(f, a) %>has-danger<% end %>">
3
+ <%= admin_field(f, a) %>
4
+ <% if defined?(help) %>
5
+ <small class="form-text text-muted"><%= help %></small>
6
+ <% end %>
7
+ <div class="form-control-feedback">
8
+ <% show_errors(f, a).each do |msg| %>
9
+ - <%= msg %><br/>
10
+ <% end %>
11
+ </div>
12
+ </div>