active_admin-codigo5_signature 0.1.0

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.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 5c7cf6a1eadf75acdc9e2f6fe131d76e1efec5ea
4
+ data.tar.gz: 32bafeedc822cf79164a1d1bf18920bfff640ec1
5
+ SHA512:
6
+ metadata.gz: b2e2718e9586f439b0979eb704059611ef4f625f616163987aa50dd8b410dcc0d3e8ffba6eb988bf8e4240b557bf9a995b9aee9dd8cc399bd168fecb506795cc
7
+ data.tar.gz: eb46743c6ef3b479e8694ba983ede5fe6c168b1b79da93591bfe6222e102ced3bc05400c8eadfc33332ca7437093b292858f50276ca34532b2b3f9321312c5ef
@@ -0,0 +1,13 @@
1
+ # http://editorconfig.org
2
+ root = true
3
+
4
+ [*]
5
+ indent_style = space
6
+ indent_size = 2
7
+ end_of_line = lf
8
+ charset = utf-8
9
+ trim_trailing_whitespace = true
10
+ insert_final_newline = true
11
+
12
+ [*.md]
13
+ trim_trailing_whitespace = false
@@ -0,0 +1,4 @@
1
+ pkg
2
+ doc
3
+ log
4
+ *.lock
@@ -0,0 +1,39 @@
1
+ # Contributing
2
+
3
+ ## Issues
4
+
5
+ If you want to request a feature or report a bug, please use the following template.
6
+
7
+ ```markdown
8
+ ## Description
9
+
10
+ [Add feature/bug description here]
11
+
12
+ ## How to reproduce
13
+
14
+ [Add steps on how to reproduce this issue]
15
+
16
+ ## What do you expect
17
+
18
+ [Describe what do you expect to happen]
19
+
20
+ ## What happened instead
21
+
22
+ [Describe the actual results]
23
+
24
+ ## Gem version:
25
+
26
+ Version: [Add gem version here]
27
+ ```
28
+
29
+ ## Writing code
30
+
31
+ Once you've made your great commits (include tests, please):
32
+
33
+ 1. [Fork](http://help.github.com/forking/) the [original repository](http://github.com/dhyegofernando/active_admin-codigo5_signature)
34
+ 2. Create a topic branch - `git checkout -b my_branch`
35
+ 3. Push to your branch - `git push origin my_branch`
36
+ 4. [Create an Issue](http://github.com/dhyegofernando/active_admin-codigo5_signature/issues) with a link to your branch
37
+ 5. That's it!
38
+
39
+ Please respect the code style using [editorconfig](http://editorconfig.org/) in your text editor.
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'http://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in active_admin-codigo5_signature.gemspec
4
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2015 Dhyego Fernando
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
13
+ all 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
21
+ THE SOFTWARE.
@@ -0,0 +1,16 @@
1
+ # ActiveAdmin Codigo5 Signature
2
+ Easily add Codigo5 Web Signature to your ActiveAdmin footer.
3
+
4
+ ## Installation
5
+ **1. Include to your Gemfile**
6
+ ```bash
7
+ gem 'active_admin-codigo5_signature'
8
+ ```
9
+
10
+ **2. Generate the options in active admin initializer file**
11
+ ```bash
12
+ rails generate active_admin:codigo5_signature
13
+ ```
14
+
15
+ ## Maintainer
16
+ [Dhyego Fernando](https://github.com/dhyegofernando)
@@ -0,0 +1,9 @@
1
+ require 'bundler/gem_tasks'
2
+ require 'rake/testtask'
3
+
4
+ Rake::TestTask.new(:test) do |t|
5
+ t.libs << 'test'
6
+ t.test_files = FileList['./test/**/*_test.rb']
7
+ end
8
+
9
+ task default: :test
@@ -0,0 +1,26 @@
1
+ $:.push File.expand_path('../lib', __FILE__)
2
+
3
+ require './lib/active_admin/codigo5_signature/version'
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = 'active_admin-codigo5_signature'
7
+ spec.version = ActiveAdmin::Codigo5Signature::Version::STRING
8
+ spec.authors = ['Dhyego Fernando']
9
+ spec.email = ['dhyegofernando@gmail.com']
10
+
11
+ spec.summary = 'Easily add Codigo5 Web Signature to your ActiveAdmin footer.'
12
+ spec.description = spec.summary
13
+ spec.homepage = 'http://github.com/dhyegofernando/active_admin-codigo5_signature'
14
+ spec.license = 'MIT'
15
+
16
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
17
+
18
+ spec.add_dependency 'railties'
19
+ spec.add_dependency 'activeadmin'
20
+
21
+ spec.add_development_dependency 'bundler'
22
+ spec.add_development_dependency 'rake'
23
+ spec.add_development_dependency 'minitest'
24
+ spec.add_development_dependency 'minitest-utils'
25
+ spec.add_development_dependency 'pry-meta'
26
+ end
@@ -0,0 +1,17 @@
1
+ require 'active_support/core_ext'
2
+ require 'active_admin'
3
+
4
+ module ActiveAdmin
5
+ module Codigo5Signature
6
+ autoload :Version, 'active_admin/codigo5_signature/version'
7
+ autoload :Widget, 'active_admin/codigo5_signature/widget'
8
+ end
9
+ end
10
+
11
+ require 'active_admin/codigo5_signature/engine'
12
+ require 'active_admin/codigo5_signature/application'
13
+
14
+ ActiveAdmin::Application.include(ActiveAdmin::Codigo5Signature::Application)
15
+
16
+ # It must be a monkey patch
17
+ require_relative 'views/footer'
@@ -0,0 +1,13 @@
1
+ module ActiveAdmin
2
+ module Codigo5Signature
3
+ module Application
4
+ def codigo5_signature(enabled = true, &block)
5
+ codigo5_signature_widget.config(enabled, &block)
6
+ end
7
+
8
+ def codigo5_signature_widget
9
+ @codigo5_signature_widget ||= ActiveAdmin::Codigo5Signature::Widget.new
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,6 @@
1
+ module ActiveAdmin
2
+ module Codigo5Signature
3
+ class Engine < ::Rails::Engine
4
+ end
5
+ end
6
+ end
@@ -0,0 +1,10 @@
1
+ module ActiveAdmin
2
+ module Codigo5Signature
3
+ module Version
4
+ MAJOR = 0
5
+ MINOR = 1
6
+ PATCH = 0
7
+ STRING = "#{MAJOR}.#{MINOR}.#{PATCH}"
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,28 @@
1
+ module ActiveAdmin
2
+ module Codigo5Signature
3
+ class Widget
4
+ HTML_OPTIONS = [:theme, :logo_width, :logo_height].freeze
5
+
6
+ attr_accessor :enabled, *HTML_OPTIONS
7
+
8
+ def config(enabled = true)
9
+ @enabled = enabled
10
+ yield(self) if block_given?
11
+ end
12
+
13
+ def enabled
14
+ @enabled = true if @enabled.nil?
15
+ @enabled
16
+ end
17
+ alias_method :enabled?, :enabled
18
+
19
+ def theme
20
+ @theme ||= 'light'
21
+ end
22
+
23
+ def options
24
+ Hash[HTML_OPTIONS.map { |o| [o, self.public_send(o)] if self.public_send(o) }.compact]
25
+ end
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,32 @@
1
+ module ActiveAdmin
2
+ module Views
3
+ class Footer < Component
4
+ def build(namespace)
5
+ super id: 'footer'
6
+ @namespace = namespace
7
+
8
+ if codigo5_signature.enabled?
9
+ div class: 'codigo5-signature-widget-wrapper'
10
+ script src: '//cdn.codigo5.com.br/signature/signature-widget.min.js'
11
+ script codigo5_signature_js.html_safe
12
+ elsif footer?
13
+ para footer_text
14
+ else
15
+ para powered_by_message
16
+ end
17
+ end
18
+
19
+ protected
20
+
21
+ def codigo5_signature
22
+ ActiveAdmin.application.codigo5_signature_widget
23
+ end
24
+
25
+ def codigo5_signature_js
26
+ <<-JS
27
+ cod5.signatureWidget.bootstrap(#{codigo5_signature.options.to_json});
28
+ JS
29
+ end
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,25 @@
1
+ module ActiveAdmin
2
+ class Codigo5SignatureGenerator < Rails::Generators::Base
3
+ def inject_into_initializer_file
4
+ inject_into_file 'config/initializers/active_admin.rb', after: /(?:.*)\.include_default_association_filters(?:\s*)\=(?:.*)\n/i do <<-'RUBY'
5
+
6
+ # == Codigo5 Signature
7
+ #
8
+ # Codigo5 Signature is enabled by default in the footer.
9
+ #
10
+ # You can disable it from here
11
+ #
12
+ # config.codigo5_signature false
13
+ #
14
+ # or you can control the widget options from here
15
+ #
16
+ # config.codigo5_signature do |widget|
17
+ # widget.theme = 'dark'
18
+ # widget.logo_width = 200
19
+ # widget.logo_height = 49
20
+ # end
21
+ RUBY
22
+ end
23
+ end
24
+ end
25
+ end
metadata ADDED
@@ -0,0 +1,157 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: active_admin-codigo5_signature
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Dhyego Fernando
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2017-10-14 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: railties
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: activeadmin
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: bundler
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rake
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: minitest
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: minitest-utils
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: pry-meta
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ description: Easily add Codigo5 Web Signature to your ActiveAdmin footer.
112
+ email:
113
+ - dhyegofernando@gmail.com
114
+ executables: []
115
+ extensions: []
116
+ extra_rdoc_files: []
117
+ files:
118
+ - ".editorconfig"
119
+ - ".gitignore"
120
+ - CONTRIBUTING.md
121
+ - Gemfile
122
+ - LICENSE
123
+ - README.md
124
+ - Rakefile
125
+ - active_admin-codigo5_signature.gemspec
126
+ - lib/active_admin/codigo5_signature.rb
127
+ - lib/active_admin/codigo5_signature/application.rb
128
+ - lib/active_admin/codigo5_signature/engine.rb
129
+ - lib/active_admin/codigo5_signature/version.rb
130
+ - lib/active_admin/codigo5_signature/widget.rb
131
+ - lib/active_admin/views/footer.rb
132
+ - lib/generators/active_admin/codigo5_signature/codigo5_signature_generator.rb
133
+ homepage: http://github.com/dhyegofernando/active_admin-codigo5_signature
134
+ licenses:
135
+ - MIT
136
+ metadata: {}
137
+ post_install_message:
138
+ rdoc_options: []
139
+ require_paths:
140
+ - lib
141
+ required_ruby_version: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - ">="
144
+ - !ruby/object:Gem::Version
145
+ version: '0'
146
+ required_rubygems_version: !ruby/object:Gem::Requirement
147
+ requirements:
148
+ - - ">="
149
+ - !ruby/object:Gem::Version
150
+ version: '0'
151
+ requirements: []
152
+ rubyforge_project:
153
+ rubygems_version: 2.4.8
154
+ signing_key:
155
+ specification_version: 4
156
+ summary: Easily add Codigo5 Web Signature to your ActiveAdmin footer.
157
+ test_files: []