backtastic 0.0.3 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +12 -10
- data/example/app/assets/javascripts/backbone/example.js.coffee +4 -3
- data/example/app/assets/javascripts/backbone/models/people.coffee +6 -6
- data/example/app/assets/javascripts/backbone/routers/people_router.coffee +6 -8
- data/example/app/models/person.rb +1 -1
- data/example/app/views/layouts/application.html.erb +2 -12
- data/example/spec/backtastic_spec.rb +5 -3
- data/example/spec/javascripts/models/person_spec.coffee +2 -3
- data/example/spec/javascripts/models/validation_spec.coffee +38 -0
- data/example/spec/javascripts/views/check_box_view_spec.coffee +17 -0
- data/example/spec/javascripts/views/select_field_view_spec.coffee +6 -0
- data/example/spec/javascripts/views/text_field_view_spec.coffee +17 -3
- data/lib/assets/javascripts/util/validation.coffee +24 -12
- data/lib/assets/javascripts/views/check_box_view.coffee +4 -1
- data/lib/assets/javascripts/views/form_field_view.coffee +15 -5
- data/lib/assets/javascripts/views/select_field_view.coffee +3 -0
- data/lib/backtastic.rb +18 -6
- data/lib/backtastic/version.rb +1 -1
- data/lib/tasks/validations.rake +17 -0
- data/lib/templates/rails_validations.coffee.erb +6 -0
- metadata +19 -22
data/README.md
CHANGED
@@ -16,29 +16,31 @@ Usage
|
|
16
16
|
To get started, add it to your Gemfile:
|
17
17
|
|
18
18
|
gem "backtastic"
|
19
|
-
|
19
|
+
|
20
20
|
Then, somewhere in your manifest, require it:
|
21
21
|
|
22
22
|
#= require "backtastic"
|
23
|
-
|
23
|
+
|
24
24
|
Next, you'll create a view that is a subclass of Backtastic.Views.FormView
|
25
25
|
|
26
26
|
class EditPersonView extends Backtastic.Views.FormView
|
27
|
-
|
27
|
+
|
28
28
|
template: JST["edit_person_view_tempate"]
|
29
29
|
|
30
30
|
Backtastic provides a render method that will invoke your template with the view itself as the template context. This means methods from the FormView are available for use in your templates, and this is how the form field helpers work.
|
31
31
|
|
32
32
|
%form
|
33
33
|
= @textField(label: "Name", field: "Name")
|
34
|
-
|
34
|
+
|
35
35
|
The field helper method (`@textField()` in this example) creates a subview of the appropriate type which renders a label and form input using twitter bootstrap friendly markup. They also listen to the model for validation errors and display appropriate styling and error messages.
|
36
36
|
|
37
37
|
Validation
|
38
38
|
----------
|
39
39
|
|
40
|
-
|
41
|
-
|
40
|
+
Backtastic supports both client side and server side validation. If you send back an error response with errors represented as jon, backtastic will decode the json and match up the error messages with fields.
|
41
|
+
|
42
|
+
As of 0.4, backtastic gives you a way to reflect (some) validations from rails models onto your backbone models. There is a rake task, backtastic:validations:build, which generates a coffeescript file that puts validation data from rails onto a Backtastic.Rails.validations. Then some where in your client side code, you can require this file and call Backtastic.applyValidations. See the example app code to understand better how all this fits together.
|
43
|
+
|
42
44
|
Example App
|
43
45
|
-----------
|
44
46
|
|
@@ -47,7 +49,7 @@ The best way to learn how to use backtastic is to spend some time checking out t
|
|
47
49
|
bundle install
|
48
50
|
rake db:migrate
|
49
51
|
bundle exec rails s
|
50
|
-
|
52
|
+
|
51
53
|
Point your browser at localhost:3000. But then you probably knew that already
|
52
54
|
|
53
55
|
Running specs
|
@@ -56,21 +58,21 @@ Running specs
|
|
56
58
|
The specs for backtastic are in the example as well so I can take advantage of the asset pipeline in my specs. To run them, do:
|
57
59
|
|
58
60
|
rake jasminerice:run
|
59
|
-
|
61
|
+
|
60
62
|
Future plans
|
61
63
|
------------
|
62
64
|
|
63
65
|
I'd like to have some metadata generated form rails and available to backbone so you could do something more formtasticy like:
|
64
66
|
|
65
67
|
@form fields["first_name", "last_name"]
|
66
|
-
|
68
|
+
|
67
69
|
|
68
70
|
Shameless self-promotion
|
69
71
|
------------------------
|
70
72
|
|
71
73
|
If in-person training in all this is something that could help you or someone you know, we've [got you covered](http://training.gaslightsoftware.com). Should you need help building a backbone rails app, we can [do that too](http://gaslightsoftware.com).
|
72
74
|
|
73
|
-
|
75
|
+
|
74
76
|
|
75
77
|
|
76
78
|
|
@@ -3,14 +3,15 @@
|
|
3
3
|
#= require_tree ./models
|
4
4
|
#= require_tree ./views
|
5
5
|
#= require_tree ./routers
|
6
|
-
#= require
|
6
|
+
#= require rails_validations
|
7
7
|
|
8
8
|
window.Example =
|
9
9
|
Models: {}
|
10
10
|
Collections: {}
|
11
11
|
Routers: {}
|
12
12
|
Views: {}
|
13
|
-
|
13
|
+
|
14
14
|
$ ->
|
15
15
|
new Example.Routers.PeopleRouter()
|
16
|
-
Backbone.history.start()
|
16
|
+
Backbone.history.start()
|
17
|
+
Backtastic.applyValidations(Example.Models, Backtastic.Rails.validations)
|
@@ -1,11 +1,11 @@
|
|
1
1
|
class Example.Models.Person extends Backbone.Model
|
2
2
|
urlRoot: "/people"
|
3
|
-
|
4
|
-
@validatePresenceOf "first_name"
|
5
|
-
|
6
|
-
@validateFormatOf "last_name",
|
7
|
-
|
3
|
+
|
4
|
+
# @validatePresenceOf "first_name"
|
5
|
+
|
6
|
+
# @validateFormatOf "last_name", with: /^J.*/
|
7
|
+
|
8
8
|
class Example.Collections.PeopleCollection extends Backbone.Collection
|
9
9
|
model: Example.Models.Person
|
10
|
-
|
10
|
+
|
11
11
|
url: "/people"
|
@@ -4,26 +4,24 @@ class Example.Routers.PeopleRouter extends Backbone.Router
|
|
4
4
|
@people = new Example.Collections.PeopleCollection(peopleJson)
|
5
5
|
@occupations = new Example.Collections.OccupationsCollection(occupationsJson)
|
6
6
|
@people.on "sync", @showPeople, @
|
7
|
-
@people.
|
8
|
-
=> @navigate "people/list", trigger: true
|
7
|
+
@people.on "add", @showPeople, @
|
9
8
|
@peopleView = new Example.Views.PeopleView(collection: @people, el: $("#people_view"))
|
10
9
|
@editPersonView = new Example.Views.EditPersonView(el: $("#edit_person"), occupations: @occupations)
|
11
10
|
@showPeople()
|
12
|
-
|
11
|
+
|
13
12
|
routes:
|
14
13
|
"people/new": "newPerson"
|
15
14
|
"people/list": "showPeople"
|
16
15
|
"people/:id/edit": "editPerson"
|
17
|
-
|
16
|
+
|
18
17
|
showPeople: ->
|
19
18
|
@peopleView.render()
|
20
19
|
@editPersonView.close()
|
21
|
-
|
20
|
+
|
22
21
|
newPerson: ->
|
23
22
|
person = new Example.Models.Person
|
24
|
-
@people.add
|
23
|
+
person.on "sync", => @people.add(person)
|
25
24
|
@editPersonView.edit(person)
|
26
|
-
|
25
|
+
|
27
26
|
editPerson: (id)->
|
28
27
|
@editPersonView.edit @people.get(id)
|
29
|
-
|
@@ -43,20 +43,10 @@
|
|
43
43
|
<div class="container">
|
44
44
|
<div class="content">
|
45
45
|
<div class="row">
|
46
|
-
<div class="
|
46
|
+
<div class="span12">
|
47
47
|
<%= yield %>
|
48
48
|
</div>
|
49
|
-
|
50
|
-
<div class="well sidebar-nav">
|
51
|
-
<h3>Sidebar</h3>
|
52
|
-
<ul class="nav nav-list">
|
53
|
-
<li class="nav-header">Sidebar</li>
|
54
|
-
<li><%= link_to "Link1", "/path1" %></li>
|
55
|
-
<li><%= link_to "Link2", "/path2" %></li>
|
56
|
-
<li><%= link_to "Link3", "/path3" %></li>
|
57
|
-
</ul>
|
58
|
-
</div><!--/.well -->
|
59
|
-
</div><!--/span-->
|
49
|
+
|
60
50
|
</div><!--/row-->
|
61
51
|
</div><!--/content-->
|
62
52
|
|
@@ -1,6 +1,8 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
describe "
|
4
|
-
|
5
|
-
Then {
|
3
|
+
describe "rails_validations" do
|
4
|
+
Given(:validations) { Backtastic.validations_for(Person) }
|
5
|
+
Then { validations[:first_name].should_not be_empty }
|
6
|
+
Then { validations[:first_name]["presence"].should == {} }
|
7
|
+
Then { binding.pry; validations[:last_name]["format"][:with].should == "/^S.*/"}
|
6
8
|
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
class BoringModel extends Backbone.Model
|
2
|
+
|
3
|
+
describe "validation", ->
|
4
|
+
beforeEach ->
|
5
|
+
BoringModel.validate
|
6
|
+
first_name:
|
7
|
+
presence: {}
|
8
|
+
last_name:
|
9
|
+
format:
|
10
|
+
with: "/^S.*/"
|
11
|
+
@model = new BoringModel
|
12
|
+
@validationErrors = {}
|
13
|
+
@model.on "error", (model, errors) =>
|
14
|
+
@validationErrors = errors
|
15
|
+
describe "presence", ->
|
16
|
+
describe "when not matching", ->
|
17
|
+
beforeEach ->
|
18
|
+
@model.set first_name: ""
|
19
|
+
it "should validate presence of", ->
|
20
|
+
expect(@validationErrors.first_name.length).toEqual 1
|
21
|
+
describe "when matching", ->
|
22
|
+
beforeEach ->
|
23
|
+
@model.set first_name: "Bill"
|
24
|
+
it "should validate presence of", ->
|
25
|
+
expect(@validationErrors.first_name).not.toBeDefined()
|
26
|
+
describe "format", ->
|
27
|
+
describe "when not matching", ->
|
28
|
+
beforeEach ->
|
29
|
+
@model.set last_name: "Not smith"
|
30
|
+
it "should validate format", ->
|
31
|
+
expect(@validationErrors.last_name.length).toEqual 1
|
32
|
+
describe "when matching", ->
|
33
|
+
beforeEach ->
|
34
|
+
@model.set last_name: "Smith"
|
35
|
+
it "should validate format", ->
|
36
|
+
expect(@validationErrors.last_name).not.toBeDefined()
|
37
|
+
|
38
|
+
|
@@ -24,4 +24,21 @@ describe "check box view", ->
|
|
24
24
|
@checkBoxFieldView.render()
|
25
25
|
it "render an unchecked check box if the value is false", ->
|
26
26
|
expect(@checkBoxFieldView.$("input[type=checkbox]").attr("checked")).toBeFalsy()
|
27
|
+
|
28
|
+
describe "updating model", ->
|
29
|
+
describe "when checking", ->
|
30
|
+
beforeEach ->
|
31
|
+
@checkBoxFieldView.render()
|
32
|
+
@checkBoxFieldView.$("input").attr("checked", true)
|
33
|
+
@checkBoxFieldView.updateModel()
|
34
|
+
it "should update the model", ->
|
35
|
+
expect(@model.get("awesome")).toBeTruthy()
|
36
|
+
describe "when unchecking", ->
|
37
|
+
beforeEach ->
|
38
|
+
@model.set awesome: true
|
39
|
+
@checkBoxFieldView.render()
|
40
|
+
@checkBoxFieldView.$("input").attr("checked", false)
|
41
|
+
@checkBoxFieldView.updateModel()
|
42
|
+
it "should update the model", ->
|
43
|
+
expect(@model.get("awesome")).toBeFalsy()
|
27
44
|
|
@@ -26,3 +26,9 @@ describe "select field view", ->
|
|
26
26
|
it "puts a label on it", ->
|
27
27
|
expect(@selectFieldView.$("label[for=occupation_id]")).toExist()
|
28
28
|
expect(@selectFieldView.$("label[for=occupation_id]")).toHaveText /Occupation/
|
29
|
+
describe "updating model", ->
|
30
|
+
beforeEach ->
|
31
|
+
@selectFieldView.$("select").val("1")
|
32
|
+
@selectFieldView.updateModel()
|
33
|
+
it "updates the model", ->
|
34
|
+
expect(@person.get("occupation_id")).toEqual "1"
|
@@ -15,7 +15,13 @@ describe "text field view", ->
|
|
15
15
|
it "puts a label on it", ->
|
16
16
|
expect(@textFieldView.$("label[for=name]")).toExist()
|
17
17
|
expect(@textFieldView.$("label[for=name]")).toHaveText /Name/
|
18
|
-
|
18
|
+
|
19
|
+
describe "updating model", ->
|
20
|
+
beforeEach ->
|
21
|
+
@textFieldView.$("input").val("Not bob")
|
22
|
+
@textFieldView.updateModel()
|
23
|
+
it "should update the model", ->
|
24
|
+
expect(@model.get("name")).toEqual "Not bob"
|
19
25
|
describe "displaying errors", ->
|
20
26
|
beforeEach ->
|
21
27
|
@textFieldView.displayErrors
|
@@ -24,11 +30,19 @@ describe "text field view", ->
|
|
24
30
|
expect(@textFieldView.$el).toHaveClass "error"
|
25
31
|
it "should add the error message", ->
|
26
32
|
expect(@textFieldView.$("span.help-inline")).toHaveText "totally borked"
|
33
|
+
describe "and then setting model attribute to something valid", ->
|
34
|
+
beforeEach ->
|
35
|
+
@model.set name: "Wut"
|
36
|
+
it "should remove error class", ->
|
37
|
+
expect(@textFieldView.$el).not.toHaveClass "error"
|
38
|
+
it "should remove the error message", ->
|
39
|
+
expect(@textFieldView.$("span.help-inline")).not.toExist()
|
40
|
+
|
27
41
|
describe "again", ->
|
28
42
|
beforeEach ->
|
29
43
|
@textFieldView.displayErrors
|
30
44
|
name: ["totally borked"]
|
31
45
|
it "should only display it once", ->
|
32
46
|
expect(@textFieldView.$("span.help-inline").size()).toEqual 1
|
33
|
-
|
34
|
-
|
47
|
+
|
48
|
+
|
@@ -1,15 +1,18 @@
|
|
1
1
|
Backtastic.Validators =
|
2
|
-
|
2
|
+
|
3
3
|
presence: (options) ->
|
4
4
|
(field, value) -> "is required" unless value?.length > 0
|
5
|
-
|
5
|
+
|
6
6
|
format: (options) ->
|
7
|
-
(
|
8
|
-
|
7
|
+
toRegExp = (str) ->
|
8
|
+
new RegExp(str.replace(/^\//, "").replace(/\/$/, ""))
|
9
|
+
pattern = if _.isRegExp(options?.with) then options?.with else toRegExp(options?.with)
|
10
|
+
(field, value) -> "must match specified format." unless value?.match(pattern)
|
11
|
+
|
9
12
|
Backtastic.Validation =
|
10
|
-
|
13
|
+
|
11
14
|
classMethods:
|
12
|
-
|
15
|
+
|
13
16
|
addValidator: (validator, field, options) ->
|
14
17
|
@validations or = {}
|
15
18
|
@validations[field] or= []
|
@@ -17,26 +20,35 @@ Backtastic.Validation =
|
|
17
20
|
|
18
21
|
validatePresenceOf: (field) ->
|
19
22
|
@addValidator("presence", field)
|
20
|
-
|
23
|
+
|
21
24
|
validateFormatOf: (field, options) ->
|
22
25
|
@addValidator("format", field, options)
|
23
|
-
|
26
|
+
|
27
|
+
validate: (validations) ->
|
28
|
+
@validations = {}
|
29
|
+
for field, fieldValidations of validations
|
30
|
+
for validationType, options of fieldValidations
|
31
|
+
@addValidator(validationType, field, options)
|
32
|
+
|
24
33
|
addError: (field, error) ->
|
25
34
|
@errors[field] or= []
|
26
35
|
@errors[field].push error
|
27
|
-
|
36
|
+
|
28
37
|
clearErrors: -> @errors = {}
|
29
|
-
|
38
|
+
|
30
39
|
validateAttribute: (attribute, value) ->
|
31
40
|
return unless @constructor.validations[attribute]
|
32
41
|
for validator in @constructor.validations[attribute]
|
33
42
|
error = validator(attribute, value)
|
34
43
|
@addError(attribute, error) if error
|
35
|
-
|
44
|
+
|
36
45
|
validate: (attributes) ->
|
37
46
|
@clearErrors()
|
38
47
|
return unless @constructor.validations
|
39
48
|
@validateAttribute(attr, value) for attr, value of attributes
|
40
49
|
@errors if _.keys(@errors).length > 0
|
41
|
-
|
50
|
+
|
42
51
|
Backtastic.include Backbone.Model, Backtastic.Validation
|
52
|
+
|
53
|
+
Backtastic.applyValidations = (models, validations) ->
|
54
|
+
model.validate(validations[name]) for name, model of models
|
@@ -5,4 +5,7 @@ class Backtastic.Views.CheckBoxView extends Backtastic.Views.FormFieldView
|
|
5
5
|
|
6
6
|
render: ->
|
7
7
|
super
|
8
|
-
@$('input').prop("checked", "checked") if @model.get(@field)
|
8
|
+
@$('input').prop("checked", "checked") if @model.get(@field)
|
9
|
+
|
10
|
+
updateModel: ->
|
11
|
+
@model.set @field, @$("input").attr("checked") == "checked"
|
@@ -1,5 +1,5 @@
|
|
1
1
|
class Backtastic.Views.FormFieldView extends Backtastic.View
|
2
|
-
|
2
|
+
|
3
3
|
constructor: (options)->
|
4
4
|
super
|
5
5
|
@field = options.field
|
@@ -7,15 +7,23 @@ class Backtastic.Views.FormFieldView extends Backtastic.View
|
|
7
7
|
@parentView = options.parentView
|
8
8
|
@parentView.on "rendered", => @afterParentRender()
|
9
9
|
@model.on "error", (model, errors) => @displayErrors(errors)
|
10
|
-
|
10
|
+
@model.on "change:#{@field}", @clearErrors, @
|
11
|
+
|
12
|
+
events:
|
13
|
+
"blur input": "updateModel"
|
14
|
+
"keyup input": "updateModel"
|
15
|
+
|
16
|
+
updateModel: ->
|
17
|
+
@model.set @field, @$("input").val()
|
18
|
+
|
11
19
|
afterParentRender: ->
|
12
20
|
@setElement(@parentView.$("[data-view-id=#{@cid}]"))
|
13
21
|
@render()
|
14
|
-
|
22
|
+
|
15
23
|
render: ->
|
16
24
|
super
|
17
25
|
@$el.addClass "control-group"
|
18
|
-
|
26
|
+
|
19
27
|
displayErrors: (errors) ->
|
20
28
|
errors = errors.errors if errors.errors
|
21
29
|
if errors?[@field]
|
@@ -23,6 +31,8 @@ class Backtastic.Views.FormFieldView extends Backtastic.View
|
|
23
31
|
@$el.addClass "error"
|
24
32
|
@$("span.help-inline").remove()
|
25
33
|
@$el.append "<span class='help-inline'>#{message}</span>" for message in messages
|
26
|
-
|
34
|
+
|
27
35
|
clearErrors: ->
|
28
36
|
@$el.removeClass "error"
|
37
|
+
@$("span.help-inline").remove()
|
38
|
+
|
data/lib/backtastic.rb
CHANGED
@@ -7,12 +7,24 @@ require "active_support/inflections"
|
|
7
7
|
module Backtastic
|
8
8
|
class BacktasticEngine < Rails::Engine
|
9
9
|
end
|
10
|
-
|
11
|
-
def self.
|
12
|
-
|
13
|
-
|
14
|
-
|
10
|
+
|
11
|
+
def self.validations_for(model)
|
12
|
+
validations = {}
|
13
|
+
model.validators.each do |validator|
|
14
|
+
attribute = validator.attributes.first
|
15
|
+
validator_type = validator.class.to_s.gsub(/^ActiveModel::Validations::/, "").gsub(/Validator$/, "").downcase
|
16
|
+
validations[attribute] ||= {}
|
17
|
+
validations[attribute][validator_type] = options_from(validator)
|
15
18
|
end
|
16
|
-
|
19
|
+
validations
|
17
20
|
end
|
21
|
+
|
22
|
+
def self.options_from(validator)
|
23
|
+
options = validator.options.dup
|
24
|
+
options.each do |option, value|
|
25
|
+
options[option] = value.is_a?(Regexp) ? value.inspect : value
|
26
|
+
end
|
27
|
+
options
|
28
|
+
end
|
29
|
+
|
18
30
|
end
|
data/lib/backtastic/version.rb
CHANGED
@@ -0,0 +1,17 @@
|
|
1
|
+
namespace :backtastic do
|
2
|
+
namespace :validations do
|
3
|
+
desc "Build put validation metadata in app/assets/javascripts"
|
4
|
+
task :build => :environment do
|
5
|
+
output = ENV["VALIDATIONS_FILE"] || Rails.root.join("app", "assets", "javascripts", "rails_validations.coffee")
|
6
|
+
Dir[Rails.root.join "app", "models", '**', '*.rb'].each do |file|
|
7
|
+
begin
|
8
|
+
require file
|
9
|
+
rescue
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
erb = ERB.new File.read(File.join(File.dirname(__FILE__), "..", "templates", "rails_validations.coffee.erb"))
|
14
|
+
File.open(output, "w") { |f| f.puts(erb.result) }
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: backtastic
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.4.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-10-12 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec
|
16
|
-
requirement: &
|
16
|
+
requirement: &70250067046740 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :development
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70250067046740
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: pry
|
27
|
-
requirement: &
|
27
|
+
requirement: &70250067046320 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :development
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70250067046320
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: haml_coffee_assets
|
38
|
-
requirement: &
|
38
|
+
requirement: &70250067045800 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ! '>='
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: '0'
|
44
44
|
type: :runtime
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *70250067045800
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: rails-backbone
|
49
|
-
requirement: &
|
49
|
+
requirement: &70250067045360 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ! '>='
|
@@ -54,10 +54,10 @@ dependencies:
|
|
54
54
|
version: '0'
|
55
55
|
type: :runtime
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *70250067045360
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: inflection-js-rails
|
60
|
-
requirement: &
|
60
|
+
requirement: &70250067044620 !ruby/object:Gem::Requirement
|
61
61
|
none: false
|
62
62
|
requirements:
|
63
63
|
- - ! '>='
|
@@ -65,10 +65,10 @@ dependencies:
|
|
65
65
|
version: '0'
|
66
66
|
type: :runtime
|
67
67
|
prerelease: false
|
68
|
-
version_requirements: *
|
68
|
+
version_requirements: *70250067044620
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: twitter-bootstrap-rails
|
71
|
-
requirement: &
|
71
|
+
requirement: &70250067043440 !ruby/object:Gem::Requirement
|
72
72
|
none: false
|
73
73
|
requirements:
|
74
74
|
- - ! '>='
|
@@ -76,10 +76,10 @@ dependencies:
|
|
76
76
|
version: '0'
|
77
77
|
type: :runtime
|
78
78
|
prerelease: false
|
79
|
-
version_requirements: *
|
79
|
+
version_requirements: *70250067043440
|
80
80
|
- !ruby/object:Gem::Dependency
|
81
81
|
name: activesupport
|
82
|
-
requirement: &
|
82
|
+
requirement: &70250067042920 !ruby/object:Gem::Requirement
|
83
83
|
none: false
|
84
84
|
requirements:
|
85
85
|
- - ! '>='
|
@@ -87,7 +87,7 @@ dependencies:
|
|
87
87
|
version: '0'
|
88
88
|
type: :runtime
|
89
89
|
prerelease: false
|
90
|
-
version_requirements: *
|
90
|
+
version_requirements: *70250067042920
|
91
91
|
description: ! "Create backbone twitter bootstrap form views easily using helpers.
|
92
92
|
Handle and display\n validation failures from rails.\n "
|
93
93
|
email:
|
@@ -172,6 +172,7 @@ files:
|
|
172
172
|
- example/script/rails
|
173
173
|
- example/spec/backtastic_spec.rb
|
174
174
|
- example/spec/javascripts/models/person_spec.coffee
|
175
|
+
- example/spec/javascripts/models/validation_spec.coffee
|
175
176
|
- example/spec/javascripts/spec.js.coffee
|
176
177
|
- example/spec/javascripts/util/module_spec.coffee
|
177
178
|
- example/spec/javascripts/views/check_box_view_spec.coffee
|
@@ -200,6 +201,8 @@ files:
|
|
200
201
|
- lib/assets/javascripts/views/text_field_view.coffee
|
201
202
|
- lib/backtastic.rb
|
202
203
|
- lib/backtastic/version.rb
|
204
|
+
- lib/tasks/validations.rake
|
205
|
+
- lib/templates/rails_validations.coffee.erb
|
203
206
|
- spec/spec_helper.rb
|
204
207
|
- vendor/assets/javascripts/bootstrap-datepicker.js
|
205
208
|
- vendor/assets/javascripts/jquery.serializeObject.js.coffee
|
@@ -216,18 +219,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
216
219
|
- - ! '>='
|
217
220
|
- !ruby/object:Gem::Version
|
218
221
|
version: '0'
|
219
|
-
segments:
|
220
|
-
- 0
|
221
|
-
hash: -824130021871109077
|
222
222
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
223
223
|
none: false
|
224
224
|
requirements:
|
225
225
|
- - ! '>='
|
226
226
|
- !ruby/object:Gem::Version
|
227
227
|
version: '0'
|
228
|
-
segments:
|
229
|
-
- 0
|
230
|
-
hash: -824130021871109077
|
231
228
|
requirements: []
|
232
229
|
rubyforge_project:
|
233
230
|
rubygems_version: 1.8.17
|