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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1ea282f99f4fadad36a5d7973f85373cde5d0a99bd4693b73ba4bb7022966d74
4
- data.tar.gz: bff51320262e2bcc2853abf0825a4887177755af61d32340e07c38cd321f1a93
3
+ metadata.gz: c66d74c692d41703b03eeae2e2e0603a145cfd3c0478496c1792e4a4ebf70776
4
+ data.tar.gz: 4657d006dbff4e84e1ba0806d72e22aebbcd86dc254cb3389208edd05c6d472e
5
5
  SHA512:
6
- metadata.gz: 6fc50f5cedbd36b6fc06c3bb71e489543629b0c9cc88b7fc7044d111d74d2f612189b0f6f686047975ecb8006a4acb4eb7e41a2cb77d01409e656d0b8eb1118f
7
- data.tar.gz: 265a469734b8be2a4b6e1087470e0cdbc284b3d32de4591ee229c9ee0993fbe27487512ff10be84d52c76b35279bd80f37f0e512ebd47dd0f7370246a3f0ad17
6
+ metadata.gz: e117f77fb4a317df03e93e9f92ab72f418418124c305c821a3fafd2bdad6abbe6ea12d09fc303e1479d28930e71cea6b2ea145f77bdee48199d8e28f539380aa
7
+ data.tar.gz: 5ad9d07738d72d9f688681fe4ffac092082f374f4e4498294bf58481e0c15f5fb2fde06141373a5db61ff343d371a754e62a2b19ba7fd9b26408ab52a5aac933
data/MIT-LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2012-2020 Dittmar Krall - www.matique.com
1
+ Copyright (c) 2012-2021 Dittmar Krall - www.matique.com
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
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.
@@ -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="#{%w{odd even}.at(cnt % 2)}"
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,5 +1,5 @@
1
1
  / Default list footer presenting a 'Create' button linked to action new.
2
2
  / May be overwriten for e.g. pagination
3
3
 
4
- div.list-footer
4
+ .list-footer
5
5
  = link_to t('button.create').html_safe, url_for(action: :new), class: 'button'
@@ -4,4 +4,3 @@
4
4
 
5
5
  - columns.each do |column|
6
6
  th = column == :multi_selection ? '' : t("header.#{column}")
7
-
@@ -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
- url = "/#{current_controller}/#{row.id}"
6
- else
7
- url = url_for row
8
- end
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, url
11
- = link_to t('button.edit').html_safe, url + '/edit'
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: { confirm: 'Are you sure?' }, method: :delete
14
+ data: {confirm: 'Are you sure?'}, method: :delete
@@ -10,7 +10,7 @@ ruby:
10
10
  left ||= nil
11
11
  right ||= nil
12
12
 
13
- div.rows-submit style="width:100%"
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
@@ -4,7 +4,8 @@ ruby:
4
4
  # partial 'form' template
5
5
 
6
6
  content_for(:submit_left) {
7
- link_to t('button.back').html_safe, "/#{controller_name}", class: 'button' }
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: ['update', 'OK']
18
+ = render '/rows/submit', right: %w[update OK]
@@ -1,8 +1,8 @@
1
- - # Template for RowsController (index)
2
- - # Requires resources model_name resource_columns
1
+ / Template for RowsController (index)
2
+ / Requires resources model_name resource_columns
3
3
 
4
- - if resources.length > 0
5
- h1 = t('ui.listing', model: model_name).html_safe
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
@@ -4,7 +4,8 @@ ruby:
4
4
  # partial 'form' template
5
5
 
6
6
  content_for(:submit_left) {
7
- link_to t('button.back').html_safe, "/#{controller_name}", class: 'button' }
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: ['create', 'OK']
17
+ = render '/rows/submit', right: %w[create OK]
@@ -4,9 +4,11 @@ ruby:
4
4
  # partial 'form' template
5
5
 
6
6
  content_for(:submit_left) {
7
- link_to t('button.back').html_safe, url_for(action: :index), class: 'button' }
7
+ link_to t('button.back').html_safe, url_for(action: :index), class: 'button'
8
+ }
8
9
  content_for(:submit_right) {
9
- link_to t('button.edit').html_safe, url_for(action: :edit), class: 'button' }
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 && resource.respond_to?(:errors) && resource.errors.any?
5
- div#error_explanation
6
- h2 #{pluralize(resource.errors.count, "error")} prohibited this template from being saved:
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].singularize.camelize.constantize
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.gsub(%r{/}, '_')
23
+ @_model_symbol ||= model_name.underscore.tr('/', '_')
24
24
  end
25
25
  end
26
26
 
@@ -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
@@ -1,7 +1,8 @@
1
1
  # rubocop: disable all
2
2
 
3
3
  module Rows
4
- VERSION = '3.0.3' # 2020-07-14
4
+ VERSION = '3.0.4' # 2021-06-24
5
+ # VERSION = '3.0.3' # 2020-07-14
5
6
  # VERSION = '3.0.2' # 2020-04-27
6
7
  # VERSION = '3.0.1' # 2020-03-01
7
8
  # VERSION = '3.0.0' # 2019-10-03
@@ -1,7 +1,8 @@
1
1
  # rubocop: disable all
2
2
 
3
3
  module Rows
4
- VERSION = '3.0.2' # 2020-04-27
4
+ VERSION = '3.0.3' # 2020-07-14
5
+ # VERSION = '3.0.2' # 2020-04-27
5
6
  # VERSION = '3.0.1' # 2020-03-01
6
7
  # VERSION = '3.0.0' # 2019-10-03
7
8
  # VERSION = '2.2.3' # 2019-10-03
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.3
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: 2020-07-14 00:00:00.000000000 Z
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: '1'
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: '1'
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: '13'
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: '13'
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: '2'
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: '2'
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: '1.1'
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: '1.1'
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: '5'
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: '5'
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: '1'
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: '1'
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.0.8
152
+ rubygems_version: 3.2.6
152
153
  signing_key:
153
154
  specification_version: 4
154
155
  summary: RowsController DRYs your controllers.