rao-component 0.0.2.pre → 0.0.3.pre
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/components/rao/component/resource_table.rb +1 -1
- data/app/concerns/rao/component/collection_table/acts_as_list_concern.rb +38 -0
- data/app/concerns/rao/component/collection_table/acts_as_published_concern.rb +26 -0
- data/app/helpers/rao/component/application_helper.rb +10 -0
- data/lib/rao-component.rb +2 -0
- metadata +73 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: da5c6e5d14e140ddf8e6255b25dbe23ba4085edf
|
4
|
+
data.tar.gz: 9889a6f5a96041aa816330a800cf381d174fa6f7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9f00f659a22b489d29fb14c7f98b6182dac0a890a8813d8854aeec5ce239b598cb66bc83de7d108430df5f9352115c9f96ba703333a5ce0b2121911a1490c040
|
7
|
+
data.tar.gz: f146d533f0c59c964dd845412274abce840e7cc5a68cf4b0db27b9757e9e249fdff6f5ee233fb6602cf514a2015e790a64ae32ca72911c7711cb20c53fc38963
|
@@ -67,7 +67,7 @@ module Rao
|
|
67
67
|
end
|
68
68
|
|
69
69
|
def table_css_classes
|
70
|
-
classes = ['table', 'resource-table', @resource_class.name.underscore.
|
70
|
+
classes = ['table', 'resource-table', @resource_class.name.underscore.gsub('/', '-')]
|
71
71
|
classes << 'table-bordered' if bordered?
|
72
72
|
classes << 'table-hover' if hover?
|
73
73
|
classes << 'table-inverse' if inverse?
|
@@ -1,5 +1,43 @@
|
|
1
1
|
module Rao
|
2
2
|
module Component
|
3
|
+
# Usage:
|
4
|
+
#
|
5
|
+
# # app/models/gallery.rb
|
6
|
+
# class Picture < ActiveRecord::Base
|
7
|
+
# has_many :pictures, -> { order(position: :asc) }
|
8
|
+
# # ...
|
9
|
+
# end
|
10
|
+
#
|
11
|
+
# # app/models/picture.rb
|
12
|
+
# class Picture < ActiveRecord::Base
|
13
|
+
# acts_as_list scope: :gallery
|
14
|
+
# # ...
|
15
|
+
# end
|
16
|
+
#
|
17
|
+
# # app/galleries/index.html.haml
|
18
|
+
# = collection_table(collection: @pictures) do |table|
|
19
|
+
# = table.acts_as_list_actions scope: :gallery_id
|
20
|
+
#
|
21
|
+
# You will have to add a repositioning route to your resource:
|
22
|
+
#
|
23
|
+
# # config/routes.rb:
|
24
|
+
# Rails.application.routes do
|
25
|
+
# resources :picture do
|
26
|
+
# post :reposition, on: :member
|
27
|
+
# end
|
28
|
+
# # ...
|
29
|
+
# end
|
30
|
+
#
|
31
|
+
# Additionally you will need a controller action to handle the reponsitioning.
|
32
|
+
# Include Rao::ResourcesController::ActsAsListConcern from rao-resource_controller
|
33
|
+
# if you don't want to implement it yourself:
|
34
|
+
#
|
35
|
+
# # app/controllers/pictures_controller.rb
|
36
|
+
# class PicturesController < ApplicationController
|
37
|
+
# include Rao::ResourcesController::ActsAsListConcern
|
38
|
+
# # ...
|
39
|
+
# end
|
40
|
+
#
|
3
41
|
module CollectionTable::ActsAsListConcern
|
4
42
|
extend ActiveSupport::Concern
|
5
43
|
|
@@ -1,5 +1,31 @@
|
|
1
1
|
module Rao
|
2
2
|
module Component
|
3
|
+
# Basic usage:
|
4
|
+
#
|
5
|
+
# # app/views/pictures/index.html.haml
|
6
|
+
# = collection_table(collection: @pictures) do |table|
|
7
|
+
# = table.acts_as_published_actions
|
8
|
+
#
|
9
|
+
# You will have to add a publishing route to your resource:
|
10
|
+
#
|
11
|
+
# # config/routes.rb:
|
12
|
+
# Rails.application.routes do
|
13
|
+
# resources :picture do
|
14
|
+
# post :toggle_published, on: :member
|
15
|
+
# end
|
16
|
+
# # ...
|
17
|
+
# end
|
18
|
+
#
|
19
|
+
# Additionally you will need a controller action to handle the reponsitioning.
|
20
|
+
# Include Rao::ResourcesController::ActsAsPublishedConcern from rao-resource_controller
|
21
|
+
# if you don't want to implement it yourself:
|
22
|
+
#
|
23
|
+
# # app/controllers/pictures_controller.rb
|
24
|
+
# class PicturesController < ApplicationController
|
25
|
+
# include Rao::ResourcesController::ActsAsPublishedConcern
|
26
|
+
# # ...
|
27
|
+
# end
|
28
|
+
#
|
3
29
|
module CollectionTable::ActsAsPublishedConcern
|
4
30
|
extend ActiveSupport::Concern
|
5
31
|
|
@@ -24,6 +24,16 @@ module Rao
|
|
24
24
|
SortLink.new(self, column_name, title, options).perform
|
25
25
|
end
|
26
26
|
|
27
|
+
# Basic usage:
|
28
|
+
#
|
29
|
+
# = collection_table(collection: @pictures) do |table|
|
30
|
+
# = table.column :title, sort: true
|
31
|
+
#
|
32
|
+
# Sorting by an attributes of an association (picture <-n---1-> gallery[name]):
|
33
|
+
#
|
34
|
+
# = collection_table(collection: @pictures) do |table|
|
35
|
+
# = table.column :gallery, as: :association, sort: { column_name: 'galleries.name' }
|
36
|
+
#
|
27
37
|
class SortLink
|
28
38
|
ARROW_UP = '▲'
|
29
39
|
ARROW_DOWN = '▼'
|
data/lib/rao-component.rb
CHANGED
metadata
CHANGED
@@ -1,15 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rao-component
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3.pre
|
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: 2018-12-
|
11
|
+
date: 2018-12-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rails
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
13
27
|
- !ruby/object:Gem::Dependency
|
14
28
|
name: rao
|
15
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -24,6 +38,20 @@ dependencies:
|
|
24
38
|
- - ">="
|
25
39
|
- !ruby/object:Gem::Version
|
26
40
|
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: haml-rails
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
27
55
|
- !ruby/object:Gem::Dependency
|
28
56
|
name: sqlite3
|
29
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -39,7 +67,7 @@ dependencies:
|
|
39
67
|
- !ruby/object:Gem::Version
|
40
68
|
version: '0'
|
41
69
|
- !ruby/object:Gem::Dependency
|
42
|
-
name: rspec
|
70
|
+
name: rspec-rails
|
43
71
|
requirement: !ruby/object:Gem::Requirement
|
44
72
|
requirements:
|
45
73
|
- - ">="
|
@@ -94,6 +122,48 @@ dependencies:
|
|
94
122
|
- - ">="
|
95
123
|
- !ruby/object:Gem::Version
|
96
124
|
version: '0'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: simplecov
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - ">="
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '0'
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - ">="
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '0'
|
139
|
+
- !ruby/object:Gem::Dependency
|
140
|
+
name: rails
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
142
|
+
requirements:
|
143
|
+
- - ">="
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: '0'
|
146
|
+
type: :development
|
147
|
+
prerelease: false
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - ">="
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: '0'
|
153
|
+
- !ruby/object:Gem::Dependency
|
154
|
+
name: capybara
|
155
|
+
requirement: !ruby/object:Gem::Requirement
|
156
|
+
requirements:
|
157
|
+
- - ">="
|
158
|
+
- !ruby/object:Gem::Version
|
159
|
+
version: '0'
|
160
|
+
type: :development
|
161
|
+
prerelease: false
|
162
|
+
version_requirements: !ruby/object:Gem::Requirement
|
163
|
+
requirements:
|
164
|
+
- - ">="
|
165
|
+
- !ruby/object:Gem::Version
|
166
|
+
version: '0'
|
97
167
|
description:
|
98
168
|
email:
|
99
169
|
- roberto@vasquez-angel.de
|