follows_function 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +17 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +74 -0
- data/Rakefile +1 -0
- data/follows_function.gemspec +23 -0
- data/lib/follows_function.rb +7 -0
- data/lib/follows_function/version.rb +3 -0
- metadata +81 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 19874f01ada0c11dbeaef247ba28464f3f3932c7
|
4
|
+
data.tar.gz: 3a9d3b2ddcc44bbb5fcd6ae437958aaadfd82232
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 22a167e124a062cec6dd76ec1b0a2d6f0a9da6746d510df4b2b5527c2aa7b25e4f9e4c5110b0c5a4fe1be4769805c6821a678f06a9638f95fe824e5a79c66f46
|
7
|
+
data.tar.gz: 0f8b7d1d45ce1a24f2c2c27e415a2a270d817cf91c6cc6307ac4acfae98c835d25ea8826b22a5a3b2b32aa5c3c173ffda53a18fadbaa8d2402730943846016c1
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2014 nickbender
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
#NOTE: This gem is in progress. All of this readme is currently LIES!!!!
|
2
|
+
|
3
|
+
#Follows Function
|
4
|
+
|
5
|
+
_Form follows function_ is a principle associated with modern architecture and industrial design in the 20th century. The principle is that the shape of a building or object should be primarily based upon its intended function or purpose.
|
6
|
+
|
7
|
+
The __Follows Function__ gem seeks to make your rails form code work even more magically and cleanly than the rails defaults. It allows clean syntax, easy integration with a number of different css frameworks, and implements fun features like client side validation and searchable multi-select (via jquery.Chosen).
|
8
|
+
|
9
|
+
So to begin...
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
gem 'follows_function'
|
13
|
+
```
|
14
|
+
|
15
|
+
Should be in your Gemfile. And as usual..
|
16
|
+
|
17
|
+
```
|
18
|
+
$ bundle install
|
19
|
+
```
|
20
|
+
|
21
|
+
There are a number of helpful generator functions to prep follows_function for your app.
|
22
|
+
|
23
|
+
```
|
24
|
+
$ rails generate ff:bootstrap
|
25
|
+
$ rails generate ff:pure
|
26
|
+
$ rails generate ff:neat
|
27
|
+
...
|
28
|
+
# etc
|
29
|
+
```
|
30
|
+
|
31
|
+
Each generator adds requisite css and js to your _application_ files, as well as establishes defaults for client-side-validation display. There are a number of configurable SASS variables for each framework that can be configured to your given tastes. They can be found [here](#).
|
32
|
+
|
33
|
+
Syntax for your forms will remain largely the same as they currently do, but can be further customized.
|
34
|
+
|
35
|
+
```
|
36
|
+
<%= form_ff_for(@object,
|
37
|
+
ff: { validate: true,
|
38
|
+
chosen_select: true,
|
39
|
+
labels: expand,
|
40
|
+
input_width: 'span3'
|
41
|
+
}) do |f|
|
42
|
+
<%= f.input
|
43
|
+
# etc
|
44
|
+
end
|
45
|
+
%>
|
46
|
+
```
|
47
|
+
|
48
|
+
As you can see, the :ff hash contains many options that can be passed to individual forms, or also set as defaults in a config file:
|
49
|
+
|
50
|
+
```
|
51
|
+
FollowsFunction.configure do |config|
|
52
|
+
config.validate = true
|
53
|
+
config.chosen_select = true
|
54
|
+
config.css = bootstrap
|
55
|
+
#...
|
56
|
+
#etc
|
57
|
+
end
|
58
|
+
```
|
59
|
+
|
60
|
+
##Why?
|
61
|
+
At Margin, we found ourselves using a lot of the same gems in every project. Simpleform, ClientSideValidations, Chosen, and various css frameworks, but realized the task of inserting all these into a new app was both tedius and time consuming given the vast number of pieces in motion.
|
62
|
+
|
63
|
+
##Where's My Framework?
|
64
|
+
If you find that we're missing your favorite open source css library, you can see our guide on integrating your own variables and helpers [here](#).
|
65
|
+
|
66
|
+
##Won't this cause a lot of bloat?
|
67
|
+
FollowsFunction dynamically inserts only the framework assets you need both into your app and onto your slug. The approriate css and javascript assets are only included if you specify them in a config file or use them on a form. Plus, the gem's total size is only X.
|
68
|
+
|
69
|
+
##What if I want to use a jquery plugin that's not included?
|
70
|
+
Feel free to send us a PR including any library you think is crucial that we've missed. See our [guide](#) on how to do so. Be warned though, we have some strong opinions, and won't increase our footprint unless we feel it adds to the gem's overall functionality.
|
71
|
+
|
72
|
+
##License
|
73
|
+
[MIT](http://www.tldrlegal.com/license/mit-license) - Go nuts!
|
74
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
@@ -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 'follows_function/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "follows_function"
|
8
|
+
spec.version = FollowsFunction::VERSION
|
9
|
+
spec.authors = ["nickbender"]
|
10
|
+
spec.email = ["nickbender@gmail.com"]
|
11
|
+
spec.summary = "Keep your forms clean and magical"
|
12
|
+
spec.description = "Aggregates and simplifies form creation in Rails"
|
13
|
+
spec.homepage = "http://github.com/marginio/follows_function"
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files`.split($/)
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_development_dependency "bundler", "~> 1.4"
|
22
|
+
spec.add_development_dependency "rake"
|
23
|
+
end
|
metadata
ADDED
@@ -0,0 +1,81 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: follows_function
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- nickbender
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-01-13 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.4'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ~>
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.4'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - '>='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
description: Aggregates and simplifies form creation in Rails
|
42
|
+
email:
|
43
|
+
- nickbender@gmail.com
|
44
|
+
executables: []
|
45
|
+
extensions: []
|
46
|
+
extra_rdoc_files: []
|
47
|
+
files:
|
48
|
+
- .gitignore
|
49
|
+
- Gemfile
|
50
|
+
- LICENSE.txt
|
51
|
+
- README.md
|
52
|
+
- Rakefile
|
53
|
+
- follows_function.gemspec
|
54
|
+
- lib/follows_function.rb
|
55
|
+
- lib/follows_function/version.rb
|
56
|
+
homepage: http://github.com/marginio/follows_function
|
57
|
+
licenses:
|
58
|
+
- MIT
|
59
|
+
metadata: {}
|
60
|
+
post_install_message:
|
61
|
+
rdoc_options: []
|
62
|
+
require_paths:
|
63
|
+
- lib
|
64
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - '>='
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
70
|
+
requirements:
|
71
|
+
- - '>='
|
72
|
+
- !ruby/object:Gem::Version
|
73
|
+
version: '0'
|
74
|
+
requirements: []
|
75
|
+
rubyforge_project:
|
76
|
+
rubygems_version: 2.0.7
|
77
|
+
signing_key:
|
78
|
+
specification_version: 4
|
79
|
+
summary: Keep your forms clean and magical
|
80
|
+
test_files: []
|
81
|
+
has_rdoc:
|