c80_modal_forms 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: f779aa2c288cd32a6ca9c1a041cc3116624fbf78
4
+ data.tar.gz: c5b6820b1ff4e2d9f0a16205e35add3c4e6a2412
5
+ SHA512:
6
+ metadata.gz: 3ff75a998f472dec51560b529fafdfb6f64a759be204de0549ebc7a819737e57c0f47df92584568bb05f4da6ec2f824ac2a9178853fda64576587728c3000197
7
+ data.tar.gz: e1a4a9c607536bfa2633ae7ab9c2157a52519f0b31b069d92f8b0af211be2ace5f4c8a10b4013563e4fc2137638d0ff93655388dc40de88dfc5fbdece9b8fdac
data/.gitignore ADDED
@@ -0,0 +1,11 @@
1
+ /.idea/
2
+ /.bundle/
3
+ /.yardoc
4
+ /Gemfile.lock
5
+ /_yardoc/
6
+ /coverage/
7
+ /doc/
8
+ /pkg/
9
+ /spec/reports/
10
+ /tmp/
11
+ *.gem
data/.travis.yml ADDED
@@ -0,0 +1,3 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.1.4
@@ -0,0 +1,13 @@
1
+ # Contributor Code of Conduct
2
+
3
+ As contributors and maintainers of this project, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities.
4
+
5
+ We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, age, or religion.
6
+
7
+ Examples of unacceptable behavior by participants include the use of sexual language or imagery, derogatory comments or personal attacks, trolling, public or private harassment, insults, or other unprofessional conduct.
8
+
9
+ Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. Project maintainers who do not follow the Code of Conduct may be removed from the project team.
10
+
11
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers.
12
+
13
+ This Code of Conduct is adapted from the [Contributor Covenant](http:contributor-covenant.org), version 1.0.0, available at [http://contributor-covenant.org/version/1/0/0/](http://contributor-covenant.org/version/1/0/0/)
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in c80_modal_forms.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2015 C80609A
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,49 @@
1
+ # C80ModalForms
2
+
3
+ Small gem containing single `modal_form.js` file provides basic functionality for using Bootstrap modal forms.
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem 'c80_modal_forms'
11
+ ```
12
+
13
+ And then execute:
14
+
15
+ $ bundle
16
+
17
+ Or install it yourself as:
18
+
19
+ $ gem install c80_modal_forms
20
+
21
+ ## Usage
22
+
23
+ NOTE: This gem uses `jQuery` gem and `bootstrap-sass` gem.
24
+
25
+ Ensure that application's Gemfile contains these lines:
26
+ ```ruby
27
+ gem 'jquery-rails'
28
+ gem 'bootstrap-sass'
29
+ ```
30
+
31
+ You will need to add these lines into your `application.js`:
32
+ ```js
33
+ //= require bootstrap/modal
34
+ //= require c80_modal_forms
35
+ ```
36
+
37
+ ## Development
38
+
39
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `bin/console` for an interactive prompt that will allow you to experiment.
40
+
41
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release` to create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
42
+
43
+ ## Contributing
44
+
45
+ 1. Fork it ( https://github.com/[my-github-username]/c80_modal_forms/fork )
46
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
47
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
48
+ 4. Push to the branch (`git push origin my-new-feature`)
49
+ 5. Create a new Pull Request
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1 @@
1
+ #= require modal_forms
@@ -0,0 +1,65 @@
1
+ /**
2
+ * Created by scout on 3/25/15.
3
+ * "методы" по работе с модальными окнами.
4
+ *
5
+ */
6
+
7
+ (function($) {
8
+
9
+ $.fn.modal_success = function(){
10
+ //console.log("modal_success>");
11
+
12
+ // close modal
13
+ this.modal('hide');
14
+
15
+ // clear form input elements
16
+ this.find('input[type="text"]').val('');
17
+ this.find('textarea').val('');
18
+
19
+ // clear error state
20
+ this.clear_previous_errors();
21
+ };
22
+
23
+ $.fn.render_form_errors = function(errors){
24
+
25
+ var $form = this;
26
+ this.clear_previous_errors();
27
+ var model = this.data('model');
28
+
29
+ // show error messages in input form-group help-block
30
+ $.each(errors, function(field, messages){
31
+ var $input = $('input[name="' + model + '[' + field + ']"]');
32
+ if ($input.length == 0) {
33
+ $input = $('textarea[name="' + model + '[' + field + ']"]');
34
+ }
35
+ $input.closest('.form-group').addClass('has-error').find('.help-block').html( messages.join(' ') );
36
+ });
37
+
38
+ };
39
+
40
+ $.fn.clear_previous_errors = function(){
41
+ $('.form-group.has-error', this).each(function(){
42
+ //console.log($('.help-block', $(this)));
43
+ $('.help-block', $(this)).html('');
44
+ $(this).removeClass('has-error');
45
+ });
46
+ $.rails.enableFormElements($(this));
47
+ };
48
+
49
+ $.fn.my_render_form_errors = function(errors) {
50
+
51
+ var model = this.data('model');
52
+
53
+ $.each(errors, function(field, messages) {
54
+
55
+ var $span = $('span#' + model + '_' + field);
56
+ //console.log($span);
57
+ $span.closest('.form-group').addClass('has-error');
58
+ $span.html( messages.join(' & ') );
59
+
60
+ });
61
+
62
+ };
63
+
64
+ }(jQuery));
65
+
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "c80_modal_forms"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start
data/bin/setup ADDED
@@ -0,0 +1,7 @@
1
+ #!/bin/bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+
5
+ bundle install
6
+
7
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,25 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'c80_modal_forms/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "c80_modal_forms"
8
+ spec.version = C80ModalForms::VERSION
9
+ spec.authors = ["C80609A"]
10
+ spec.email = ["c080609a@gmail.com"]
11
+
12
+ spec.summary = 'Bootstrap modal forms js asset'
13
+ spec.description = 'Small gem containing single `modal_form.js` file provides basic functionality for using Bootstrap modal forms.'
14
+ spec.homepage = "http://github.com/c80609a/c80_modal_forms"
15
+ spec.license = "MIT"
16
+
17
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
18
+ spec.bindir = "exe"
19
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
20
+ spec.require_paths = ["lib"]
21
+
22
+ spec.add_development_dependency "bundler", "~> 1.9"
23
+ spec.add_development_dependency "rake", "~> 10.0"
24
+ spec.add_dependency 'rails', '~> 4.1', '>= 4.1.4'
25
+ end
@@ -0,0 +1,3 @@
1
+ module C80ModalForms
2
+ VERSION = "0.1.0"
3
+ end
@@ -0,0 +1,9 @@
1
+ require "c80_modal_forms/version"
2
+
3
+ module C80ModalForms
4
+ module Rails
5
+ class Engine < ::Rails::Engine
6
+
7
+ end
8
+ end
9
+ end
metadata ADDED
@@ -0,0 +1,107 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: c80_modal_forms
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - C80609A
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2015-12-21 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.9'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.9'
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: rails
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '4.1'
48
+ - - ">="
49
+ - !ruby/object:Gem::Version
50
+ version: 4.1.4
51
+ type: :runtime
52
+ prerelease: false
53
+ version_requirements: !ruby/object:Gem::Requirement
54
+ requirements:
55
+ - - "~>"
56
+ - !ruby/object:Gem::Version
57
+ version: '4.1'
58
+ - - ">="
59
+ - !ruby/object:Gem::Version
60
+ version: 4.1.4
61
+ description: Small gem containing single `modal_form.js` file provides basic functionality
62
+ for using Bootstrap modal forms.
63
+ email:
64
+ - c080609a@gmail.com
65
+ executables: []
66
+ extensions: []
67
+ extra_rdoc_files: []
68
+ files:
69
+ - ".gitignore"
70
+ - ".travis.yml"
71
+ - CODE_OF_CONDUCT.md
72
+ - Gemfile
73
+ - LICENSE.txt
74
+ - README.md
75
+ - Rakefile
76
+ - app/assets/javascripts/c80_modal_forms.js.coffee
77
+ - app/assets/javascripts/modal_forms.js
78
+ - bin/console
79
+ - bin/setup
80
+ - c80_modal_forms.gemspec
81
+ - lib/c80_modal_forms.rb
82
+ - lib/c80_modal_forms/version.rb
83
+ homepage: http://github.com/c80609a/c80_modal_forms
84
+ licenses:
85
+ - MIT
86
+ metadata: {}
87
+ post_install_message:
88
+ rdoc_options: []
89
+ require_paths:
90
+ - lib
91
+ required_ruby_version: !ruby/object:Gem::Requirement
92
+ requirements:
93
+ - - ">="
94
+ - !ruby/object:Gem::Version
95
+ version: '0'
96
+ required_rubygems_version: !ruby/object:Gem::Requirement
97
+ requirements:
98
+ - - ">="
99
+ - !ruby/object:Gem::Version
100
+ version: '0'
101
+ requirements: []
102
+ rubyforge_project:
103
+ rubygems_version: 2.5.1
104
+ signing_key:
105
+ specification_version: 4
106
+ summary: Bootstrap modal forms js asset
107
+ test_files: []