interage-helpers 0.0.2 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGES +16 -0
- data/Gemfile.lock +3 -3
- data/README.md +1 -1
- data/VERSION +1 -0
- data/interage-helpers-0.0.2.gem +0 -0
- data/interage-helpers.gemspec +6 -8
- data/lib/generators/interage/{helper → helpers}/install/USAGE +0 -0
- data/lib/generators/interage/{helper → helpers}/install/install_generator.rb +0 -0
- data/lib/generators/interage/{helper → helpers}/install/templates/application_helper.rb +0 -0
- data/lib/generators/interage/{helper → helpers}/install/templates/application_helper.yml +0 -0
- data/lib/interage/application_helper.rb +2 -1
- data/lib/interage/bootstrap_alert_helper.rb +4 -1
- data/lib/interage/bootstrap_grid_helper.rb +13 -0
- data/lib/interage/controller_active_helper.rb +19 -6
- data/lib/interage/date_time_helper.rb +9 -1
- data/lib/interage/flash_message_helper.rb +17 -3
- data/lib/interage/font_awesome_helper.rb +3 -1
- data/lib/interage/helpers.rb +2 -1
- data/lib/interage/helpers/version.rb +2 -2
- data/lib/interage/material_design_icons_helper.rb +3 -1
- data/lib/interage/text_helper.rb +3 -3
- data/lib/interage/version_helper.rb +1 -1
- metadata +17 -13
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f3455439b3028ea71d4787cf5980e81278b657cbd745a873395640ea97d73828
|
4
|
+
data.tar.gz: 136445f50323d97692cbf14c9cb9f3d7d65d88f1f128763be81a583608d8637a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b6890cf216e33f18e29830293b1aef583cfa83c9c41d28ceb2df51862e1af3841a0b1e7a274c992a89aa55a4b2936e79042af1a26bd1142592b76d6d103f191f
|
7
|
+
data.tar.gz: c285b899191c1d088201290c619a53b82de6fe304aa6c8c268d3fd27a5f6806e9870775f2270f2429b7bb7b5280a994e2b64543ca0540bd52d2a3a10e4ed9879
|
data/CHANGES
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
Version 0.1.0:
|
2
|
+
- Adiciona alguns helper metodos
|
3
|
+
- Ajusta nome da class principal da gem
|
4
|
+
- Inicia versão 0.1.0
|
5
|
+
- Atualiza url do repositório
|
6
|
+
- Update rake requirement from ~> 10.0 to ~> 13.0
|
7
|
+
|
8
|
+
Version 0.0.2:
|
9
|
+
- Altera arquivos VERSION e CHANGES da v0.0.2
|
10
|
+
- Gera versão 0.0.2
|
11
|
+
- Adicona novos helpers
|
12
|
+
|
13
|
+
Version 0.0.1:
|
14
|
+
- Cria arquivos VERSION e CHANGES da v0.0.1
|
15
|
+
- Gera versão 0.0.1
|
16
|
+
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
interage-helpers (0.0
|
4
|
+
interage-helpers (0.1.0)
|
5
5
|
|
6
6
|
GEM
|
7
7
|
remote: https://rubygems.org/
|
@@ -29,7 +29,7 @@ GEM
|
|
29
29
|
method_source (~> 0.9.0)
|
30
30
|
psych (3.1.0)
|
31
31
|
rainbow (3.0.0)
|
32
|
-
rake (
|
32
|
+
rake (13.0.1)
|
33
33
|
rspec (3.9.0)
|
34
34
|
rspec-core (~> 3.9.0)
|
35
35
|
rspec-expectations (~> 3.9.0)
|
@@ -70,7 +70,7 @@ DEPENDENCIES
|
|
70
70
|
bundler (~> 2.0)
|
71
71
|
interage-helpers!
|
72
72
|
pry (~> 0.12.2)
|
73
|
-
rake (~>
|
73
|
+
rake (~> 13.0)
|
74
74
|
rspec (~> 3.8)
|
75
75
|
rubocop (~> 0.67.2)
|
76
76
|
rubocop-performance (~> 1.1)
|
data/README.md
CHANGED
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.1.0
|
Binary file
|
data/interage-helpers.gemspec
CHANGED
@@ -5,24 +5,22 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
5
5
|
require 'interage/helpers/version'
|
6
6
|
|
7
7
|
Gem::Specification.new do |spec|
|
8
|
-
CODE_URL = 'https://gitlab.com/interage/patterns/helpers'
|
9
|
-
|
10
8
|
spec.name = 'interage-helpers'
|
11
|
-
spec.version = Interage::
|
9
|
+
spec.version = Interage::Helpers::VERSION
|
12
10
|
spec.authors = ['Walmir Neto']
|
13
11
|
spec.email = ['owalmirneto@gmail.com']
|
14
12
|
|
15
|
-
spec.summary = 'Application
|
13
|
+
spec.summary = 'Application Helpers for Interage'
|
16
14
|
spec.description = 'Classes to encapsulate helpers'
|
17
|
-
spec.homepage =
|
15
|
+
spec.homepage = 'https://github.com/InterageASH/application-helpers'
|
18
16
|
spec.licenses = ['MIT']
|
19
17
|
|
20
18
|
if spec.respond_to?(:metadata)
|
21
19
|
spec.metadata['allowed_push_host'] = 'https://rubygems.org'
|
22
20
|
|
23
21
|
spec.metadata['homepage_uri'] = spec.homepage
|
24
|
-
spec.metadata['source_code_uri'] =
|
25
|
-
spec.metadata['changelog_uri'] =
|
22
|
+
spec.metadata['source_code_uri'] = spec.homepage
|
23
|
+
spec.metadata['changelog_uri'] = "#{spec.homepage}/blob/master/CHANGES"
|
26
24
|
else
|
27
25
|
raise 'RubyGems 2.0 or newer is required to protect against ' \
|
28
26
|
'public gem pushes.'
|
@@ -38,6 +36,6 @@ Gem::Specification.new do |spec|
|
|
38
36
|
spec.require_paths = ['lib']
|
39
37
|
|
40
38
|
spec.add_development_dependency 'bundler', '~> 2.0'
|
41
|
-
spec.add_development_dependency 'rake', '~>
|
39
|
+
spec.add_development_dependency 'rake', '~> 13.0'
|
42
40
|
spec.add_development_dependency 'rspec', '~> 3.0'
|
43
41
|
end
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -6,6 +6,7 @@ module Interage
|
|
6
6
|
include ::Interage::BootstrapAlertHelper
|
7
7
|
include ::Interage::BootstrapBadgeHelper
|
8
8
|
include ::Interage::BootstrapButtonHelper
|
9
|
+
include ::Interage::BootstrapGridHelper
|
9
10
|
include ::Interage::CEPHelper
|
10
11
|
include ::Interage::CNPJHelper
|
11
12
|
include ::Interage::CocoonHelper
|
@@ -46,7 +47,7 @@ module Interage
|
|
46
47
|
end
|
47
48
|
|
48
49
|
def app_name
|
49
|
-
ENV.fetch('APP_NAME', t('application.name', default: rails_app_name))
|
50
|
+
raw ENV.fetch('APP_NAME', t('application.name', default: rails_app_name))
|
50
51
|
end
|
51
52
|
|
52
53
|
def rails_app_name
|
@@ -4,9 +4,12 @@ module Interage
|
|
4
4
|
module BootstrapAlertHelper
|
5
5
|
def bootstrap_alert(type, message)
|
6
6
|
icon = t("bootstrap.alert.icons.#{type}", default: type)
|
7
|
+
subtitles = t("bootstrap.alert.subtitles.#{type}", default: '')
|
7
8
|
|
8
9
|
content_tag :div, class: "no-margin alert alert-#{type}" do
|
9
|
-
|
10
|
+
concat app_icon(icon)
|
11
|
+
concat content_tag(:b, " #{subtitles}: ") if subtitles.present?
|
12
|
+
concat message
|
10
13
|
end
|
11
14
|
end
|
12
15
|
alias bs_alert bootstrap_alert
|
@@ -0,0 +1,13 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Interage
|
4
|
+
module BootstrapGridHelper
|
5
|
+
BS_COLUMNS_CLASSES = ['col', 'col-sm', 'col-md', 'col-lg', 'col-xl'].freeze
|
6
|
+
|
7
|
+
def bs_columns(*columns)
|
8
|
+
BS_COLUMNS_CLASSES.each_with_index.map do |klass, key|
|
9
|
+
"#{klass}-#{columns[key]}"
|
10
|
+
end.join(' ')
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -5,19 +5,32 @@ module Interage
|
|
5
5
|
HTML_SHOW_CLASS = ENV.fetch('CONTROLLER_SHOW_CLASS', 'show')
|
6
6
|
HTML_ACTIVE_CLASS = ENV.fetch('CONTROLLER_ACTIVE_CLASS', 'active')
|
7
7
|
|
8
|
-
def
|
9
|
-
|
8
|
+
def controller_class_active_show(*controllers)
|
9
|
+
return unless current_controller?(*controllers)
|
10
|
+
|
11
|
+
"#{HTML_SHOW_CLASS} #{HTML_ACTIVE_CLASS}"
|
10
12
|
end
|
11
13
|
|
12
|
-
def
|
14
|
+
def controller_class_active(*controllers)
|
13
15
|
HTML_ACTIVE_CLASS if current_controller?(*controllers)
|
14
16
|
end
|
15
|
-
alias
|
17
|
+
alias menu_active controller_class_active
|
18
|
+
|
19
|
+
def controller_class_show(*controllers)
|
20
|
+
HTML_SHOW_CLASS if current_controller?(*controllers)
|
21
|
+
end
|
22
|
+
alias menu_class_show controller_class_show
|
16
23
|
|
17
24
|
def current_controller?(*controllers)
|
18
|
-
controllers
|
25
|
+
Array.wrap(controllers).include?(params[:controller])
|
26
|
+
end
|
27
|
+
|
28
|
+
def action_class_active(*actions)
|
29
|
+
HTML_ACTIVE_CLASS if current_action?(*actions)
|
30
|
+
end
|
19
31
|
|
20
|
-
|
32
|
+
def current_action?(*actions)
|
33
|
+
Array.wrap(actions).include?("#{controller_name}/#{action_name}")
|
21
34
|
end
|
22
35
|
end
|
23
36
|
end
|
@@ -25,7 +25,15 @@ module Interage
|
|
25
25
|
end
|
26
26
|
|
27
27
|
def format_datetime(date, date_format = '%d/%m/%Y %H:%M')
|
28
|
-
format_date(date,
|
28
|
+
format_date(date, date_format)
|
29
|
+
end
|
30
|
+
|
31
|
+
def current_month_name
|
32
|
+
month_name(Date.current)
|
33
|
+
end
|
34
|
+
|
35
|
+
def month_name(date)
|
36
|
+
date.to_date.strftime('%b')
|
29
37
|
end
|
30
38
|
|
31
39
|
def current_day_name
|
@@ -2,9 +2,11 @@
|
|
2
2
|
|
3
3
|
module Interage
|
4
4
|
module FlashMessageHelper
|
5
|
+
ALIAS_TYPES = { notice: 'success', alert: 'info', error: 'danger' }.freeze
|
6
|
+
|
5
7
|
def flash_messages
|
6
8
|
messages ||= flashes.map do |type, message|
|
7
|
-
bootstrap_alert(
|
9
|
+
bootstrap_alert(handler_type(type), handler_message(message))
|
8
10
|
end
|
9
11
|
|
10
12
|
safe_join(messages || [])
|
@@ -14,8 +16,20 @@ module Interage
|
|
14
16
|
flash.to_h.symbolize_keys
|
15
17
|
end
|
16
18
|
|
17
|
-
def
|
18
|
-
type
|
19
|
+
def handler_type(type)
|
20
|
+
ALIAS_TYPES[type] || type
|
21
|
+
end
|
22
|
+
|
23
|
+
def handler_message(messages)
|
24
|
+
return messages unless messages.respond_to?(:map)
|
25
|
+
|
26
|
+
errors = content_tag :ul do
|
27
|
+
messages.map do |message|
|
28
|
+
concat content_tag(:li, message)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
safe_join [errors]
|
19
33
|
end
|
20
34
|
end
|
21
35
|
end
|
@@ -2,6 +2,8 @@
|
|
2
2
|
|
3
3
|
module Interage
|
4
4
|
module FontAwesomeHelper
|
5
|
+
FA_ICON_TEXT_CLASS = 'text'
|
6
|
+
|
5
7
|
def fa_icons
|
6
8
|
t('icons_alias', default: {}).keys
|
7
9
|
end
|
@@ -17,7 +19,7 @@ module Interage
|
|
17
19
|
def fa_icon_text(icon, text, options = {})
|
18
20
|
content_tag :span do
|
19
21
|
concat fa_fw_icon(icon, options)
|
20
|
-
concat text
|
22
|
+
concat content_tag(:span, text, class: FA_ICON_TEXT_CLASS)
|
21
23
|
end
|
22
24
|
end
|
23
25
|
|
data/lib/interage/helpers.rb
CHANGED
@@ -4,7 +4,7 @@ require 'interage/helpers/version'
|
|
4
4
|
require 'active_support/core_ext/module'
|
5
5
|
|
6
6
|
module Interage
|
7
|
-
module
|
7
|
+
module Helpers
|
8
8
|
class Error < StandardError
|
9
9
|
end
|
10
10
|
end
|
@@ -14,6 +14,7 @@ module Interage
|
|
14
14
|
autoload :BootstrapAlertHelper, 'interage/bootstrap_alert_helper'
|
15
15
|
autoload :BootstrapBadgeHelper, 'interage/bootstrap_badge_helper'
|
16
16
|
autoload :BootstrapButtonHelper, 'interage/bootstrap_button_helper'
|
17
|
+
autoload :BootstrapGridHelper, 'interage/bootstrap_grid_helper'
|
17
18
|
autoload :CEPHelper, 'interage/cep_helper'
|
18
19
|
autoload :CNPJHelper, 'interage/cnpj_helper'
|
19
20
|
autoload :CocoonHelper, 'interage/cocoon_helper'
|
@@ -2,6 +2,8 @@
|
|
2
2
|
|
3
3
|
module Interage
|
4
4
|
module MaterialDesignIconsHelper
|
5
|
+
MD_ICON_TEXT_CLASS = 'text'
|
6
|
+
|
5
7
|
def md_icon(icon, options = {})
|
6
8
|
icon_classes = icon.to_s.split(' ')
|
7
9
|
icon = icon_classes.shift
|
@@ -14,7 +16,7 @@ module Interage
|
|
14
16
|
def md_icon_text(icon, text, options = {})
|
15
17
|
content_tag :span do
|
16
18
|
concat md_icon(icon, options)
|
17
|
-
concat " #{text}"
|
19
|
+
concat content_tag(:span, " #{text}", class: MD_ICON_TEXT_CLASS)
|
18
20
|
end
|
19
21
|
end
|
20
22
|
|
data/lib/interage/text_helper.rb
CHANGED
@@ -2,9 +2,9 @@
|
|
2
2
|
|
3
3
|
module Interage
|
4
4
|
module TextHelper
|
5
|
-
def nl2br(string
|
6
|
-
out = string.split("\n").map do |str|
|
7
|
-
|
5
|
+
def nl2br(string)
|
6
|
+
out = string.to_s.split("\n").map do |str|
|
7
|
+
[str, content_tag(:br)]
|
8
8
|
end
|
9
9
|
|
10
10
|
safe_join out
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: interage-helpers
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Walmir Neto
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-05-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -30,14 +30,14 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
33
|
+
version: '13.0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
40
|
+
version: '13.0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rspec
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -63,10 +63,12 @@ files:
|
|
63
63
|
- ".rspec"
|
64
64
|
- ".rubocop.yml"
|
65
65
|
- ".travis.yml"
|
66
|
+
- CHANGES
|
66
67
|
- Gemfile
|
67
68
|
- Gemfile.lock
|
68
69
|
- README.md
|
69
70
|
- Rakefile
|
71
|
+
- VERSION
|
70
72
|
- bin/brakeman
|
71
73
|
- bin/bundle
|
72
74
|
- bin/ci
|
@@ -75,16 +77,18 @@ files:
|
|
75
77
|
- bin/rubocop
|
76
78
|
- bin/setup
|
77
79
|
- interage-helpers-0.0.1.gem
|
80
|
+
- interage-helpers-0.0.2.gem
|
78
81
|
- interage-helpers.gemspec
|
79
|
-
- lib/generators/interage/
|
80
|
-
- lib/generators/interage/
|
81
|
-
- lib/generators/interage/
|
82
|
-
- lib/generators/interage/
|
82
|
+
- lib/generators/interage/helpers/install/USAGE
|
83
|
+
- lib/generators/interage/helpers/install/install_generator.rb
|
84
|
+
- lib/generators/interage/helpers/install/templates/application_helper.rb
|
85
|
+
- lib/generators/interage/helpers/install/templates/application_helper.yml
|
83
86
|
- lib/interage/application_helper.rb
|
84
87
|
- lib/interage/application_icon_helper.rb
|
85
88
|
- lib/interage/bootstrap_alert_helper.rb
|
86
89
|
- lib/interage/bootstrap_badge_helper.rb
|
87
90
|
- lib/interage/bootstrap_button_helper.rb
|
91
|
+
- lib/interage/bootstrap_grid_helper.rb
|
88
92
|
- lib/interage/cep_helper.rb
|
89
93
|
- lib/interage/cnpj_helper.rb
|
90
94
|
- lib/interage/cocoon_helper.rb
|
@@ -109,14 +113,14 @@ files:
|
|
109
113
|
- lib/interage/text_helper.rb
|
110
114
|
- lib/interage/translation_helper.rb
|
111
115
|
- lib/interage/version_helper.rb
|
112
|
-
homepage: https://
|
116
|
+
homepage: https://github.com/InterageASH/application-helpers
|
113
117
|
licenses:
|
114
118
|
- MIT
|
115
119
|
metadata:
|
116
120
|
allowed_push_host: https://rubygems.org
|
117
|
-
homepage_uri: https://
|
118
|
-
source_code_uri: https://
|
119
|
-
changelog_uri: https://
|
121
|
+
homepage_uri: https://github.com/InterageASH/application-helpers
|
122
|
+
source_code_uri: https://github.com/InterageASH/application-helpers
|
123
|
+
changelog_uri: https://github.com/InterageASH/application-helpers/blob/master/CHANGES
|
120
124
|
post_install_message:
|
121
125
|
rdoc_options: []
|
122
126
|
require_paths:
|
@@ -135,5 +139,5 @@ requirements: []
|
|
135
139
|
rubygems_version: 3.0.6
|
136
140
|
signing_key:
|
137
141
|
specification_version: 4
|
138
|
-
summary: Application
|
142
|
+
summary: Application Helpers for Interage
|
139
143
|
test_files: []
|