action_link 1.0.0 → 1.0.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: 90a160a0379ad2b4ff0a3813e886c89e89ca482c4ef94b3299d115c16e343e8b
4
- data.tar.gz: 10e782ef155643a9740d39c4c946afc28df9dc34fc80b1cd1319e7be6205ec60
3
+ metadata.gz: 80820750651f4ec759b40bafb3e029029676672d2e72f83b69eba9bd2f05a95b
4
+ data.tar.gz: e3daa24250f63d7a9e5c41c2c4609007d63b3501e1e48c156eee0590efc2253b
5
5
  SHA512:
6
- metadata.gz: 23ff1d124a0aa98854c1a86a09e030ac942999318febb6e006ac307d73aabb05c7cd3008fb162f45e145c82211cd60a5149240de912b3643315a46d0eff3cbb1
7
- data.tar.gz: 9b76d7416233de84b45201b9e151961d46a666dab70cd1661540a04d50c1b1808221c37a0a826ff915c1a8ce798ecdfda5c7aed71cc83aa4799488c6d3a34c4e
6
+ metadata.gz: a639c34fb4df4af7c79fe5478f9212fcd39dfd61363e1476f7fc411a370199e529c2b85549f0092803a369fbf00e6bd7f634fafcabb64f7827b14576950b4c5e
7
+ data.tar.gz: d637d15c764b1cfc0c82ae5f27b83846cc82ac7f2627dc96662eaad0a805641e0e1fb6fd725f37e0bfcf446c95cb7e5fc4b49538af2ba37ace681d8febbf3ccf
data/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [1.0.1] - 2026-01-27
4
+
5
+ - Fix <a title> for non-breaking spaces
6
+
7
+ ## [1.0.0] - 2025-05-11
8
+
9
+ - Add more link types
10
+
3
11
  ## [0.1.0] - 2023-08-24
4
12
 
5
13
  - Initial release
@@ -2,3 +2,7 @@
2
2
  @use "./style"
3
3
  @use "./fonts"
4
4
  @use "./acticons"
5
+
6
+ // Let's add some sane default that is not blue.
7
+ .c-action-link
8
+ color: black
@@ -0,0 +1 @@
1
+ .o-acticon{font-family:"acticons";speak:none;font-style:normal;font-weight:normal;font-variant:normal;text-transform:none;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}/*# sourceMappingURL=acticons.css.map */
@@ -0,0 +1 @@
1
+ {"version":3,"sourceRoot":"","sources":["file:///Users/orange/Code/2-Areas/action_link/action_link/app/assets/stylesheets/action_link/acticons.sass"],"names":[],"mappings":"AAAA,WACE,uBACA,WACA,kBACA,mBACA,oBACA,oBACA,mCACA","file":"acticons.css","sourcesContent":[".o-acticon\n font-family: 'acticons'\n speak: none\n font-style: normal\n font-weight: normal\n font-variant: normal\n text-transform: none\n -webkit-font-smoothing: antialiased\n -moz-osx-font-smoothing: grayscale\n"]}
@@ -0,0 +1 @@
1
+ @font-face{font-family:"acticons";font-weight:normal;font-style:normal;src:url("/action_link/acticons.woff") format("woff")}/*# sourceMappingURL=fonts.css.map */
@@ -0,0 +1 @@
1
+ {"version":3,"sourceRoot":"","sources":["file:///Users/orange/Code/2-Areas/action_link/action_link/app/assets/stylesheets/action_link/fonts.sass"],"names":[],"mappings":"AAAA,WACE,uBACA,mBACA,kBACA","file":"fonts.css","sourcesContent":["@font-face\n font-family: 'acticons'\n font-weight: normal\n font-style: normal\n src: url('/action_link/acticons.woff') format('woff')\n"]}
@@ -2,4 +2,4 @@
2
2
  font-family: 'acticons'
3
3
  font-weight: normal
4
4
  font-style: normal
5
- src: url('action_link/acticons.woff') format('woff')
5
+ src: url('/action_link/acticons.woff') format('woff')
@@ -0,0 +1 @@
1
+ .o-acticon--info-circle:before{content:""}.o-acticon--questionmark:before{content:"❓"}.o-acticon--arrow-down-circle:before{content:""}.o-acticon--pencil-circle:before{content:""}.o-acticon--check-circle:before{content:""}.o-acticon--chevron-circle-right:before{content:""}.o-acticon--plus-circle:before{content:""}.o-acticon--times-circle:before{content:""}/*# sourceMappingURL=style.css.map */
@@ -0,0 +1 @@
1
+ {"version":3,"sourceRoot":"","sources":["file:///Users/orange/Code/2-Areas/action_link/action_link/app/assets/stylesheets/action_link/style.scss","file:///Users/orange/Code/2-Areas/action_link/action_link/app/assets/stylesheets/action_link/variables.scss"],"names":[],"mappings":"CAKE,+BACE,QCJU,IDQZ,gCACE,QCRW,IDYb,qCACE,QCZgB,IDgBlB,iCACE,QChBY,IDoBd,gCACE,QCpBW,IDwBb,wCACE,QCxBmB,ID4BrB,+BACE,QC5BU,IDgCZ,gCACE,QChCW","file":"style.css","sourcesContent":["// This file is autogenerated by `rake acticons:update`\n\n@use \"variables\";\n\n.o-acticon--info-circle {\n &:before {\n content: variables.$info-circle;\n }\n}\n.o-acticon--questionmark {\n &:before {\n content: variables.$questionmark;\n }\n}\n.o-acticon--arrow-down-circle {\n &:before {\n content: variables.$arrow-down-circle;\n }\n}\n.o-acticon--pencil-circle {\n &:before {\n content: variables.$pencil-circle;\n }\n}\n.o-acticon--check-circle {\n &:before {\n content: variables.$check-circle;\n }\n}\n.o-acticon--chevron-circle-right {\n &:before {\n content: variables.$chevron-circle-right;\n }\n}\n.o-acticon--plus-circle {\n &:before {\n content: variables.$plus-circle;\n }\n}\n.o-acticon--times-circle {\n &:before {\n content: variables.$times-circle;\n }\n}\n","// This file is autogenerated by `rake acticons:update`\n\n$info-circle: \"\\e907\";\n$questionmark: \"\\2753\";\n$arrow-down-circle: \"\\e9af\";\n$pencil-circle: \"\\e9ae\";\n$check-circle: \"\\e93b\";\n$chevron-circle-right: \"\\e928\";\n$plus-circle: \"\\e919\";\n$times-circle: \"\\e91a\";\n"]}
@@ -0,0 +1 @@
1
+ /*# sourceMappingURL=variables.css.map */
@@ -0,0 +1 @@
1
+ {"version":3,"sourceRoot":"","sources":[],"names":[],"mappings":"","file":"variables.css","sourcesContent":[]}
@@ -53,7 +53,7 @@ module ActionLink
53
53
  # May be accessed and/or overriden in subclasses
54
54
 
55
55
  def i18n_title_key
56
- "action_link_component.titles.#{_action}"
56
+ "action_link.titles.#{_action}"
57
57
  end
58
58
 
59
59
  def http_method; end
@@ -70,7 +70,11 @@ module ActionLink
70
70
  # Options for `link_to`
71
71
 
72
72
  def _title
73
- t(i18n_title_key, subject: strip_tags(_title_subject_name))
73
+ return if manual_title == false
74
+
75
+ # Sometimes the <a title> attribute has non-breaking spaces in it ` `.
76
+ # ActionLink must not replace that with `&bnsp;` (though other HTML needs to be stripped).
77
+ t(i18n_title_key, subject: strip_tags(_title_subject_name.gsub(' ', ' ')))
74
78
  end
75
79
 
76
80
  def _data
@@ -97,6 +101,8 @@ module ActionLink
97
101
 
98
102
  # Converts a class like `::ActionLink::New` to the symbol `:new`.
99
103
  def _action
104
+ return action if is_a?(::ActionLink::Custom)
105
+
100
106
  @_action ||= self.class.name[12..].underscore.to_sym
101
107
  end
102
108
 
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ActionLink
4
+ # An action link that indicates showing an existing record.
5
+ class Custom < Base
6
+ option :action
7
+
8
+ erb_template <<~ERB.gsub("\n", '')
9
+ <% if permission? %>
10
+ <%= link_to(url, **options) do %>
11
+ <%= content %>
12
+ <% icon_tag :icon %>
13
+ <% end %>
14
+ <% else %>
15
+ <%= content %>
16
+ <% end %>
17
+ ERB
18
+ end
19
+ end
@@ -22,7 +22,7 @@ module ActionLink
22
22
  option :associative, default: -> { false }
23
23
 
24
24
  def i18n_title_key
25
- return 'action_link_component.titles.unassign' if associative
25
+ return 'action_link.titles.unassign' if associative
26
26
 
27
27
  super
28
28
  end
@@ -42,9 +42,9 @@ module ActionLink
42
42
 
43
43
  def i18n_confirmation_key
44
44
  if associative
45
- 'action_link_component.confirmations.unassign'
45
+ 'action_link.confirmations.unassign'
46
46
  else
47
- 'action_link_component.confirmations.destroy'
47
+ 'action_link.confirmations.destroy'
48
48
  end
49
49
  end
50
50
  end
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ActionLink
4
+ # An action link that indicates downloading a file.
5
+ class Download < Show
6
+ ICON = 'arrow-down-circle'
7
+
8
+ erb_template <<~ERB.gsub("\n", '')
9
+ <% if permission? %>
10
+ <%= link_to(url, **options.merge(target: :_blank)) do %>
11
+ <%= content %>
12
+ <% if icon? %><%= ' ' %><%= icon_tag ::ActionLink::Download::ICON %><% end %>
13
+ <% end %>
14
+ <% else %>
15
+ <%= content %>
16
+ <% end %>
17
+ ERB
18
+
19
+ option :url
20
+ end
21
+ end
@@ -3,7 +3,7 @@
3
3
  module ActionLink
4
4
  # An action link that indicates editing an existing record.
5
5
  class Edit < Base
6
- ICON = 'pencil-circle'
6
+ ICON = 'pencil-circle'.freeze
7
7
 
8
8
  erb_template <<~ERB.gsub("\n", '')
9
9
  <% if permission? %>
@@ -3,7 +3,7 @@
3
3
  module ActionLink
4
4
  # An action link that indicates adding a new record.
5
5
  class New < Base
6
- ICON = 'plus-circle'
6
+ ICON = 'plus-circle'.freeze
7
7
 
8
8
  erb_template <<~ERB.gsub("\n", '')
9
9
  <% if permission? %>
@@ -23,7 +23,7 @@ module ActionLink
23
23
  option :associative, default: -> { false }
24
24
 
25
25
  def i18n_title_key
26
- return 'action_link_component.titles.assign' if associative
26
+ return 'action_link.titles.assign' if associative
27
27
 
28
28
  super
29
29
  end
@@ -3,7 +3,7 @@
3
3
  module ActionLink
4
4
  # An action link that indicates showing an existing record.
5
5
  class Show < Base
6
- ICON = 'chevron-circle-right'
6
+ ICON = 'chevron-circle-right'.freeze
7
7
 
8
8
  erb_template <<~ERB.gsub("\n", '')
9
9
  <% if permission? %>
@@ -1,5 +1,5 @@
1
1
  de:
2
- action_link_component:
2
+ action_link:
3
3
  confirmations:
4
4
  destroy: "Möchtest du %{subject} löschen?"
5
5
  unassign: "Möchtest du %{subject} entkoppeln? Bei dieser Aktion wird nichts gelöscht."
@@ -10,3 +10,4 @@ de:
10
10
  new: "%{subject} anlegen"
11
11
  show: "%{subject} anzeigen"
12
12
  unassign: "%{subject} entkoppeln"
13
+ download: "%{subject} downloaden"
@@ -1,5 +1,5 @@
1
1
  en:
2
- action_link_component:
2
+ action_link:
3
3
  confirmations:
4
4
  destroy: "Would you like to delete %{subject}?"
5
5
  unassign: "Would you like to unassign %{subject}? This action does not delete."
@@ -10,3 +10,4 @@ en:
10
10
  new: Add %{subject}
11
11
  show: "Show %{subject}"
12
12
  unassign: "Unassign %{subject}"
13
+ download: "Download %{subject}"
@@ -9,7 +9,19 @@ module ActionLink
9
9
  isolate_namespace ActionLink
10
10
 
11
11
  initializer "action_link.assets" do |app|
12
- app.config.assets.paths << File.expand_path("../app/assets/stylesheets", __dir__)
12
+ app.config.assets.paths << Engine.root.join('app/stylesheets')
13
+ end
14
+
15
+ initializer 'action_link.vscode_snippets', group: :all do |app|
16
+ app.config.after_initialize do
17
+ vscode_dir = Rails.root.join('.vscode')
18
+ next unless vscode_dir.directory?
19
+
20
+ target = vscode_dir.join('action_link.code-snippets')
21
+ source = Engine.root.join('vscode/action_link.code-snippets')
22
+
23
+ FileUtils.ln_s(source, target, force: true)
24
+ end
13
25
  end
14
26
 
15
27
  config.to_prepare do
@@ -25,10 +37,12 @@ module ActionLink
25
37
  # That's right here and now.
26
38
  require_relative '../../app/components/action_link/application_component'
27
39
  require_relative '../../app/components/action_link/base'
40
+ require_relative '../../app/components/action_link/custom'
28
41
  require_relative '../../app/components/action_link/destroy'
29
42
  require_relative '../../app/components/action_link/edit'
30
43
  require_relative '../../app/components/action_link/new'
31
44
  require_relative '../../app/components/action_link/show'
45
+ require_relative '../../app/components/action_link/download'
32
46
  end
33
47
  end
34
48
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ActionLink
4
- VERSION = '1.0.0'
4
+ VERSION = '1.0.1'
5
5
  end
@@ -0,0 +1,43 @@
1
+ {
2
+ "= render ActionLink::New": {
3
+ "prefix": [
4
+ "nal"
5
+ ],
6
+ "body": [
7
+ "= render ActionLink::New.new(url: $1,",
8
+ " model: $2,",
9
+ " current_user:)",
10
+ ]
11
+ },
12
+ "= render ActionLink::Show": {
13
+ "prefix": [
14
+ "sal"
15
+ ],
16
+ "body": [
17
+ "= render ActionLink::Show.new(url: $1, current_user:)",
18
+ ]
19
+ },
20
+ "= render ActionLink::Edit": {
21
+ "prefix": [
22
+ "eal"
23
+ ],
24
+ "body": [
25
+ "= render ActionLink::Edit.new(url: $1,",
26
+ " model: $2,",
27
+ " title: $3,",
28
+ " current_user:)",
29
+ ]
30
+ },
31
+ "= render ActionLink::Destroy": {
32
+ "prefix": [
33
+ "dal"
34
+ ],
35
+ "body": [
36
+ "= render ActionLink::Destroy.new(url: $1,",
37
+ " model: $2,",
38
+ " confirmation_subject: 'dieses Ding',",
39
+ " associative: true,",
40
+ " current_user:)",
41
+ ]
42
+ },
43
+ }
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: action_link
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - halo
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2025-05-11 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: actionview
@@ -78,13 +77,23 @@ files:
78
77
  - README.md
79
78
  - app/assets/fonts/action_link/acticons.woff
80
79
  - app/assets/stylesheets/action_link/_index.sass
80
+ - app/assets/stylesheets/action_link/acticons.css
81
+ - app/assets/stylesheets/action_link/acticons.css.map
81
82
  - app/assets/stylesheets/action_link/acticons.sass
83
+ - app/assets/stylesheets/action_link/fonts.css
84
+ - app/assets/stylesheets/action_link/fonts.css.map
82
85
  - app/assets/stylesheets/action_link/fonts.sass
86
+ - app/assets/stylesheets/action_link/style.css
87
+ - app/assets/stylesheets/action_link/style.css.map
83
88
  - app/assets/stylesheets/action_link/style.scss
89
+ - app/assets/stylesheets/action_link/variables.css
90
+ - app/assets/stylesheets/action_link/variables.css.map
84
91
  - app/assets/stylesheets/action_link/variables.scss
85
92
  - app/components/action_link/application_component.rb
86
93
  - app/components/action_link/base.rb
94
+ - app/components/action_link/custom.rb
87
95
  - app/components/action_link/destroy.rb
96
+ - app/components/action_link/download.rb
88
97
  - app/components/action_link/edit.rb
89
98
  - app/components/action_link/new.rb
90
99
  - app/components/action_link/show.rb
@@ -95,6 +104,7 @@ files:
95
104
  - lib/action_link/model.rb
96
105
  - lib/action_link/title_subject_name.rb
97
106
  - lib/action_link/version.rb
107
+ - vscode/action_link.code-snippets
98
108
  homepage: https://github.com/halo/action_link
99
109
  licenses:
100
110
  - MIT
@@ -103,7 +113,6 @@ metadata:
103
113
  source_code_uri: https://github.com/halo/action_link
104
114
  changelog_uri: https://github.com/halo/halo/blob/main/CHANGELOG.md
105
115
  rubygems_mfa_required: 'true'
106
- post_install_message:
107
116
  rdoc_options: []
108
117
  require_paths:
109
118
  - lib
@@ -118,8 +127,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
118
127
  - !ruby/object:Gem::Version
119
128
  version: '0'
120
129
  requirements: []
121
- rubygems_version: 3.5.14
122
- signing_key:
130
+ rubygems_version: 4.0.1
123
131
  specification_version: 4
124
132
  summary: A set of ViewComponents for common links (show, edit, delete, etc.)
125
133
  test_files: []