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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3176ff3236482c18350f5a94f1e90f28218ed753
4
- data.tar.gz: 3c517cbbfe60a18c0ea977f64579adfb02de2eb5
3
+ metadata.gz: da5c6e5d14e140ddf8e6255b25dbe23ba4085edf
4
+ data.tar.gz: 9889a6f5a96041aa816330a800cf381d174fa6f7
5
5
  SHA512:
6
- metadata.gz: f72dce6a27dd7bced33732b4f8b9b2e82398de0a4303599bedb212e7908a44673f3cfe0b12b46136385d788e734b45e5bef704e260dfb8d3fe7af02d07599133
7
- data.tar.gz: 5f70ea7e847ef49e646ea204f84a63499e0d0fa815939850aef9f1c4ebd82d8480422edc8ed13cfe88ed5693eaa44ec072e1b8e503ed5f4950853ff95a3e9f53
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.pluralize.gsub('/', '-')]
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 = '&#9650;'
29
39
  ARROW_DOWN = '&#9660;'
data/lib/rao-component.rb CHANGED
@@ -1,2 +1,4 @@
1
+ require "haml-rails"
2
+
1
3
  require "rao"
2
4
  require "rao/component"
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.2.pre
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-13 00:00:00.000000000 Z
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