ndr_ui 3.3.2 → 4.0.0
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 +4 -4
- data/app/assets/javascripts/ndr_ui/index.js +1 -1
- data/app/builders/ndr_ui/bootstrap/readonly.rb +44 -14
- data/app/helpers/ndr_ui/bootstrap_helper.rb +2 -7
- data/lib/ndr_ui/version.rb +1 -1
- metadata +13 -13
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1a10cafddb6e52461d4995ea48f7dd8cfe418f3c3fc1760b1e18d7df49d76fdf
|
4
|
+
data.tar.gz: c869d40114073f56436dcccc96bed5e59e6cfed746ba08e5bd4d04e5b4b3e45a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6fd96447a43927500444f8edaa6377a00908773691b450664298e702ad719029c34e1d882946cc3e20651af65361269f9d5352c3face479adefa3d707e2b23c5
|
7
|
+
data.tar.gz: bbb2b267b1b333c8595338eb79776867befac1bac11c7a566a0d67867227cfd27eb8a66cbc75ac66f6f2fd160e42092b92b429bfac140f5da1699153ddad73c7
|
@@ -9,41 +9,71 @@ module NdrUi
|
|
9
9
|
module Readonly
|
10
10
|
def self.included(base)
|
11
11
|
# These have different signatures, or aren't affected by `readonly`:
|
12
|
-
not_affected = [
|
13
|
-
needs_custom = [
|
12
|
+
not_affected = %i[label fields_for]
|
13
|
+
needs_custom = %i[radio_button file_field hidden_field textarea] +
|
14
14
|
base.field_helpers_from_form_options_helper
|
15
15
|
|
16
16
|
(base.field_helpers - needs_custom - not_affected).each do |selector|
|
17
|
-
class_eval <<-
|
17
|
+
class_eval <<-ENDEVAL, __FILE__, __LINE__ + 1
|
18
|
+
# def text_field(method, options = {}, *rest)
|
19
|
+
# return super unless readonly?
|
20
|
+
# readonly_value = options.symbolize_keys.fetch(:readonly_value, object.send(method))
|
21
|
+
# @template.content_tag(:p, readonly_value, class: 'form-control-static')
|
22
|
+
# end
|
18
23
|
def #{selector}(method, options = {}, *rest)
|
19
24
|
return super unless readonly?
|
20
25
|
readonly_value = options.symbolize_keys.fetch(:readonly_value, object.send(method))
|
21
26
|
@template.content_tag(:p, readonly_value, class: 'form-control-static')
|
22
27
|
end
|
23
|
-
|
28
|
+
ENDEVAL
|
24
29
|
end
|
25
30
|
|
26
|
-
[
|
27
|
-
class_eval <<-
|
31
|
+
%i[text_area].each do |selector|
|
32
|
+
class_eval <<-ENDEVAL, __FILE__, __LINE__ + 1
|
33
|
+
# def text_area(method, options = {}, *rest)
|
34
|
+
# return super unless readonly?
|
35
|
+
# readonly_value = options.symbolize_keys.fetch(:readonly_value, object.send(method))
|
36
|
+
# @template.simple_format(readonly_value, class: 'form-control-static')
|
37
|
+
# end
|
38
|
+
def #{selector}(method, options = {}, *rest)
|
39
|
+
return super unless readonly?
|
40
|
+
readonly_value = options.symbolize_keys.fetch(:readonly_value, object.send(method))
|
41
|
+
@template.simple_format(readonly_value, class: 'form-control-static')
|
42
|
+
end
|
43
|
+
ENDEVAL
|
44
|
+
end
|
45
|
+
|
46
|
+
%i[select time_zone_select].each do |selector|
|
47
|
+
class_eval <<-ENDEVAL, __FILE__, __LINE__ + 1
|
48
|
+
# def select(method, _something, options = {}, *rest)
|
49
|
+
# return super unless readonly?
|
50
|
+
# readonly_value = options.symbolize_keys.fetch(:readonly_value, object.send(method))
|
51
|
+
# @template.content_tag(:p, readonly_value, class: 'form-control-static')
|
52
|
+
# end
|
28
53
|
def #{selector}(method, _something, options = {}, *rest)
|
29
54
|
return super unless readonly?
|
30
55
|
readonly_value = options.symbolize_keys.fetch(:readonly_value, object.send(method))
|
31
56
|
@template.content_tag(:p, readonly_value, class: 'form-control-static')
|
32
57
|
end
|
33
|
-
|
58
|
+
ENDEVAL
|
34
59
|
end
|
35
60
|
|
36
|
-
[
|
37
|
-
class_eval <<-
|
61
|
+
%i[collection_select collection_check_boxes collection_radio_buttons].each do |selector|
|
62
|
+
class_eval <<-ENDEVAL, __FILE__, __LINE__ + 1
|
63
|
+
# def collection_select(method, collection, value_method, text_method, options = {}, *rest)
|
64
|
+
# return super unless readonly?
|
65
|
+
# readonly_value = options.symbolize_keys.fetch(:readonly_value, object.send(method))
|
66
|
+
# @template.content_tag(:p, readonly_value, class: 'form-control-static')
|
67
|
+
# end
|
38
68
|
def #{selector}(method, collection, value_method, text_method, options = {}, *rest)
|
39
69
|
return super unless readonly?
|
40
70
|
readonly_value = options.symbolize_keys.fetch(:readonly_value, object.send(method))
|
41
71
|
@template.content_tag(:p, readonly_value, class: 'form-control-static')
|
42
72
|
end
|
43
|
-
|
73
|
+
ENDEVAL
|
44
74
|
end
|
45
75
|
|
46
|
-
class_eval <<-
|
76
|
+
class_eval <<-ENDEVAL, __FILE__, __LINE__ + 1
|
47
77
|
# grouped_collection_select takes many other arguments
|
48
78
|
def grouped_collection_select(method, collection, group_method, group_label_method, option_key_method, option_value_method, options = {}, html_options = {})
|
49
79
|
return super unless readonly?
|
@@ -69,15 +99,15 @@ module NdrUi
|
|
69
99
|
def hidden_field(*)
|
70
100
|
super unless readonly?
|
71
101
|
end
|
72
|
-
|
102
|
+
ENDEVAL
|
73
103
|
|
74
|
-
class_eval <<-
|
104
|
+
class_eval <<-ENDEVAL, __FILE__, __LINE__ + 1
|
75
105
|
# Allow fields_for to inherit `readonly`:
|
76
106
|
def fields_for(record_name, record_object = nil, fields_options = {}, &block)
|
77
107
|
fields_options[:readonly] ||= readonly
|
78
108
|
super
|
79
109
|
end
|
80
|
-
|
110
|
+
ENDEVAL
|
81
111
|
end
|
82
112
|
|
83
113
|
attr_accessor :readonly
|
@@ -1,6 +1,6 @@
|
|
1
1
|
module NdrUi
|
2
2
|
# Provides helper methods for the Twitter Bootstrap framework
|
3
|
-
module BootstrapHelper
|
3
|
+
module BootstrapHelper
|
4
4
|
include ::NdrUi::Bootstrap::BreadcrumbsHelper
|
5
5
|
include ::NdrUi::Bootstrap::DropdownHelper
|
6
6
|
include ::NdrUi::Bootstrap::ModalHelper
|
@@ -594,12 +594,7 @@ module NdrUi
|
|
594
594
|
return true unless respond_to?(:can?)
|
595
595
|
|
596
596
|
unless subject.is_a?(ActiveRecord::Base)
|
597
|
-
|
598
|
-
Rails.application.deprecators[:active_support]
|
599
|
-
else
|
600
|
-
ActiveSupport::Deprecation # Rails <= 7.0
|
601
|
-
end
|
602
|
-
deprecator.warn(<<~MSG)
|
597
|
+
ActiveSupport::Deprecation.warn(<<~MSG)
|
603
598
|
Attempting to authorise a non-resource object causes authorisation to be skipped.
|
604
599
|
In future, this behaviour may change; please use a resource where possible.
|
605
600
|
MSG
|
data/lib/ndr_ui/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ndr_ui
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 4.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- NDR Development Team
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-05-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -19,7 +19,7 @@ dependencies:
|
|
19
19
|
version: '6.1'
|
20
20
|
- - "<"
|
21
21
|
- !ruby/object:Gem::Version
|
22
|
-
version: '7.
|
22
|
+
version: '7.1'
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -29,7 +29,7 @@ dependencies:
|
|
29
29
|
version: '6.1'
|
30
30
|
- - "<"
|
31
31
|
- !ruby/object:Gem::Version
|
32
|
-
version: '7.
|
32
|
+
version: '7.1'
|
33
33
|
- !ruby/object:Gem::Dependency
|
34
34
|
name: bootstrap-sass
|
35
35
|
requirement: !ruby/object:Gem::Requirement
|
@@ -48,16 +48,16 @@ dependencies:
|
|
48
48
|
name: jquery-rails
|
49
49
|
requirement: !ruby/object:Gem::Requirement
|
50
50
|
requirements:
|
51
|
-
- -
|
51
|
+
- - '='
|
52
52
|
- !ruby/object:Gem::Version
|
53
|
-
version: 4.
|
53
|
+
version: 4.2.0
|
54
54
|
type: :runtime
|
55
55
|
prerelease: false
|
56
56
|
version_requirements: !ruby/object:Gem::Requirement
|
57
57
|
requirements:
|
58
|
-
- -
|
58
|
+
- - '='
|
59
59
|
- !ruby/object:Gem::Version
|
60
|
-
version: 4.
|
60
|
+
version: 4.2.0
|
61
61
|
- !ruby/object:Gem::Dependency
|
62
62
|
name: sprockets
|
63
63
|
requirement: !ruby/object:Gem::Requirement
|
@@ -90,16 +90,16 @@ dependencies:
|
|
90
90
|
name: sqlite3
|
91
91
|
requirement: !ruby/object:Gem::Requirement
|
92
92
|
requirements:
|
93
|
-
- - "
|
93
|
+
- - "~>"
|
94
94
|
- !ruby/object:Gem::Version
|
95
|
-
version: '
|
95
|
+
version: '1.7'
|
96
96
|
type: :development
|
97
97
|
prerelease: false
|
98
98
|
version_requirements: !ruby/object:Gem::Requirement
|
99
99
|
requirements:
|
100
|
-
- - "
|
100
|
+
- - "~>"
|
101
101
|
- !ruby/object:Gem::Version
|
102
|
-
version: '
|
102
|
+
version: '1.7'
|
103
103
|
- !ruby/object:Gem::Dependency
|
104
104
|
name: mocha
|
105
105
|
requirement: !ruby/object:Gem::Requirement
|
@@ -414,7 +414,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
414
414
|
- !ruby/object:Gem::Version
|
415
415
|
version: '0'
|
416
416
|
requirements: []
|
417
|
-
rubygems_version: 3.
|
417
|
+
rubygems_version: 3.2.33
|
418
418
|
signing_key:
|
419
419
|
specification_version: 4
|
420
420
|
summary: NDR UI Rails Engine
|