rails-clipboard-helper 0.1.0 → 0.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 +4 -4
- data/CHANGELOG.md +12 -0
- data/README.md +60 -0
- data/lib/rails/clipboard/helper/version.rb +1 -1
- data/lib/rails/clipboard/helper.rb +6 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: d3cfba771d95ea5e83392dff778fb6dad90908bcc3fc6521d0c0bc85be57ed50
|
|
4
|
+
data.tar.gz: a78992a6f8bce03a3484f6768ff22ab9d610f3945fee0cfcbb21c20f573684e5
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 7b82e790f6209b28805d57fc3ba5af3cc9605b9e55677b4805e17e252a02470c305d97f4fda659d7ebd3de80bf78fc1521d858862bad3d82f0775e8658aa51bc
|
|
7
|
+
data.tar.gz: d7e4577ecfcd9b1aa502244552ed8f3f9669010e5e0bf6486616f5bfcd318f2f5a61caac2f040f1179032560eb5bd73c1b2a78bd3eaf8628aa4d047d3724e7e7
|
data/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,17 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [0.1.1] - 2025-11-09
|
|
9
|
+
|
|
10
|
+
### Fixed
|
|
11
|
+
- Fixed Railtie loading issue that prevented helper methods from being available in views
|
|
12
|
+
- Added proper conditional loading for both Engine and Railtie
|
|
13
|
+
- Improved helper method initialization in Rails applications
|
|
14
|
+
|
|
15
|
+
### Added
|
|
16
|
+
- Added troubleshooting section to README
|
|
17
|
+
- Documented helper method not found error resolution
|
|
18
|
+
|
|
8
19
|
## [0.1.0] - 2025-11-09
|
|
9
20
|
|
|
10
21
|
### Added
|
|
@@ -26,5 +37,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
26
37
|
- Comprehensive RSpec tests
|
|
27
38
|
- Documentation
|
|
28
39
|
|
|
40
|
+
[0.1.1]: https://github.com/dhq_boiler/rails-clipboard-helper/releases/tag/v0.1.1
|
|
29
41
|
[0.1.0]: https://github.com/dhq_boiler/rails-clipboard-helper/releases/tag/v0.1.0
|
|
30
42
|
|
data/README.md
CHANGED
|
@@ -213,6 +213,66 @@ This gem uses the modern Clipboard API, which is supported by:
|
|
|
213
213
|
|
|
214
214
|
Requires HTTPS or localhost for operation.
|
|
215
215
|
|
|
216
|
+
## Troubleshooting
|
|
217
|
+
|
|
218
|
+
### Helper method `clipboard_copy` is not found
|
|
219
|
+
|
|
220
|
+
If you get an error like `undefined method 'clipboard_copy'`, try the following:
|
|
221
|
+
|
|
222
|
+
1. **Restart your Rails server** after installing the gem:
|
|
223
|
+
```bash
|
|
224
|
+
bundle install
|
|
225
|
+
rails restart # or ctrl+c and restart your server
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
2. **Verify the gem is installed:**
|
|
229
|
+
```bash
|
|
230
|
+
bundle list | grep rails-clipboard-helper
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
3. **Check if the gem is required:**
|
|
234
|
+
The helper should be automatically included in your views via Rails Engine/Railtie.
|
|
235
|
+
If not, you can manually include it in `app/controllers/application_controller.rb`:
|
|
236
|
+
```ruby
|
|
237
|
+
class ApplicationController < ActionController::Base
|
|
238
|
+
helper Rails::Clipboard::Helper::ViewHelpers
|
|
239
|
+
end
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
4. **Check your Rails version:**
|
|
243
|
+
This gem requires Rails 6.0 or higher.
|
|
244
|
+
|
|
245
|
+
### JavaScript not working / Copy button doesn't respond
|
|
246
|
+
|
|
247
|
+
1. **Check if JavaScript is loaded:**
|
|
248
|
+
Open browser developer console and look for any JavaScript errors.
|
|
249
|
+
|
|
250
|
+
2. **For Importmap (Rails 7+):**
|
|
251
|
+
Make sure `config/importmap.rb` includes:
|
|
252
|
+
```ruby
|
|
253
|
+
pin "rails_clipboard_helper"
|
|
254
|
+
```
|
|
255
|
+
|
|
256
|
+
And run:
|
|
257
|
+
```bash
|
|
258
|
+
bin/importmap pin rails_clipboard_helper
|
|
259
|
+
```
|
|
260
|
+
|
|
261
|
+
3. **For Sprockets:**
|
|
262
|
+
Make sure `app/assets/javascripts/application.js` includes:
|
|
263
|
+
```javascript
|
|
264
|
+
//= require rails_clipboard_helper
|
|
265
|
+
```
|
|
266
|
+
|
|
267
|
+
4. **Manual JavaScript inclusion:**
|
|
268
|
+
If asset pipeline is not working, add this to your layout:
|
|
269
|
+
```erb
|
|
270
|
+
<%= clipboard_javascript_tag %>
|
|
271
|
+
```
|
|
272
|
+
|
|
273
|
+
5. **HTTPS requirement:**
|
|
274
|
+
The Clipboard API requires HTTPS (or localhost for development).
|
|
275
|
+
|
|
216
276
|
## Development
|
|
217
277
|
|
|
218
278
|
After checking out the repo:
|
|
@@ -2,7 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
require_relative "helper/version"
|
|
4
4
|
require_relative "helper/view_helpers"
|
|
5
|
-
|
|
5
|
+
|
|
6
|
+
if defined?(Rails::Engine)
|
|
7
|
+
require_relative "helper/engine"
|
|
8
|
+
elsif defined?(Rails::Railtie)
|
|
9
|
+
require_relative "helper/railtie"
|
|
10
|
+
end
|
|
6
11
|
|
|
7
12
|
module Rails
|
|
8
13
|
module Clipboard
|