madmin 1.2.7 → 1.2.8

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: 8cd4e0b3d14780dd13db0a21a57a63e750a750298ea78cc93ec5eb327b1714e7
4
- data.tar.gz: 92f273ea140b603a887660b36802de9e6c0021a56cbeeb49cef5318696ae7bf6
3
+ metadata.gz: 452ba760d0701d79257b2f0ef4282a785dd3bc3e5380802c75220a6e7e8d3113
4
+ data.tar.gz: af23fac79122683d21c97866a355b2ebb373f7353610a46e8b83f25504a7e9b2
5
5
  SHA512:
6
- metadata.gz: 677c4da0f37a96e2515584a02e6d0c941d59fae91b43a15e19386a723d1bdeb6a4e47db8bdc987c59e59c1b75ae2f507d055603a8a996dc5c45b3731d95aac13
7
- data.tar.gz: b06f7fa04b747a761f956fccaa81e9f4535757db2276427e0cbda7a63d901295c9e275faf22a9753459290d530808f6b118806813e7858aeada501b3cb220cbf
6
+ metadata.gz: 0e37320de16647c286f7551e819f290bd040862ba0b209f8ee0a57971c76ee2988fa149a889e6bb366e5fe212eb98c93f101cb010ac65af34f64a9144ec34800
7
+ data.tar.gz: 0ff60d8bca0aeb06769542e1d550ed468cad26213ab04259335dbec5e61e03890fc253babb78ac09358c15345f6c98d7b1fc55acaf77fe2115939b93d0d7005c
@@ -15,7 +15,7 @@ module Madmin
15
15
  end
16
16
 
17
17
  def clear_search_params
18
- resource.index_path(params.permit(:sort, :direction))
18
+ resource.index_path(sort: params[:sort], direction: params[:direction])
19
19
  end
20
20
  end
21
21
  end
@@ -2,13 +2,13 @@ module Madmin
2
2
  module SortHelper
3
3
  def sortable(column, title, options = {})
4
4
  matching_column = (column.to_s == sort_column)
5
- direction = sort_direction == "asc" ? "desc" : "asc"
5
+ direction = (sort_direction == "asc") ? "desc" : "asc"
6
6
 
7
7
  link_to resource.index_path(sort: column, direction: direction), options do
8
8
  concat title
9
9
  if matching_column
10
10
  concat " "
11
- concat tag.i(sort_direction == "asc" ? "▲" : "▼")
11
+ concat tag.i((sort_direction == "asc") ? "▲" : "▼")
12
12
  end
13
13
  end
14
14
  end
@@ -5,10 +5,11 @@
5
5
  <%= link_to resource.display_name(@record), resource.show_path(@record), class: "text-indigo-500 font-bold" %>
6
6
  </h1>
7
7
 
8
- <div class="flex items-center px-4">
9
- <div class="mr-2">
10
- <%= 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" %>
11
- </div>
8
+ <div class="flex gap-2 items-center px-4">
9
+ <% resource.member_actions.each do |action| %>
10
+ <%= instance_eval &action %>
11
+ <% end %>
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" %>
12
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" %>
13
14
  </div>
14
15
  </div>
@@ -1,11 +1,13 @@
1
1
  module Madmin
2
2
  class Resource
3
3
  class_attribute :attributes, default: ActiveSupport::OrderedHash.new
4
+ class_attribute :member_actions, default: []
4
5
  class_attribute :scopes, default: []
5
6
 
6
7
  class << self
7
8
  def inherited(base)
8
9
  base.attributes = attributes.dup
10
+ base.member_actions = scopes.dup
9
11
  base.scopes = scopes.dup
10
12
  super
11
13
  end
@@ -108,6 +110,10 @@ module Madmin
108
110
  attributes.values.select { |a| a.field.searchable? }
109
111
  end
110
112
 
113
+ def member_action(&block)
114
+ member_actions << block
115
+ end
116
+
111
117
  private
112
118
 
113
119
  def field_for_type(type)
@@ -1,3 +1,3 @@
1
1
  module Madmin
2
- VERSION = "1.2.7"
2
+ VERSION = "1.2.8"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: madmin
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.7
4
+ version: 1.2.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Oliver
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2022-09-30 00:00:00.000000000 Z
12
+ date: 2023-05-10 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -32,9 +32,6 @@ dependencies:
32
32
  - - ">="
33
33
  - !ruby/object:Gem::Version
34
34
  version: '3.5'
35
- - - "<"
36
- - !ruby/object:Gem::Version
37
- version: '6.0'
38
35
  type: :runtime
39
36
  prerelease: false
40
37
  version_requirements: !ruby/object:Gem::Requirement
@@ -42,9 +39,6 @@ dependencies:
42
39
  - - ">="
43
40
  - !ruby/object:Gem::Version
44
41
  version: '3.5'
45
- - - "<"
46
- - !ruby/object:Gem::Version
47
- version: '6.0'
48
42
  description: It's an admin, obviously.
49
43
  email:
50
44
  - excid3@gmail.com
@@ -212,7 +206,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
212
206
  - !ruby/object:Gem::Version
213
207
  version: '0'
214
208
  requirements: []
215
- rubygems_version: 3.3.7
209
+ rubygems_version: 3.4.12
216
210
  signing_key:
217
211
  specification_version: 4
218
212
  summary: A modern admin for Ruby on Rails apps