madmin 1.2.8 → 1.2.9

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 452ba760d0701d79257b2f0ef4282a785dd3bc3e5380802c75220a6e7e8d3113
4
- data.tar.gz: af23fac79122683d21c97866a355b2ebb373f7353610a46e8b83f25504a7e9b2
3
+ metadata.gz: d4711c582952084164bfafbad483a4b5cb520ff505f96c0f9a87a7b61732068c
4
+ data.tar.gz: 3eed3f7cbd6969f14b499c3c51bc91cacf423b9554c590c612000d23ccafea8f
5
5
  SHA512:
6
- metadata.gz: 0e37320de16647c286f7551e819f290bd040862ba0b209f8ee0a57971c76ee2988fa149a889e6bb366e5fe212eb98c93f101cb010ac65af34f64a9144ec34800
7
- data.tar.gz: 0ff60d8bca0aeb06769542e1d550ed468cad26213ab04259335dbec5e61e03890fc253babb78ac09358c15345f6c98d7b1fc55acaf77fe2115939b93d0d7005c
6
+ metadata.gz: 3464c6efd9b1561a49c437b8f994616e212d88ba0ec37eebbdac78cccaa0f700ef28bb5c90c20133eea98dfbc71cd7f008b8db38e055602bacc7a7bddcafb0e8
7
+ data.tar.gz: dff80cd6e7c84008618f61381ec0551519305f6ab8434d0742a85f37e50202740a5d146beb27989308426f8bd7ffd218fb86bf0903074bb4d89ec2238b55dbf2
@@ -13,7 +13,7 @@
13
13
  "@rails/activestorage": "https://unpkg.com/@rails/activestorage@<%= npm_rails_version %>/app/assets/javascripts/activestorage.esm.js",
14
14
  "flatpickr": "https://unpkg.com/flatpickr/dist/esm/index.js",
15
15
  "stimulus-flatpickr": "https://unpkg.com/stimulus-flatpickr@3.0.0-0/dist/index.m.js",
16
- "tailwindcss-stimulus-components": "https://unpkg.com/tailwindcss-stimulus-components/dist/tailwindcss-stimulus-components.modern.js",
16
+ "tailwindcss-stimulus-components": "https://unpkg.com/tailwindcss-stimulus-components/dist/tailwindcss-stimulus-components.module.js",
17
17
  "tom-select": "https://unpkg.com/tom-select/dist/esm/tom-select.complete.js",
18
18
  "trix": "https://unpkg.com/trix"
19
19
  }
@@ -0,0 +1,7 @@
1
+ <% Madmin.resources.each do |resource| %>
2
+ <%= nav_link_to resource.friendly_name.pluralize, resource.index_path, class: "block p-2 rounded hover:bg-gray-100", starts_with: resource.index_path, active_class: "font-bold text-black" %>
3
+ <% end %>
4
+
5
+ <div class="mt-auto">
6
+ <%= link_to "View Madmin on GitHub", "https://github.com/excid3/madmin", target: :_blank, class: "block p-2 rounded text-gray-500 hover:bg-gray-100" %>
7
+ </div>
@@ -1,4 +1,4 @@
1
- <div class="flex flex-col h-full text-sm" data-controller="dropdown">
1
+ <div class="flex flex-col h-full text-sm">
2
2
  <div class="flex md:block justify-between items-center">
3
3
  <div class="flex md:block items-center">
4
4
  <h1 class="mr-2 md:p-2 text-xl font-semibold">Madmin</h1>
@@ -9,7 +9,7 @@
9
9
  <% end %>
10
10
  </div>
11
11
 
12
- <div class="-mr-2 flex items-center md:hidden">
12
+ <div class="-mr-2 flex items-center md:hidden relative" data-controller="dropdown">
13
13
  <button data-action="click->dropdown#toggle touch->dropdown#toggle click@window->dropdown#hide touch@window#dropdown->hide" type="button" class="bg-white rounded-md p-2 inline-flex items-center justify-center text-gray-400 hover:bg-gray-200 focus:outline-none focus:ring-2 focus-ring-inset focus:ring-white" id="main-menu" aria-haspopup="true">
14
14
  <span class="sr-only">Open main menu</span>
15
15
  <!-- Heroicon name: outline/menu -->
@@ -17,16 +17,13 @@
17
17
  <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 6h16M4 12h16M4 18h16"></path>
18
18
  </svg>
19
19
  </button>
20
- </div>
21
- </div>
22
20
 
23
- <div class="hidden md:flex flex-col flex-grow justify-between" data-dropdown-target="menu">
24
- <% Madmin.resources.each do |resource| %>
25
- <%= nav_link_to resource.friendly_name.pluralize, resource.index_path, class: "block p-2 rounded hover:bg-gray-100", starts_with: resource.index_path, active_class: "font-bold text-black" %>
26
- <% end %>
27
-
28
- <div class="mt-auto">
29
- <%= link_to "View Madmin on GitHub", "https://github.com/excid3/madmin", target: :_blank, class: "block p-2 rounded text-gray-500 hover:bg-gray-100" %>
21
+ <div class="absolute top-12 right-0 bg-white rounded-lg min-w-64 shadow-lg hidden md:flex flex-col flex-grow justify-between" data-dropdown-target="menu">
22
+ <%= render "menu_resources" %>
23
+ </div>
24
+ </div>
25
+ <div class="hidden md:block">
26
+ <%= render "menu_resources" %>
30
27
  </div>
31
28
  </div>
32
29
  </div>
@@ -7,7 +7,7 @@
7
7
 
8
8
  <div class="flex gap-2 items-center px-4">
9
9
  <% resource.member_actions.each do |action| %>
10
- <%= instance_eval &action %>
10
+ <%= instance_eval(&action) %>
11
11
  <% end %>
12
12
  <%= link_to "Edit", resource.edit_path(@record), class: "block bg-white hover:bg-gray-100 text-gray-800 font-semibold py-2 px-4 border border-gray-400 rounded shadow" %>
13
13
  <%= button_to "Delete", resource.show_path(@record), method: :delete, data: { turbo_confirm: "Are you sure?" }, class: "bg-white hover:bg-gray-100 text-red-500 font-semibold py-2 px-4 border border-red-500 rounded shadow pointer-cursor" %>
@@ -2,7 +2,7 @@ require "madmin/generator_helpers"
2
2
 
3
3
  module Madmin
4
4
  module Generators
5
- class InstallGenerator < Rails::Generators::Base
5
+ class InstallGenerator < ::Rails::Generators::Base
6
6
  include Madmin::GeneratorHelpers
7
7
 
8
8
  source_root File.expand_path("../templates", __FILE__)
@@ -43,12 +43,12 @@ module Madmin
43
43
  # Skip Abstract classes, ActiveRecord::Base, and auto-generated HABTM models
44
44
  def generateable_models
45
45
  active_record_models.reject do |model|
46
- model.abstract_class? || model == ActiveRecord::Base || model.name.start_with?("HABTM_")
46
+ model.abstract_class? || model == ::ActiveRecord::Base || model.name.start_with?("HABTM_")
47
47
  end
48
48
  end
49
49
 
50
50
  def active_record_models
51
- ObjectSpace.each_object(ActiveRecord::Base.singleton_class)
51
+ ObjectSpace.each_object(::ActiveRecord::Base.singleton_class)
52
52
  end
53
53
  end
54
54
  end
@@ -12,7 +12,7 @@ module Madmin
12
12
  end
13
13
 
14
14
  def to_param
15
- {"#{attribute_name.to_s.singularize}_ids".to_sym => []}
15
+ {"#{attribute_name.to_s.singularize}_ids": []}
16
16
  end
17
17
 
18
18
  def index_path
@@ -1,3 +1,5 @@
1
+ require "ostruct"
2
+
1
3
  module Madmin
2
4
  class Resource
3
5
  class_attribute :attributes, default: ActiveSupport::OrderedHash.new
@@ -114,8 +116,6 @@ module Madmin
114
116
  member_actions << block
115
117
  end
116
118
 
117
- private
118
-
119
119
  def field_for_type(type)
120
120
  {
121
121
  binary: Fields::String,
@@ -184,7 +184,7 @@ module Madmin
184
184
 
185
185
  if model.attribute_types.include?(name_string)
186
186
  column_type = model.attribute_types[name_string]
187
- if column_type.is_a? ActiveRecord::Enum::EnumType
187
+ if column_type.is_a? ::ActiveRecord::Enum::EnumType
188
188
  :enum
189
189
  else
190
190
  column_type.type || :string
@@ -226,7 +226,6 @@ module Madmin
226
226
 
227
227
  def model_store_accessors
228
228
  store_accessors = model.stored_attributes.values
229
-
230
229
  store_accessors.flatten
231
230
  end
232
231
  end
data/lib/madmin/search.rb CHANGED
@@ -50,11 +50,11 @@ module Madmin
50
50
  end
51
51
 
52
52
  def query_table_name(attr)
53
- ActiveRecord::Base.connection.quote_column_name(@scoped_resource.table_name)
53
+ ::ActiveRecord::Base.connection.quote_column_name(@scoped_resource.table_name)
54
54
  end
55
55
 
56
56
  def column_to_query(attr)
57
- ActiveRecord::Base.connection.quote_column_name(attr)
57
+ ::ActiveRecord::Base.connection.quote_column_name(attr)
58
58
  end
59
59
  end
60
60
  end
@@ -1,3 +1,3 @@
1
1
  module Madmin
2
- VERSION = "1.2.8"
2
+ VERSION = "1.2.9"
3
3
  end
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: madmin
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.8
4
+ version: 1.2.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Oliver
8
8
  - Andrea Fomera
9
- autorequire:
9
+ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2023-05-10 00:00:00.000000000 Z
12
+ date: 2024-04-28 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -63,6 +63,7 @@ files:
63
63
  - app/views/layouts/madmin/application.html.erb
64
64
  - app/views/madmin/application/_form.html.erb
65
65
  - app/views/madmin/application/_javascript.html.erb
66
+ - app/views/madmin/application/_menu_resources.html.erb
66
67
  - app/views/madmin/application/_navigation.html.erb
67
68
  - app/views/madmin/application/edit.html.erb
68
69
  - app/views/madmin/application/index.html.erb
@@ -191,7 +192,7 @@ homepage: https://github.com/excid3/madmin
191
192
  licenses:
192
193
  - MIT
193
194
  metadata: {}
194
- post_install_message:
195
+ post_install_message:
195
196
  rdoc_options: []
196
197
  require_paths:
197
198
  - lib
@@ -206,8 +207,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
206
207
  - !ruby/object:Gem::Version
207
208
  version: '0'
208
209
  requirements: []
209
- rubygems_version: 3.4.12
210
- signing_key:
210
+ rubygems_version: 3.5.9
211
+ signing_key:
211
212
  specification_version: 4
212
213
  summary: A modern admin for Ruby on Rails apps
213
214
  test_files: []