redmineflux_icon_compat 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 272232d401404eec7346af84c3fe7352c41f904b4292967462fab4f29daf7a89
4
- data.tar.gz: b0775447faafc0ad28d5365a4190355fb79956e7c82bec3a114a4c04c2f4f718
3
+ metadata.gz: e13f0604cfb7cd9b8a19058158bd81fb61bba6ca32fc84e0044b9481dae0faaf
4
+ data.tar.gz: 61704c9b1b47ea9030ed3752638b2de9f7e16dc219d962c5d1849971108dedfe
5
5
  SHA512:
6
- metadata.gz: d4e9e4a3dfde1fa90da197690a5456b52f4ae8ad17fa2e0cfb5cd9fe25b96fe0773ff7c47a6912f1b0e042beab14c9a990f3718046deabcfbc88726f0c9ab55c
7
- data.tar.gz: e50cf452bdc430577ddc4b7bdc579439912dcbfd214dfdbace58d68fceea42e8883d38bd92fd5970e4d79e9b600dabbb301742a87bd51c3ddf1ec932cb6d4893
6
+ metadata.gz: dc75480b32b6ff1a82a2f0a128ac23f6277b43f875e99aca71fe36c0c254c83db4eb422ab74755c1b45a98ba197f9fde9f933506126688f0224ec2d5d22fdc05
7
+ data.tar.gz: d542b29d7b96acbb9b80c7df35e70aaa3b1b1571724d5bf88f16c931ece299047bf7984427e6fdad76abe173011c3a29fd0fd6ef19a9c756edc62fdfb54e2671
data/CHANGELOG.md ADDED
@@ -0,0 +1,26 @@
1
+ # Changelog
2
+
3
+ All notable changes to `redmineflux_icon_compat` will be documented in this file.
4
+
5
+ ## [0.1.1] - 2026-04-16
6
+
7
+ ### Added
8
+ - Added comprehensive README usage guide for plugin integration.
9
+ - Added gem publishing documentation for RubyGems.
10
+ - Added test suite for icon helper behavior across fallback modes.
11
+ - Added YARD-style API comments for key helper methods.
12
+ - Added `CHANGELOG.md` to packaged gem files.
13
+
14
+ ### Changed
15
+ - Improved icon rendering detection to rely on helper availability, not Redmine major version constants.
16
+ - Added fallback rendering path through `ApplicationController.helpers.sprite_icon` when local helper context does not expose `sprite_icon`.
17
+
18
+ ### Fixed
19
+ - Prevented incorrect fallback to legacy icon classes in Redmine 6 hook/view contexts.
20
+
21
+ ## [0.1.0] - 2026-04-16
22
+
23
+ ### Added
24
+ - Initial release.
25
+ - Introduced `rf_icon_link` helper for Redmine 5/6 icon compatibility.
26
+ - Added Railtie-based automatic helper inclusion for views/controllers.
data/README.md CHANGED
@@ -6,26 +6,76 @@ This gem gives one helper API (`rf_icon_link`) that works in both:
6
6
  - Redmine 5 style icons (`icon icon-*` classes)
7
7
  - Redmine 6 SVG sprite icons (`sprite_icon`)
8
8
 
9
- ## Usage in a Redmine plugin
9
+ ## Use This Gem In A Redmine Plugin
10
10
 
11
- 1. Add to plugin Gemfile:
11
+ ### 1) Add gem declaration in your plugin Gemfile
12
+
13
+ Create or update `plugins/<your_plugin>/Gemfile`.
14
+
15
+ For local development:
12
16
 
13
17
  ```ruby
14
18
  gem 'redmineflux_icon_compat', path: '../redmineflux_icon_compat'
15
19
  ```
16
20
 
17
- 2. Include helper where needed:
21
+ For published usage from RubyGems:
22
+
23
+ ```ruby
24
+ gem 'redmineflux_icon_compat', '~> 0.1.0'
25
+ ```
26
+
27
+ ### 2) Install dependencies
28
+
29
+ From Redmine root:
30
+
31
+ ```bash
32
+ bundle install
33
+ ```
34
+
35
+ ### 3) Load gem in plugin init file
36
+
37
+ In `plugins/<your_plugin>/init.rb`:
18
38
 
19
39
  ```ruby
20
- include RedminefluxIconCompat::Helper
40
+ require 'redmineflux_icon_compat'
21
41
  ```
22
42
 
23
- 3. Use in views/helpers:
43
+ ### 4) Include helper in plugin helpers (optional but recommended)
44
+
45
+ Example:
24
46
 
25
47
  ```ruby
26
- rf_icon_link(:add, 'Add', '#')
48
+ module MyPluginHelper
49
+ include RedminefluxIconCompat::Helper
50
+ end
51
+ ```
52
+
53
+ ### 5) Use `rf_icon_link` in views or helpers
54
+
55
+ Example in ERB:
56
+
57
+ ```erb
58
+ <%= rf_icon_link(:add, 'Add Checklist', '#', class: 'add-checklist-btn') %>
27
59
  ```
28
60
 
61
+ Example in helper:
62
+
63
+ ```ruby
64
+ rf_icon_link(:edit, l(:button_edit), edit_path(record))
65
+ ```
66
+
67
+ ### 6) Restart Redmine server
68
+
69
+ After gem or helper changes, restart app server so Rails reloads plugin code.
70
+
71
+ ## Troubleshooting
72
+
73
+ If you still see old icons:
74
+ - run `rm -rf tmp/cache/*`
75
+ - run `bundle install` again
76
+ - restart Redmine
77
+ - hard refresh browser (`Ctrl+Shift+R`)
78
+
29
79
  ## Run Tests
30
80
 
31
81
  From Redmine root:
@@ -41,7 +91,7 @@ cd plugins/redmineflux_icon_compat
41
91
  ruby test/helper_test.rb
42
92
  ```
43
93
 
44
- ## Release Workflow (RubyGems)
94
+ ## Publish To RubyGems
45
95
 
46
96
  1. Create RubyGems account: https://rubygems.org/sign_up
47
97
  2. Login from terminal:
@@ -72,9 +122,10 @@ gem build redmineflux_icon_compat.gemspec
72
122
  gem push redmineflux_icon_compat-<VERSION>.gem
73
123
  ```
74
124
 
75
- 7. Verify:
125
+ 7. Verify publication:
76
126
  - Open `https://rubygems.org/gems/redmineflux_icon_compat`
77
- - Install test:
127
+ - Check docs page after indexing: `https://www.rubydoc.info/gems/redmineflux_icon_compat`
128
+ - Install smoke test:
78
129
 
79
130
  ```bash
80
131
  gem install redmineflux_icon_compat
@@ -89,17 +140,3 @@ gem owner redmineflux_icon_compat --add teammate@example.com
89
140
  ```
90
141
 
91
142
  Require MFA on RubyGems account for push/yank.
92
-
93
- ## Consume Published Gem
94
-
95
- In plugin `Gemfile`:
96
-
97
- ```ruby
98
- gem 'redmineflux_icon_compat', '~> 0.1.0'
99
- ```
100
-
101
- Then:
102
-
103
- ```bash
104
- bundle install
105
- ```
@@ -1,6 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RedminefluxIconCompat
4
+ # View helper methods for rendering icon links that work on both
5
+ # Redmine 5 (legacy CSS icons) and Redmine 6 (SVG sprite icons).
4
6
  module Helper
5
7
  RF_ICON_MAP = {
6
8
  delete: { legacy: 'del', sprite: 'del' },
@@ -10,7 +12,13 @@ module RedminefluxIconCompat
10
12
  save: { legacy: 'save', sprite: 'save' }
11
13
  }.freeze
12
14
 
13
- # Centralized icon-link renderer for Redmine 5/6 compatibility.
15
+ # Builds a link with icon markup compatible with Redmine 5/6.
16
+ #
17
+ # @param icon [Symbol, String] icon key (for example: :add, :edit, :delete)
18
+ # @param label [String] human readable label text
19
+ # @param href [String] target URL
20
+ # @param html_options [Hash] HTML options passed to +link_to+
21
+ # @return [String] HTML link markup
14
22
  def rf_icon_link(icon, label, href = '#', html_options = {})
15
23
  icon_names = rf_icon_names(icon)
16
24
  options = (html_options || {}).dup
@@ -26,7 +34,9 @@ module RedminefluxIconCompat
26
34
  link_to(content, href, options)
27
35
  end
28
36
 
29
- # Redmine 6+ provides sprite icons through IconsHelper#sprite_icon.
37
+ # Detects whether SVG sprite rendering is currently available.
38
+ #
39
+ # @return [Boolean]
30
40
  def rf_sprite_icons_available?
31
41
  respond_to?(:sprite_icon, true) || rf_global_sprite_helper_available?
32
42
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RedminefluxIconCompat
4
- VERSION = '0.1.0'
4
+ VERSION = '0.1.1'
5
5
  end
@@ -1,5 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ # Entry point for the redmineflux_icon_compat gem.
3
4
  require_relative 'redmineflux_icon_compat/version'
4
5
  require_relative 'redmineflux_icon_compat/helper'
5
6
  require_relative 'redmineflux_icon_compat/railtie' if defined?(Rails::Railtie)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: redmineflux_icon_compat
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Redmineflux
@@ -46,6 +46,7 @@ executables: []
46
46
  extensions: []
47
47
  extra_rdoc_files: []
48
48
  files:
49
+ - CHANGELOG.md
49
50
  - LICENSE.txt
50
51
  - README.md
51
52
  - lib/redmineflux_icon_compat.rb