swop 0.1.1 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +47 -9
- data/app/assets/images/swop/favicon.ico +0 -0
- data/app/assets/stylesheets/rails_admin/application.scss.erb +11 -20
- data/app/assets/stylesheets/{rails_admin/themes/base/base.scss → swop/swop-base/swop-base.scss} +1 -5
- data/app/assets/stylesheets/swop/swop-base/swop-typography.scss +11 -0
- data/app/assets/stylesheets/swop/swop-colors/swop-colors.scss +2 -0
- data/app/assets/stylesheets/swop/swop-core/swop-bootstrap-variables.scss +172 -0
- data/app/assets/stylesheets/swop/swop-core/swop-variables.scss +34 -0
- data/app/assets/stylesheets/swop/swop-themes/swop-simple/swop-base/swop-base.scss +3 -0
- data/app/assets/stylesheets/swop/swop-themes/swop-simple/swop-base/swop-main.scss +25 -0
- data/app/assets/stylesheets/swop/swop-themes/swop-simple/swop-base/swop-typography.scss +4 -0
- data/app/assets/stylesheets/swop/swop-themes/swop-simple/swop-colors/swop-amethyst.scss +29 -0
- data/app/assets/stylesheets/swop/swop-themes/swop-simple/swop-colors/swop-dark.scss +29 -0
- data/app/assets/stylesheets/swop/swop-themes/swop-simple/swop-colors/swop-forest.scss +29 -0
- data/app/assets/stylesheets/swop/swop-themes/swop-simple/swop-colors/swop-light.scss +29 -0
- data/app/assets/stylesheets/swop/swop-themes/swop-simple/swop-colors/swop-royal.scss +29 -0
- data/app/assets/stylesheets/swop/swop-themes/swop-simple/swop-components/swop-alerts.scss +12 -0
- data/app/assets/stylesheets/swop/swop-themes/swop-simple/swop-components/swop-badges.scss +31 -0
- data/app/assets/stylesheets/swop/swop-themes/swop-simple/swop-components/swop-buttons.scss +133 -0
- data/app/assets/stylesheets/swop/swop-themes/swop-simple/swop-components/swop-dropdowns.scss +26 -0
- data/app/assets/stylesheets/swop/swop-themes/swop-simple/swop-components/swop-filters.scss +57 -0
- data/app/assets/stylesheets/swop/swop-themes/swop-simple/swop-components/swop-forms.scss +158 -0
- data/app/assets/stylesheets/swop/swop-themes/swop-simple/swop-components/swop-images.scss +31 -0
- data/app/assets/stylesheets/swop/swop-themes/swop-simple/swop-components/swop-input-groups.scss +18 -0
- data/app/assets/stylesheets/swop/swop-themes/swop-simple/swop-components/swop-loading.scss +14 -0
- data/app/assets/stylesheets/swop/swop-themes/swop-simple/swop-components/swop-navbar.scss +15 -0
- data/app/assets/stylesheets/swop/swop-themes/swop-simple/swop-components/swop-navs.scss +77 -0
- data/app/assets/stylesheets/swop/swop-themes/swop-simple/swop-components/swop-offcanvas.scss +64 -0
- data/app/assets/stylesheets/swop/swop-themes/swop-simple/swop-components/swop-pagination.scss +21 -0
- data/app/assets/stylesheets/swop/swop-themes/swop-simple/swop-components/swop-progress.scss +3 -0
- data/app/assets/stylesheets/swop/swop-themes/swop-simple/swop-components/swop-sidebars.scss +49 -0
- data/app/assets/stylesheets/swop/swop-themes/swop-simple/swop-components/swop-tables.scss +82 -0
- data/app/assets/stylesheets/swop/swop-themes/swop-simple/swop-components/swop-tiles.scss +20 -0
- data/app/assets/stylesheets/swop/swop-themes/swop-simple/swop-core/swop-bootstrap-variables.scss +149 -0
- data/app/assets/stylesheets/swop/swop-themes/swop-simple/swop-core/swop-variables.scss +41 -0
- data/app/assets/stylesheets/{rails_admin/themes/simple/components/containers.scss → swop/swop-themes/swop-simple/swop-layouts/swop-containers.scss} +9 -0
- data/app/assets/stylesheets/swop/swop-themes/swop-simple/swop-layouts/swop-header.scss +15 -0
- data/app/assets/stylesheets/swop/swop-themes/swop-simple/swop-simple-amethyst.scss +35 -0
- data/app/assets/stylesheets/swop/swop-themes/swop-simple/swop-simple-base.scss +3 -0
- data/app/assets/stylesheets/swop/swop-themes/swop-simple/swop-simple-components.scss +17 -0
- data/app/assets/stylesheets/swop/swop-themes/swop-simple/swop-simple-dark.scss +35 -0
- data/app/assets/stylesheets/swop/swop-themes/swop-simple/swop-simple-forest.scss +35 -0
- data/app/assets/stylesheets/swop/swop-themes/swop-simple/swop-simple-layouts.scss +2 -0
- data/app/assets/stylesheets/swop/swop-themes/swop-simple/swop-simple-light.scss +35 -0
- data/app/assets/stylesheets/swop/swop-themes/swop-simple/swop-simple-royal.scss +35 -0
- data/app/assets/stylesheets/swop/swop.scss +8 -0
- data/app/views/kaminari/ra-twitter-bootstrap/_next_page.html.erb +7 -0
- data/app/views/kaminari/ra-twitter-bootstrap/_prev_page.html.erb +5 -0
- data/app/views/kaminari/ra-twitter-bootstrap/default/_next_page.html.erb +9 -0
- data/app/views/kaminari/ra-twitter-bootstrap/default/_prev_page.html.erb +9 -0
- data/app/views/kaminari/ra-twitter-bootstrap/swop-simple/_next_page.html.erb +9 -0
- data/app/views/kaminari/ra-twitter-bootstrap/swop-simple/_prev_page.html.erb +9 -0
- data/app/views/layouts/rails_admin/_head.html.erb +5 -32
- data/app/views/layouts/rails_admin/_sidebar_navigation.html.erb +5 -3
- data/app/views/layouts/rails_admin/application.html.erb +5 -27
- data/app/views/layouts/rails_admin/content.html.erb +4 -11
- data/app/views/layouts/rails_admin/default/_application.html.erb +27 -0
- data/app/views/layouts/rails_admin/default/_content.html.erb +22 -0
- data/app/views/layouts/rails_admin/default/_head.html.erb +32 -0
- data/app/views/layouts/rails_admin/default/_sidebar_navigation.html.erb +5 -0
- data/app/views/layouts/rails_admin/swop-simple/_application.html.erb +17 -0
- data/app/views/layouts/rails_admin/swop-simple/_content.html.erb +41 -0
- data/app/views/layouts/rails_admin/swop-simple/_head.html.erb +42 -0
- data/app/views/layouts/rails_admin/swop-simple/_sidebar_navigation.html.erb +12 -0
- data/app/views/rails_admin/main/_delete_notice.html.erb +7 -0
- data/app/views/rails_admin/main/default/_delete.html.erb +21 -0
- data/app/views/rails_admin/main/default/_delete_notice.html.erb +34 -0
- data/app/views/rails_admin/main/default/_edit.html.erb +3 -0
- data/app/views/rails_admin/main/default/_export.html.erb +149 -0
- data/app/views/rails_admin/main/default/_history.html.erb +80 -0
- data/app/views/rails_admin/main/default/_index.html.erb +184 -0
- data/app/views/rails_admin/main/default/_new.html.erb +3 -0
- data/app/views/rails_admin/main/default/_show.html.erb +30 -0
- data/app/views/rails_admin/main/delete.html.erb +5 -0
- data/app/views/rails_admin/main/edit.html.erb +5 -0
- data/app/views/rails_admin/main/export.html.erb +5 -128
- data/app/views/rails_admin/main/history.html.erb +4 -86
- data/app/views/rails_admin/main/index.html.erb +4 -173
- data/app/views/rails_admin/main/new.html.erb +5 -0
- data/app/views/rails_admin/main/show.html.erb +5 -20
- data/app/views/rails_admin/main/swop-simple/_delete.html.erb +11 -0
- data/app/views/rails_admin/main/swop-simple/_delete_notice.html.erb +23 -0
- data/app/views/rails_admin/main/swop-simple/_edit.html.erb +3 -0
- data/app/views/rails_admin/main/swop-simple/_export.html.erb +90 -0
- data/app/views/rails_admin/main/swop-simple/_history.html.erb +80 -0
- data/app/views/rails_admin/main/swop-simple/_index.html.erb +169 -0
- data/app/views/rails_admin/main/swop-simple/_new.html.erb +3 -0
- data/app/views/rails_admin/main/swop-simple/_show.html.erb +18 -0
- data/lib/swop/engine.rb +8 -3
- data/lib/swop/railtie.rb +7 -0
- data/lib/swop/version.rb +1 -1
- data/lib/swop.rb +20 -2
- metadata +102 -98
- data/CHANGELOG.md +0 -5
- data/CODE_OF_CONDUCT.md +0 -132
- data/LICENSE +0 -201
- data/Rakefile +0 -4
- data/app/assets/javascripts/rails_admin/application.js.erb +0 -33
- data/app/assets/javascripts/rails_admin/custom/abstract-select.js +0 -30
- data/app/assets/javascripts/rails_admin/custom/filter-box.js +0 -363
- data/app/assets/javascripts/rails_admin/custom/filtering-multiselect.js +0 -387
- data/app/assets/javascripts/rails_admin/custom/filtering-select.js +0 -304
- data/app/assets/stylesheets/rails_admin/themes/base/bootstrap-variables.scss +0 -252
- data/app/assets/stylesheets/rails_admin/themes/base/theming.scss +0 -22
- data/app/assets/stylesheets/rails_admin/themes/base/variables.scss +0 -71
- data/app/assets/stylesheets/rails_admin/themes/simple/base/typography.scss +0 -22
- data/app/assets/stylesheets/rails_admin/themes/simple/base/variables-dark.scss +0 -74
- data/app/assets/stylesheets/rails_admin/themes/simple/base/variables-light.scss +0 -77
- data/app/assets/stylesheets/rails_admin/themes/simple/base/variables-navy.scss +0 -74
- data/app/assets/stylesheets/rails_admin/themes/simple/base/variables.scss +0 -129
- data/app/assets/stylesheets/rails_admin/themes/simple/components/alerts.scss +0 -88
- data/app/assets/stylesheets/rails_admin/themes/simple/components/breadcrumbs.scss +0 -44
- data/app/assets/stylesheets/rails_admin/themes/simple/components/buttons.scss +0 -138
- data/app/assets/stylesheets/rails_admin/themes/simple/components/dropdowns.scss +0 -12
- data/app/assets/stylesheets/rails_admin/themes/simple/components/filter-box.scss +0 -8
- data/app/assets/stylesheets/rails_admin/themes/simple/components/filtering-multiselect.scss +0 -40
- data/app/assets/stylesheets/rails_admin/themes/simple/components/filtering-select.scss +0 -42
- data/app/assets/stylesheets/rails_admin/themes/simple/components/forms.scss +0 -27
- data/app/assets/stylesheets/rails_admin/themes/simple/components/images.scss +0 -19
- data/app/assets/stylesheets/rails_admin/themes/simple/components/links.scss +0 -25
- data/app/assets/stylesheets/rails_admin/themes/simple/components/navs.scss +0 -73
- data/app/assets/stylesheets/rails_admin/themes/simple/components/progress.scss +0 -4
- data/app/assets/stylesheets/rails_admin/themes/simple/components/sidebar.scss +0 -84
- data/app/assets/stylesheets/rails_admin/themes/simple/components/tables.scss +0 -84
- data/app/assets/stylesheets/rails_admin/themes/simple/layouts/rows.scss +0 -34
- data/app/assets/stylesheets/rails_admin/themes/simple/light/components/links.scss +0 -15
- data/app/assets/stylesheets/rails_admin/themes/simple/light/components/sidebar.scss +0 -25
- data/app/assets/stylesheets/rails_admin/themes/simple.scss.erb +0 -37
- data/app/helpers/rails_admin/application_helper.rb +0 -258
- data/app/helpers/rails_admin/form_builder.rb +0 -166
- data/app/views/layouts/rails_admin/_custom_navigation.html.erb +0 -10
- data/app/views/layouts/rails_admin/_header.html.erb +0 -43
- data/app/views/rails_admin/main/_form_polymorphic_association.html.erb +0 -15
- data/app/views/rails_admin/main/_submit_buttons.html.erb +0 -29
- data/app/views/rails_admin/main/dashboard.html.erb +0 -64
- data/config/locales/rails_admin.en.yml +0 -158
- data/sig/swop.rbs +0 -4
- /data/app/assets/stylesheets/{rails_admin/themes/base/mixins.scss → swop/swop-core/swop-mixins.scss} +0 -0
|
@@ -1,20 +1,5 @@
|
|
|
1
|
-
<%
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
<h4><%= fieldset.label %></h4>
|
|
7
|
-
<p><%= fieldset.help %></p>
|
|
8
|
-
<% end %>
|
|
9
|
-
<div class="list-group">
|
|
10
|
-
<% fields.each_with_index do |field, index| %>
|
|
11
|
-
<div class="list-group-item border-0 <%= field.type_css_class %> <%= field.css_class %> mb-3">
|
|
12
|
-
<div class="text-muted"><%= field.label %></div>
|
|
13
|
-
<div class="fw-semibold text-dark"><%= field.pretty_value %></div>
|
|
14
|
-
</div>
|
|
15
|
-
<% end %>
|
|
16
|
-
</dl>
|
|
17
|
-
</div>
|
|
18
|
-
<% end %>
|
|
19
|
-
<% end %>
|
|
20
|
-
<% end %>
|
|
1
|
+
<% if Swop.configuration.style == :simple %>
|
|
2
|
+
<%= render partial: "rails_admin/main/swop-simple/show" %>
|
|
3
|
+
<% else %>
|
|
4
|
+
<%= render partial: "rails_admin/main/default/show" %>
|
|
5
|
+
<% end %>
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
<h2><%= t("admin.form.all_of_the_following_related_items_will_be_deleted") %></h2>
|
|
2
|
+
<%= render partial: "delete_notice", object: @object %>
|
|
3
|
+
<%= form_for(@object, url: delete_path(model_name: @abstract_model.to_param, id: @object.id), html: {method: "delete"}) do %>
|
|
4
|
+
<input name="return_to" type="<%= :hidden %>" value="<%= (params[:return_to].presence || request.referer) %>" />
|
|
5
|
+
<div class="form-actions">
|
|
6
|
+
<button class="btn btn-danger" data-disable-with="<%= t("admin.form.confirmation") %>" type="submit"><%= t("admin.form.confirmation") %>
|
|
7
|
+
</button>
|
|
8
|
+
<button class="btn btn-body" data-disable-with="<%= t("admin.form.cancel") %>" name="_continue" type="submit"><%= t("admin.form.cancel") %>
|
|
9
|
+
</button>
|
|
10
|
+
</div>
|
|
11
|
+
<% end %>
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
<ul class="lead">
|
|
2
|
+
<% @abstract_model.each_associated_children(object) do |association, children| %>
|
|
3
|
+
<% humanized_association = @abstract_model.model.human_attribute_name association.name %>
|
|
4
|
+
<% limit = children.count > 12 ? 10 : children.count %>
|
|
5
|
+
<% children.first(limit).each do |child| %>
|
|
6
|
+
<%= content_tag :li, class: dom_class(child) do %>
|
|
7
|
+
<% child_config = RailsAdmin.config(child) %>
|
|
8
|
+
<%= humanized_association.singularize %>
|
|
9
|
+
<% wording = child.send(child_config.object_label_method) %>
|
|
10
|
+
<% if child.id && (show_action = action(:show, child_config.abstract_model, child)) %>
|
|
11
|
+
<%= link_to(wording, url_for(action: show_action.action_name, model_name: child_config.abstract_model.to_param, id: child.id)) %>
|
|
12
|
+
<% else %>
|
|
13
|
+
<%= wording %>
|
|
14
|
+
<% end %>
|
|
15
|
+
<% end %>
|
|
16
|
+
<% end %>
|
|
17
|
+
<% if children.count > limit %>
|
|
18
|
+
<li>
|
|
19
|
+
<%= t('admin.misc.more', count: children.count - limit, models_name: humanized_association) %>
|
|
20
|
+
</li>
|
|
21
|
+
<% end %>
|
|
22
|
+
<% end %>
|
|
23
|
+
</ul>
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
<% params = request.params.except(:action, :controller, :utf8, :page, :per_page, :format, :authenticity_token) %>
|
|
2
|
+
<% visible_fields = @model_config.export.with(view: self, object: @abstract_model.model.new, controller: self.controller).visible_fields %>
|
|
3
|
+
<%= form_tag export_path(params.merge(all: true)), method: 'post', class: "", data: {turbo: false} do %>
|
|
4
|
+
<input name="send_data" type="hidden" value="true" />
|
|
5
|
+
<fieldset id="fields_to_export">
|
|
6
|
+
<label class="form-check checkbox" for="check_all">
|
|
7
|
+
<%= check_box_tag 'all', 'all', true, { class: "form-check-input", id: 'check_all' } %>
|
|
8
|
+
<span class="form-check-label" for="check_all"><%= t('admin.export.select_all_fields') %></span>
|
|
9
|
+
</label>
|
|
10
|
+
<div class="control-group mt-5">
|
|
11
|
+
<h2><%= t('admin.export.fields_from', name: @model_config.label_plural.downcase) %></h2>
|
|
12
|
+
<div class="row gy-2">
|
|
13
|
+
<% visible_fields.select{ |f| !f.association? || f.association.polymorphic? }.each do |field| %>
|
|
14
|
+
<% list = field.virtual? ? 'methods' : 'only' %>
|
|
15
|
+
<div class="checkbox col-sm-3">
|
|
16
|
+
<% if field.association? && field.association.polymorphic? %>
|
|
17
|
+
<label class="form-check" for="schema_<%= list %>_<%= field.method_name %>">
|
|
18
|
+
<%= check_box_tag "schema[#{list}][]", field.method_name, true, { class: "form-check-input", id: "schema_#{list}_#{field.method_name}" } %>
|
|
19
|
+
<span class="form-check-label"><%= field.label + " [id]" %></span>
|
|
20
|
+
</label>
|
|
21
|
+
<% polymorphic_type_column_name = @abstract_model.properties.detect {|p| field.association.foreign_type == p.name }.name %>
|
|
22
|
+
<label class="form-check" for="schema_<%= list %>_<%= polymorphic_type_column_name %>">
|
|
23
|
+
<%= check_box_tag "schema[#{list}][]", polymorphic_type_column_name, true, { class: "form-check-input", id: "schema_#{list}_#{polymorphic_type_column_name}" } %>
|
|
24
|
+
<span class="form-check-label"><%= field.label + " [type]" %></span>
|
|
25
|
+
</label>
|
|
26
|
+
<% else %>
|
|
27
|
+
<label class="form-check" for="schema_<%= list %>_<%= field.name %>">
|
|
28
|
+
<%= check_box_tag "schema[#{list}][]", field.name, true, { class: "form-check-input", id: "schema_#{list}_#{field.name}" } %>
|
|
29
|
+
<span class="form-check-label"><%= field.label %></span>
|
|
30
|
+
</label>
|
|
31
|
+
<% end %>
|
|
32
|
+
</div>
|
|
33
|
+
<% end %>
|
|
34
|
+
</div>
|
|
35
|
+
</div>
|
|
36
|
+
<% visible_fields.select{ |f| f.association? && !f.association.polymorphic? }.each do |field| %>
|
|
37
|
+
<% fields = field.associated_model_config.export.with(controller: self.controller, view: self, object: (associated_model = field.associated_model_config.abstract_model.model).new).visible_fields.select{ |f| !f.association? } %>
|
|
38
|
+
<div class="control-group mt-7">
|
|
39
|
+
<h2><%= t('admin.export.fields_from_associated', name: field.label.downcase) %></h2>
|
|
40
|
+
<div class="row gy-2">
|
|
41
|
+
<% fields.each do |associated_model_field| %>
|
|
42
|
+
<% list = associated_model_field.virtual? ? 'methods' : 'only' %>
|
|
43
|
+
<div class="checkbox col-sm-3">
|
|
44
|
+
<label class="form-check" for="schema_include_<%= field.name %>_<%= list %>_<%= associated_model_field.name %>">
|
|
45
|
+
<%= check_box_tag "schema[include][#{field.name}][#{list}][]", associated_model_field.name, true, { class: "form-check-input", id: "schema_include_#{field.name}_#{list}_#{associated_model_field.name}" } %>
|
|
46
|
+
<span class="form-check-label"><%= associated_model_field.label %></span>
|
|
47
|
+
</label>
|
|
48
|
+
</div>
|
|
49
|
+
<% end %>
|
|
50
|
+
</div>
|
|
51
|
+
</div>
|
|
52
|
+
<% end %>
|
|
53
|
+
</fieldset>
|
|
54
|
+
<fieldset class="mt-7">
|
|
55
|
+
<h2><%= t('admin.export.options_for', name: 'csv') %></h2>
|
|
56
|
+
<div class="mb-4">
|
|
57
|
+
<% guessed_encoding = @abstract_model.encoding %>
|
|
58
|
+
<label class="form-label" for="csv_options_encoding_to"><%= t('admin.export.csv.encoding_to') %></label>
|
|
59
|
+
<%= select_tag 'csv_options[encoding_to]', options_for_select(Encoding.name_list.sort), include_blank: true, placeholder: t('admin.misc.search'), :'data-enumeration' => true %>
|
|
60
|
+
<p class="form-text mb-0"><%= t('admin.export.csv.encoding_to_help', name: guessed_encoding) %></p>
|
|
61
|
+
</div>
|
|
62
|
+
<label class="form-check">
|
|
63
|
+
<%= check_box_tag 'csv_options[skip_header]', 'true', false, class: 'form-check-input' %>
|
|
64
|
+
<span class="form-check-label"><%= t('admin.export.csv.skip_header') %></span>
|
|
65
|
+
</label>
|
|
66
|
+
<p class="form-text mb-4"><%= t('admin.export.csv.skip_header_help') %></p>
|
|
67
|
+
<div>
|
|
68
|
+
<label class="form-label" for="csv_options_generator_col_sep"><%= t('admin.export.csv.col_sep') %></label>
|
|
69
|
+
<%= select_tag 'csv_options[generator][col_sep]', options_for_select({ '' => t('admin.export.csv.default_col_sep'), "<comma> ','" => ',', "<semicolon> ';'" => ';', '<tabs>' => "'\t'" }), placeholder: t('admin.misc.search'), :'data-enumeration' => true %>
|
|
70
|
+
<p class="form-text mb-0"><%= t('admin.export.csv.col_sep_help', value: t('admin.export.csv.default_col_sep')) %></p>
|
|
71
|
+
</div>
|
|
72
|
+
</fieldset>
|
|
73
|
+
<div class="form-actions">
|
|
74
|
+
<input name="return_to" type="<%= :hidden %>" value="<%= (params[:return_to].presence || request.referer) %>" />
|
|
75
|
+
<button class="btn btn-primary" name="csv" type="submit">
|
|
76
|
+
<i class="fas fa-check"></i>
|
|
77
|
+
<%= t("admin.export.confirmation", name: 'csv') %>
|
|
78
|
+
</button>
|
|
79
|
+
<button class="btn btn-info" name="json" type="submit">
|
|
80
|
+
<%= t("admin.export.confirmation", name: 'json') %>
|
|
81
|
+
</button>
|
|
82
|
+
<button class="btn btn-info" name="xml" type="submit">
|
|
83
|
+
<%= t("admin.export.confirmation", name: 'xml') %>
|
|
84
|
+
</button>
|
|
85
|
+
<button class="btn btn-light" name="_continue" type="submit">
|
|
86
|
+
<i class="fas fa-times"></i>
|
|
87
|
+
<%= t("admin.form.cancel") %>
|
|
88
|
+
</button>
|
|
89
|
+
</div>
|
|
90
|
+
<% end %>
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
<% params = request.params.except(:action, :controller, :model_name) %>
|
|
2
|
+
<% query = params[:query] %>
|
|
3
|
+
<% filter = params[:filter] %>
|
|
4
|
+
<% sort = params[:sort] %>
|
|
5
|
+
<% sort_reverse = params[:sort_reverse] %>
|
|
6
|
+
<% path_method = params[:id] ? "history_show_path" : "history_index_path" %>
|
|
7
|
+
<%= form_tag("", method: "get", class: "search form-inline") do %>
|
|
8
|
+
<div class="filters-wrapper">
|
|
9
|
+
<div class="row">
|
|
10
|
+
<div class="col-sm-6">
|
|
11
|
+
<div class="input-group">
|
|
12
|
+
<input class="form-control" name="query" placeholder="<%= t("admin.misc.filter") %>" type="search" value="<%= query %>" />
|
|
13
|
+
<button class="btn btn-primary" data-disable-with="<%= '<i class="fas fa-sync"></i> ' + t('admin.misc.refresh') %>" type="submit">
|
|
14
|
+
<i class="fas fa-sync"></i>
|
|
15
|
+
<%= t("admin.misc.refresh") %>
|
|
16
|
+
</button>
|
|
17
|
+
</div>
|
|
18
|
+
</div>
|
|
19
|
+
</div>
|
|
20
|
+
</div>
|
|
21
|
+
<% end %>
|
|
22
|
+
<table class="table table-condensed table-striped table-hover" id="history">
|
|
23
|
+
<thead>
|
|
24
|
+
<tr>
|
|
25
|
+
<% columns = [] %>
|
|
26
|
+
<% columns << { property_name: "created_at", css_class: "created_at",link_text: t('admin.table_headers.created_at') } %>
|
|
27
|
+
<% columns << { property_name: "username", css_class: "username", link_text: t('admin.table_headers.username') } %>
|
|
28
|
+
<% columns << { property_name: "item", css_class: "item", link_text: t('admin.table_headers.item') } if @general %>
|
|
29
|
+
<% columns << { property_name: "message", css_class: "message", link_text: t('admin.table_headers.message') } %>
|
|
30
|
+
<% columns.each do |column| %>
|
|
31
|
+
<% property_name = column[:property_name] %>
|
|
32
|
+
<% selected = (sort == property_name) %>
|
|
33
|
+
<% sort_direction = (sort_reverse ? "headerSortUp" : "headerSortDown" if selected) %>
|
|
34
|
+
<% sort_location = send(path_method, params.except("sort_reverse").merge(model_name: @abstract_model.to_param, sort: property_name).merge(selected && sort_reverse != "true" ? {sort_reverse: "true"} : {})) %>
|
|
35
|
+
<th class="header <%= column[:css_class] %> <%= sort_direction if selected %>" data-href="<%= sort_location %>">
|
|
36
|
+
<%= column[:link_text] %>
|
|
37
|
+
</th>
|
|
38
|
+
<% end %>
|
|
39
|
+
</tr>
|
|
40
|
+
</thead>
|
|
41
|
+
<tbody class="table-group-divider">
|
|
42
|
+
<% @history.each_with_index do |object, index| %>
|
|
43
|
+
<tr>
|
|
44
|
+
<% unless object.created_at.nil? %>
|
|
45
|
+
<td>
|
|
46
|
+
<%= l(object.created_at, format: :long, default: l(object.created_at, format: :long)) %>
|
|
47
|
+
</td>
|
|
48
|
+
<% end %>
|
|
49
|
+
<td>
|
|
50
|
+
<%= object.username %>
|
|
51
|
+
</td>
|
|
52
|
+
<% if @general %>
|
|
53
|
+
<% if o = @abstract_model.get(object.item) %>
|
|
54
|
+
<% label = o.send(@abstract_model.config.object_label_method) %>
|
|
55
|
+
<% if show_action = action(:show, @abstract_model, o) %>
|
|
56
|
+
<td>
|
|
57
|
+
<%= link_to(label, url_for(action: show_action.action_name, model_name: @abstract_model.to_param, id: o.id)) %>
|
|
58
|
+
</td>
|
|
59
|
+
<% else %>
|
|
60
|
+
<td>
|
|
61
|
+
<%= label %>
|
|
62
|
+
</td>
|
|
63
|
+
<% end %>
|
|
64
|
+
<% else %>
|
|
65
|
+
<td>
|
|
66
|
+
<%= "#{@abstract_model.config.label} ##{object.item}" %>
|
|
67
|
+
</td>
|
|
68
|
+
<% end %>
|
|
69
|
+
<% end %>
|
|
70
|
+
<td>
|
|
71
|
+
<%= object.message.in?(['delete', 'new']) ? t("admin.actions.#{object.message}.done").capitalize : object.message %>
|
|
72
|
+
</td>
|
|
73
|
+
</tr>
|
|
74
|
+
<% end %>
|
|
75
|
+
</tbody>
|
|
76
|
+
</table>
|
|
77
|
+
<% unless params[:all] || !@history.respond_to?(:current_page) %>
|
|
78
|
+
<%= paginate(@history, theme: 'ra-twitter-bootstrap') %>
|
|
79
|
+
<%= link_to(t("admin.misc.show_all"), send(path_method, params.merge(all: true)), class: "show-all btn btn-light") unless (tc = @history.total_count) <= @history.size || tc > 100 %>
|
|
80
|
+
<% end %>
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
<%
|
|
2
|
+
query = params[:query]
|
|
3
|
+
params = request.params.except(:authenticity_token, :action, :controller, :utf8, :bulk_export)
|
|
4
|
+
params.delete(:query) if params[:query].blank?
|
|
5
|
+
params.delete(:sort_reverse) unless params[:sort_reverse] == 'true'
|
|
6
|
+
sort_reverse = params[:sort_reverse]
|
|
7
|
+
sort = params[:sort]
|
|
8
|
+
params.delete(:sort) if params[:sort] == @model_config.list.sort_by.to_s
|
|
9
|
+
export_action = RailsAdmin::Config::Actions.find(:export, { controller: self.controller, abstract_model: @abstract_model })
|
|
10
|
+
export_action = nil unless export_action && authorized?(export_action.authorization_key, @abstract_model)
|
|
11
|
+
description = RailsAdmin.config(@abstract_model.model_name).description
|
|
12
|
+
properties = @model_config.list.with(controller: self.controller, view: self, object: @abstract_model.model.new).fields_for_table
|
|
13
|
+
checkboxes = @model_config.list.checkboxes?
|
|
14
|
+
table_table_header_count = begin
|
|
15
|
+
count = checkboxes ? 1 : 0
|
|
16
|
+
count = count + properties.count
|
|
17
|
+
end
|
|
18
|
+
%>
|
|
19
|
+
|
|
20
|
+
<% content_for :contextual_tabs do %>
|
|
21
|
+
<% if filterable_fields.present? %>
|
|
22
|
+
<li class="nav-item dropdown">
|
|
23
|
+
<a class="nav-link dropdown-toggle" data-bs-toggle="dropdown" href="#">
|
|
24
|
+
<%= t('admin.misc.add_filter') %>
|
|
25
|
+
</a>
|
|
26
|
+
<ul class="dropdown-menu dropdown-menu-end" id="filters">
|
|
27
|
+
<% filterable_fields.each do |field| %>
|
|
28
|
+
<li><a href="#" class="dropdown-item" data-options="<%= field.with(view: self).filter_options.to_json %>"><%= field.label %></a></li>
|
|
29
|
+
<% end %>
|
|
30
|
+
</ul>
|
|
31
|
+
</li>
|
|
32
|
+
<% end %>
|
|
33
|
+
<% if checkboxes %>
|
|
34
|
+
<%= bulk_menu %>
|
|
35
|
+
<% end %>
|
|
36
|
+
<% end %>
|
|
37
|
+
|
|
38
|
+
<style>
|
|
39
|
+
<% properties.select{ |p| p.column_width.present? }.each do |property| %>
|
|
40
|
+
<%= "#list th.#{property.css_class} { width: #{property.column_width}px; min-width: #{property.column_width}px; }" %>
|
|
41
|
+
<%= "#list td.#{property.css_class} { max-width: #{property.column_width}px;}" %>
|
|
42
|
+
<% end %>
|
|
43
|
+
</style>
|
|
44
|
+
|
|
45
|
+
<div id="list">
|
|
46
|
+
<%= form_tag(index_path(params.except(*%w[page f query])), method: :get) do %>
|
|
47
|
+
<div class="filters filters-wrapper">
|
|
48
|
+
<div class="filters-box" data-options="<%= ordered_filter_options.to_json %>" id="filters_box"></div>
|
|
49
|
+
<div class="row justify-content-between gy-0">
|
|
50
|
+
<div class="col-6">
|
|
51
|
+
<div class="input-group">
|
|
52
|
+
<input class="form-control" name="query" placeholder="<%= t("admin.misc.filter") %>" type="search" value="<%= query %>" />
|
|
53
|
+
<button class="btn btn-body" data-disable-with="<%= '<i class="fas fa-sync"></i>' + t('admin.misc.refresh') %>" type="submit"><i class="fas fa-sync"></i><%= t('admin.misc.refresh') %>
|
|
54
|
+
<button class="btn btn-body" id="remove_filter" title="<%= t('admin.misc.reset_filters') %>"><i class="fas fa-times"></i></button>
|
|
55
|
+
</div>
|
|
56
|
+
<% if @model_config.list.search_help.present? %>
|
|
57
|
+
<div class="form-text"><%= @model_config.list.search_help %></div>
|
|
58
|
+
<% end %>
|
|
59
|
+
</div>
|
|
60
|
+
<div class="col-auto">
|
|
61
|
+
<% if export_action %>
|
|
62
|
+
<%= link_to wording_for(:link, export_action), export_path(params.except('page')), class: 'btn btn-body' %>
|
|
63
|
+
<% end %>
|
|
64
|
+
</div>
|
|
65
|
+
</div>
|
|
66
|
+
</div>
|
|
67
|
+
<% end %>
|
|
68
|
+
<% unless @model_config.list.scopes.empty? %>
|
|
69
|
+
<ul class="nav nav-tabs" id="scope_selector">
|
|
70
|
+
<% @model_config.list.scopes.each_with_index do |scope, index| %>
|
|
71
|
+
<% scope = '_all' if scope.nil? %>
|
|
72
|
+
<li class="nav-item">
|
|
73
|
+
<a href="<%= index_path(params.merge(scope: scope, page: nil)) %>" class="nav-link <%= 'active' if scope.to_s == params[:scope] || (params[:scope].blank? && index == 0) %>">
|
|
74
|
+
<%= I18n.t("admin.scopes.#{@abstract_model.to_param}.#{scope}", default: I18n.t("admin.scopes.#{scope}", default: scope.to_s.titleize)) %>
|
|
75
|
+
</a>
|
|
76
|
+
</li>
|
|
77
|
+
<% end %>
|
|
78
|
+
</ul>
|
|
79
|
+
<% end %>
|
|
80
|
+
<%= form_tag bulk_action_path(model_name: @abstract_model.to_param), method: :post, id: "bulk_form", class: ["form", "mb-0"] do %>
|
|
81
|
+
<%= hidden_field_tag :bulk_action %>
|
|
82
|
+
<% if description.present? %>
|
|
83
|
+
<p>
|
|
84
|
+
<strong>
|
|
85
|
+
<%= description %>
|
|
86
|
+
</strong>
|
|
87
|
+
</p>
|
|
88
|
+
<% end %>
|
|
89
|
+
<div id="sidescroll">
|
|
90
|
+
<table class="table table-condensed table-striped table-hover">
|
|
91
|
+
<thead>
|
|
92
|
+
<tr>
|
|
93
|
+
<% if checkboxes %>
|
|
94
|
+
<th class="shrink sticky">
|
|
95
|
+
<input class="toggle" type="checkbox" />
|
|
96
|
+
</th>
|
|
97
|
+
<% end %>
|
|
98
|
+
<% properties.each do |property| %>
|
|
99
|
+
<% selected = (sort == property.name.to_s) %>
|
|
100
|
+
<% if property.sortable %>
|
|
101
|
+
<% sort_location = index_path params.except('sort_reverse').except('page').merge(sort: property.name).merge(selected && sort_reverse != "true" ? {sort_reverse: "true"} : {}) %>
|
|
102
|
+
<% sort_direction = (sort_reverse == 'true' ? "headerSortUp" : "headerSortDown" if selected) %>
|
|
103
|
+
<% end %>
|
|
104
|
+
<th class="<%= [property.sortable && "header", property.sortable && sort_direction, property.sticky? && 'sticky', property.css_class, property.type_css_class].select(&:present?).join(' ') %>" data-href="<%= property.sortable && sort_location %>" rel="tooltip" title="<%= property.hint %>">
|
|
105
|
+
<%= property.label %>
|
|
106
|
+
</th>
|
|
107
|
+
<% end %>
|
|
108
|
+
<th class="last shrink"></th>
|
|
109
|
+
</tr>
|
|
110
|
+
</thead>
|
|
111
|
+
<tbody class="table-group-divider">
|
|
112
|
+
<% @objects.each do |object| %>
|
|
113
|
+
<tr class="<%= @abstract_model.param_key %>_row <%= @model_config.list.with(object: object).row_css_class %>">
|
|
114
|
+
<% if checkboxes %>
|
|
115
|
+
<td class="sticky">
|
|
116
|
+
<%= check_box_tag "bulk_ids[]", object.id.to_s, false %>
|
|
117
|
+
</td>
|
|
118
|
+
<% end %>
|
|
119
|
+
<% properties.map{ |property| property.bind(:object, object) }.each do |property| %>
|
|
120
|
+
<% value = property.pretty_value %>
|
|
121
|
+
<%= content_tag(:td, class: [property.sticky? && 'sticky', property.css_class, property.type_css_class].select(&:present?), title: strip_tags(value.to_s)) do %>
|
|
122
|
+
<%= value %>
|
|
123
|
+
<% end %>
|
|
124
|
+
<% end %>
|
|
125
|
+
<td class="last links ra-sidescroll-frozen">
|
|
126
|
+
<ul class="nav d-inline list-inline">
|
|
127
|
+
<%= menu_for :member, @abstract_model, object, true %>
|
|
128
|
+
</ul>
|
|
129
|
+
</td>
|
|
130
|
+
</tr>
|
|
131
|
+
<% end %>
|
|
132
|
+
<% if @objects.empty? %>
|
|
133
|
+
<tr class="empty_row">
|
|
134
|
+
<td colspan="<%= table_table_header_count %>">
|
|
135
|
+
<%= I18n.t('admin.actions.index.no_records') %>
|
|
136
|
+
</td>
|
|
137
|
+
</tr>
|
|
138
|
+
<% end %>
|
|
139
|
+
</tbody>
|
|
140
|
+
</table>
|
|
141
|
+
</div>
|
|
142
|
+
<% if @model_config.list.limited_pagination %>
|
|
143
|
+
<div class="row g-0">
|
|
144
|
+
<div class="col d-flex justify-content-center mx-auto">
|
|
145
|
+
<%= paginate(@objects, theme: 'ra-twitter-bootstrap/without_count', total_pages: Float::INFINITY) %>
|
|
146
|
+
</div>
|
|
147
|
+
</div>
|
|
148
|
+
<% elsif @objects.respond_to?(:total_count) %>
|
|
149
|
+
<div class="row align-items-center g-0">
|
|
150
|
+
<div class="col-4 justify-content-start d-none d-md-flex">
|
|
151
|
+
<% total_count = @objects.total_count.to_i %>
|
|
152
|
+
<div class="clearfix total-count text-muted"><%= "#{total_count} #{@model_config.pluralize(total_count).downcase}" %></div>
|
|
153
|
+
</div>
|
|
154
|
+
<div class="col d-flex justify-content-center mx-auto">
|
|
155
|
+
<%= paginate(@objects, theme: 'ra-twitter-bootstrap') %>
|
|
156
|
+
</div>
|
|
157
|
+
<div class="col-4 justify-content-end d-none d-md-flex">
|
|
158
|
+
<%= link_to(t("admin.misc.show_all"), index_path(params.merge(all: true)), class: "show-all btn btn-body btn-sm clearfix") unless total_count > 100 || total_count <= @objects.to_a.size %>
|
|
159
|
+
</div>
|
|
160
|
+
</div>
|
|
161
|
+
<% else %>
|
|
162
|
+
<div class="row g-0">
|
|
163
|
+
<div class="col d-flex justify-content-start">
|
|
164
|
+
<div class="clearfix total-count text-muted"><%= "#{@objects.size} #{@model_config.pluralize(@objects.size).downcase}" %></div>
|
|
165
|
+
</div>
|
|
166
|
+
</div>
|
|
167
|
+
<% end %>
|
|
168
|
+
<% end %>
|
|
169
|
+
</div>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
<% @model_config.show.with(object: @object, view: self, controller: self.controller).visible_groups.each do |fieldset| %>
|
|
2
|
+
<% unless (fields = fieldset.with(object: @object, view: self, controller: self.controller).visible_fields).empty? %>
|
|
3
|
+
<% unless (fields = fields.reject{ |f| RailsAdmin::config.compact_show_view && (f.formatted_value.nil? || f.formatted_value == '') }).empty? %>
|
|
4
|
+
<div class="fieldset">
|
|
5
|
+
<h2><%= fieldset.label %></h2>
|
|
6
|
+
<% if fieldset.help %>
|
|
7
|
+
<p><%= fieldset.help %></p>
|
|
8
|
+
<% end %>
|
|
9
|
+
<% fields.each_with_index do |field, index| %>
|
|
10
|
+
<div class="lead <%= field.type_css_class %> <%= field.css_class %> <%= "mb-4" unless field == fields.last %>">
|
|
11
|
+
<h3 class="h6 mb-1"><%= field.label %></h3>
|
|
12
|
+
<%= field.pretty_value %></p>
|
|
13
|
+
</div>
|
|
14
|
+
<% end %>
|
|
15
|
+
</div>
|
|
16
|
+
<% end %>
|
|
17
|
+
<% end %>
|
|
18
|
+
<% end %>
|
data/lib/swop/engine.rb
CHANGED
|
@@ -1,7 +1,12 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
1
|
module Swop
|
|
4
2
|
class Engine < ::Rails::Engine
|
|
5
|
-
|
|
3
|
+
initializer "swop.assets.precompile" do |app|
|
|
4
|
+
app.config.assets.precompile += %w[swop/favicon.ico]
|
|
5
|
+
app.config.assets.precompile += %w[swop/swop-themes/swop-simple/swop-simple-amethyst.css]
|
|
6
|
+
app.config.assets.precompile += %w[swop/swop-themes/swop-simple/swop-simple-dark.css]
|
|
7
|
+
app.config.assets.precompile += %w[swop/swop-themes/swop-simple/swop-simple-forest.css]
|
|
8
|
+
app.config.assets.precompile += %w[swop/swop-themes/swop-simple/swop-simple-light.css]
|
|
9
|
+
app.config.assets.precompile += %w[swop/swop-themes/swop-simple/swop-simple-royal.css]
|
|
10
|
+
end
|
|
6
11
|
end
|
|
7
12
|
end
|
data/lib/swop/railtie.rb
ADDED
data/lib/swop/version.rb
CHANGED
data/lib/swop.rb
CHANGED
|
@@ -1,9 +1,27 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
require_relative "swop/version"
|
|
4
|
-
require "swop/engine"
|
|
4
|
+
require "swop/engine" if defined?(Rails)
|
|
5
5
|
|
|
6
6
|
module Swop
|
|
7
7
|
class Error < StandardError; end
|
|
8
|
-
|
|
8
|
+
|
|
9
|
+
class << self
|
|
10
|
+
attr_accessor :configuration
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def self.configure
|
|
14
|
+
self.configuration ||= Configuration.new
|
|
15
|
+
yield(configuration)
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
class Configuration
|
|
19
|
+
attr_accessor :style
|
|
20
|
+
attr_accessor :color
|
|
21
|
+
|
|
22
|
+
def initialize
|
|
23
|
+
@style = :simple
|
|
24
|
+
@color = :light
|
|
25
|
+
end
|
|
26
|
+
end
|
|
9
27
|
end
|