forticons_helper 0.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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 3328b4ddc53b11251b2e5df15e7845e9ceaa6b0e51025c0ee3499c72bd946990
4
+ data.tar.gz: 6dd5ecbb91117be1a7b13edbf923346dbe3911c61b200ee9a1b4d18829bcd68c
5
+ SHA512:
6
+ metadata.gz: 7234db9aed34287214dd1d27dbd46781b66d2a00e0a46ef35aa76f119e0b1d6ea68a0cca3dfa5918e3f7f048b007a692c28f854c0ad97d1f6fe8f9493e0617db
7
+ data.tar.gz: 7f52f937c1cf49ca21a18a0b49586e61187e4e19eb9865993ee9069fd44cc81759ffbd6d554f5e372a5cc34938bc8efbfc55b4630c031f4007f1fd5bb5eb01c0
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2023 GitHub Inc.
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,21 @@
1
+ # forticons_helper
2
+
3
+ [![Gem version](https://img.shields.io/gem/v/forticons_helper.svg)](https://rubygems.org/gems/forticons_helper)
4
+
5
+
6
+ This rails helper lets you easily include svg forticons in your rails apps.
7
+
8
+ ## Install
9
+
10
+ 1. Add this to your `Gemfile`
11
+
12
+ ```rb
13
+ gem 'forticons_helper'
14
+ ```
15
+
16
+ 3. Use this tag in your erbs
17
+
18
+ ```rb
19
+ <%= forticon "alert", :height => 32, :class => "right left", :"aria-label" => "hi" %>
20
+ ```
21
+ We recommend including the CSS in the [`@primer/forticons`](/packages/javascript) npm module. You can also npm install that package and include `build/build.css` in your styles.
@@ -0,0 +1,24 @@
1
+ require "forticons"
2
+ require "action_view"
3
+
4
+ module ForticonsHelper
5
+ include ActionView::Helpers::TagHelper
6
+
7
+ mattr_accessor :forticons_helper_cache, default: {}
8
+
9
+ def forticon(symbol, options = {})
10
+ return "" if symbol.nil?
11
+
12
+ cache_key = [symbol, options]
13
+
14
+ if tag = forticons_helper_cache[cache_key]
15
+ tag
16
+ else
17
+ icon = Forticons::Forticon.new(symbol, options)
18
+
19
+ tag = content_tag(:svg, icon.path.html_safe, icon.options).freeze
20
+ forticons_helper_cache[cache_key] = tag
21
+ tag
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,9 @@
1
+ require "rails"
2
+
3
+ module ForticonsHelper
4
+ class Railtie < Rails::Railtie
5
+ initializer "forticons_helper.helper" do
6
+ ActionView::Base.send :include, ForticonsHelper
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,3 @@
1
+ module ForticonsHelper
2
+ VERSION = "0.0.2".freeze
3
+ end
@@ -0,0 +1,3 @@
1
+ require "forticons_helper/version"
2
+ require "forticons_helper/helper"
3
+ require "forticons_helper/railtie" if defined?(Rails)
metadata ADDED
@@ -0,0 +1,91 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: forticons_helper
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.2
5
+ platform: ruby
6
+ authors:
7
+ - anosim114
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2023-12-02 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: forticons
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - '='
18
+ - !ruby/object:Gem::Version
19
+ version: 0.0.2
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - '='
25
+ - !ruby/object:Gem::Version
26
+ version: 0.0.2
27
+ - !ruby/object:Gem::Dependency
28
+ name: railties
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: actionview
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ description: A rails helper that makes including svg Forticons simple.
56
+ email:
57
+ - arnold_siemens@pm.me
58
+ executables: []
59
+ extensions: []
60
+ extra_rdoc_files: []
61
+ files:
62
+ - LICENSE
63
+ - README.md
64
+ - lib/forticons_helper.rb
65
+ - lib/forticons_helper/helper.rb
66
+ - lib/forticons_helper/railtie.rb
67
+ - lib/forticons_helper/version.rb
68
+ homepage: https://github.com/anosim114/forticons
69
+ licenses:
70
+ - MIT
71
+ metadata: {}
72
+ post_install_message:
73
+ rdoc_options: []
74
+ require_paths:
75
+ - lib
76
+ required_ruby_version: !ruby/object:Gem::Requirement
77
+ requirements:
78
+ - - ">="
79
+ - !ruby/object:Gem::Version
80
+ version: '0'
81
+ required_rubygems_version: !ruby/object:Gem::Requirement
82
+ requirements:
83
+ - - ">="
84
+ - !ruby/object:Gem::Version
85
+ version: '0'
86
+ requirements: []
87
+ rubygems_version: 3.4.10
88
+ signing_key:
89
+ specification_version: 4
90
+ summary: Forticons rails helper
91
+ test_files: []