simphi 0.0.3 → 0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +26 -5
- data/lib/simphi.rb +8 -1
- data/simphi.gemspec +2 -1
- data/vendor/assets/stylesheets/simphi.css +1 -1
- metadata +15 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f0708b3a846d74d39691a8621ed9873c1d340f7e
|
4
|
+
data.tar.gz: bcf0cdfc136a9e747a0244b02509e5c830bd2fa3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fe86c1df85ae87c508dcfd9578ada17d9a47980233cd668fe7358fb5d62e83d4cf3f530d6d09f5c069868d6efc141c27fa1ad2679dc9e48f133079a3227c9e6e
|
7
|
+
data.tar.gz: 7b9e1ad1878178d826d0046897ca07fad0b6fbeabab5b4e42a0edf8c686057c7c9c2e54a85140757085bb32bf96783ae84aca770203786fc1b15daec8be1e604
|
data/README.md
CHANGED
@@ -6,9 +6,8 @@ This gem were implemented for natural using hashes in web development.
|
|
6
6
|
The gem divided in two parts: middleware and simple_form custom input.
|
7
7
|
With *Simphi::Middleware* you can send params to server and they will be rebuilt to normal hash and with simple_form input the hash can be sended in proper format to server.
|
8
8
|
|
9
|
-
|
9
|
+
#### Middleware
|
10
10
|
The middleware relies to `-simphi` part of the hash key.
|
11
|
-
#### Example
|
12
11
|
```ruby
|
13
12
|
"contacts-simphi": {
|
14
13
|
"don't matter what here": {
|
@@ -31,7 +30,7 @@ The middleware relies to `-simphi` part of the hash key.
|
|
31
30
|
}
|
32
31
|
```
|
33
32
|
|
34
|
-
|
33
|
+
#### Hash Input
|
35
34
|
SimphiInput is a SimpleForm custom input which create a typical hash structure for input with key, value.
|
36
35
|
|
37
36
|
[Simphi Hash Input](http://gdurl.com/wTNH)
|
@@ -64,7 +63,8 @@ Or install it yourself as:
|
|
64
63
|
|
65
64
|
$ gem install simphi
|
66
65
|
|
67
|
-
|
66
|
+
#### Middleware
|
67
|
+
To use middleware you need to add such lines to your `config/application.rb` file:
|
68
68
|
|
69
69
|
```ruby
|
70
70
|
require "simphi/middleware"
|
@@ -74,8 +74,29 @@ class Application < Rails::Application
|
|
74
74
|
end
|
75
75
|
```
|
76
76
|
|
77
|
-
|
77
|
+
#### Simphi Input
|
78
|
+
Hash input can be used as simple_form input with `as: :simphi` option. But you can reassign `simphi` to another name:
|
79
|
+
```ruby
|
80
|
+
# config/initializer/simphi.rb
|
81
|
+
module SimpleForm
|
82
|
+
class FormBuilder
|
83
|
+
map_type :name_which_you_want, to: Simphi::SimphiInput
|
84
|
+
end
|
85
|
+
end
|
86
|
+
```
|
87
|
+
But to make `simphi` fully functional assets should be included
|
88
|
+
|
89
|
+
```js
|
90
|
+
// app/assets/javascripts/application.js
|
78
91
|
|
92
|
+
//= require simphi
|
93
|
+
```
|
94
|
+
|
95
|
+
```js
|
96
|
+
// app/assets/stylesheets/application.css
|
97
|
+
|
98
|
+
*= require "simphi" // NOTE: this file is only for hidding 'sample' hash element which used for generating new hash pairs
|
99
|
+
```
|
79
100
|
## Contributing
|
80
101
|
|
81
102
|
1. Fork it ( https://github.com/AlexBeznos/simphi/fork )
|
data/lib/simphi.rb
CHANGED
@@ -1,6 +1,13 @@
|
|
1
1
|
require "simple_form"
|
2
|
+
require "simphi/simphi_input"
|
2
3
|
|
3
4
|
module Simphi
|
5
|
+
class Engine < Rails::Engine
|
6
|
+
end
|
4
7
|
end
|
5
8
|
|
6
|
-
SimpleForm
|
9
|
+
module SimpleForm
|
10
|
+
class FormBuilder
|
11
|
+
map_type :simphi, to: Simphi::SimphiInput
|
12
|
+
end
|
13
|
+
end
|
data/simphi.gemspec
CHANGED
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
4
|
|
5
5
|
Gem::Specification.new do |spec|
|
6
6
|
spec.name = "simphi"
|
7
|
-
spec.version = "0.
|
7
|
+
spec.version = "0.1"
|
8
8
|
spec.authors = ["Alex Beznos"]
|
9
9
|
spec.email = ["beznosa@yahoo.com"]
|
10
10
|
spec.summary = %q{Ability to deale with hash like inputs}
|
@@ -19,6 +19,7 @@ Gem::Specification.new do |spec|
|
|
19
19
|
spec.add_dependency "simple_form", "> 2.0"
|
20
20
|
spec.add_dependency "rack", "~> 1.6.4"
|
21
21
|
spec.add_dependency "coffee-rails"
|
22
|
+
spec.add_dependency "jquery-rails", "~> 4.0.5"
|
22
23
|
|
23
24
|
spec.add_development_dependency "bundler", "~> 1.7"
|
24
25
|
spec.add_development_dependency "rake", "~> 10.0"
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: simphi
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: '0.1'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alex Beznos
|
@@ -52,6 +52,20 @@ dependencies:
|
|
52
52
|
- - '>='
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: jquery-rails
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ~>
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 4.0.5
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ~>
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 4.0.5
|
55
69
|
- !ruby/object:Gem::Dependency
|
56
70
|
name: bundler
|
57
71
|
requirement: !ruby/object:Gem::Requirement
|