swop 0.1.0

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 (49) hide show
  1. checksums.yaml +7 -0
  2. data/CHANGELOG.md +5 -0
  3. data/CODE_OF_CONDUCT.md +132 -0
  4. data/LICENSE +201 -0
  5. data/README.md +15 -0
  6. data/Rakefile +4 -0
  7. data/app/assets/javascripts/rails_admin/application.js.erb +32 -0
  8. data/app/assets/javascripts/rails_admin/custom/filtering-select.js +304 -0
  9. data/app/assets/javascripts/rails_admin/custom/sidescroll.js +20 -0
  10. data/app/assets/javascripts/rails_admin/custom/ui.js +11 -0
  11. data/app/assets/stylesheets/rails_admin/application.scss.erb +52 -0
  12. data/app/assets/stylesheets/rails_admin/custom/base/base.scss +5 -0
  13. data/app/assets/stylesheets/rails_admin/custom/base/bootstrap-variables.scss +196 -0
  14. data/app/assets/stylesheets/rails_admin/custom/base/mixins.scss +88 -0
  15. data/app/assets/stylesheets/rails_admin/custom/base/typography.scss +16 -0
  16. data/app/assets/stylesheets/rails_admin/custom/base/variables.scss +86 -0
  17. data/app/assets/stylesheets/rails_admin/custom/components/breadcrumbs.scss +18 -0
  18. data/app/assets/stylesheets/rails_admin/custom/components/buttons.scss +55 -0
  19. data/app/assets/stylesheets/rails_admin/custom/components/dropdowns.scss +40 -0
  20. data/app/assets/stylesheets/rails_admin/custom/components/filtering-select.scss +43 -0
  21. data/app/assets/stylesheets/rails_admin/custom/components/forms.scss +25 -0
  22. data/app/assets/stylesheets/rails_admin/custom/components/images.scss +21 -0
  23. data/app/assets/stylesheets/rails_admin/custom/components/navbar.scss +18 -0
  24. data/app/assets/stylesheets/rails_admin/custom/components/navs.scss +28 -0
  25. data/app/assets/stylesheets/rails_admin/custom/components/offcanvas.scss +18 -0
  26. data/app/assets/stylesheets/rails_admin/custom/components/progress.scss +11 -0
  27. data/app/assets/stylesheets/rails_admin/custom/components/sidebar.scss +115 -0
  28. data/app/assets/stylesheets/rails_admin/custom/components/table.scss +59 -0
  29. data/app/assets/stylesheets/rails_admin/custom/components/tiles.scss +20 -0
  30. data/app/assets/stylesheets/rails_admin/custom/layouts/body.scss +10 -0
  31. data/app/assets/stylesheets/rails_admin/custom/layouts/containers.scss +31 -0
  32. data/app/helpers/rails_admin/application_helper.rb +270 -0
  33. data/app/views/layouts/rails_admin/_sidebar_navigation.html.erb +1 -0
  34. data/app/views/layouts/rails_admin/application.html.erb +24 -0
  35. data/app/views/layouts/rails_admin/content.html.erb +57 -0
  36. data/app/views/layouts/rails_admin/custom/_nav.html.erb +10 -0
  37. data/app/views/rails_admin/main/_submit_buttons.html.erb +25 -0
  38. data/app/views/rails_admin/main/dashboard.html.erb +70 -0
  39. data/app/views/rails_admin/main/delete.html.erb +19 -0
  40. data/app/views/rails_admin/main/edit.html.erb +5 -0
  41. data/app/views/rails_admin/main/export.html.erb +128 -0
  42. data/app/views/rails_admin/main/index.html.erb +170 -0
  43. data/app/views/rails_admin/main/new.html.erb +5 -0
  44. data/app/views/rails_admin/main/show.html.erb +28 -0
  45. data/lib/swop/engine.rb +7 -0
  46. data/lib/swop/version.rb +5 -0
  47. data/lib/swop.rb +8 -0
  48. data/sig/swop.rbs +4 -0
  49. metadata +140 -0
@@ -0,0 +1,170 @@
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 checkboxes %>
22
+ <div class="col-md-auto">
23
+ <%= bulk_menu %>
24
+ </div>
25
+ <% end %>
26
+ <% end %>
27
+
28
+ <style>
29
+ <% properties.select{ |p| p.column_width.present? }.each do |property| %>
30
+ <%= "#list th.#{property.css_class} { width: #{property.column_width}px; min-width: #{property.column_width}px; }" %>
31
+ <%= "#list td.#{property.css_class} { max-width: #{property.column_width}px;}" %>
32
+ <% end %>
33
+ </style>
34
+
35
+ <div id="list">
36
+ <%= form_tag(index_path(params.except(*%w[page f query])), method: :get) do %>
37
+ <section class="mb-md-6">
38
+ <div class="row" data-options="<%= ordered_filter_options.to_json %>" id="filters_box"></div>
39
+ <hr class="filters_box" style="display:<%= ordered_filters.empty? ? 'none' : 'block' %>"/>
40
+ <div class="row justify-content-end gx-5 gy-3 gy-md-0">
41
+ <%= content_for :contextual_tabs %>
42
+ <div class="col-md-auto">
43
+ <div class="input-group">
44
+ <input class="form-control" name="query" placeholder="<%= t("admin.misc.search") %>" type="search" value="<%= query %>" />
45
+ <button class="btn btn-white" data-disable-with="<%= '<i class="fas fa-sync"></i>' + t('admin.misc.refresh') %>" type="submit">
46
+ <i class="fas fa-sync fa-sm me-1"></i>
47
+ <%= t('admin.misc.refresh') %>
48
+ </button>
49
+ <button class="btn btn-white" id="remove_filter" title="<%= t('admin.misc.reset_filters') %>">
50
+ <i class="fas fa-times"></i>
51
+ </button>
52
+ </div>
53
+ <% if @model_config.list.search_help.present? %>
54
+ <div class="form-text"><%= @model_config.list.search_help %></div>
55
+ <% end %>
56
+ </div>
57
+ <%= menu_for((@abstract_model ? (@object.try(:persisted?) ? :member : :collection) : :root), @abstract_model, @object) %>
58
+ </div>
59
+ </section>
60
+ <% end %>
61
+ <% unless @model_config.list.scopes.empty? %>
62
+ <ul class="nav nav-tabs" id="scope_selector">
63
+ <% @model_config.list.scopes.each_with_index do |scope, index| %>
64
+ <% scope = '_all' if scope.nil? %>
65
+ <li class="nav-item">
66
+ <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) %>">
67
+ <%= I18n.t("admin.scopes.#{@abstract_model.to_param}.#{scope}", default: I18n.t("admin.scopes.#{scope}", default: scope.to_s.titleize)) %>
68
+ </a>
69
+ </li>
70
+ <% end %>
71
+ </ul>
72
+ <% end %>
73
+ <%= form_tag bulk_action_path(model_name: @abstract_model.to_param), method: :post, id: "bulk_form", class: ["form", "mb-3"] do %>
74
+ <%= hidden_field_tag :bulk_action %>
75
+ <% if description.present? %>
76
+ <p>
77
+ <strong>
78
+ <%= description %>
79
+ </strong>
80
+ </p>
81
+ <% end %>
82
+
83
+ <section class="bg-white p-4 p-md-5 shadow rounded-3">
84
+ <div id="sidescroll">
85
+ <table class="table table-condensed new">
86
+ <thead>
87
+ <tr>
88
+ <% if checkboxes %>
89
+ <th class="shrink sticky">
90
+ <input class="toggle form-check-input" type="checkbox" />
91
+ </th>
92
+ <% end %>
93
+ <% properties.each do |property| %>
94
+ <% selected = (sort == property.name.to_s) %>
95
+ <% if property.sortable %>
96
+ <% sort_location = index_path params.except('sort_reverse').except('page').merge(sort: property.name).merge(selected && sort_reverse != "true" ? {sort_reverse: "true"} : {}) %>
97
+ <% sort_direction = (sort_reverse == 'true' ? "headerSortUp" : "headerSortDown" if selected) %>
98
+ <% end %>
99
+ <th class="<%= [property.sortable && "header", property.sortable && sort_direction, property.sticky? && 'sticky', property.css_class, property.type_css_class, "small text-muted fw-semibold"].select(&:present?).join(' ') %>" data-href="<%= property.sortable && sort_location %>" rel="tooltip" title="<%= property.hint %>">
100
+ <%= property.label %>
101
+ </th>
102
+ <% end %>
103
+ <th class="last shrink"></th>
104
+ </tr>
105
+ </thead>
106
+ <tbody class="table-group-divider">
107
+ <% @objects.each do |object| %>
108
+ <tr class="<%= @abstract_model.param_key %>_row <%= @model_config.list.with(object: object).row_css_class %> small">
109
+ <% if checkboxes %>
110
+ <td class="sticky align-middle">
111
+ <%= check_box_tag "bulk_ids[]", object.id.to_s, false, class: "form-check-input" %>
112
+ </td>
113
+ <% end %>
114
+ <% properties.map{ |property| property.bind(:object, object) }.each do |property| %>
115
+ <% value = property.pretty_value %>
116
+ <%= content_tag(:td, class: [property.sticky? && 'sticky', 'align-middle', property.css_class, property.type_css_class].select(&:present?), title: strip_tags(value.to_s)) do %>
117
+ <%= value %>
118
+ <% end %>
119
+ <% end %>
120
+ <td class="last links ra-sidescroll-frozen overflow-visible align-middle">
121
+ <div class="dropdown dropstart">
122
+ <button class="btn btn-dropdown btn-sm btn-square" type="button" data-bs-toggle="dropdown" aria-expanded="false">
123
+ <i class="fas fa-ellipsis-vertical"></i>
124
+ </button>
125
+ <ul class="dropdown-menu">
126
+ <%= menu_for :member, @abstract_model, object, false %>
127
+ </ul>
128
+ </div>
129
+ </td>
130
+ </tr>
131
+ <% end %>
132
+ <% if @objects.empty? %>
133
+ <tr class="small 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">
144
+ <div class="col-md-6">
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
+ <% total_count = @objects.total_count.to_i %>
150
+ <div class="row">
151
+ <div class="col-md-6">
152
+ <%= paginate(@objects, theme: 'ra-twitter-bootstrap') %>
153
+ </div>
154
+ </div>
155
+ <div class="row">
156
+ <div class="col-md-6">
157
+ <%= 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 %>
158
+ </div>
159
+ </div>
160
+ <div class="small clearfix total-count">
161
+ <%= "#{total_count} #{@model_config.pluralize(total_count).downcase}" %>
162
+ </div>
163
+ <% else %>
164
+ <div class="small clearfix total-count">
165
+ <%= "#{@objects.size} #{@model_config.pluralize(@objects.size).downcase}" %>
166
+ </div>
167
+ <% end %>
168
+ </section>
169
+ <% end %>
170
+ </div>
@@ -0,0 +1,5 @@
1
+ <section class="bg-white p-5 p-md-7 p-lg-9 mb-5 mb-md-6 shadow rounded-3">
2
+ <%= 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| %>
3
+ <%= form.generate action: :create %>
4
+ <% end %>
5
+ </section>
@@ -0,0 +1,28 @@
1
+ <section class="bg-white p-5 p-md-7 p-lg-9 mb-5 mb-md-6 shadow rounded-3">
2
+ <% @model_config.show.with(object: @object, view: self, controller: self.controller).visible_groups.each do |fieldset| %>
3
+ <% unless (fields = fieldset.with(object: @object, view: self, controller: self.controller).visible_fields).empty? %>
4
+ <% unless (fields = fields.reject{ |f| RailsAdmin::config.compact_show_view && (f.formatted_value.nil? || f.formatted_value == '') }).empty? %>
5
+ <div class="fieldset">
6
+ <div class="d-md-flex mb-4 mb-md-5">
7
+ <div>
8
+ <h2 class="mb-2"><%= fieldset.label %></h2>
9
+ <% if fieldset.help %>
10
+ <p class="mb-4 mb-md-0"><%= fieldset.help %></p>
11
+ <% end %>
12
+ </div>
13
+ <ul class="nav nav-tabs nav-tabs-main-show mb-4 mb-md-0 ms-auto">
14
+ <%= menu_for((@abstract_model ? (@object.try(:persisted?) ? :member : :collection) : :root), @abstract_model, @object) %>
15
+ <%= content_for :contextual_tabs %>
16
+ </ul>
17
+ </div>
18
+ <% fields.each_with_index do |field, index| %>
19
+ <div class="card border-top-0 border-start-0 border-end-0 border-bottom-0 mb-6 mb-md-8">
20
+ <h3 class="h6 card-header bg-white px-0 pb-2 pt-0"><%= field.label %></h3>
21
+ <div class="card-body px-o pt-2 pb-0"><%= field.pretty_value %></div>
22
+ </div>
23
+ <% end %>
24
+ </div>
25
+ <% end %>
26
+ <% end %>
27
+ <% end %>
28
+ </section>
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Swop
4
+ class Engine < ::Rails::Engine
5
+ isolate_namespace Swop
6
+ end
7
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Swop
4
+ VERSION = "0.1.0"
5
+ end
data/lib/swop.rb ADDED
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "swop/version"
4
+
5
+ module Swop
6
+ class Error < StandardError; end
7
+ # Your code goes here...
8
+ end
data/sig/swop.rbs ADDED
@@ -0,0 +1,4 @@
1
+ module Swop
2
+ VERSION: String
3
+ # See the writing guide of rbs: https://github.com/ruby/rbs#guides
4
+ end
metadata ADDED
@@ -0,0 +1,140 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: swop
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Kamil Wodzinski
8
+ - Harrison James
9
+ autorequire:
10
+ bindir: exe
11
+ cert_chain: []
12
+ date: 2024-12-30 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: rails
16
+ requirement: !ruby/object:Gem::Requirement
17
+ requirements:
18
+ - - ">="
19
+ - !ruby/object:Gem::Version
20
+ version: '6.0'
21
+ - - "<"
22
+ - !ruby/object:Gem::Version
23
+ version: '8'
24
+ type: :runtime
25
+ prerelease: false
26
+ version_requirements: !ruby/object:Gem::Requirement
27
+ requirements:
28
+ - - ">="
29
+ - !ruby/object:Gem::Version
30
+ version: '6.0'
31
+ - - "<"
32
+ - !ruby/object:Gem::Version
33
+ version: '8'
34
+ - !ruby/object:Gem::Dependency
35
+ name: rails_admin
36
+ requirement: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '2.0'
41
+ type: :runtime
42
+ prerelease: false
43
+ version_requirements: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '2.0'
48
+ - !ruby/object:Gem::Dependency
49
+ name: bundler
50
+ requirement: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '1.0'
55
+ type: :development
56
+ prerelease: false
57
+ version_requirements: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '1.0'
62
+ description:
63
+ email:
64
+ - kamilw175@gmail.com
65
+ - harissoooon@outlook.com
66
+ executables: []
67
+ extensions: []
68
+ extra_rdoc_files: []
69
+ files:
70
+ - CHANGELOG.md
71
+ - CODE_OF_CONDUCT.md
72
+ - LICENSE
73
+ - README.md
74
+ - Rakefile
75
+ - app/assets/javascripts/rails_admin/application.js.erb
76
+ - app/assets/javascripts/rails_admin/custom/filtering-select.js
77
+ - app/assets/javascripts/rails_admin/custom/sidescroll.js
78
+ - app/assets/javascripts/rails_admin/custom/ui.js
79
+ - app/assets/stylesheets/rails_admin/application.scss.erb
80
+ - app/assets/stylesheets/rails_admin/custom/base/base.scss
81
+ - app/assets/stylesheets/rails_admin/custom/base/bootstrap-variables.scss
82
+ - app/assets/stylesheets/rails_admin/custom/base/mixins.scss
83
+ - app/assets/stylesheets/rails_admin/custom/base/typography.scss
84
+ - app/assets/stylesheets/rails_admin/custom/base/variables.scss
85
+ - app/assets/stylesheets/rails_admin/custom/components/breadcrumbs.scss
86
+ - app/assets/stylesheets/rails_admin/custom/components/buttons.scss
87
+ - app/assets/stylesheets/rails_admin/custom/components/dropdowns.scss
88
+ - app/assets/stylesheets/rails_admin/custom/components/filtering-select.scss
89
+ - app/assets/stylesheets/rails_admin/custom/components/forms.scss
90
+ - app/assets/stylesheets/rails_admin/custom/components/images.scss
91
+ - app/assets/stylesheets/rails_admin/custom/components/navbar.scss
92
+ - app/assets/stylesheets/rails_admin/custom/components/navs.scss
93
+ - app/assets/stylesheets/rails_admin/custom/components/offcanvas.scss
94
+ - app/assets/stylesheets/rails_admin/custom/components/progress.scss
95
+ - app/assets/stylesheets/rails_admin/custom/components/sidebar.scss
96
+ - app/assets/stylesheets/rails_admin/custom/components/table.scss
97
+ - app/assets/stylesheets/rails_admin/custom/components/tiles.scss
98
+ - app/assets/stylesheets/rails_admin/custom/layouts/body.scss
99
+ - app/assets/stylesheets/rails_admin/custom/layouts/containers.scss
100
+ - app/helpers/rails_admin/application_helper.rb
101
+ - app/views/layouts/rails_admin/_sidebar_navigation.html.erb
102
+ - app/views/layouts/rails_admin/application.html.erb
103
+ - app/views/layouts/rails_admin/content.html.erb
104
+ - app/views/layouts/rails_admin/custom/_nav.html.erb
105
+ - app/views/rails_admin/main/_submit_buttons.html.erb
106
+ - app/views/rails_admin/main/dashboard.html.erb
107
+ - app/views/rails_admin/main/delete.html.erb
108
+ - app/views/rails_admin/main/edit.html.erb
109
+ - app/views/rails_admin/main/export.html.erb
110
+ - app/views/rails_admin/main/index.html.erb
111
+ - app/views/rails_admin/main/new.html.erb
112
+ - app/views/rails_admin/main/show.html.erb
113
+ - lib/swop.rb
114
+ - lib/swop/engine.rb
115
+ - lib/swop/version.rb
116
+ - sig/swop.rbs
117
+ homepage: https://github.com/kamz16/swop
118
+ licenses:
119
+ - Apache-2.0
120
+ metadata: {}
121
+ post_install_message:
122
+ rdoc_options: []
123
+ require_paths:
124
+ - lib
125
+ required_ruby_version: !ruby/object:Gem::Requirement
126
+ requirements:
127
+ - - ">="
128
+ - !ruby/object:Gem::Version
129
+ version: 3.0.0
130
+ required_rubygems_version: !ruby/object:Gem::Requirement
131
+ requirements:
132
+ - - ">="
133
+ - !ruby/object:Gem::Version
134
+ version: '0'
135
+ requirements: []
136
+ rubygems_version: 3.4.19
137
+ signing_key:
138
+ specification_version: 4
139
+ summary: Theme's for the rails_admin gem
140
+ test_files: []