rows_controller 3.0.5 → 3.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9414a13edbb916cc607c39536a62b3642ada61cee3c0cb26361fa759b192acfa
4
- data.tar.gz: 615a5cf379ea71ae26ec8904ac3221712e45670efcd6a5e3cd303b67be835738
3
+ metadata.gz: 608e308317430650c974be5dcc19c0d63bf4dce16c4a85844d568caf2c4fcc63
4
+ data.tar.gz: 0dbbd3d8229975a7b0c3e37dec220bd983c7c0476d15de3687f708907930df30
5
5
  SHA512:
6
- metadata.gz: 32f61e6e683933e0d81c87127a9bf9beaf24bb611f68c051974f65b3b830ee9ec5cbfc3c38e1632206422277befa6cd1511c2334f63c6042d2a4124e098d5fc9
7
- data.tar.gz: 7c4ae08f41e3c196a7adea824b674cf3d4bed5883ff24377aacd7d76ed4a209ea598e28c9a1dc2bc77b16c9b68758a8fc0176bd627c15e093a9d4393b9b82051
6
+ metadata.gz: 13d43c53f9b359eaf673b4048ff4f8ce3790533402bf897dae3ae1dbb4a36d34b9abebf49e2ada94674d4cfdebc65619a7a6abe301abb041c6bced77a4e547b2
7
+ data.tar.gz: 153b05355ee37847f683f576f96566534dd07c2a358d1f35ccf9c4d2e90c1fbfdf3979d806992bb2e6471aec6bedc257060b12b99479729e6d9a3b8e6d014c64
data/MIT-LICENSE CHANGED
@@ -1,4 +1,6 @@
1
- Copyright (c) 2012-2021 Dittmar Krall - www.matique.com
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2012-2023 Dittmar Krall (www.matiq.com)
2
4
 
3
5
  Permission is hereby granted, free of charge, to any person obtaining
4
6
  a copy of this software and associated documentation files (the
data/README.md CHANGED
@@ -1,27 +1,31 @@
1
- RowsController
2
- ==============
1
+ # RowsController
3
2
  [![Gem Version](https://badge.fury.io/rb/rows_controller.svg)](https://badge.fury.io/rb/rows_controller)
3
+ [![GEM Downloads](https://img.shields.io/gem/dt/rows_controller?color=168AFE&logo=ruby&logoColor=FE1616)](https://rubygems.org/gems/rows_controller)
4
4
 
5
5
  DRYs Rails controllers. Imagine replacing that @order by 'resource' in the
6
6
  controllers/views and, imho, an area for DRYing appears.
7
7
  Instead of:
8
8
 
9
- class OrdersController < ApplicationController
10
- .....
11
- private
12
- def order_params
13
- params.require(:order).permit(:name)
14
- end
15
- end
9
+ ~~~ruby
10
+ class OrdersController < ApplicationController
11
+ .....
12
+ private
13
+ def order_params
14
+ params.require(:order).permit(:name)
15
+ end
16
+ end
17
+ ~~~
16
18
 
17
19
  use:
18
20
 
19
- class OrdersController < RowsController # < ApplicationController
20
- private
21
- def resource_whitelist
22
- %i{ name }
23
- end
24
- end
21
+ ~~~ruby
22
+ class OrdersController < RowsController # < ApplicationController
23
+ private
24
+ def resource_whitelist
25
+ %i{ name }
26
+ end
27
+ end
28
+ ~~~
25
29
 
26
30
  I.e. RowsController defines all the usual methods (index, show, edit,...).
27
31
 
@@ -31,16 +35,17 @@ The methods may be redefined in OrdersController
31
35
  Low level methods like 'resources' may be redefined as well.
32
36
  An example:
33
37
 
34
- def resources
35
- @_resources ||= model_class.paginate(page: params[:page])
36
- end
38
+ ~~~ruby
39
+ def resources
40
+ @_resources ||= model_class.paginate(page: params[:page])
41
+ end
42
+ ~~~
37
43
 
38
44
  RowsController inherites from ApplicationController, i.e. all the helpers
39
45
  defined there will be available.
40
46
 
41
47
 
42
- Customizing of views
43
- --------------------
48
+ ## Customizing of views
44
49
 
45
50
  RowsController initializes some instance variables used in the views
46
51
  (e.g. @order, @orders; legacy @row & @rows are still supported).
@@ -56,33 +61,44 @@ Similarly, partials '\_row\_buttons' and '\_list\_footer' may be overwritten
56
61
  as well.
57
62
 
58
63
 
59
- model_class
60
- -----------
64
+ ## model_class
61
65
 
62
66
  RowsController guesses the model from params[:controller]. This can
63
- be changed by e.g.:
67
+ be changed by:
64
68
 
65
- class OrdersController < RowsController
66
- model_class Booking
67
- ...
69
+ ~~~ruby
70
+ class OrdersController < RowsController
71
+ model_class Booking
72
+ ...
73
+ ~~~
68
74
 
69
75
  The model class can be retrieved with the helper model_class.
70
76
 
71
77
 
72
- Rails 6
73
- -------
78
+ ## Rails 7
79
+
80
+ RowsController 3.1.0 is intended for Rails 7.
81
+ In particular Hotwire caused some quirks
82
+ which are handled by this version.
83
+ Compatibility with older Rails versions are not intended
84
+ and has not been checked.
85
+
86
+ Older Rails versions may use "gem 'rows_controller', '= 3.0.5'".
87
+
88
+
89
+ ## Rails 6
74
90
 
75
91
  This gem is intended for Rails 6.
76
92
  Older Rails versions may use "gem 'rows_controller', '= 2.2.2'".
77
93
 
78
- Rails 5
79
- -------
94
+
95
+ ## Rails 5
80
96
 
81
97
  This gem is intended for Rails 5.
82
98
  Older Rails versions may use "gem 'rows_controller', '= 2.0.8'".
83
99
 
84
- Rails 4
85
- -------
100
+
101
+ ## Rails 4
86
102
 
87
103
  This gem is intended for Rails 4.
88
104
  Older Rails versions may use "gem 'rows_controller', '= 1.1.9'".
@@ -93,22 +109,8 @@ in the controllers.
93
109
  Alternatively you may define the private method 'resource_params'
94
110
  in the controller to filter params.
95
111
 
96
-
97
112
  ## Enhancements
98
113
 
99
- ### copy
100
-
101
- The method "copy" was added to the RowsExtController.
102
- "copy" is like "new", however its attributes are initialized
103
- from an existing resource.
104
- The "id" of the cloned resource is set to nil.
105
-
106
- Usage of "copy" requires a defining in config/routes.rb. An example:
107
-
108
- resources :orders
109
- get 'copy', on: :member
110
- end
111
-
112
114
  ### columns
113
115
 
114
116
  Add a class method 'column_headers' to the model
@@ -121,10 +123,12 @@ a class method which returns the columns defined by the ActiveRecord model.
121
123
 
122
124
  As usual:
123
125
 
124
- gem 'rows_controller' # in Gemfile
125
- bundle
126
- ( cd spec/dummy; rake db:create db:migrate ) # not required for Rails 6
127
- rake
126
+ ~~~ruby
127
+ gem 'rows_controller' # in Gemfile
128
+ bundle
129
+ ( cd spec/dummy; rake db:create db:migrate ) # not required for Rails 6
130
+ rake
131
+ ~~~
128
132
 
129
133
 
130
134
  ## Credits
@@ -136,4 +140,9 @@ Look for:
136
140
  - inherited_resources
137
141
  - decent_exposure
138
142
 
139
- Copyright (c) 2009-2020 [Dittmar Krall], released under the MIT license.
143
+ ## Miscellaneous
144
+
145
+ Copyright (c) 2009-2023 Dittmar Krall (www.matiq.com),
146
+ released under the MIT license:
147
+
148
+ * https://opensource.org/licenses/MIT
@@ -1,11 +1,13 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'rows/resources'
4
- require 'rows/model'
5
- require 'rows/utils'
3
+ require "rows/resources"
4
+ require "rows/model"
5
+ require "rows/utils"
6
6
 
7
7
  class RowsController < ApplicationController
8
- helper_method :set_resource, :set_resources, :resource, :resources
8
+ before_action :set_resource, only: %i[show edit update destroy]
9
+
10
+ helper_method :resource, :resources, :set_resource, :set_resources
9
11
  helper_method :resource_columns, :resource_format
10
12
  helper_method :model_class, :model_name
11
13
  helper_method :model_symbol, :model_symbol_plural
@@ -15,80 +17,80 @@ class RowsController < ApplicationController
15
17
  include Rows::Utils
16
18
 
17
19
  def self.model_class(model_class = nil)
18
- @_model_class ||= nil
19
- unless model_class.nil?
20
- @_model_class = model_class
21
- @_model_class = model_class.constantize if model_class.is_a?(String)
22
- end
23
- @_model_class
20
+ return @_model_class if model_class.nil?
21
+
22
+ @_model_class = model_class
23
+ @_model_class = model_class.constantize if model_class.is_a?(String)
24
24
  end
25
25
 
26
- # GET /:resources[.json]
27
26
  def index
28
- set_resources
27
+ set_resources model_class.all
29
28
  end
30
29
 
31
- # GET /:resource/:id[.json]
32
30
  def show
33
- set_resource
34
31
  end
35
32
 
36
- # GET /:resource/new
37
33
  def new
38
- resource_new
34
+ set_resource model_class.new
39
35
  end
40
36
 
41
- # GET /:resource/:id/edit
42
37
  def edit
43
- set_resource
44
38
  end
45
39
 
46
- # POST /:resources[.json]
47
40
  def create
48
- create_update(:resource_create, 'created')
41
+ set_resource model_class.new(resource_params)
42
+ msg = t("ui.created", model: model_name)
43
+ if resource.save
44
+ succeded msg, :create
45
+ else
46
+ failed :edit
47
+ end
49
48
  end
50
49
 
51
- # PATCH/PUT /:resources/:id[.json]
52
50
  def update
53
- set_resource
54
- create_update(:resource_update, 'updated')
51
+ msg = t("ui.updated", model: model_name)
52
+ if resource.update(resource_params)
53
+ succeded msg, :ok
54
+ else
55
+ failed :edit
56
+ end
55
57
  end
56
58
 
57
- # DELETE /:resources/:id[.json]
58
59
  def destroy
59
- set_resource
60
- resource_destroy
61
- msg = t('ui.destroyed', model: model_name).html_safe
62
- flash[:notice] = msg unless request.xhr?
60
+ resource.destroy
61
+ msg = t("ui.destroyed", model: model_name)
62
+ flash[:notice] = msg unless request.xhr?
63
63
  respond_to do |format|
64
64
  format.html { redirect_to action: :index }
65
- format.js { render template: 'rows/destroy', layout: false }
66
65
  format.json { head :no_content }
66
+ format.turbo_stream {}
67
67
  end
68
68
  end
69
69
 
70
- private
71
- def create_update(which, msg)
70
+ private
71
+
72
+ def succeded(msg, next_status)
72
73
  respond_to do |format|
73
- if send(which)
74
- format.html {
75
- flash[:notice] = t(msg, scope: :ui, model: model_name,
76
- default: "%{model} was successfully #{msg}.").html_safe
77
- if params[:commit] == 'OK'
78
- redirect_to action: :index
79
- else
80
- redirect_to action: 'edit', id: resource.id
81
- end
82
- }
83
- format.json { render action: 'show',
84
- status: msg == 'created' ? :created : :ok,
85
- location: resource }
86
- else ## failed
87
- format.html { render action: msg == 'created' ? :new : :edit }
88
- format.json { render json: resource.errors,
89
- status: :unprocessable_entity }
90
- end
74
+ format.html {
75
+ flash[:notice] = msg
76
+ if params[:commit] == "OK"
77
+ redirect_to action: :index
78
+ else
79
+ redirect_to action: :edit, id: resource.id
80
+ end
81
+ }
82
+ format.json {
83
+ render action: :show, status: next_status, location: resource
84
+ }
91
85
  end
92
86
  end
93
87
 
88
+ def failed(next_action)
89
+ respond_to do |format|
90
+ format.html { render action: next_action }
91
+ format.json {
92
+ render json: resource.errors, status: :unprocessable_entity
93
+ }
94
+ end
95
+ end
94
96
  end
@@ -9,11 +9,13 @@ table.rows-list
9
9
  thead
10
10
  tr
11
11
  = render 'list_header', columns: columns
12
+ /= render 'list_header', columns:
12
13
 
13
14
  tbody
14
15
  - resources.each do |resource|
15
16
  - cnt += 1
16
- tr id="row_#{resource.id}" class="#{odd_even.at(cnt % 2)}"
17
+ tr id=dom_id(resource) class="#{odd_even.at(cnt % 2)}"
17
18
  = render 'list_row', resource: resource, columns: columns
19
+ /= render 'list_row', resource:, columns:
18
20
  td
19
21
  = render 'row_buttons', row: resource
@@ -2,4 +2,4 @@
2
2
  / May be overwriten for e.g. pagination
3
3
 
4
4
  .list-footer
5
- = link_to t('button.create').html_safe, url_for(action: :new), class: 'button'
5
+ = link_to t('button.create'), url_for(action: :new), class: 'button'
@@ -6,9 +6,11 @@ ruby:
6
6
  else
7
7
  url_for row
8
8
  end
9
+ show = t('button.show')
10
+ edit = t('button.edit')
11
+ delete = t('button.delete')
9
12
 
10
- = link_to t('button.show').html_safe, url
11
- = link_to t('button.edit').html_safe, "#{url}/edit"
12
- = link_to t('button.delete').html_safe, url,
13
- remote: true,
14
- data: {confirm: 'Are you sure?'}, method: :delete
13
+ = link_to image_tag('show.gif', alt: show, title: show), url
14
+ = link_to image_tag('plus.png', alt: edit, title: edit), "#{url}/edit"
15
+ = link_to image_tag('minus.png', alt: delete, title: delete), url,
16
+ data: { turbo_method: :delete, turbo_confirm: 'Are you sure?' }
@@ -10,7 +10,7 @@ ruby:
10
10
  left ||= nil
11
11
  right ||= nil
12
12
 
13
- .rows-submit style="width:100%"
13
+ .rows-submit style="width:100%" data= { turbo: 'false' }
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
@@ -0,0 +1 @@
1
+ <%= turbo_stream.remove(dom_id(resource)) %>
@@ -3,16 +3,14 @@ ruby:
3
3
  # Requires resource model_name model_symbol
4
4
  # partial 'form' template
5
5
 
6
- content_for(:submit_left) {
6
+ content_for(:submit_left) do
7
7
  link_to t('button.back').html_safe, "/#{controller_name}", class: 'button'
8
- }
8
+ end
9
9
 
10
10
  fieldset class="wide mask" id=model_symbol
11
11
  legend = t('ui.editing', model: model_name).html_safe
12
12
  = render '/shared/error_explanation'
13
13
 
14
- - @multipart ||= false
15
- /"/#{controller_name}/update/#{@row.id}"
16
- = form_for resource, url: "/#{controller_name}/#{@row.id}", html: {multipart: @multipart} do |f|
14
+ = form_with model: resource do |f|
17
15
  = render 'form', f: f
18
16
  = render '/rows/submit', right: %w[update OK]
@@ -2,8 +2,9 @@
2
2
  / Requires resources model_name resource_columns
3
3
 
4
4
  - if resources.length.positive?
5
- h1 = t('ui.listing', model: model_name).html_safe
5
+ h1 = model_symbol_plural.capitalize
6
6
  = render '/rows/list', resources: resources, columns: resource_columns
7
+ /= render '/rows/list', resources:, columns: resource_columns
7
8
  - else
8
9
  h1 = t('ui.empty_list', model: model_name).html_safe
9
10
 
@@ -3,15 +3,14 @@ ruby:
3
3
  # Requires resource model_name model_symbol
4
4
  # partial 'form' template
5
5
 
6
- content_for(:submit_left) {
6
+ content_for(:submit_left) do
7
7
  link_to t('button.back').html_safe, "/#{controller_name}", class: 'button'
8
- }
8
+ end
9
9
 
10
10
  fieldset.wide class="mask" id=model_symbol
11
11
  legend = t('ui.new', model: model_name).html_safe
12
12
  = render '/shared/error_explanation'
13
13
 
14
- - @multipart ||= false
15
- = form_for resource, html: {multipart: @multipart} do |f|
14
+ = form_with model: resource do |f|
16
15
  = render 'form', f: f
17
16
  = render '/rows/submit', right: %w[create OK]
@@ -3,17 +3,17 @@ ruby:
3
3
  # Requires resource model_name model_symbol
4
4
  # partial 'form' template
5
5
 
6
- content_for(:submit_left) {
6
+ content_for(:submit_left) do
7
7
  link_to t('button.back').html_safe, url_for(action: :index), class: 'button'
8
- }
9
- content_for(:submit_right) {
8
+ end
9
+ content_for(:submit_right) do
10
10
  link_to t('button.edit').html_safe, url_for(action: :edit), class: 'button'
11
- }
11
+ end
12
12
 
13
13
  fieldset.show class="wide mask" id=model_symbol
14
- legend = t('ui.showing', model: model_name).html_safe
14
+ legend = model_name
15
15
  = render '/shared/error_explanation'
16
16
 
17
- = form_for resource, url: {action: :show}, method: :get do |f|
17
+ = form_with model: resource do |f|
18
18
  = render 'form', f: f
19
19
  = render '/rows/submit'
@@ -1,9 +1,14 @@
1
1
  / # Show complete flash
2
2
  / # flash[:notice] are faded out after 5 seconds
3
- / # never call this file just 'flash' ==> empties flash
3
+
4
+ css:
5
+ .flash_notice {
6
+ animation: animate_notice 5s linear 2s forwards;
7
+ }
8
+ @keyframes animate_notice {
9
+ from { opacity: 1; }
10
+ to { opacity: 0; }
11
+ }
4
12
 
5
13
  - (flash || {}).each do |key, value|
6
14
  p class="flash_#{key}" = sanitize(value)
7
- - if key == :notice
8
- javascript:
9
- $('.flash_notice').fadeOut(5000, function() { $(this).remove(); });
@@ -1,25 +1,20 @@
1
- # under construction; see english version
2
1
  de:
3
2
 
4
3
  ui:
5
- created: '%{model} erstellt.'
6
- destroyed: '%{model} gel&ouml;scht.'
7
- updated: '%{model} ge&auml;ndert.'
8
-
9
- editing: 'Editiere %{model}'
10
- listing: 'Liste %{model}'
11
- new: 'Neue(r/s) %{model}'
12
- showing: 'Zeige %{model}'
13
-
14
- empty_list: 'Liste %{model} ist leer.'
4
+ created: "%{model} erstellt."
5
+ destroyed: "%{model} gel&ouml;scht."
6
+ editing: "Editiere %{model}"
7
+ empty_list: "Liste %{model} ist leer."
8
+ new: "Neue(r/s) %{model}"
9
+ updated: "%{model} ge&auml;ndert."
15
10
 
16
11
  button:
17
- ok: OK
18
12
  back: "Zur&uuml;ck"
19
13
  cancel: Abbrechen
14
+ clone: Klonen
20
15
  create: Erstelle
21
- update: Speichern
22
- delete: 'L&ouml;sche'
16
+ delete: "L&ouml;sche"
23
17
  edit: Editieren
18
+ ok: OK
24
19
  show: Zeige
25
- clone: Klonen
20
+ update: Speichern
@@ -1,24 +1,20 @@
1
1
  en:
2
2
 
3
3
  ui:
4
- created: '%{model} created.'
5
- destroyed: '%{model} deleted.'
6
- updated: '%{model} updated.'
7
-
8
- editing: 'Editing %{model}'
9
- listing: 'Listing %{model}'
10
- new: 'New %{model}'
11
- showing: 'Showing %{model}'
12
-
13
- empty_list: 'List %{model} is empty'
4
+ created: "%{model} created."
5
+ destroyed: "%{model} deleted."
6
+ editing: "Editing %{model}"
7
+ empty_list: "List %{model} is empty"
8
+ new: "New %{model}"
9
+ updated: "%{model} updated."
14
10
 
15
11
  button:
16
- ok: OK
17
12
  back: Back
18
13
  cancel: Cancel
14
+ clone: Clone
19
15
  create: Create
20
- update: Update
21
16
  delete: Delete
22
17
  edit: Edit
18
+ ok: OK
23
19
  show: Show
24
- clone: Clone
20
+ update: Update
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
- Kernel.const_get(params[:controller].classify)
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.tr('/', '_')
23
+ @_model_symbol ||= model_name.underscore.tr("/", "_")
24
24
  end
25
25
  end
26
26
 
@@ -1,83 +1,45 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Rows::Resources
4
- def set_resources(rows = nil)
5
- rows ||= model_class.all
6
- instance_variable_set("@#{model_symbol_plural}", rows)
7
- @rows = rows
4
+ def resource
5
+ @_resource || set_resource
6
+ end
7
+
8
+ def resources
9
+ @_resources || set_resources
8
10
  end
9
11
 
10
12
  def set_resource(row = nil)
11
13
  row ||= model_class.find_by_id(params[:id].to_i)
12
14
  instance_variable_set("@#{model_symbol}", row)
15
+ @_resource = row
13
16
  @row = row
14
17
  end
15
18
 
16
- def resources
17
- @rows ||= set_resources
18
- end
19
-
20
- def resource
21
- @row ||= set_resource
22
- end
23
-
24
- private
25
- # low level resource methods
26
- # can be monkey patched
27
- def resource_new
28
- if params[model_symbol]
29
- set_resource model_class.new(resource_params)
30
- else
31
- set_resource model_class.new
32
- end
33
- end
34
-
35
- def resource_create
36
- resource_new
37
- resource.save
38
- end
39
-
40
- def resource_update
41
- if Rails::VERSION::MAJOR >= 4
42
- # return true unless params[model_symbol]
43
- resource.update(resource_params)
44
- else
45
- resource.update_attributes(resource_params)
46
- end
19
+ def set_resources(rows = nil)
20
+ rows ||= model_class.all
21
+ instance_variable_set("@#{model_symbol_plural}", rows)
22
+ @_resources = rows
23
+ @rows = rows
47
24
  end
48
25
 
49
- def resource_destroy
50
- resource.destroy
51
- end
26
+ private
52
27
 
53
28
  def resource_columns
54
29
  return model_class.column_headers if model_class.respond_to?(:column_headers)
55
- return ['to_s'] unless model_class.respond_to?(:content_columns)
30
+ return ["to_s"] unless model_class.respond_to?(:content_columns)
56
31
 
57
- ['id'] + model_class.content_columns.collect(&:name)
32
+ ["id"] + model_class.content_columns.collect(&:name)
58
33
  end
59
34
 
60
35
  def resource_whitelist
61
- raise "RowsController requires private method 'resource_whitelist' in controller <#{params[:controller]}>"
36
+ raise "TurbocController requires private method 'resource_whitelist' in controller <#{params[:controller]}>"
62
37
  end
63
38
 
64
39
  # Never trust parameters from the scary internet, only allow the
65
40
  # white list through.
66
41
  def resource_params
67
42
  permits = resource_whitelist
68
- if params.respond_to?(:require)
69
- params.require(model_symbol).permit(permits)
70
- else
71
- pars = params[model_symbol] || {}
72
- # pars.keys.each { |x|
73
- pars.each_key { |x|
74
- x = x.to_sym
75
- unless permits.include?(x) || permits.include?({x => []})
76
- pars.delete(x)
77
- p "** WARNING: model <#{model_name}> dropping params <#{x}>"
78
- end
79
- }
80
- pars
81
- end
43
+ params.require(model_symbol).permit(permits)
82
44
  end
83
45
  end
data/lib/rows/version.rb CHANGED
@@ -1,13 +1,13 @@
1
- # rubocop: disable all
2
-
3
1
  module Rows
4
- VERSION = '3.0.5' # 2021-06-24
5
- # VERSION = '3.0.3' # 2020-07-14
6
- # VERSION = '3.0.2' # 2020-04-27
7
- # VERSION = '3.0.1' # 2020-03-01
8
- # VERSION = '3.0.0' # 2019-10-03
9
- # VERSION = '2.2.3' # 2019-10-03
10
- # VERSION = '2.2.2' # 2019-05-06
11
- # VERSION = '2.2.1' # 2019-02-18
12
- # VERSION = '2.2.0'
2
+ VERSION = "3.1.1" # 2023-04-20
3
+ # VERSION = "3.1.0" # 2022-09-18
4
+ # VERSION = '3.0.5' # 2021-06-24
5
+ # VERSION = '3.0.3' # 2020-07-14
6
+ # VERSION = '3.0.2' # 2020-04-27
7
+ # VERSION = '3.0.1' # 2020-03-01
8
+ # VERSION = '3.0.0' # 2019-10-03
9
+ # VERSION = '2.2.3' # 2019-10-03
10
+ # VERSION = '2.2.2' # 2019-05-06
11
+ # VERSION = '2.2.1' # 2019-02-18
12
+ # VERSION = '2.2.0'
13
13
  end
@@ -1,13 +1,12 @@
1
- # rubocop: disable all
2
-
3
1
  module Rows
4
- VERSION = '3.0.4' # 2021-06-24
5
- # VERSION = '3.0.3' # 2020-07-14
6
- # VERSION = '3.0.2' # 2020-04-27
7
- # VERSION = '3.0.1' # 2020-03-01
8
- # VERSION = '3.0.0' # 2019-10-03
9
- # VERSION = '2.2.3' # 2019-10-03
10
- # VERSION = '2.2.2' # 2019-05-06
11
- # VERSION = '2.2.1' # 2019-02-18
12
- # VERSION = '2.2.0'
2
+ VERSION = "3.1.0" # 2022-09-18
3
+ # VERSION = '3.0.5' # 2021-06-24
4
+ # VERSION = '3.0.3' # 2020-07-14
5
+ # VERSION = '3.0.2' # 2020-04-27
6
+ # VERSION = '3.0.1' # 2020-03-01
7
+ # VERSION = '3.0.0' # 2019-10-03
8
+ # VERSION = '2.2.3' # 2019-10-03
9
+ # VERSION = '2.2.2' # 2019-05-06
10
+ # VERSION = '2.2.1' # 2019-02-18
11
+ # VERSION = '2.2.0'
13
12
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rows_controller
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.5
4
+ version: 3.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dittmar Krall
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-06-24 00:00:00.000000000 Z
11
+ date: 2023-04-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -96,7 +96,7 @@ dependencies:
96
96
  version: '0'
97
97
  description: YourController < RowsController ( < ApplicationController).
98
98
  email:
99
- - dittmar.krall@matique.de
99
+ - dittmar.krall@matiq.com
100
100
  executables: []
101
101
  extensions: []
102
102
  extra_rdoc_files: []
@@ -104,7 +104,6 @@ files:
104
104
  - MIT-LICENSE
105
105
  - README.md
106
106
  - app/controllers/rows_controller.rb
107
- - app/controllers/rows_ext_controller.rb
108
107
  - app/views/rows/_form.slim
109
108
  - app/views/rows/_list.slim
110
109
  - app/views/rows/_list_footer.slim
@@ -113,7 +112,7 @@ files:
113
112
  - app/views/rows/_row_buttons.slim
114
113
  - app/views/rows/_submit.slim
115
114
  - app/views/rows/_submit_part.slim
116
- - app/views/rows/destroy.js.erb
115
+ - app/views/rows/destroy.turbo_stream.erb
117
116
  - app/views/rows/edit.slim
118
117
  - app/views/rows/index.slim
119
118
  - app/views/rows/new.slim
@@ -129,7 +128,7 @@ files:
129
128
  - lib/rows/version.rb
130
129
  - lib/rows/version.rb.bak
131
130
  - lib/rows_controller.rb
132
- homepage: http://matique.de
131
+ homepage: http://matiq.com
133
132
  licenses:
134
133
  - MIT
135
134
  metadata:
@@ -149,7 +148,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
149
148
  - !ruby/object:Gem::Version
150
149
  version: '0'
151
150
  requirements: []
152
- rubygems_version: 3.2.6
151
+ rubygems_version: 3.4.10
153
152
  signing_key:
154
153
  specification_version: 4
155
154
  summary: RowsController DRYs your controllers.
@@ -1,21 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # Extensions
4
- class RowsExtController < RowsController
5
-
6
- def copy
7
- set_resource resource.dup
8
- resource.id = nil
9
- respond_to do |format|
10
- format.html { render action: :new }
11
- end
12
- end
13
-
14
- def multi_deletion
15
- items = params[:multi_tick] || []
16
- items -= ['']
17
- items.map { |id| model_class.find_by_id(id.to_i).destroy }
18
- redirect_to action: :index
19
- end
20
-
21
- end
@@ -1 +0,0 @@
1
- $('#row_<%= resource.id %>').fadeOut(500, function() { $(this).remove(); });