administrate-field-hex_color_picker 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.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: ffc6de7a69c2888e0bee308f95c9f705734ecf63
4
+ data.tar.gz: e78d11489afba309b3abf9807cab6968c0a5d490
5
+ SHA512:
6
+ metadata.gz: 5016e58263cf61cd542ffcd6ac9edbeb6c0b1d8e41aae7451a76122e26325a4cb1f64d64aa5e40093e573c5266c87f91441e08294ef532e056e0a0b7f11fdc78
7
+ data.tar.gz: e3c26aefeeda10e2b26bc71af6cb3ab9f21f37471fa0c5c0186fc7c4c9fff2d8d221f5bdc0acd587a1de200a0e82aa580885edbce8a8fdba42a32f2ca31199ed
data/.gitignore ADDED
@@ -0,0 +1,13 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+
11
+ # rspec failure tracking
12
+ .rspec_status
13
+ *.gem
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --format documentation
2
+ --color
data/.ruby-gemset ADDED
@@ -0,0 +1 @@
1
+ administrate_gems
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 2.4.0
data/.travis.yml ADDED
@@ -0,0 +1,5 @@
1
+ sudo: false
2
+ language: ruby
3
+ rvm:
4
+ - 2.4.0
5
+ before_install: gem install bundler -v 1.14.6
data/Gemfile ADDED
@@ -0,0 +1,2 @@
1
+ source 'https://rubygems.org'
2
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2017 Headway, LLC
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.
data/README.md ADDED
@@ -0,0 +1,29 @@
1
+ # Administrate::Field::HexColorPicker
2
+
3
+ A plugin for [Administrate](https://github.com/thoughtbot/administrate)
4
+
5
+ ## Usage
6
+
7
+ Add to your `Gemfile`:
8
+
9
+ ```ruby
10
+ gem 'administrate-field-hex_color_picker'
11
+ ```
12
+
13
+ Run:
14
+
15
+ ```bash
16
+ $ bundle install
17
+ ```
18
+
19
+ Add to your `FooDashboard`:
20
+ ```ruby
21
+ ATTRIBUTE_TYPES = [
22
+ bars: Field::HexColorPicker.with_options(
23
+ choices: %w[One Two Three],
24
+ include_blank: 'Choose An Option',
25
+ multiple: true,
26
+ ),
27
+ ]
28
+ ```
29
+
data/Rakefile ADDED
@@ -0,0 +1,6 @@
1
+ require 'bundler/gem_tasks'
2
+ require 'rspec/core/rake_task'
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task default: :spec
@@ -0,0 +1,34 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+
5
+ GEM_NAME = 'hex_color_picker'
6
+ GEM_NAME_CLASS = GEM_NAME.split('_').map(&:capitalize).join
7
+ FULL_GEM_NAME = "administrate-field-#{GEM_NAME}"
8
+
9
+ Gem::Specification.new do |gem|
10
+ gem.name = FULL_GEM_NAME
11
+ gem.version = '0.1.0'
12
+ gem.authors = ['Jon Kinney']
13
+ gem.email = ['jon@headway.io']
14
+
15
+ gem.summary = %(Custom Administrate field #{GEM_NAME})
16
+ gem.description = gem.summary
17
+ gem.homepage = "http://github.com/headwayio/#{FULL_GEM_NAME}"
18
+ gem.license = 'MIT'
19
+
20
+ gem.files = `git ls-files -z`.split("\x0").reject do |f|
21
+ f.match(%r{^(test|spec|features)/})
22
+ end
23
+ gem.bindir = 'exe'
24
+ gem.executables = gem.files.grep(%r{^exe/}) { |f| File.basename(f) }
25
+ gem.require_paths = ['lib']
26
+
27
+ gem.add_development_dependency 'bundler', '~> 1.14'
28
+ gem.add_development_dependency 'rake', '~> 10.0'
29
+ gem.add_development_dependency 'rspec', '~> 3.0'
30
+ gem.add_dependency 'administrate', '~> 0.7'
31
+ gem.add_dependency 'rails', '~> 5.0'
32
+ gem.add_dependency 'jquery-minicolors-rails', '~> 2.2'
33
+ gem.add_dependency 'jquery-rails', '~> 4.3'
34
+ end
@@ -0,0 +1,3 @@
1
+ //= require jquery
2
+ //= require jquery.minicolors
3
+ //= require_tree
@@ -0,0 +1,3 @@
1
+ $(function() {
2
+ $('.minicolors').minicolors();
3
+ });
@@ -0,0 +1,5 @@
1
+ /*
2
+ *= require_self
3
+ *= require jquery.minicolors
4
+ *= require_tree .
5
+ */
@@ -0,0 +1,17 @@
1
+ .hex-number
2
+ float: left
3
+ position: relative
4
+ top: 4px
5
+
6
+ .hex-swatch
7
+ height: 30px
8
+ width: 30px
9
+ margin-left: 70px
10
+
11
+ .minicolors-theme-default .minicolors-input
12
+ width: 200px
13
+ height: 36px
14
+ padding-top: 8px
15
+
16
+ .minicolors-theme-default .minicolors-swatch
17
+ top: 9px
@@ -0,0 +1,6 @@
1
+ <div class="field-unit__label">
2
+ <%= f.label field.attribute %>
3
+ </div>
4
+ <div class="field-unit__field">
5
+ <%= f.text_field field.attribute, class: 'minicolors' %>
6
+ </div>
@@ -0,0 +1 @@
1
+ <%= render 'fields/hex_color_picker/shared_display', { field: field } %>
@@ -0,0 +1,2 @@
1
+ <div class='hex-number'><%= field.data %></div>
2
+ <div class='hex-swatch' style='background: <%= field.data %>'></div>
@@ -0,0 +1 @@
1
+ <%= render 'fields/hex_color_picker/shared_display', { field: field } %>
@@ -0,0 +1,19 @@
1
+ require 'administrate/field/base'
2
+ require 'rails'
3
+ require 'jquery-rails'
4
+ require 'jquery-minicolors-rails'
5
+
6
+ module Administrate
7
+ module Field
8
+ class HexColorPicker < Base
9
+ class Engine < ::Rails::Engine
10
+ Administrate::Engine.add_javascript 'administrate-field-hex_color_picker/application'
11
+ Administrate::Engine.add_stylesheet 'administrate-field-hex_color_picker/application'
12
+ end
13
+
14
+ def to_s
15
+ data
16
+ end
17
+ end
18
+ end
19
+ end
metadata ADDED
@@ -0,0 +1,161 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: administrate-field-hex_color_picker
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Jon Kinney
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2017-06-04 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.14'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.14'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '3.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '3.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: administrate
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '0.7'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '0.7'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rails
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '5.0'
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '5.0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: jquery-minicolors-rails
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '2.2'
90
+ type: :runtime
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '2.2'
97
+ - !ruby/object:Gem::Dependency
98
+ name: jquery-rails
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: '4.3'
104
+ type: :runtime
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: '4.3'
111
+ description: Custom Administrate field hex_color_picker
112
+ email:
113
+ - jon@headway.io
114
+ executables: []
115
+ extensions: []
116
+ extra_rdoc_files: []
117
+ files:
118
+ - ".gitignore"
119
+ - ".rspec"
120
+ - ".ruby-gemset"
121
+ - ".ruby-version"
122
+ - ".travis.yml"
123
+ - Gemfile
124
+ - LICENSE.txt
125
+ - README.md
126
+ - Rakefile
127
+ - administrate-field-hex_color_picker.gemspec
128
+ - app/assets/javascripts/administrate-field-hex_color_picker/application.js
129
+ - app/assets/javascripts/administrate-field-hex_color_picker/hex_color_picker.js
130
+ - app/assets/stylesheets/administrate-field-hex_color_picker/application.css
131
+ - app/assets/stylesheets/administrate-field-hex_color_picker/hex_color_picker.sass
132
+ - app/views/fields/hex_color_picker/_form.html.erb
133
+ - app/views/fields/hex_color_picker/_index.html.erb
134
+ - app/views/fields/hex_color_picker/_shared_display.html.erb
135
+ - app/views/fields/hex_color_picker/_show.html.erb
136
+ - lib/administrate/field/hex_color_picker.rb
137
+ homepage: http://github.com/headwayio/administrate-field-hex_color_picker
138
+ licenses:
139
+ - MIT
140
+ metadata: {}
141
+ post_install_message:
142
+ rdoc_options: []
143
+ require_paths:
144
+ - lib
145
+ required_ruby_version: !ruby/object:Gem::Requirement
146
+ requirements:
147
+ - - ">="
148
+ - !ruby/object:Gem::Version
149
+ version: '0'
150
+ required_rubygems_version: !ruby/object:Gem::Requirement
151
+ requirements:
152
+ - - ">="
153
+ - !ruby/object:Gem::Version
154
+ version: '0'
155
+ requirements: []
156
+ rubyforge_project:
157
+ rubygems_version: 2.6.11
158
+ signing_key:
159
+ specification_version: 4
160
+ summary: Custom Administrate field hex_color_picker
161
+ test_files: []