phantom_nested_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: cb1202f8b3930c3384795ea84a38008c4bb7744a
4
+ data.tar.gz: a9ce7645eb51712efbc55b3f895d533a9f5525e4
5
+ SHA512:
6
+ metadata.gz: 34735969893fa7d27b46af090434d3bd7a1802ba352c7ba9767d003e728f73df19f12d7af653b91b3725888e96632f65e3eb48bd2de752dcba497e898bb4d616
7
+ data.tar.gz: e6e8386d27420f5fd9a66c83f67be69062bee70d1e1a700e0c208d4d8b10a2c068ca1b7d9cf40415d3d5a7c14c8d5a5cf0ed5d6febec4d94a70f9dad43b8139e
data/README.md ADDED
@@ -0,0 +1 @@
1
+ Helpers for Twitter Bootstrap v3.
@@ -0,0 +1,4 @@
1
+ module PhantomNestedForms
2
+ class Engine < Rails::Engine
3
+ end
4
+ end
@@ -0,0 +1,12 @@
1
+ require 'nested_form/builder_mixin'
2
+ require 'phantom_forms/form_builders/validate_form_builder'
3
+
4
+ module PhantomNestedForms
5
+ module FormBuilders
6
+
7
+ class ValidateNestedFormBuilder < PhantomForms::FormBuilders::ValidateFormBuilder
8
+ include ::NestedForm::BuilderMixin
9
+ end
10
+
11
+ end
12
+ end
@@ -0,0 +1,25 @@
1
+ module PhantomNestedForms
2
+ module Helper
3
+
4
+ def remote_nested_form_for(object, options = {}, &block)
5
+ options[:validate] = true
6
+ options[:builder] = PhantomNestedForms::FormBuilders::ValidateNestedFormBuilder
7
+ options[:html] = {:class => 'remote-form form'}
8
+ options[:remote] = true
9
+ content_tag :div, class: "row" do
10
+ content_tag :div, class: "span12 well" do
11
+ nested_form_for(object, options, &block)
12
+ end
13
+ end
14
+ end
15
+
16
+ def modal_nested_form_for(object, options = {}, &block)
17
+ options[:validate] = true
18
+ options[:builder] = PhantomNestedForms::FormBuilders::ValidateNestedFormBuilder
19
+ options[:html] = {:'data-type' => 'script', :class => 'remote-form'}
20
+ options[:remote] = true
21
+ nested_form_for(object, options, &block)
22
+ end
23
+
24
+ end
25
+ end
@@ -0,0 +1,8 @@
1
+ require 'phantom_nested_forms/helper'
2
+ require 'phantom_nested_forms/engine'
3
+ require 'phantom_nested_forms/form_builders/validate_nested_form_builder'
4
+
5
+ module PhantomNestedForms
6
+ end
7
+
8
+ ActionView::Base.send :include, PhantomNestedForms::Helper
@@ -0,0 +1,23 @@
1
+ formBuilder =
2
+ add: (element, settings, message) ->
3
+ if element.data("valid") isnt false
4
+ element.data "valid", false
5
+ element.parent().parent().addClass "error"
6
+ element.parent().find(".message").addClass "error help-inline"
7
+ $('<span/>').addClass('help-inline').text(message).appendTo(element.parent())
8
+
9
+ remove: (element, settings) ->
10
+ element.parent().parent().removeClass('error')
11
+ element.parent().find(".message").removeClass "error help-inline"
12
+ element.parent().find('span.help-inline').remove()
13
+ element.data "valid", true
14
+
15
+ window.Rails4ClientSideValidations.formBuilders["PhantomNestedForms::FormBuilders::ValidateNestedFormBuilder"] = formBuilder
16
+
17
+ $ ->
18
+
19
+ window.Rails4ClientSideValidations.callbacks.element.fail = (element, message, callback) ->
20
+ callback()
21
+ if element.data("valid") isnt false
22
+ element.parent().parent().addClass "error"
23
+ element.parent().find(".message").addClass "error help-inline"
@@ -0,0 +1 @@
1
+ //= require nested_forms
metadata ADDED
@@ -0,0 +1,96 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: phantom_nested_forms
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Vassil Kalkov
8
+ - Rei Kagetsuki
9
+ - Nakaya Yukiharu
10
+ autorequire:
11
+ bindir: bin
12
+ cert_chain: []
13
+ date: 2013-09-23 00:00:00.000000000 Z
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: phantom_forms
17
+ requirement: !ruby/object:Gem::Requirement
18
+ requirements:
19
+ - - ~>
20
+ - !ruby/object:Gem::Version
21
+ version: 0.1.0
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ requirements:
26
+ - - ~>
27
+ - !ruby/object:Gem::Version
28
+ version: 0.1.0
29
+ - !ruby/object:Gem::Dependency
30
+ name: nested_form
31
+ requirement: !ruby/object:Gem::Requirement
32
+ requirements:
33
+ - - '>='
34
+ - !ruby/object:Gem::Version
35
+ version: '0'
36
+ type: :runtime
37
+ prerelease: false
38
+ version_requirements: !ruby/object:Gem::Requirement
39
+ requirements:
40
+ - - '>='
41
+ - !ruby/object:Gem::Version
42
+ version: '0'
43
+ - !ruby/object:Gem::Dependency
44
+ name: rails4_client_side_validations
45
+ requirement: !ruby/object:Gem::Requirement
46
+ requirements:
47
+ - - '>='
48
+ - !ruby/object:Gem::Version
49
+ version: '0'
50
+ type: :runtime
51
+ prerelease: false
52
+ version_requirements: !ruby/object:Gem::Requirement
53
+ requirements:
54
+ - - '>='
55
+ - !ruby/object:Gem::Version
56
+ version: '0'
57
+ description: rails helpers for bootstrap 3
58
+ email: info@genshin.org
59
+ executables: []
60
+ extensions: []
61
+ extra_rdoc_files: []
62
+ files:
63
+ - lib/phantom_nested_forms.rb
64
+ - lib/phantom_nested_forms/form_builders/validate_nested_form_builder.rb
65
+ - lib/phantom_nested_forms/engine.rb
66
+ - lib/phantom_nested_forms/helper.rb
67
+ - vendor/assets/javascripts/phantom_nested_forms.js
68
+ - vendor/assets/javascripts/nested_forms.js.coffee
69
+ - README.md
70
+ homepage: http://github.com/Genshin/phantom_nested_forms
71
+ licenses:
72
+ - GNU GPL-3
73
+ - AGPL-3
74
+ metadata: {}
75
+ post_install_message:
76
+ rdoc_options: []
77
+ require_paths:
78
+ - lib
79
+ required_ruby_version: !ruby/object:Gem::Requirement
80
+ requirements:
81
+ - - '>='
82
+ - !ruby/object:Gem::Version
83
+ version: 1.8.7
84
+ required_rubygems_version: !ruby/object:Gem::Requirement
85
+ requirements:
86
+ - - '>='
87
+ - !ruby/object:Gem::Version
88
+ version: '0'
89
+ requirements:
90
+ - none
91
+ rubyforge_project:
92
+ rubygems_version: 2.0.3
93
+ signing_key:
94
+ specification_version: 4
95
+ summary: Phantom Nested Forms
96
+ test_files: []