rows_controller 3.0.3 → 3.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/MIT-LICENSE +1 -1
- data/README.md +0 -1
- data/app/views/rows/_list.slim +2 -1
- data/app/views/rows/_list_footer.slim +1 -1
- data/app/views/rows/_list_header.slim +0 -1
- data/app/views/rows/_row_buttons.slim +8 -8
- data/app/views/rows/_submit.slim +1 -1
- data/app/views/rows/edit.slim +3 -2
- data/app/views/rows/index.slim +4 -4
- data/app/views/rows/new.slim +3 -2
- data/app/views/rows/show.slim +4 -2
- data/app/views/shared/_error_explanation.slim +3 -3
- data/lib/rows/model.rb +2 -2
- data/lib/rows/resources.rb +2 -1
- data/lib/rows/version.rb +2 -1
- data/lib/rows/version.rb.bak +2 -1
- metadata +29 -28
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c66d74c692d41703b03eeae2e2e0603a145cfd3c0478496c1792e4a4ebf70776
|
4
|
+
data.tar.gz: 4657d006dbff4e84e1ba0806d72e22aebbcd86dc254cb3389208edd05c6d472e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e117f77fb4a317df03e93e9f92ab72f418418124c305c821a3fafd2bdad6abbe6ea12d09fc303e1479d28930e71cea6b2ea145f77bdee48199d8e28f539380aa
|
7
|
+
data.tar.gz: 5ad9d07738d72d9f688681fe4ffac092082f374f4e4498294bf58481e0c15f5fb2fde06141373a5db61ff343d371a754e62a2b19ba7fd9b26408ab52a5aac933
|
data/MIT-LICENSE
CHANGED
data/README.md
CHANGED
@@ -1,7 +1,6 @@
|
|
1
1
|
RowsController
|
2
2
|
==============
|
3
3
|
[![Gem Version](https://badge.fury.io/rb/rows_controller.svg)](https://badge.fury.io/rb/rows_controller)
|
4
|
-
[![Build Status](https://travis-ci.org/matique/rows_controller.png?branch=master)](https://travis-ci.org/matique/rows_controller)
|
5
4
|
|
6
5
|
DRYs Rails controllers. Imagine replacing that @order by 'resource' in the
|
7
6
|
controllers/views and, imho, an area for DRYing appears.
|
data/app/views/rows/_list.slim
CHANGED
@@ -3,6 +3,7 @@ ruby:
|
|
3
3
|
# Column :multi_selection generates a check_box
|
4
4
|
|
5
5
|
cnt = 0
|
6
|
+
odd_even = %w[odd even]
|
6
7
|
|
7
8
|
table.rows-list
|
8
9
|
thead
|
@@ -12,7 +13,7 @@ table.rows-list
|
|
12
13
|
tbody
|
13
14
|
- resources.each do |resource|
|
14
15
|
- cnt += 1
|
15
|
-
tr id="row_#{resource.id}" class="#{
|
16
|
+
tr id="row_#{resource.id}" class="#{odd_even.at(cnt % 2)}"
|
16
17
|
= render 'list_row', resource: resource, columns: columns
|
17
18
|
td
|
18
19
|
= render 'row_buttons', row: resource
|
@@ -1,14 +1,14 @@
|
|
1
1
|
ruby:
|
2
2
|
# Fills the last column of the list with "buttons".
|
3
3
|
# Requires row current_controller (supplied by Rails)
|
4
|
-
if defined?(current_controller)
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
4
|
+
url = if defined?(current_controller)
|
5
|
+
"/#{current_controller}/#{row.id}"
|
6
|
+
else
|
7
|
+
url_for row
|
8
|
+
end
|
9
9
|
|
10
|
-
= link_to t('button.show').html_safe,
|
11
|
-
= link_to t('button.edit').html_safe,
|
10
|
+
= link_to t('button.show').html_safe, url
|
11
|
+
= link_to t('button.edit').html_safe, "#{url}/edit"
|
12
12
|
= link_to t('button.delete').html_safe, url,
|
13
13
|
remote: true,
|
14
|
-
data: {
|
14
|
+
data: {confirm: 'Are you sure?'}, method: :delete
|
data/app/views/rows/_submit.slim
CHANGED
@@ -10,7 +10,7 @@ ruby:
|
|
10
10
|
left ||= nil
|
11
11
|
right ||= nil
|
12
12
|
|
13
|
-
|
13
|
+
.rows-submit style="width:100%"
|
14
14
|
input style="display:none" type="submit" name="commit" value="OK"
|
15
15
|
p style="float:left"
|
16
16
|
= render '/rows/submit_part', content: :submit_left, names: left
|
data/app/views/rows/edit.slim
CHANGED
@@ -4,7 +4,8 @@ ruby:
|
|
4
4
|
# partial 'form' template
|
5
5
|
|
6
6
|
content_for(:submit_left) {
|
7
|
-
|
7
|
+
link_to t('button.back').html_safe, "/#{controller_name}", class: 'button'
|
8
|
+
}
|
8
9
|
|
9
10
|
fieldset class="wide mask" id=model_symbol
|
10
11
|
legend = t('ui.editing', model: model_name).html_safe
|
@@ -14,4 +15,4 @@ fieldset class="wide mask" id=model_symbol
|
|
14
15
|
/"/#{controller_name}/update/#{@row.id}"
|
15
16
|
= form_for resource, url: "/#{controller_name}/#{@row.id}", html: {multipart: @multipart} do |f|
|
16
17
|
= render 'form', f: f
|
17
|
-
= render '/rows/submit', right: [
|
18
|
+
= render '/rows/submit', right: %w[update OK]
|
data/app/views/rows/index.slim
CHANGED
@@ -1,8 +1,8 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
/ Template for RowsController (index)
|
2
|
+
/ Requires resources model_name resource_columns
|
3
3
|
|
4
|
-
- if resources.length
|
5
|
-
h1
|
4
|
+
- if resources.length.positive?
|
5
|
+
h1 = t('ui.listing', model: model_name).html_safe
|
6
6
|
= render '/rows/list', resources: resources, columns: resource_columns
|
7
7
|
- else
|
8
8
|
h1 = t('ui.empty_list', model: model_name).html_safe
|
data/app/views/rows/new.slim
CHANGED
@@ -4,7 +4,8 @@ ruby:
|
|
4
4
|
# partial 'form' template
|
5
5
|
|
6
6
|
content_for(:submit_left) {
|
7
|
-
|
7
|
+
link_to t('button.back').html_safe, "/#{controller_name}", class: 'button'
|
8
|
+
}
|
8
9
|
|
9
10
|
fieldset.wide class="mask" id=model_symbol
|
10
11
|
legend = t('ui.new', model: model_name).html_safe
|
@@ -13,4 +14,4 @@ fieldset.wide class="mask" id=model_symbol
|
|
13
14
|
- @multipart ||= false
|
14
15
|
= form_for resource, html: {multipart: @multipart} do |f|
|
15
16
|
= render 'form', f: f
|
16
|
-
= render '/rows/submit', right: [
|
17
|
+
= render '/rows/submit', right: %w[create OK]
|
data/app/views/rows/show.slim
CHANGED
@@ -4,9 +4,11 @@ ruby:
|
|
4
4
|
# partial 'form' template
|
5
5
|
|
6
6
|
content_for(:submit_left) {
|
7
|
-
|
7
|
+
link_to t('button.back').html_safe, url_for(action: :index), class: 'button'
|
8
|
+
}
|
8
9
|
content_for(:submit_right) {
|
9
|
-
|
10
|
+
link_to t('button.edit').html_safe, url_for(action: :edit), class: 'button'
|
11
|
+
}
|
10
12
|
|
11
13
|
fieldset.show class="wide mask" id=model_symbol
|
12
14
|
legend = t('ui.showing', model: model_name).html_safe
|
@@ -1,9 +1,9 @@
|
|
1
1
|
/ # Generates error messages
|
2
2
|
/ # requires resource
|
3
3
|
|
4
|
-
- if resource
|
5
|
-
|
6
|
-
h2 #{pluralize(resource.errors.count,
|
4
|
+
- if resource.respond_to?(:errors) && resource.errors.any?
|
5
|
+
#error_explanation
|
6
|
+
h2 #{pluralize(resource.errors.count, 'error')} prohibited this template from being saved:
|
7
7
|
|
8
8
|
ul
|
9
9
|
- resource.errors.full_messages.each do |msg|
|
data/lib/rows/model.rb
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
module Rows::Model
|
4
4
|
def model_class
|
5
5
|
@_model_class ||= self.class.model_class ||
|
6
|
-
params[:controller].
|
6
|
+
Kernel.const_get(params[:controller].classify)
|
7
7
|
end
|
8
8
|
|
9
9
|
if Rails::VERSION::MAJOR > 3
|
@@ -20,7 +20,7 @@ module Rows::Model
|
|
20
20
|
end
|
21
21
|
|
22
22
|
def model_symbol
|
23
|
-
@_model_symbol ||= model_name.underscore.
|
23
|
+
@_model_symbol ||= model_name.underscore.tr('/', '_')
|
24
24
|
end
|
25
25
|
end
|
26
26
|
|
data/lib/rows/resources.rb
CHANGED
@@ -69,7 +69,8 @@ module Rows::Resources
|
|
69
69
|
params.require(model_symbol).permit(permits)
|
70
70
|
else
|
71
71
|
pars = params[model_symbol] || {}
|
72
|
-
pars.keys.each { |x|
|
72
|
+
# pars.keys.each { |x|
|
73
|
+
pars.each_key { |x|
|
73
74
|
x = x.to_sym
|
74
75
|
unless permits.include?(x) || permits.include?({x => []})
|
75
76
|
pars.delete(x)
|
data/lib/rows/version.rb
CHANGED
data/lib/rows/version.rb.bak
CHANGED
metadata
CHANGED
@@ -1,99 +1,99 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rows_controller
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0.
|
4
|
+
version: 3.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dittmar Krall
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-06-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '0'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - "
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
26
|
+
version: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - "
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
33
|
+
version: '0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - "
|
38
|
+
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
40
|
+
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: appraisal
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - "
|
45
|
+
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
47
|
+
version: '0'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- - "
|
52
|
+
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
54
|
+
version: '0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: combustion
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- - "
|
59
|
+
- - ">="
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: '
|
61
|
+
version: '0'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- - "
|
66
|
+
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: '
|
68
|
+
version: '0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: minitest
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- - "
|
73
|
+
- - ">="
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: '
|
75
|
+
version: '0'
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- - "
|
80
|
+
- - ">="
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: '
|
82
|
+
version: '0'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: sqlite3
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- - "
|
87
|
+
- - ">="
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version: '
|
89
|
+
version: '0'
|
90
90
|
type: :development
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
|
-
- - "
|
94
|
+
- - ">="
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version: '
|
96
|
+
version: '0'
|
97
97
|
description: YourController < RowsController ( < ApplicationController).
|
98
98
|
email:
|
99
99
|
- dittmar.krall@matique.de
|
@@ -132,7 +132,8 @@ files:
|
|
132
132
|
homepage: http://matique.de
|
133
133
|
licenses:
|
134
134
|
- MIT
|
135
|
-
metadata:
|
135
|
+
metadata:
|
136
|
+
source_code_uri: https://github.com/matique/rows_controller
|
136
137
|
post_install_message:
|
137
138
|
rdoc_options: []
|
138
139
|
require_paths:
|
@@ -148,7 +149,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
148
149
|
- !ruby/object:Gem::Version
|
149
150
|
version: '0'
|
150
151
|
requirements: []
|
151
|
-
rubygems_version: 3.
|
152
|
+
rubygems_version: 3.2.6
|
152
153
|
signing_key:
|
153
154
|
specification_version: 4
|
154
155
|
summary: RowsController DRYs your controllers.
|