dynamic_scaffold 1.6.0 → 1.7.0
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: ec4088a2da9e8c6667356e7adcbc51fca13dd76ab7be8c411b9217ebd052aa1b
|
4
|
+
data.tar.gz: 794a726dda7dde2485b0d3749e5d307f89e29c5724335e369fea0981b714c227
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 56db4471671b267e0387a3bdcd5e0c16b50551f8f3b1c73c947a1f7af8db0f9f5e0aca54762d9a7b76fb36bed3baa9bc8a71cc48f32098356cf213044248cd03
|
7
|
+
data.tar.gz: 469fc969cf4b0126785538894f7cc97498d4f39d9d32c1b215c8d6733a576fae63104709fe3b997300004d251fe0e33db8e0abed45871c85169e3f1b690e0b01
|
data/README.md
CHANGED
@@ -170,6 +170,11 @@ class ShopController < ApplicationController
|
|
170
170
|
# config.list.title do |record|
|
171
171
|
# record.name
|
172
172
|
# end
|
173
|
+
|
174
|
+
# You can add class to list page's each row.
|
175
|
+
config.list.row_class do |record|
|
176
|
+
'disabled' unless record.active?
|
177
|
+
end
|
173
178
|
|
174
179
|
# First arg is attribute name of model.
|
175
180
|
# Last hash arg is given to HTML attributes options.
|
@@ -30,8 +30,8 @@
|
|
30
30
|
data-confirm-cancel="<%= t('dynamic_scaffold.message.confirm_cancel') %>"
|
31
31
|
data-confirm-cancel-class="btn btn-outline-secondary btn-default btn-sm"
|
32
32
|
>
|
33
|
-
<%@records.
|
34
|
-
<li class="ds-list-row js-ds-list-row">
|
33
|
+
<%@records.each_with_index do |record, index|%>
|
34
|
+
<li class="<%= class_names('ds-list-row js-ds-list-row', dynamic_scaffold.list.row_class(record)) %>">
|
35
35
|
<% if dynamic_scaffold.list.title? %>
|
36
36
|
<div class="ds-list-heading"><%= dynamic_scaffold.list.title(record) %></div>
|
37
37
|
<% end %>
|
@@ -7,6 +7,7 @@ module DynamicScaffold
|
|
7
7
|
@order = []
|
8
8
|
@title = nil
|
9
9
|
@filter = nil
|
10
|
+
@row_class_block = nil
|
10
11
|
end
|
11
12
|
|
12
13
|
def pagination(options = nil)
|
@@ -88,5 +89,13 @@ module DynamicScaffold
|
|
88
89
|
@filter = block if block_given?
|
89
90
|
@filter
|
90
91
|
end
|
92
|
+
|
93
|
+
def row_class(record = nil, &block)
|
94
|
+
if block_given?
|
95
|
+
@row_class_block = block
|
96
|
+
elsif record.present? && @row_class_block
|
97
|
+
@config.controller.view_context.instance_exec(record, &@row_class_block)
|
98
|
+
end
|
99
|
+
end
|
91
100
|
end
|
92
101
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dynamic_scaffold
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Masamoto Miyata
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-01-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: classnames-rails-view
|