erroneous 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/LICENSE +20 -0
- data/README.rdoc +39 -0
- data/lib/erroneous/railtie.rb +10 -0
- data/lib/erroneous/version.rb +3 -0
- data/lib/erroneous.rb +33 -0
- metadata +69 -0
data/LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2010 Kevin Sylvestre
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.rdoc
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
= Formula
|
2
|
+
|
3
|
+
Formula is a Rails form generator that generates simple clean markup. The project aims to let users create semantically beautiful forms without introducing too much syntax. The goal is to make integrating advanced layout systems (such as grid systems) as simple as possible.
|
4
|
+
|
5
|
+
== Installation
|
6
|
+
|
7
|
+
gem install formula
|
8
|
+
|
9
|
+
== Examples
|
10
|
+
|
11
|
+
<% formula_form_for @user do |f| %>
|
12
|
+
<%= f.input :email %>
|
13
|
+
<%= f.input :password %>
|
14
|
+
<% end %>
|
15
|
+
|
16
|
+
<% formula_form_for @user do |f| %>
|
17
|
+
<%= f.input :email, :label => "Email:", :hint => "We promise never to bother you." %>
|
18
|
+
<%= f.input :password, :label => "Password:", :hint => "Must be at least six characters." %>
|
19
|
+
<% end %>
|
20
|
+
|
21
|
+
<% formula_form_for @company do |f|
|
22
|
+
<%= f.input :url, :class => 'grid-04' %>
|
23
|
+
<%= f.input :phone, :class => 'grid-04' %>
|
24
|
+
<%= f.input :email, :class => 'grid-04' %>
|
25
|
+
<% end %>
|
26
|
+
|
27
|
+
<% formula_form_for @user do |f| %>
|
28
|
+
<%= f.input :email, :label => "Email:", :class => 'grid-06 %>
|
29
|
+
<%= f.input :password, :label => "Password:", :class => 'grid-06' %>
|
30
|
+
<% formula_fields_for @user.payment do |payment_f| %>
|
31
|
+
<%= f.input :credit_card_number, :label => 'Number:', :class => 'grid-08' %>
|
32
|
+
<%= f.input :credit_card_verification, :label => 'CVV:', :class => 'grid-02' %>
|
33
|
+
<%= f.input :credit_card_expiration, :label => 'Expiration:', :class => 'grid-02' %>
|
34
|
+
<% end %>
|
35
|
+
<% end %>
|
36
|
+
|
37
|
+
== Copyright
|
38
|
+
|
39
|
+
Copyright (c) 2010 Kevin Sylvestre. See LICENSE for details.
|
data/lib/erroneous.rb
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
module Erroneous
|
2
|
+
|
3
|
+
require 'erroneous/railtie' if defined?(Rails)
|
4
|
+
|
5
|
+
mattr_accessor :error_class
|
6
|
+
@@error_class = 'errors'
|
7
|
+
|
8
|
+
mattr_accessor :error_tag
|
9
|
+
@@error_tag = :div
|
10
|
+
|
11
|
+
# Output basic sentence errors.
|
12
|
+
#
|
13
|
+
# Usage:
|
14
|
+
#
|
15
|
+
# <%= errors(@user, :name) %>
|
16
|
+
#
|
17
|
+
# Equivalent:
|
18
|
+
#
|
19
|
+
# <%- if @user.errors[:name] -%>
|
20
|
+
# <%= content_tag(:div, :class => 'errors' ) do %>
|
21
|
+
# <%= @user.errors[:name].to_sentence %>
|
22
|
+
# <% end %>
|
23
|
+
# <%- end -%>
|
24
|
+
|
25
|
+
def errors(object, method, options = {})
|
26
|
+
if object.errors[method]
|
27
|
+
content_tag(::Erroneous.error_tag, :class => ::Erroneous.error_class) do
|
28
|
+
object.errors[method].to_sentence
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
end
|
metadata
ADDED
@@ -0,0 +1,69 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: erroneous
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease: false
|
5
|
+
segments:
|
6
|
+
- 0
|
7
|
+
- 0
|
8
|
+
- 1
|
9
|
+
version: 0.0.1
|
10
|
+
platform: ruby
|
11
|
+
authors:
|
12
|
+
- Kevin Sylvestre
|
13
|
+
autorequire:
|
14
|
+
bindir: bin
|
15
|
+
cert_chain: []
|
16
|
+
|
17
|
+
date: 2010-12-25 00:00:00 -05:00
|
18
|
+
default_executable:
|
19
|
+
dependencies: []
|
20
|
+
|
21
|
+
description: Erroneous adds inline errors to Rails views in a simple, sentence like format.
|
22
|
+
email:
|
23
|
+
- kevin@ksylvest.com
|
24
|
+
executables: []
|
25
|
+
|
26
|
+
extensions: []
|
27
|
+
|
28
|
+
extra_rdoc_files: []
|
29
|
+
|
30
|
+
files:
|
31
|
+
- lib/erroneous/railtie.rb
|
32
|
+
- lib/erroneous/version.rb
|
33
|
+
- lib/erroneous.rb
|
34
|
+
- README.rdoc
|
35
|
+
- LICENSE
|
36
|
+
has_rdoc: true
|
37
|
+
homepage: http://github.com/ksylvest/erroneous
|
38
|
+
licenses: []
|
39
|
+
|
40
|
+
post_install_message:
|
41
|
+
rdoc_options: []
|
42
|
+
|
43
|
+
require_paths:
|
44
|
+
- lib
|
45
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
46
|
+
none: false
|
47
|
+
requirements:
|
48
|
+
- - ">="
|
49
|
+
- !ruby/object:Gem::Version
|
50
|
+
segments:
|
51
|
+
- 0
|
52
|
+
version: "0"
|
53
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
54
|
+
none: false
|
55
|
+
requirements:
|
56
|
+
- - ">="
|
57
|
+
- !ruby/object:Gem::Version
|
58
|
+
segments:
|
59
|
+
- 0
|
60
|
+
version: "0"
|
61
|
+
requirements: []
|
62
|
+
|
63
|
+
rubyforge_project:
|
64
|
+
rubygems_version: 1.3.7
|
65
|
+
signing_key:
|
66
|
+
specification_version: 3
|
67
|
+
summary: An easy way to display inline errors in forms
|
68
|
+
test_files: []
|
69
|
+
|