simple_form_custom_inputs 0.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.
Files changed (113) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +9 -0
  3. data/.rspec +2 -0
  4. data/.travis.yml +3 -0
  5. data/Gemfile +3 -0
  6. data/README.md +78 -0
  7. data/Rakefile +2 -0
  8. data/example/.gitignore +21 -0
  9. data/example/Gemfile +61 -0
  10. data/example/Gemfile.lock +206 -0
  11. data/example/README.md +24 -0
  12. data/example/Rakefile +6 -0
  13. data/example/app/assets/config/manifest.js +3 -0
  14. data/example/app/assets/images/.keep +0 -0
  15. data/example/app/assets/javascripts/application.js +19 -0
  16. data/example/app/assets/javascripts/cable.js +13 -0
  17. data/example/app/assets/javascripts/channels/.keep +0 -0
  18. data/example/app/assets/javascripts/posts.coffee +3 -0
  19. data/example/app/assets/stylesheets/application.scss +7 -0
  20. data/example/app/assets/stylesheets/posts.scss +3 -0
  21. data/example/app/assets/stylesheets/scaffolds.scss +89 -0
  22. data/example/app/channels/application_cable/channel.rb +4 -0
  23. data/example/app/channels/application_cable/connection.rb +4 -0
  24. data/example/app/controllers/application_controller.rb +3 -0
  25. data/example/app/controllers/concerns/.keep +0 -0
  26. data/example/app/controllers/posts_controller.rb +74 -0
  27. data/example/app/helpers/application_helper.rb +2 -0
  28. data/example/app/helpers/posts_helper.rb +2 -0
  29. data/example/app/jobs/application_job.rb +2 -0
  30. data/example/app/mailers/application_mailer.rb +4 -0
  31. data/example/app/models/application_record.rb +3 -0
  32. data/example/app/models/concerns/.keep +0 -0
  33. data/example/app/models/post.rb +2 -0
  34. data/example/app/views/layouts/application.html.erb +14 -0
  35. data/example/app/views/layouts/mailer.html.erb +13 -0
  36. data/example/app/views/layouts/mailer.text.erb +1 -0
  37. data/example/app/views/posts/_form.html.erb +13 -0
  38. data/example/app/views/posts/_post.json.jbuilder +2 -0
  39. data/example/app/views/posts/edit.html.erb +6 -0
  40. data/example/app/views/posts/index.html.erb +31 -0
  41. data/example/app/views/posts/index.json.jbuilder +1 -0
  42. data/example/app/views/posts/new.html.erb +5 -0
  43. data/example/app/views/posts/show.html.erb +19 -0
  44. data/example/app/views/posts/show.json.jbuilder +1 -0
  45. data/example/bin/bundle +3 -0
  46. data/example/bin/rails +9 -0
  47. data/example/bin/rake +9 -0
  48. data/example/bin/setup +34 -0
  49. data/example/bin/spring +17 -0
  50. data/example/bin/update +29 -0
  51. data/example/config.ru +5 -0
  52. data/example/config/application.rb +15 -0
  53. data/example/config/boot.rb +3 -0
  54. data/example/config/cable.yml +9 -0
  55. data/example/config/database.yml +25 -0
  56. data/example/config/environment.rb +5 -0
  57. data/example/config/environments/development.rb +54 -0
  58. data/example/config/environments/production.rb +86 -0
  59. data/example/config/environments/test.rb +42 -0
  60. data/example/config/initializers/application_controller_renderer.rb +6 -0
  61. data/example/config/initializers/assets.rb +11 -0
  62. data/example/config/initializers/backtrace_silencers.rb +7 -0
  63. data/example/config/initializers/cookies_serializer.rb +5 -0
  64. data/example/config/initializers/filter_parameter_logging.rb +4 -0
  65. data/example/config/initializers/inflections.rb +16 -0
  66. data/example/config/initializers/mime_types.rb +4 -0
  67. data/example/config/initializers/new_framework_defaults.rb +24 -0
  68. data/example/config/initializers/session_store.rb +3 -0
  69. data/example/config/initializers/simple_form.rb +169 -0
  70. data/example/config/initializers/simple_form_bootstrap.rb +154 -0
  71. data/example/config/initializers/wrap_parameters.rb +14 -0
  72. data/example/config/locales/en.yml +23 -0
  73. data/example/config/locales/simple_form.en.yml +31 -0
  74. data/example/config/puma.rb +47 -0
  75. data/example/config/routes.rb +4 -0
  76. data/example/config/secrets.yml +22 -0
  77. data/example/config/spring.rb +6 -0
  78. data/example/db/migrate/20170427011041_create_posts.rb +11 -0
  79. data/example/db/schema.rb +23 -0
  80. data/example/db/seeds.rb +7 -0
  81. data/example/lib/assets/.keep +0 -0
  82. data/example/lib/tasks/.keep +0 -0
  83. data/example/lib/templates/erb/scaffold/_form.html.erb +13 -0
  84. data/example/log/.keep +0 -0
  85. data/example/public/404.html +67 -0
  86. data/example/public/422.html +67 -0
  87. data/example/public/500.html +66 -0
  88. data/example/public/apple-touch-icon-precomposed.png +0 -0
  89. data/example/public/apple-touch-icon.png +0 -0
  90. data/example/public/favicon.ico +0 -0
  91. data/example/public/robots.txt +5 -0
  92. data/example/test/controllers/.keep +0 -0
  93. data/example/test/controllers/posts_controller_test.rb +48 -0
  94. data/example/test/fixtures/.keep +0 -0
  95. data/example/test/fixtures/files/.keep +0 -0
  96. data/example/test/fixtures/posts.yml +11 -0
  97. data/example/test/helpers/.keep +0 -0
  98. data/example/test/integration/.keep +0 -0
  99. data/example/test/mailers/.keep +0 -0
  100. data/example/test/models/.keep +0 -0
  101. data/example/test/models/post_test.rb +7 -0
  102. data/example/test/test_helper.rb +10 -0
  103. data/example/tmp/.keep +0 -0
  104. data/example/vendor/assets/javascripts/.keep +0 -0
  105. data/example/vendor/assets/stylesheets/.keep +0 -0
  106. data/lib/simple_form_custom_inputs.rb +7 -0
  107. data/lib/simple_form_custom_inputs/simple_form/switch_input.rb +11 -0
  108. data/lib/simple_form_custom_inputs/version.rb +3 -0
  109. data/screenshot.png +0 -0
  110. data/simple_form_custom_inputs.gemspec +23 -0
  111. data/vendor/assets/javascripts/.keep +0 -0
  112. data/vendor/assets/javascripts/simple_form_custom_inputs.js +22 -0
  113. metadata +182 -0
@@ -0,0 +1,67 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>The change you wanted was rejected (422)</title>
5
+ <meta name="viewport" content="width=device-width,initial-scale=1">
6
+ <style>
7
+ body {
8
+ background-color: #EFEFEF;
9
+ color: #2E2F30;
10
+ text-align: center;
11
+ font-family: arial, sans-serif;
12
+ margin: 0;
13
+ }
14
+
15
+ div.dialog {
16
+ width: 95%;
17
+ max-width: 33em;
18
+ margin: 4em auto 0;
19
+ }
20
+
21
+ div.dialog > div {
22
+ border: 1px solid #CCC;
23
+ border-right-color: #999;
24
+ border-left-color: #999;
25
+ border-bottom-color: #BBB;
26
+ border-top: #B00100 solid 4px;
27
+ border-top-left-radius: 9px;
28
+ border-top-right-radius: 9px;
29
+ background-color: white;
30
+ padding: 7px 12% 0;
31
+ box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
32
+ }
33
+
34
+ h1 {
35
+ font-size: 100%;
36
+ color: #730E15;
37
+ line-height: 1.5em;
38
+ }
39
+
40
+ div.dialog > p {
41
+ margin: 0 0 1em;
42
+ padding: 1em;
43
+ background-color: #F7F7F7;
44
+ border: 1px solid #CCC;
45
+ border-right-color: #999;
46
+ border-left-color: #999;
47
+ border-bottom-color: #999;
48
+ border-bottom-left-radius: 4px;
49
+ border-bottom-right-radius: 4px;
50
+ border-top-color: #DADADA;
51
+ color: #666;
52
+ box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
53
+ }
54
+ </style>
55
+ </head>
56
+
57
+ <body>
58
+ <!-- This file lives in public/422.html -->
59
+ <div class="dialog">
60
+ <div>
61
+ <h1>The change you wanted was rejected.</h1>
62
+ <p>Maybe you tried to change something you didn't have access to.</p>
63
+ </div>
64
+ <p>If you are the application owner check the logs for more information.</p>
65
+ </div>
66
+ </body>
67
+ </html>
@@ -0,0 +1,66 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>We're sorry, but something went wrong (500)</title>
5
+ <meta name="viewport" content="width=device-width,initial-scale=1">
6
+ <style>
7
+ body {
8
+ background-color: #EFEFEF;
9
+ color: #2E2F30;
10
+ text-align: center;
11
+ font-family: arial, sans-serif;
12
+ margin: 0;
13
+ }
14
+
15
+ div.dialog {
16
+ width: 95%;
17
+ max-width: 33em;
18
+ margin: 4em auto 0;
19
+ }
20
+
21
+ div.dialog > div {
22
+ border: 1px solid #CCC;
23
+ border-right-color: #999;
24
+ border-left-color: #999;
25
+ border-bottom-color: #BBB;
26
+ border-top: #B00100 solid 4px;
27
+ border-top-left-radius: 9px;
28
+ border-top-right-radius: 9px;
29
+ background-color: white;
30
+ padding: 7px 12% 0;
31
+ box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
32
+ }
33
+
34
+ h1 {
35
+ font-size: 100%;
36
+ color: #730E15;
37
+ line-height: 1.5em;
38
+ }
39
+
40
+ div.dialog > p {
41
+ margin: 0 0 1em;
42
+ padding: 1em;
43
+ background-color: #F7F7F7;
44
+ border: 1px solid #CCC;
45
+ border-right-color: #999;
46
+ border-left-color: #999;
47
+ border-bottom-color: #999;
48
+ border-bottom-left-radius: 4px;
49
+ border-bottom-right-radius: 4px;
50
+ border-top-color: #DADADA;
51
+ color: #666;
52
+ box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
53
+ }
54
+ </style>
55
+ </head>
56
+
57
+ <body>
58
+ <!-- This file lives in public/500.html -->
59
+ <div class="dialog">
60
+ <div>
61
+ <h1>We're sorry, but something went wrong.</h1>
62
+ </div>
63
+ <p>If you are the application owner check the logs for more information.</p>
64
+ </div>
65
+ </body>
66
+ </html>
File without changes
File without changes
File without changes
@@ -0,0 +1,5 @@
1
+ # See http://www.robotstxt.org/robotstxt.html for documentation on how to use the robots.txt file
2
+ #
3
+ # To ban all spiders from the entire site uncomment the next two lines:
4
+ # User-agent: *
5
+ # Disallow: /
File without changes
@@ -0,0 +1,48 @@
1
+ require 'test_helper'
2
+
3
+ class PostsControllerTest < ActionDispatch::IntegrationTest
4
+ setup do
5
+ @post = posts(:one)
6
+ end
7
+
8
+ test "should get index" do
9
+ get posts_url
10
+ assert_response :success
11
+ end
12
+
13
+ test "should get new" do
14
+ get new_post_url
15
+ assert_response :success
16
+ end
17
+
18
+ test "should create post" do
19
+ assert_difference('Post.count') do
20
+ post posts_url, params: { post: { active: @post.active, content: @post.content, title: @post.title } }
21
+ end
22
+
23
+ assert_redirected_to post_url(Post.last)
24
+ end
25
+
26
+ test "should show post" do
27
+ get post_url(@post)
28
+ assert_response :success
29
+ end
30
+
31
+ test "should get edit" do
32
+ get edit_post_url(@post)
33
+ assert_response :success
34
+ end
35
+
36
+ test "should update post" do
37
+ patch post_url(@post), params: { post: { active: @post.active, content: @post.content, title: @post.title } }
38
+ assert_redirected_to post_url(@post)
39
+ end
40
+
41
+ test "should destroy post" do
42
+ assert_difference('Post.count', -1) do
43
+ delete post_url(@post)
44
+ end
45
+
46
+ assert_redirected_to posts_url
47
+ end
48
+ end
File without changes
File without changes
@@ -0,0 +1,11 @@
1
+ # Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
2
+
3
+ one:
4
+ title: MyString
5
+ content: MyText
6
+ active: false
7
+
8
+ two:
9
+ title: MyString
10
+ content: MyText
11
+ active: false
File without changes
File without changes
File without changes
File without changes
@@ -0,0 +1,7 @@
1
+ require 'test_helper'
2
+
3
+ class PostTest < ActiveSupport::TestCase
4
+ # test "the truth" do
5
+ # assert true
6
+ # end
7
+ end
@@ -0,0 +1,10 @@
1
+ ENV['RAILS_ENV'] ||= 'test'
2
+ require File.expand_path('../../config/environment', __FILE__)
3
+ require 'rails/test_help'
4
+
5
+ class ActiveSupport::TestCase
6
+ # Setup all fixtures in test/fixtures/*.yml for all tests in alphabetical order.
7
+ fixtures :all
8
+
9
+ # Add more helper methods to be used by all tests here...
10
+ end
data/example/tmp/.keep ADDED
File without changes
File without changes
File without changes
@@ -0,0 +1,7 @@
1
+ require "simple_form_custom_inputs/version"
2
+
3
+ autoload :SwitchInput, "simple_form_custom_inputs/simple_form/switch_input"
4
+
5
+ module SimpleFormCustomInputs
6
+ class Engine < ::Rails::Engine; end
7
+ end
@@ -0,0 +1,11 @@
1
+ class SwitchInput < SimpleForm::Inputs::BooleanInput
2
+ def input(wrapper_options)
3
+ input_html_options[:class] ||= {}
4
+ input_html_options[:class] << 'js-switch'
5
+
6
+ input_html_options[:data] ||= {}
7
+ input_html_options[:data].merge!({ color: "#12CA9E" }) unless input_html_options[:data][:color]
8
+ input_html_options[:data].merge!({ size: "medium" }) unless input_html_options[:data][:size]
9
+ super
10
+ end
11
+ end
@@ -0,0 +1,3 @@
1
+ module SimpleFormCustomInputs
2
+ VERSION = "0.0.1"
3
+ end
data/screenshot.png ADDED
Binary file
@@ -0,0 +1,23 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'simple_form_custom_inputs/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "simple_form_custom_inputs"
8
+ spec.version = SimpleFormCustomInputs::VERSION
9
+ spec.authors = ["Marcelo Barreto"]
10
+ spec.email = ["marcelobarretojunior@gmail.com"]
11
+
12
+ spec.summary = %q{Some custom inputs for simple_form}
13
+ spec.homepage = "https://github.com/marcelobarreto/simple_form_custom_inputs"
14
+
15
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
16
+ spec.bindir = "exe"
17
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
18
+ spec.require_paths = ["lib"]
19
+
20
+ spec.add_development_dependency "bundler", "~> 1.8"
21
+ spec.add_development_dependency "rake", "~> 10.0"
22
+ #spec.add_runtime_dependency 'rails-assets-jquery'
23
+ end
File without changes
@@ -0,0 +1,22 @@
1
+ var initSwitchery = function() {
2
+ var elem = $('.js-switch')
3
+ if (elem[0]){
4
+ var init = new Switchery(elem[0], {
5
+ color: elem.data('color'),
6
+ secondaryColor: elem.data('secondaryColor'),
7
+ jackColor: elem.data('jackColor'),
8
+ jackSecondaryColor: elem.data('jackSecondaryColor'),
9
+ size: elem.data('size')
10
+ });
11
+ }
12
+ }
13
+
14
+ var ready = function() {
15
+ initSwitchery();
16
+ };
17
+
18
+ if (typeof Turbolinks == "undefined") {
19
+ $(document).ready(ready);
20
+ } else {
21
+ $(document).on("turbolinks:load", ready);
22
+ }
metadata ADDED
@@ -0,0 +1,182 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: simple_form_custom_inputs
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Marcelo Barreto
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2017-04-27 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.8'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.8'
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
+ description:
42
+ email:
43
+ - marcelobarretojunior@gmail.com
44
+ executables: []
45
+ extensions: []
46
+ extra_rdoc_files: []
47
+ files:
48
+ - ".gitignore"
49
+ - ".rspec"
50
+ - ".travis.yml"
51
+ - Gemfile
52
+ - README.md
53
+ - Rakefile
54
+ - example/.gitignore
55
+ - example/Gemfile
56
+ - example/Gemfile.lock
57
+ - example/README.md
58
+ - example/Rakefile
59
+ - example/app/assets/config/manifest.js
60
+ - example/app/assets/images/.keep
61
+ - example/app/assets/javascripts/application.js
62
+ - example/app/assets/javascripts/cable.js
63
+ - example/app/assets/javascripts/channels/.keep
64
+ - example/app/assets/javascripts/posts.coffee
65
+ - example/app/assets/stylesheets/application.scss
66
+ - example/app/assets/stylesheets/posts.scss
67
+ - example/app/assets/stylesheets/scaffolds.scss
68
+ - example/app/channels/application_cable/channel.rb
69
+ - example/app/channels/application_cable/connection.rb
70
+ - example/app/controllers/application_controller.rb
71
+ - example/app/controllers/concerns/.keep
72
+ - example/app/controllers/posts_controller.rb
73
+ - example/app/helpers/application_helper.rb
74
+ - example/app/helpers/posts_helper.rb
75
+ - example/app/jobs/application_job.rb
76
+ - example/app/mailers/application_mailer.rb
77
+ - example/app/models/application_record.rb
78
+ - example/app/models/concerns/.keep
79
+ - example/app/models/post.rb
80
+ - example/app/views/layouts/application.html.erb
81
+ - example/app/views/layouts/mailer.html.erb
82
+ - example/app/views/layouts/mailer.text.erb
83
+ - example/app/views/posts/_form.html.erb
84
+ - example/app/views/posts/_post.json.jbuilder
85
+ - example/app/views/posts/edit.html.erb
86
+ - example/app/views/posts/index.html.erb
87
+ - example/app/views/posts/index.json.jbuilder
88
+ - example/app/views/posts/new.html.erb
89
+ - example/app/views/posts/show.html.erb
90
+ - example/app/views/posts/show.json.jbuilder
91
+ - example/bin/bundle
92
+ - example/bin/rails
93
+ - example/bin/rake
94
+ - example/bin/setup
95
+ - example/bin/spring
96
+ - example/bin/update
97
+ - example/config.ru
98
+ - example/config/application.rb
99
+ - example/config/boot.rb
100
+ - example/config/cable.yml
101
+ - example/config/database.yml
102
+ - example/config/environment.rb
103
+ - example/config/environments/development.rb
104
+ - example/config/environments/production.rb
105
+ - example/config/environments/test.rb
106
+ - example/config/initializers/application_controller_renderer.rb
107
+ - example/config/initializers/assets.rb
108
+ - example/config/initializers/backtrace_silencers.rb
109
+ - example/config/initializers/cookies_serializer.rb
110
+ - example/config/initializers/filter_parameter_logging.rb
111
+ - example/config/initializers/inflections.rb
112
+ - example/config/initializers/mime_types.rb
113
+ - example/config/initializers/new_framework_defaults.rb
114
+ - example/config/initializers/session_store.rb
115
+ - example/config/initializers/simple_form.rb
116
+ - example/config/initializers/simple_form_bootstrap.rb
117
+ - example/config/initializers/wrap_parameters.rb
118
+ - example/config/locales/en.yml
119
+ - example/config/locales/simple_form.en.yml
120
+ - example/config/puma.rb
121
+ - example/config/routes.rb
122
+ - example/config/secrets.yml
123
+ - example/config/spring.rb
124
+ - example/db/migrate/20170427011041_create_posts.rb
125
+ - example/db/schema.rb
126
+ - example/db/seeds.rb
127
+ - example/lib/assets/.keep
128
+ - example/lib/tasks/.keep
129
+ - example/lib/templates/erb/scaffold/_form.html.erb
130
+ - example/log/.keep
131
+ - example/public/404.html
132
+ - example/public/422.html
133
+ - example/public/500.html
134
+ - example/public/apple-touch-icon-precomposed.png
135
+ - example/public/apple-touch-icon.png
136
+ - example/public/favicon.ico
137
+ - example/public/robots.txt
138
+ - example/test/controllers/.keep
139
+ - example/test/controllers/posts_controller_test.rb
140
+ - example/test/fixtures/.keep
141
+ - example/test/fixtures/files/.keep
142
+ - example/test/fixtures/posts.yml
143
+ - example/test/helpers/.keep
144
+ - example/test/integration/.keep
145
+ - example/test/mailers/.keep
146
+ - example/test/models/.keep
147
+ - example/test/models/post_test.rb
148
+ - example/test/test_helper.rb
149
+ - example/tmp/.keep
150
+ - example/vendor/assets/javascripts/.keep
151
+ - example/vendor/assets/stylesheets/.keep
152
+ - lib/simple_form_custom_inputs.rb
153
+ - lib/simple_form_custom_inputs/simple_form/switch_input.rb
154
+ - lib/simple_form_custom_inputs/version.rb
155
+ - screenshot.png
156
+ - simple_form_custom_inputs.gemspec
157
+ - vendor/assets/javascripts/.keep
158
+ - vendor/assets/javascripts/simple_form_custom_inputs.js
159
+ homepage: https://github.com/marcelobarreto/simple_form_custom_inputs
160
+ licenses: []
161
+ metadata: {}
162
+ post_install_message:
163
+ rdoc_options: []
164
+ require_paths:
165
+ - lib
166
+ required_ruby_version: !ruby/object:Gem::Requirement
167
+ requirements:
168
+ - - ">="
169
+ - !ruby/object:Gem::Version
170
+ version: '0'
171
+ required_rubygems_version: !ruby/object:Gem::Requirement
172
+ requirements:
173
+ - - ">="
174
+ - !ruby/object:Gem::Version
175
+ version: '0'
176
+ requirements: []
177
+ rubyforge_project:
178
+ rubygems_version: 2.6.11
179
+ signing_key:
180
+ specification_version: 4
181
+ summary: Some custom inputs for simple_form
182
+ test_files: []