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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 452ba760d0701d79257b2f0ef4282a785dd3bc3e5380802c75220a6e7e8d3113
|
4
|
+
data.tar.gz: af23fac79122683d21c97866a355b2ebb373f7353610a46e8b83f25504a7e9b2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0e37320de16647c286f7551e819f290bd040862ba0b209f8ee0a57971c76ee2988fa149a889e6bb366e5fe212eb98c93f101cb010ac65af34f64a9144ec34800
|
7
|
+
data.tar.gz: 0ff60d8bca0aeb06769542e1d550ed468cad26213ab04259335dbec5e61e03890fc253babb78ac09358c15345f6c98d7b1fc55acaf77fe2115939b93d0d7005c
|
@@ -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
|
-
|
10
|
-
<%=
|
11
|
-
|
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>
|
data/lib/madmin/resource.rb
CHANGED
@@ -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)
|
data/lib/madmin/version.rb
CHANGED
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.
|
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:
|
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.
|
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
|