rails-add_ons 0.5.0 → 0.6.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
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 27d2b81421d0d2fa001db6f2b7bd9071190c56c3
|
4
|
+
data.tar.gz: 5b2cd7b72fde14704f85b85cb166c4d6bae7ccac
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 59f015f0b1adbb87c93bba6618aaa3a7e5ab4676ba6f30005e12c4dd253ce446d15da08eac7c7fcfcb8452bce07f2164ac412fe30b89e567459f1bf49c509fe4
|
7
|
+
data.tar.gz: c66a9e46718dc4827f95ebf1d4e84b5d5b086edb8939cd862a5fb46437c875331a3219018a59c20be930734b505e9d74ba0d1fcd4130ab2a44d6c704eb34727d
|
@@ -67,7 +67,7 @@ module Component
|
|
67
67
|
end
|
68
68
|
|
69
69
|
def table_css_classes
|
70
|
-
classes = ['table']
|
70
|
+
classes = ['table', 'collection-table', @resource_class.name.underscore.pluralize]
|
71
71
|
classes << 'table-bordered' if bordered?
|
72
72
|
classes << 'table-hover' if hover?
|
73
73
|
classes << 'table-inverse' if inverse?
|
@@ -77,4 +77,4 @@ module Component
|
|
77
77
|
classes
|
78
78
|
end
|
79
79
|
end
|
80
|
-
end
|
80
|
+
end
|
@@ -106,19 +106,23 @@ module ResourcesController
|
|
106
106
|
private
|
107
107
|
|
108
108
|
def new_resource_path
|
109
|
-
url_for
|
109
|
+
resource_router.send(:url_for, { action: :new, only_path: true })
|
110
110
|
end
|
111
111
|
|
112
112
|
def collection_path
|
113
|
-
url_for
|
113
|
+
resource_router.send(:url_for, { action: :index, only_path: true })
|
114
114
|
end
|
115
115
|
|
116
116
|
def resource_path(resource)
|
117
|
-
url_for
|
117
|
+
resource_router.send(:url_for, { action: :show, id: resource, only_path: true })
|
118
118
|
end
|
119
119
|
|
120
120
|
def edit_resource_path(resource)
|
121
|
-
url_for
|
121
|
+
resource_router.send(:url_for, { action: :edit, id: resource, only_path: true })
|
122
|
+
end
|
123
|
+
|
124
|
+
def resource_router
|
125
|
+
self
|
122
126
|
end
|
123
127
|
end
|
124
128
|
|
@@ -2,19 +2,28 @@
|
|
2
2
|
%thead
|
3
3
|
%tr
|
4
4
|
- columns.each do |name, options|
|
5
|
-
- title =
|
6
|
-
|
7
|
-
|
8
|
-
|
5
|
+
- title = options.delete(:title)
|
6
|
+
- if title.nil?
|
7
|
+
- if resource_class.respond_to?(:human_attribute_name)
|
8
|
+
- title = resource_class.human_attribute_name(name)
|
9
|
+
- else
|
10
|
+
- title = name
|
9
11
|
- if options.has_key?(:sort)
|
10
12
|
%td= sort_link(name, title, options[:sort])
|
11
13
|
- else
|
12
14
|
%td= title
|
13
15
|
%tbody
|
14
16
|
- collection.each do |resource|
|
15
|
-
|
17
|
+
- tr_options = { class: resource_class.name.underscore }
|
18
|
+
- if resource.respond_to?(:model_name)
|
19
|
+
- tr_options[:id] = dom_id(resource)
|
20
|
+
- else
|
21
|
+
- tr_options[:id] = "#{resource.class.name.underscore}-#{resource.object_id}"
|
22
|
+
%tr{ tr_options }
|
16
23
|
- columns.each do |name, options|
|
24
|
+
- td_options = { class: "attribute-#{name}", id: "#{tr_options[:id]}-#{name}"}
|
17
25
|
- if options[:block].present?
|
18
|
-
%td= options[:block].call(resource)
|
26
|
+
%td{ td_options }= options[:block].call(resource)
|
19
27
|
- else
|
20
|
-
%td= resource.send(name)
|
28
|
+
%td{ td_options }= resource.send(name)
|
29
|
+
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails-add_ons
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Roberto Vasquez Angel
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-10-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|