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.
Files changed (139) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +47 -9
  3. data/app/assets/images/swop/favicon.ico +0 -0
  4. data/app/assets/stylesheets/rails_admin/application.scss.erb +11 -20
  5. data/app/assets/stylesheets/{rails_admin/themes/base/base.scss → swop/swop-base/swop-base.scss} +1 -5
  6. data/app/assets/stylesheets/swop/swop-base/swop-typography.scss +11 -0
  7. data/app/assets/stylesheets/swop/swop-colors/swop-colors.scss +2 -0
  8. data/app/assets/stylesheets/swop/swop-core/swop-bootstrap-variables.scss +172 -0
  9. data/app/assets/stylesheets/swop/swop-core/swop-variables.scss +34 -0
  10. data/app/assets/stylesheets/swop/swop-themes/swop-simple/swop-base/swop-base.scss +3 -0
  11. data/app/assets/stylesheets/swop/swop-themes/swop-simple/swop-base/swop-main.scss +25 -0
  12. data/app/assets/stylesheets/swop/swop-themes/swop-simple/swop-base/swop-typography.scss +4 -0
  13. data/app/assets/stylesheets/swop/swop-themes/swop-simple/swop-colors/swop-amethyst.scss +29 -0
  14. data/app/assets/stylesheets/swop/swop-themes/swop-simple/swop-colors/swop-dark.scss +29 -0
  15. data/app/assets/stylesheets/swop/swop-themes/swop-simple/swop-colors/swop-forest.scss +29 -0
  16. data/app/assets/stylesheets/swop/swop-themes/swop-simple/swop-colors/swop-light.scss +29 -0
  17. data/app/assets/stylesheets/swop/swop-themes/swop-simple/swop-colors/swop-royal.scss +29 -0
  18. data/app/assets/stylesheets/swop/swop-themes/swop-simple/swop-components/swop-alerts.scss +12 -0
  19. data/app/assets/stylesheets/swop/swop-themes/swop-simple/swop-components/swop-badges.scss +31 -0
  20. data/app/assets/stylesheets/swop/swop-themes/swop-simple/swop-components/swop-buttons.scss +133 -0
  21. data/app/assets/stylesheets/swop/swop-themes/swop-simple/swop-components/swop-dropdowns.scss +26 -0
  22. data/app/assets/stylesheets/swop/swop-themes/swop-simple/swop-components/swop-filters.scss +57 -0
  23. data/app/assets/stylesheets/swop/swop-themes/swop-simple/swop-components/swop-forms.scss +158 -0
  24. data/app/assets/stylesheets/swop/swop-themes/swop-simple/swop-components/swop-images.scss +31 -0
  25. data/app/assets/stylesheets/swop/swop-themes/swop-simple/swop-components/swop-input-groups.scss +18 -0
  26. data/app/assets/stylesheets/swop/swop-themes/swop-simple/swop-components/swop-loading.scss +14 -0
  27. data/app/assets/stylesheets/swop/swop-themes/swop-simple/swop-components/swop-navbar.scss +15 -0
  28. data/app/assets/stylesheets/swop/swop-themes/swop-simple/swop-components/swop-navs.scss +77 -0
  29. data/app/assets/stylesheets/swop/swop-themes/swop-simple/swop-components/swop-offcanvas.scss +64 -0
  30. data/app/assets/stylesheets/swop/swop-themes/swop-simple/swop-components/swop-pagination.scss +21 -0
  31. data/app/assets/stylesheets/swop/swop-themes/swop-simple/swop-components/swop-progress.scss +3 -0
  32. data/app/assets/stylesheets/swop/swop-themes/swop-simple/swop-components/swop-sidebars.scss +49 -0
  33. data/app/assets/stylesheets/swop/swop-themes/swop-simple/swop-components/swop-tables.scss +82 -0
  34. data/app/assets/stylesheets/swop/swop-themes/swop-simple/swop-components/swop-tiles.scss +20 -0
  35. data/app/assets/stylesheets/swop/swop-themes/swop-simple/swop-core/swop-bootstrap-variables.scss +149 -0
  36. data/app/assets/stylesheets/swop/swop-themes/swop-simple/swop-core/swop-variables.scss +41 -0
  37. data/app/assets/stylesheets/{rails_admin/themes/simple/components/containers.scss → swop/swop-themes/swop-simple/swop-layouts/swop-containers.scss} +9 -0
  38. data/app/assets/stylesheets/swop/swop-themes/swop-simple/swop-layouts/swop-header.scss +15 -0
  39. data/app/assets/stylesheets/swop/swop-themes/swop-simple/swop-simple-amethyst.scss +35 -0
  40. data/app/assets/stylesheets/swop/swop-themes/swop-simple/swop-simple-base.scss +3 -0
  41. data/app/assets/stylesheets/swop/swop-themes/swop-simple/swop-simple-components.scss +17 -0
  42. data/app/assets/stylesheets/swop/swop-themes/swop-simple/swop-simple-dark.scss +35 -0
  43. data/app/assets/stylesheets/swop/swop-themes/swop-simple/swop-simple-forest.scss +35 -0
  44. data/app/assets/stylesheets/swop/swop-themes/swop-simple/swop-simple-layouts.scss +2 -0
  45. data/app/assets/stylesheets/swop/swop-themes/swop-simple/swop-simple-light.scss +35 -0
  46. data/app/assets/stylesheets/swop/swop-themes/swop-simple/swop-simple-royal.scss +35 -0
  47. data/app/assets/stylesheets/swop/swop.scss +8 -0
  48. data/app/views/kaminari/ra-twitter-bootstrap/_next_page.html.erb +7 -0
  49. data/app/views/kaminari/ra-twitter-bootstrap/_prev_page.html.erb +5 -0
  50. data/app/views/kaminari/ra-twitter-bootstrap/default/_next_page.html.erb +9 -0
  51. data/app/views/kaminari/ra-twitter-bootstrap/default/_prev_page.html.erb +9 -0
  52. data/app/views/kaminari/ra-twitter-bootstrap/swop-simple/_next_page.html.erb +9 -0
  53. data/app/views/kaminari/ra-twitter-bootstrap/swop-simple/_prev_page.html.erb +9 -0
  54. data/app/views/layouts/rails_admin/_head.html.erb +5 -32
  55. data/app/views/layouts/rails_admin/_sidebar_navigation.html.erb +5 -3
  56. data/app/views/layouts/rails_admin/application.html.erb +5 -27
  57. data/app/views/layouts/rails_admin/content.html.erb +4 -11
  58. data/app/views/layouts/rails_admin/default/_application.html.erb +27 -0
  59. data/app/views/layouts/rails_admin/default/_content.html.erb +22 -0
  60. data/app/views/layouts/rails_admin/default/_head.html.erb +32 -0
  61. data/app/views/layouts/rails_admin/default/_sidebar_navigation.html.erb +5 -0
  62. data/app/views/layouts/rails_admin/swop-simple/_application.html.erb +17 -0
  63. data/app/views/layouts/rails_admin/swop-simple/_content.html.erb +41 -0
  64. data/app/views/layouts/rails_admin/swop-simple/_head.html.erb +42 -0
  65. data/app/views/layouts/rails_admin/swop-simple/_sidebar_navigation.html.erb +12 -0
  66. data/app/views/rails_admin/main/_delete_notice.html.erb +7 -0
  67. data/app/views/rails_admin/main/default/_delete.html.erb +21 -0
  68. data/app/views/rails_admin/main/default/_delete_notice.html.erb +34 -0
  69. data/app/views/rails_admin/main/default/_edit.html.erb +3 -0
  70. data/app/views/rails_admin/main/default/_export.html.erb +149 -0
  71. data/app/views/rails_admin/main/default/_history.html.erb +80 -0
  72. data/app/views/rails_admin/main/default/_index.html.erb +184 -0
  73. data/app/views/rails_admin/main/default/_new.html.erb +3 -0
  74. data/app/views/rails_admin/main/default/_show.html.erb +30 -0
  75. data/app/views/rails_admin/main/delete.html.erb +5 -0
  76. data/app/views/rails_admin/main/edit.html.erb +5 -0
  77. data/app/views/rails_admin/main/export.html.erb +5 -128
  78. data/app/views/rails_admin/main/history.html.erb +4 -86
  79. data/app/views/rails_admin/main/index.html.erb +4 -173
  80. data/app/views/rails_admin/main/new.html.erb +5 -0
  81. data/app/views/rails_admin/main/show.html.erb +5 -20
  82. data/app/views/rails_admin/main/swop-simple/_delete.html.erb +11 -0
  83. data/app/views/rails_admin/main/swop-simple/_delete_notice.html.erb +23 -0
  84. data/app/views/rails_admin/main/swop-simple/_edit.html.erb +3 -0
  85. data/app/views/rails_admin/main/swop-simple/_export.html.erb +90 -0
  86. data/app/views/rails_admin/main/swop-simple/_history.html.erb +80 -0
  87. data/app/views/rails_admin/main/swop-simple/_index.html.erb +169 -0
  88. data/app/views/rails_admin/main/swop-simple/_new.html.erb +3 -0
  89. data/app/views/rails_admin/main/swop-simple/_show.html.erb +18 -0
  90. data/lib/swop/engine.rb +8 -3
  91. data/lib/swop/railtie.rb +7 -0
  92. data/lib/swop/version.rb +1 -1
  93. data/lib/swop.rb +20 -2
  94. metadata +102 -98
  95. data/CHANGELOG.md +0 -5
  96. data/CODE_OF_CONDUCT.md +0 -132
  97. data/LICENSE +0 -201
  98. data/Rakefile +0 -4
  99. data/app/assets/javascripts/rails_admin/application.js.erb +0 -33
  100. data/app/assets/javascripts/rails_admin/custom/abstract-select.js +0 -30
  101. data/app/assets/javascripts/rails_admin/custom/filter-box.js +0 -363
  102. data/app/assets/javascripts/rails_admin/custom/filtering-multiselect.js +0 -387
  103. data/app/assets/javascripts/rails_admin/custom/filtering-select.js +0 -304
  104. data/app/assets/stylesheets/rails_admin/themes/base/bootstrap-variables.scss +0 -252
  105. data/app/assets/stylesheets/rails_admin/themes/base/theming.scss +0 -22
  106. data/app/assets/stylesheets/rails_admin/themes/base/variables.scss +0 -71
  107. data/app/assets/stylesheets/rails_admin/themes/simple/base/typography.scss +0 -22
  108. data/app/assets/stylesheets/rails_admin/themes/simple/base/variables-dark.scss +0 -74
  109. data/app/assets/stylesheets/rails_admin/themes/simple/base/variables-light.scss +0 -77
  110. data/app/assets/stylesheets/rails_admin/themes/simple/base/variables-navy.scss +0 -74
  111. data/app/assets/stylesheets/rails_admin/themes/simple/base/variables.scss +0 -129
  112. data/app/assets/stylesheets/rails_admin/themes/simple/components/alerts.scss +0 -88
  113. data/app/assets/stylesheets/rails_admin/themes/simple/components/breadcrumbs.scss +0 -44
  114. data/app/assets/stylesheets/rails_admin/themes/simple/components/buttons.scss +0 -138
  115. data/app/assets/stylesheets/rails_admin/themes/simple/components/dropdowns.scss +0 -12
  116. data/app/assets/stylesheets/rails_admin/themes/simple/components/filter-box.scss +0 -8
  117. data/app/assets/stylesheets/rails_admin/themes/simple/components/filtering-multiselect.scss +0 -40
  118. data/app/assets/stylesheets/rails_admin/themes/simple/components/filtering-select.scss +0 -42
  119. data/app/assets/stylesheets/rails_admin/themes/simple/components/forms.scss +0 -27
  120. data/app/assets/stylesheets/rails_admin/themes/simple/components/images.scss +0 -19
  121. data/app/assets/stylesheets/rails_admin/themes/simple/components/links.scss +0 -25
  122. data/app/assets/stylesheets/rails_admin/themes/simple/components/navs.scss +0 -73
  123. data/app/assets/stylesheets/rails_admin/themes/simple/components/progress.scss +0 -4
  124. data/app/assets/stylesheets/rails_admin/themes/simple/components/sidebar.scss +0 -84
  125. data/app/assets/stylesheets/rails_admin/themes/simple/components/tables.scss +0 -84
  126. data/app/assets/stylesheets/rails_admin/themes/simple/layouts/rows.scss +0 -34
  127. data/app/assets/stylesheets/rails_admin/themes/simple/light/components/links.scss +0 -15
  128. data/app/assets/stylesheets/rails_admin/themes/simple/light/components/sidebar.scss +0 -25
  129. data/app/assets/stylesheets/rails_admin/themes/simple.scss.erb +0 -37
  130. data/app/helpers/rails_admin/application_helper.rb +0 -258
  131. data/app/helpers/rails_admin/form_builder.rb +0 -166
  132. data/app/views/layouts/rails_admin/_custom_navigation.html.erb +0 -10
  133. data/app/views/layouts/rails_admin/_header.html.erb +0 -43
  134. data/app/views/rails_admin/main/_form_polymorphic_association.html.erb +0 -15
  135. data/app/views/rails_admin/main/_submit_buttons.html.erb +0 -29
  136. data/app/views/rails_admin/main/dashboard.html.erb +0 -64
  137. data/config/locales/rails_admin.en.yml +0 -158
  138. data/sig/swop.rbs +0 -4
  139. /data/app/assets/stylesheets/{rails_admin/themes/base/mixins.scss → swop/swop-core/swop-mixins.scss} +0 -0
@@ -0,0 +1,184 @@
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
+ <b class="caret"></b>
26
+ </a>
27
+ <ul class="dropdown-menu dropdown-menu-end" id="filters">
28
+ <% filterable_fields.each do |field| %>
29
+ <li>
30
+ <a
31
+ href="#"
32
+ class="dropdown-item"
33
+ data-options="<%= field.with(view: self).filter_options.to_json %>"
34
+ >
35
+ <%= field.label %>
36
+ </a>
37
+ </li>
38
+ <% end %>
39
+ </ul>
40
+ </li>
41
+ <% end %>
42
+ <% if checkboxes %>
43
+ <%= bulk_menu %>
44
+ <% end %>
45
+ <% end %>
46
+
47
+ <style>
48
+ <% properties.select{ |p| p.column_width.present? }.each do |property| %>
49
+ <%= "#list th.#{property.css_class} { width: #{property.column_width}px; min-width: #{property.column_width}px; }" %>
50
+ <%= "#list td.#{property.css_class} { max-width: #{property.column_width}px;}" %>
51
+ <% end %>
52
+ </style>
53
+
54
+ <div id="list">
55
+ <%= form_tag(index_path(params.except(*%w[page f query])), method: :get) do %>
56
+ <div class="card mb-3 p-3 bg-light">
57
+ <div class="row" data-options="<%= ordered_filter_options.to_json %>" id="filters_box"></div>
58
+ <hr class="filters_box" style="display:<%= ordered_filters.empty? ? 'none' : 'block' %>"/>
59
+ <div class="row">
60
+ <div class="col-sm-6">
61
+ <div class="input-group">
62
+ <input class="form-control" name="query" placeholder="<%= t("admin.misc.filter") %>" type="search" value="<%= query %>" />
63
+ <button class="btn btn-primary" data-disable-with="<%= '<i class="fas fa-sync"></i>' + t('admin.misc.refresh') %>" type="submit">
64
+ <i class="fas fa-sync"></i>
65
+ <%= t('admin.misc.refresh') %>
66
+ </button>
67
+ <button class="btn btn-info" id="remove_filter" title="<%= t('admin.misc.reset_filters') %>">
68
+ <i class="fas fa-times"></i>
69
+ </button>
70
+ </div>
71
+ <% if @model_config.list.search_help.present? %>
72
+ <div class="form-text"><%= @model_config.list.search_help %></div>
73
+ <% end %>
74
+ </div>
75
+ <div class="col-sm-6 text-end">
76
+ <% if export_action %>
77
+ <%= link_to wording_for(:link, export_action), export_path(params.except('page')), class: 'btn btn-info' %>
78
+ <% end %>
79
+ </div>
80
+ </div>
81
+ </div>
82
+ <% end %>
83
+ <% unless @model_config.list.scopes.empty? %>
84
+ <ul class="nav nav-tabs" id="scope_selector">
85
+ <% @model_config.list.scopes.each_with_index do |scope, index| %>
86
+ <% scope = '_all' if scope.nil? %>
87
+ <li class="nav-item">
88
+ <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) %>">
89
+ <%= I18n.t("admin.scopes.#{@abstract_model.to_param}.#{scope}", default: I18n.t("admin.scopes.#{scope}", default: scope.to_s.titleize)) %>
90
+ </a>
91
+ </li>
92
+ <% end %>
93
+ </ul>
94
+ <% end %>
95
+ <%= form_tag bulk_action_path(model_name: @abstract_model.to_param), method: :post, id: "bulk_form", class: ["form", "mb-3"] do %>
96
+ <%= hidden_field_tag :bulk_action %>
97
+ <% if description.present? %>
98
+ <p>
99
+ <strong>
100
+ <%= description %>
101
+ </strong>
102
+ </p>
103
+ <% end %>
104
+ <div id="sidescroll">
105
+ <table class="table table-condensed table-striped table-hover">
106
+ <thead>
107
+ <tr>
108
+ <% if checkboxes %>
109
+ <th class="shrink sticky">
110
+ <input class="toggle" type="checkbox" />
111
+ </th>
112
+ <% end %>
113
+ <% properties.each do |property| %>
114
+ <% selected = (sort == property.name.to_s) %>
115
+ <% if property.sortable %>
116
+ <% sort_location = index_path params.except('sort_reverse').except('page').merge(sort: property.name).merge(selected && sort_reverse != "true" ? {sort_reverse: "true"} : {}) %>
117
+ <% sort_direction = (sort_reverse == 'true' ? "headerSortUp" : "headerSortDown" if selected) %>
118
+ <% end %>
119
+ <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 %>">
120
+ <%= property.label %>
121
+ </th>
122
+ <% end %>
123
+ <th class="last shrink"></th>
124
+ </tr>
125
+ </thead>
126
+ <tbody class="table-group-divider">
127
+ <% @objects.each do |object| %>
128
+ <tr class="<%= @abstract_model.param_key %>_row <%= @model_config.list.with(object: object).row_css_class %>">
129
+ <% if checkboxes %>
130
+ <td class="sticky">
131
+ <%= check_box_tag "bulk_ids[]", object.id.to_s, false %>
132
+ </td>
133
+ <% end %>
134
+ <% properties.map{ |property| property.bind(:object, object) }.each do |property| %>
135
+ <% value = property.pretty_value %>
136
+ <%= content_tag(:td, class: [property.sticky? && 'sticky', property.css_class, property.type_css_class].select(&:present?), title: strip_tags(value.to_s)) do %>
137
+ <%= value %>
138
+ <% end %>
139
+ <% end %>
140
+ <td class="last links ra-sidescroll-frozen">
141
+ <ul class="nav d-inline list-inline">
142
+ <%= menu_for :member, @abstract_model, object, true %>
143
+ </ul>
144
+ </td>
145
+ </tr>
146
+ <% end %>
147
+ <% if @objects.empty? %>
148
+ <tr class="empty_row">
149
+ <td colspan="<%= table_table_header_count %>">
150
+ <%= I18n.t('admin.actions.index.no_records') %>
151
+ </td>
152
+ </tr>
153
+ <% end %>
154
+ </tbody>
155
+ </table>
156
+ </div>
157
+ <% if @model_config.list.limited_pagination %>
158
+ <div class="row">
159
+ <div class="col-md-6">
160
+ <%= paginate(@objects, theme: 'ra-twitter-bootstrap/without_count', total_pages: Float::INFINITY) %>
161
+ </div>
162
+ </div>
163
+ <% elsif @objects.respond_to?(:total_count) %>
164
+ <% total_count = @objects.total_count.to_i %>
165
+ <div class="row">
166
+ <div class="col-md-6">
167
+ <%= paginate(@objects, theme: 'ra-twitter-bootstrap') %>
168
+ </div>
169
+ </div>
170
+ <div class="row">
171
+ <div class="col-md-6">
172
+ <%= link_to(t("admin.misc.show_all"), index_path(params.merge(all: true)), class: "show-all btn btn-light clearfix") unless total_count > 100 || total_count <= @objects.to_a.size %>
173
+ </div>
174
+ </div>
175
+ <div class="clearfix total-count">
176
+ <%= "#{total_count} #{@model_config.pluralize(total_count).downcase}" %>
177
+ </div>
178
+ <% else %>
179
+ <div class="clearfix total-count">
180
+ <%= "#{@objects.size} #{@model_config.pluralize(@objects.size).downcase}" %>
181
+ </div>
182
+ <% end %>
183
+ <% end %>
184
+ </div>
@@ -0,0 +1,3 @@
1
+ <%= rails_admin_form_for @object, url: new_path(model_name: @abstract_model.to_param), as: @abstract_model.param_key, html: { multipart: true, class: "main", data: { title: @page_name } } do |form| %>
2
+ <%= form.generate action: :create %>
3
+ <% end %>
@@ -0,0 +1,30 @@
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
+ <h4>
6
+ <%= fieldset.label %>
7
+ </h4>
8
+ <% if fieldset.help %>
9
+ <p>
10
+ <%= fieldset.help %>
11
+ </p>
12
+ <% end %>
13
+ <div class="list-group">
14
+ <% fields.each_with_index do |field, index| %>
15
+ <div class="list-group-item border-0 <%= field.type_css_class %> <%= field.css_class %>">
16
+ <div class="card">
17
+ <h5 class="card-header bg-light">
18
+ <%= field.label %>
19
+ </h5>
20
+ <div class="card-body">
21
+ <%= field.pretty_value %>
22
+ </div>
23
+ </div>
24
+ </div>
25
+ <% end %>
26
+ </dl>
27
+ </div>
28
+ <% end %>
29
+ <% end %>
30
+ <% end %>
@@ -0,0 +1,5 @@
1
+ <% if Swop.configuration.style == :simple %>
2
+ <%= render partial: "rails_admin/main/swop-simple/delete" %>
3
+ <% else %>
4
+ <%= render partial: "rails_admin/main/default/delete" %>
5
+ <% end %>
@@ -0,0 +1,5 @@
1
+ <% if Swop.configuration.style == :simple %>
2
+ <%= render partial: "rails_admin/main/swop-simple/edit" %>
3
+ <% else %>
4
+ <%= render partial: "rails_admin/main/default/edit" %>
5
+ <% end %>
@@ -1,128 +1,5 @@
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: "main", data: {turbo: false} do %>
4
- <section class="mb-5 mb-md-7">
5
- <input name="send_data" type="hidden" value="true" />
6
- <fieldset id="fields_to_export" class="mb-4">
7
- <h2 class="h3 mb-0">
8
- <legend class="mb-0"><%= t('admin.export.select') %></legend>
9
- </h2>
10
- </fieldset>
11
- <fieldset id="fields_to_export">
12
- <div class="control-group mb-6">
13
- <div class="checkbox mb-3">
14
- <label class="form-check mb-0" for="reverse-selection">
15
- <%= check_box_tag 'all', 'all', true, { id: 'reverse-selection', class: 'reverse-selection form-check-input' } %>
16
- <div class="h5 fw-medium form-check-label"><%= t('admin.export.fields_from', name: @model_config.label_plural) %></div>
17
- </label>
18
- </div>
19
- <div class="controls row gx-8 gy-2">
20
- <% visible_fields.select{ |f| !f.association? || f.association.polymorphic? }.each do |field| %>
21
- <% list = field.virtual? ? 'methods' : 'only' %>
22
- <div class="col-auto">
23
- <div class="checkbox">
24
- <% if field.association? && field.association.polymorphic? %>
25
- <label class="form-check form-label mb-0" for="schema_<%= list %>_<%= field.method_name %>">
26
- <%= check_box_tag "schema[#{list}][]", field.method_name, true, { id: "schema_#{list}_#{field.method_name}", class: "form-check-input" } %>
27
- <%= field.label + " [id]" %>
28
- </label>
29
- <% polymorphic_type_column_name = @abstract_model.properties.detect { |p| field.association.foreign_type == p.name }.name %>
30
- <label class="form-check form-label mb-0" for="schema_<%= list %>_<%= polymorphic_type_column_name %>">
31
- <%= check_box_tag "schema[#{list}][]", polymorphic_type_column_name, true, { id: "schema_#{list}_#{polymorphic_type_column_name}", class: "form-check-input" } %>
32
- <%= field.label + " [type]" %>
33
- </label>
34
- <% else %>
35
- <label class="form-check form-label mb-0" for="schema_<%= list %>_<%= field.name %>">
36
- <%= check_box_tag "schema[#{list}][]", field.name, true, { id: "schema_#{list}_#{field.name}", class: "form-check-input" } %>
37
- <%= field.label %>
38
- </label>
39
- <% end %>
40
- </div>
41
- </div>
42
- <% end %>
43
- </div>
44
- </div>
45
- <h3 class="h4 mb-4">Associations</h3>
46
- <% visible_fields.select{ |f| f.association? && !f.association.polymorphic? }.each_with_index do |field, group_index| %>
47
- <% 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? } %>
48
- <div class="control-group <%= "mb-6" if group_index < visible_fields.select{ |f| f.association? && !f.association.polymorphic? }.size - 1 %>">
49
- <div class="checkbox mb-3">
50
- <label class="form-check mb-0">
51
- <%= check_box_tag 'all', 'all', true, { id: 'reverse-selection', class: 'reverse-selection form-check-input' } %>
52
- <div class="h5 fw-medium form-check-label"><%= t('admin.export.fields_from_associated', name: field.label.pluralize) %></div>
53
- </label>
54
- </div>
55
- <div class="controls row gx-8 gy-2">
56
- <% fields.each do |associated_model_field| %>
57
- <% list = associated_model_field.virtual? ? 'methods' : 'only' %>
58
- <div class="col-auto">
59
- <div class="checkbox">
60
- <label class="form-check mb-0 form-label" for="schema_include_<%= field.name %>_<%= list %>_<%= associated_model_field.name %>">
61
- <%= check_box_tag "schema[include][#{field.name}][#{list}][]", associated_model_field.name, true, { id: "schema_include_#{field.name}_#{list}_#{associated_model_field.name}", class: "form-check-input" } %>
62
- <%= associated_model_field.label %>
63
- </label>
64
- </div>
65
- </div>
66
- <% end %>
67
- </div>
68
- </div>
69
- <% end %>
70
- </fieldset>
71
- </section>
72
- <section class="mb-5 mb-md-6">
73
- <fieldset>
74
- <h2 class="h3 d-flex mb-4">
75
- <legend class="mb-0"><%= t('admin.export.options_for', name: 'csv') %></legend>
76
- </h2>
77
- <div class="control-group row mb-3">
78
- <% guessed_encoding = @abstract_model.encoding %>
79
- <label class="form-label" for="csv_options_encoding_to"><%= t('admin.export.csv.encoding_to') %></label>
80
- <div class="controls col col-md-10 col-xl-5">
81
- <%= select_tag 'csv_options[encoding_to]', options_for_select(Encoding.name_list.sort), include_blank: true, placeholder: t('admin.misc.search'), :'data-enumeration' => true %>
82
- </div>
83
- <p class="form-text mb-0"><%= t('admin.export.csv.encoding_to_help', name: guessed_encoding) %></p>
84
- </div>
85
- <div class="control-group mb-3">
86
- <div class="form-check mb-0 form-switch d-flex flex-column">
87
- <label class="form-label for="csv_options_skip_header"><%= t('admin.export.csv.skip_header') %></label>
88
- <%= check_box_tag 'csv_options[skip_header]', 'true', false, { class: 'form-check-input' } %>
89
- </div>
90
- <p class="form-text mb-0"><%= t('admin.export.csv.skip_header_help') %></p>
91
- </div>
92
- <div class="control-group row">
93
- <label class="form-label" for="csv_options_generator_col_sep">
94
- <%= t('admin.export.csv.col_sep') %>
95
- </label>
96
- <div class="controls col col-md-10 col-xl-5">
97
- <%= 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 %>
98
- </div>
99
- <p class="form-text mb-0"><%= t('admin.export.csv.col_sep_help', value: t('admin.export.csv.default_col_sep')) %></p>
100
- </div>
101
- </fieldset>
102
- </section>
103
- <div class="form-actions row justify-content-end gx-5 gy-3 gy-md-0">
104
- <input name="return_to" type="<%= :hidden %>" value="<%= (params[:return_to].presence || request.referer) %>" />
105
- <div class="col-auto">
106
- <button class="btn btn-primary" name="csv" type="submit">
107
- <i class="fas fa-check"></i>
108
- <%= t("admin.export.confirmation", name: 'csv') %>
109
- </button>
110
- </div>
111
- <div class="col-auto">
112
- <button class="btn btn-white" name="json" type="submit">
113
- <%= t("admin.export.confirmation", name: 'json') %>
114
- </button>
115
- </div>
116
- <div class="col-auto">
117
- <button class="btn btn-white" name="xml" type="submit">
118
- <%= t("admin.export.confirmation", name: 'xml') %>
119
- </button>
120
- </div>
121
- <div class="col-auto">
122
- <button class="btn btn-danger" name="_continue" type="submit">
123
- <i class="fas fa-times"></i>
124
- <%= t("admin.form.cancel") %>
125
- </button>
126
- </div>
127
- </div>
128
- <% end %>
1
+ <% if Swop.configuration.style == :simple %>
2
+ <%= render partial: "rails_admin/main/swop-simple/export" %>
3
+ <% else %>
4
+ <%= render partial: "rails_admin/main/default/export" %>
5
+ <% end %>
@@ -1,87 +1,5 @@
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="mb-6 mb-md-7">
9
- <div class="row justify-content-between gy-3 gy-md-0">
10
- <div class="col-md-auto">
11
- <div class="input-group">
12
- <input class="form-control" name="query" placeholder="<%= t("admin.misc.search") %>" type="search" value="<%= query %>" />
13
- <button class="btn btn-white" data-disable-with="<%= '<i class="fas fa-sync"></i>' + t('admin.misc.refresh') %>" type="submit">
14
- <i class="fas fa-sync fa-sm me-1"></i>
15
- <%= t('admin.misc.refresh') %>
16
- </button>
17
- <button class="btn btn-white" id="remove_filter" title="<%= t('admin.misc.reset_filters') %>">
18
- <i class="fas fa-times"></i>
19
- </button>
20
- </div>
21
- </div>
22
- </div>
23
- </div>
1
+ <% if Swop.configuration.style == :simple %>
2
+ <%= render partial: "rails_admin/main/swop-simple/history" %>
3
+ <% else %>
4
+ <%= render partial: "rails_admin/main/default/history" %>
24
5
  <% end %>
25
- <div id="sidescroll">
26
- <div class="table-responsive mb-4 mb-md-5">
27
- <table class="table table-condensed table-hover" id="history">
28
- <thead>
29
- <tr>
30
- <% columns = [] %>
31
- <% columns << { property_name: "created_at", css_class: "created_at",link_text: t('admin.table_headers.created_at') } %>
32
- <% columns << { property_name: "username", css_class: "username", link_text: t('admin.table_headers.username') } %>
33
- <% columns << { property_name: "item", css_class: "item", link_text: t('admin.table_headers.item') } if @general %>
34
- <% columns << { property_name: "message", css_class: "message", link_text: t('admin.table_headers.message') } %>
35
- <% columns.each do |column| %>
36
- <% property_name = column[:property_name] %>
37
- <% selected = (sort == property_name) %>
38
- <% sort_direction = (sort_reverse ? "headerSortUp" : "headerSortDown" if selected) %>
39
- <% 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"} : {})) %>
40
- <th class="header <%= column[:css_class] %> <%= sort_direction if selected %>" data-href="<%= sort_location %>">
41
- <%= column[:link_text] %>
42
- </th>
43
- <% end %>
44
- </tr>
45
- </thead>
46
- <tbody class="table-group-divider">
47
- <% @history.each_with_index do |object, index| %>
48
- <tr>
49
- <% unless object.created_at.nil? %>
50
- <td>
51
- <%= l(object.created_at, format: :long, default: l(object.created_at, format: :long)) %>
52
- </td>
53
- <% end %>
54
- <td>
55
- <%= object.username %>
56
- </td>
57
- <% if @general %>
58
- <% if o = @abstract_model.get(object.item) %>
59
- <% label = o.send(@abstract_model.config.object_label_method) %>
60
- <% if show_action = action(:show, @abstract_model, o) %>
61
- <td>
62
- <%= link_to(label, url_for(action: show_action.action_name, model_name: @abstract_model.to_param, id: o.id)) %>
63
- </td>
64
- <% else %>
65
- <td>
66
- <%= label %>
67
- </td>
68
- <% end %>
69
- <% else %>
70
- <td>
71
- <%= "#{@abstract_model.config.label} ##{object.item}" %>
72
- </td>
73
- <% end %>
74
- <% end %>
75
- <td>
76
- <%= object.message.in?(['delete', 'new']) ? t("admin.actions.#{object.message}.done").capitalize : object.message %>
77
- </td>
78
- </tr>
79
- <% end %>
80
- </tbody>
81
- </table>
82
- </div>
83
- </div>
84
- <% unless params[:all] || !@history.respond_to?(:current_page) %>
85
- <%= paginate(@history, theme: 'ra-twitter-bootstrap') %>
86
- <%= 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 %>
87
- <% end %>
@@ -1,174 +1,5 @@
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
- <b class="caret"></b>
26
- </a>
27
- <ul class="dropdown-menu dropdown-menu-end" id="filters">
28
- <% filterable_fields.each do |field| %>
29
- <li>
30
- <a
31
- href="#"
32
- class="dropdown-item"
33
- data-options="<%= field.with(view: self).filter_options.to_json %>"
34
- >
35
- <%= field.label %>
36
- </a>
37
- </li>
38
- <% end %>
39
- </ul>
40
- </li>
41
- <% end %>
42
- <% if checkboxes %>
43
- <%= bulk_menu %>
44
- <% end %>
1
+ <% if Swop.configuration.style == :simple %>
2
+ <%= render partial: "rails_admin/main/swop-simple/index" %>
3
+ <% else %>
4
+ <%= render partial: "rails_admin/main/default/index" %>
45
5
  <% end %>
46
-
47
- <style>
48
- <% properties.select{ |p| p.column_width.present? }.each do |property| %>
49
- <%= "#list th.#{property.css_class} { width: #{property.column_width}px; min-width: #{property.column_width}px; }" %>
50
- <%= "#list td.#{property.css_class} { max-width: #{property.column_width}px;}" %>
51
- <% end %>
52
- </style>
53
-
54
- <div id="list">
55
- <%= form_tag(index_path(params.except(*%w[page f query])), method: :get) do %>
56
- <div class="mb-6 mb-md-7">
57
- <div class="row" data-options="<%= ordered_filter_options.to_json %>" id="filters_box"></div>
58
- <hr class="filters_box mt-2 mb-4 mb-md-5" style="display:<%= ordered_filters.empty? ? 'none' : 'block' %>"/>
59
- <div class="row justify-content-between gy-3 gy-md-0">
60
- <div class="col-md-auto">
61
- <div class="input-group">
62
- <input class="form-control" name="query" placeholder="<%= t("admin.misc.search") %>" type="search" value="<%= query %>" />
63
- <button class="btn btn-white" data-disable-with="<%= '<i class="fas fa-sync"></i>' + t('admin.misc.refresh') %>" type="submit">
64
- <i class="fas fa-sync fa-sm me-1"></i>
65
- <%= t('admin.misc.refresh') %>
66
- </button>
67
- <button class="btn btn-white" id="remove_filter" title="<%= t('admin.misc.reset_filters') %>">
68
- <i class="fas fa-times"></i>
69
- </button>
70
- </div>
71
- <% if @model_config.list.search_help.present? %>
72
- <div class="form-text"><%= @model_config.list.search_help %></div>
73
- <% end %>
74
- </div>
75
- <div class="col-md-auto text-end">
76
- <% if export_action %>
77
- <%= link_to wording_for(:link, export_action), export_path(params.except('page')), class: 'btn btn-white w-100' %>
78
- <% end %>
79
- </div>
80
- </div>
81
- </div>
82
- <% end %>
83
- <% unless @model_config.list.scopes.empty? %>
84
- <ul class="nav nav-tabs" id="scope_selector">
85
- <% @model_config.list.scopes.each_with_index do |scope, index| %>
86
- <% scope = '_all' if scope.nil? %>
87
- <li class="nav-item">
88
- <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) %>">
89
- <%= I18n.t("admin.scopes.#{@abstract_model.to_param}.#{scope}", default: I18n.t("admin.scopes.#{scope}", default: scope.to_s.titleize)) %>
90
- </a>
91
- </li>
92
- <% end %>
93
- </ul>
94
- <% end %>
95
- <%= form_tag bulk_action_path(model_name: @abstract_model.to_param), method: :post, id: "bulk_form", class: ["form", "mb-3", "overflow-hidden"] do %>
96
- <%= hidden_field_tag :bulk_action %>
97
- <% if description.present? %>
98
- <p>
99
- <strong>
100
- <%= description %>
101
- </strong>
102
- </p>
103
- <% end %>
104
- <div id="sidescroll">
105
- <div class="table-responsive mb-4 mb-md-5">
106
- <table class="table table-condensed table-hover">
107
- <thead>
108
- <tr>
109
- <% if checkboxes %>
110
- <th class="shrink sticky z-1">
111
- <input class="toggle form-check-input" type="checkbox" />
112
- </th>
113
- <% end %>
114
- <% properties.each do |property| %>
115
- <% selected = (sort == property.name.to_s) %>
116
- <% if property.sortable %>
117
- <% sort_location = index_path params.except('sort_reverse').except('page').merge(sort: property.name).merge(selected && sort_reverse != "true" ? {sort_reverse: "true"} : {}) %>
118
- <% sort_direction = (sort_reverse == 'true' ? "headerSortUp" : "headerSortDown" if selected) %>
119
- <% end %>
120
- <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 %>">
121
- <%= property.label %>
122
- </th>
123
- <% end %>
124
- <th class="last shrink"></th>
125
- </tr>
126
- </thead>
127
- <tbody>
128
- <% @objects.each do |object| %>
129
- <tr class="<%= @abstract_model.param_key %>_row <%= @model_config.list.with(object: object).row_css_class %>">
130
- <% if checkboxes %>
131
- <td class="sticky align-middle">
132
- <%= check_box_tag "bulk_ids[]", object.id.to_s, false, class: "form-check-input" %>
133
- </td>
134
- <% end %>
135
- <% properties.map{ |property| property.bind(:object, object) }.each do |property| %>
136
- <% value = property.pretty_value %>
137
- <%= content_tag(:td, class: [property.sticky? && 'sticky', 'align-middle', 'overflow-hidden', property.css_class, property.type_css_class].select(&:present?), title: strip_tags(value.to_s)) do %>
138
- <%= value %>
139
- <% end %>
140
- <% end %>
141
- <td class="last links ra-sidescroll-frozen">
142
- <ul class="nav d-flex align-items-center justify-content-end flex-nowrap gap-2 gap-md-3 mb-0">
143
- <%= menu_for :member, @abstract_model, object, true %>
144
- </ul>
145
- </td>
146
- </tr>
147
- <% end %>
148
- <% if @objects.empty? %>
149
- <tr class="empty_row">
150
- <td colspan="<%= table_table_header_count %>">
151
- <%= I18n.t('admin.actions.index.no_records') %>
152
- </td>
153
- </tr>
154
- <% end %>
155
- </tbody>
156
- </table>
157
- </div>
158
- </div>
159
- <% if @model_config.list.limited_pagination %>
160
- <%= paginate(@objects, theme: 'ra-twitter-bootstrap/without_count', total_pages: Float::INFINITY) %>
161
- <% elsif @objects.respond_to?(:total_count) %>
162
- <% total_count = @objects.total_count.to_i %>
163
- <%= paginate(@objects, theme: 'ra-twitter-bootstrap') %>
164
- <%= link_to(t("admin.misc.show_all"), index_path(params.merge(all: true)), class: "show-all clearfix") unless total_count > 100 || total_count <= @objects.to_a.size %>
165
- <div class="clearfix total-count mt-4 mt-md-5">
166
- <%= "#{total_count} #{@model_config.pluralize(total_count).downcase}" %>
167
- </div>
168
- <% else %>
169
- <div class="clearfix total-count">
170
- <%= "#{@objects.size} #{@model_config.pluralize(@objects.size).downcase}" %>
171
- </div>
172
- <% end %>
173
- <% end %>
174
- </div>
@@ -0,0 +1,5 @@
1
+ <% if Swop.configuration.style == :simple %>
2
+ <%= render partial: "rails_admin/main/swop-simple/new" %>
3
+ <% else %>
4
+ <%= render partial: "rails_admin/main/default/new" %>
5
+ <% end %>