smart_buttons 1.0 → 1.0.2

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: 444a4eefa01c242b794d90c3a3b3e0a7d6f5be3891908eeced6b22025c813bce
4
- data.tar.gz: bf6e28906dc51b9fa7f656c54854ce8bf08b24b1d7ef50aa2ad501ec95cfa1bf
3
+ metadata.gz: e62296a190211402547b57b9a4fa36b7783cc9a8e4abe392c4d9e1463a64eb00
4
+ data.tar.gz: 7128312d8fbeccd08ef6d880f3c45b15a1f38ea5a683c640f30593b459570f7a
5
5
  SHA512:
6
- metadata.gz: f7b08104497bf07d7926b1cc1ec641ca70553950be5987a381c3edf8953cd8b1271fdc790e6010288de68a24ac1f4f8c08a876a7ac0d2e53cbef984c57e05a5a
7
- data.tar.gz: 9872d2361adc8c51832f40910b8e9f4d4033ee31a5153f61cf876375daf389407731d60f6f31026965b4c5a935e300d9988ddafdeeb37b165faad1bf5efd172f
6
+ metadata.gz: 8d4e4be7d732e17024cf242cfaa0d291c2851acf0782981c7b4bc453b9d435350b5f43e62cd17fb4cfd48dcf1e2b19d805fd543eb262a297b092ce110f8a93b4
7
+ data.tar.gz: 4d601ed618d33fdac8ddea1d8b9326f947a4f30c4084adb270cc217e048a1f58cabb52303b1abd4ef3bdf92fea521d17857b7a9b64613f2d2c599f615eca3463
@@ -0,0 +1,43 @@
1
+ name: Gem Push
2
+
3
+ on:
4
+ push:
5
+ branches: [ 'master' ]
6
+
7
+ jobs:
8
+ push:
9
+ name: Build + Publish
10
+ runs-on: ubuntu-latest
11
+ permissions:
12
+ contents: read
13
+ packages: write
14
+
15
+ steps:
16
+ - uses: actions/checkout@v3
17
+ - name: Set up Ruby 2.7.7
18
+ uses: ruby/setup-ruby@v1
19
+ with:
20
+ ruby-version: 2.7.7
21
+
22
+ - name: Publish to GPR
23
+ run: |
24
+ mkdir -p $HOME/.gem
25
+ touch $HOME/.gem/credentials
26
+ chmod 0600 $HOME/.gem/credentials
27
+ printf -- "---\n:github: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials
28
+ gem build *.gemspec
29
+ gem push --KEY github --host https://rubygems.pkg.github.com/${OWNER} *.gem
30
+ env:
31
+ GEM_HOST_API_KEY: "Bearer ${{secrets.GITHUB_TOKEN}}"
32
+ OWNER: ${{ github.repository_owner }}
33
+
34
+ - name: Publish to RubyGems
35
+ run: |
36
+ mkdir -p $HOME/.gem
37
+ touch $HOME/.gem/credentials
38
+ chmod 0600 $HOME/.gem/credentials
39
+ printf -- "---\n:rubygems_api_key: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials
40
+ gem build *.gemspec
41
+ gem push *.gem
42
+ env:
43
+ GEM_HOST_API_KEY: "${{secrets.RUBYGEMS_AUTH_TOKEN}}"
@@ -13,7 +13,7 @@ jobs:
13
13
  ruby-versions: 2.6.5, 2.7.0, 2.5.7, 2.4.9
14
14
  - name: Build and test with Rake
15
15
  run: |
16
- gem install bundler -v '1.17.2'
16
+ gem install bundler -v '2.1.2'
17
17
  bundle install --jobs 4 --retry 3
18
18
  bundle exec rspec
19
19
  rubocop
data/README.md CHANGED
@@ -33,12 +33,31 @@ end
33
33
 
34
34
  If you need button with HTTP/DELETE method, just use
35
35
 
36
- ```
36
+ ```ruby
37
37
  delete_button url, form_options: { class: :some_form_class }, button_options: { class: :some_button_class } do
38
38
  here_content_which_will_be_inside_of_button
39
39
  end
40
40
  ```
41
41
 
42
+ ### HTTP / PATCH
43
+
44
+ If you need to make changes with ActiveRecord model, just use
45
+
46
+ ```ruby
47
+ patch_button(
48
+ record: some_record_you_gonna_change,
49
+ controller: ControllerWhichWilChangeYourModel,
50
+ action: :action_in_this_controller,
51
+ parameters: { url: parameters },
52
+ attributes: { attribute1: value, attribute2: value },
53
+ model_name: record.model_name,
54
+ button_options: { class: :some_button_class },
55
+ form_options: { class: :some_form_class }
56
+ ) do
57
+ here_content_which_will_be_inside_of_button
58
+ end
59
+ ```
60
+
42
61
  ## Contributing
43
62
 
44
63
  Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/smart_buttons.
@@ -2,7 +2,7 @@
2
2
 
3
3
  module SmartButtons::PatchButton
4
4
  def patch_button(**options)
5
- simple_form_for options[:record], url: build_url(options), method: :patch, html: options[:form_options] do |f|
5
+ simple_form_for options[:record], url: options[:url], method: :patch, html: options[:form_options] do |f|
6
6
  options[:attributes].each do |attr|
7
7
  concat build_input attr, options, f
8
8
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module SmartButtons
4
- VERSION = '1.0'
4
+ VERSION = '1.0.2'
5
5
  end
@@ -19,7 +19,6 @@ Gem::Specification.new do |spec|
19
19
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
20
20
  spec.require_paths = ["lib"]
21
21
 
22
- spec.add_development_dependency 'bundler', '~> 1.17'
23
22
  spec.add_development_dependency 'rake', '~> 10.0'
24
23
  spec.add_development_dependency 'rspec', '~> 3.0'
25
24
  spec.add_development_dependency 'pry'
@@ -27,4 +26,5 @@ Gem::Specification.new do |spec|
27
26
  spec.add_development_dependency 'rubocop'
28
27
 
29
28
  spec.add_dependency 'simple_form'
29
+ spec.add_dependency 'nokogiri', '>= 1.10.8'
30
30
  end
metadata CHANGED
@@ -1,29 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: smart_buttons
3
3
  version: !ruby/object:Gem::Version
4
- version: '1.0'
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pavel Kalashnikov
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-01-25 00:00:00.000000000 Z
11
+ date: 2023-01-14 00:00:00.000000000 Z
12
12
  dependencies:
13
- - !ruby/object:Gem::Dependency
14
- name: bundler
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - "~>"
18
- - !ruby/object:Gem::Version
19
- version: '1.17'
20
- type: :development
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - "~>"
25
- - !ruby/object:Gem::Version
26
- version: '1.17'
27
13
  - !ruby/object:Gem::Dependency
28
14
  name: rake
29
15
  requirement: !ruby/object:Gem::Requirement
@@ -108,6 +94,20 @@ dependencies:
108
94
  - - ">="
109
95
  - !ruby/object:Gem::Version
110
96
  version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: nokogiri
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: 1.10.8
104
+ type: :runtime
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: 1.10.8
111
111
  description: Replacement of Rails `link_to` method with static HTML
112
112
  email:
113
113
  - kalashnikovisme@gmail.com
@@ -115,13 +115,13 @@ executables: []
115
115
  extensions: []
116
116
  extra_rdoc_files: []
117
117
  files:
118
+ - ".github/workflows/gem-push.yml"
118
119
  - ".github/workflows/ruby.yml"
119
120
  - ".gitignore"
120
121
  - ".rspec"
121
122
  - ".rubocop.yml"
122
123
  - ".travis.yml"
123
124
  - Gemfile
124
- - Gemfile.lock
125
125
  - LICENSE.txt
126
126
  - README.md
127
127
  - Rakefile
@@ -151,7 +151,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
151
151
  - !ruby/object:Gem::Version
152
152
  version: '0'
153
153
  requirements: []
154
- rubygems_version: 3.0.3
154
+ rubygems_version: 3.1.6
155
155
  signing_key:
156
156
  specification_version: 4
157
157
  summary: Replacement of Rails `link_to` method with static HTML
data/Gemfile.lock DELETED
@@ -1,108 +0,0 @@
1
- PATH
2
- remote: .
3
- specs:
4
- smart_buttons (1.0)
5
- simple_form
6
-
7
- GEM
8
- remote: https://rubygems.org/
9
- specs:
10
- actionpack (6.0.2.1)
11
- actionview (= 6.0.2.1)
12
- activesupport (= 6.0.2.1)
13
- rack (~> 2.0, >= 2.0.8)
14
- rack-test (>= 0.6.3)
15
- rails-dom-testing (~> 2.0)
16
- rails-html-sanitizer (~> 1.0, >= 1.2.0)
17
- actionview (6.0.2.1)
18
- activesupport (= 6.0.2.1)
19
- builder (~> 3.1)
20
- erubi (~> 1.4)
21
- rails-dom-testing (~> 2.0)
22
- rails-html-sanitizer (~> 1.1, >= 1.2.0)
23
- activemodel (6.0.2.1)
24
- activesupport (= 6.0.2.1)
25
- activesupport (6.0.2.1)
26
- concurrent-ruby (~> 1.0, >= 1.0.2)
27
- i18n (>= 0.7, < 2)
28
- minitest (~> 5.1)
29
- tzinfo (~> 1.1)
30
- zeitwerk (~> 2.2)
31
- ast (2.4.0)
32
- builder (3.2.4)
33
- coderay (1.1.2)
34
- concurrent-ruby (1.1.5)
35
- crass (1.0.6)
36
- diff-lcs (1.3)
37
- erubi (1.9.0)
38
- i18n (1.8.2)
39
- concurrent-ruby (~> 1.0)
40
- jaro_winkler (1.5.4)
41
- loofah (2.4.0)
42
- crass (~> 1.0.2)
43
- nokogiri (>= 1.5.9)
44
- method_source (0.9.2)
45
- mini_portile2 (2.4.0)
46
- minitest (5.14.0)
47
- nokogiri (1.10.7)
48
- mini_portile2 (~> 2.4.0)
49
- parallel (1.19.1)
50
- parser (2.7.0.2)
51
- ast (~> 2.4.0)
52
- pry (0.12.2)
53
- coderay (~> 1.1.0)
54
- method_source (~> 0.9.0)
55
- rack (2.1.1)
56
- rack-test (1.1.0)
57
- rack (>= 1.0, < 3)
58
- rails-dom-testing (2.0.3)
59
- activesupport (>= 4.2.0)
60
- nokogiri (>= 1.6)
61
- rails-html-sanitizer (1.3.0)
62
- loofah (~> 2.3)
63
- rainbow (3.0.0)
64
- rake (10.5.0)
65
- rspec (3.9.0)
66
- rspec-core (~> 3.9.0)
67
- rspec-expectations (~> 3.9.0)
68
- rspec-mocks (~> 3.9.0)
69
- rspec-core (3.9.1)
70
- rspec-support (~> 3.9.1)
71
- rspec-expectations (3.9.0)
72
- diff-lcs (>= 1.2.0, < 2.0)
73
- rspec-support (~> 3.9.0)
74
- rspec-mocks (3.9.1)
75
- diff-lcs (>= 1.2.0, < 2.0)
76
- rspec-support (~> 3.9.0)
77
- rspec-support (3.9.2)
78
- rubocop (0.79.0)
79
- jaro_winkler (~> 1.5.1)
80
- parallel (~> 1.10)
81
- parser (>= 2.7.0.1)
82
- rainbow (>= 2.2.2, < 4.0)
83
- ruby-progressbar (~> 1.7)
84
- unicode-display_width (>= 1.4.0, < 1.7)
85
- ruby-progressbar (1.10.1)
86
- simple_form (5.0.1)
87
- actionpack (>= 5.0)
88
- activemodel (>= 5.0)
89
- thread_safe (0.3.6)
90
- tzinfo (1.2.6)
91
- thread_safe (~> 0.1)
92
- unicode-display_width (1.6.1)
93
- zeitwerk (2.2.2)
94
-
95
- PLATFORMS
96
- ruby
97
-
98
- DEPENDENCIES
99
- actionview
100
- bundler (~> 1.17)
101
- pry
102
- rake (~> 10.0)
103
- rspec (~> 3.0)
104
- rubocop
105
- smart_buttons!
106
-
107
- BUNDLED WITH
108
- 1.17.2