abracadabra 1.0.2 → 1.0.3

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f1f78acf9d1934bf40e2d2efad77bfe6b4ed4127
4
- data.tar.gz: 28b8156bb3c5dc500e15f5db765324704b34ac52
3
+ metadata.gz: a547e178b8cfdab8f627f326c25a717262c259c8
4
+ data.tar.gz: b9f09ee3fa7e063623b8f90e0ebbff941296bdf8
5
5
  SHA512:
6
- metadata.gz: 7e95f984e783c3f570dca808096b5b7133cb57d598b2a245e94c1e38ed176e0090897dc10c612750af3f9b291ea993cb917ea8b12ca08eca4eefedf695660191
7
- data.tar.gz: 9a421a6ef67b44e1305e8d6d7f90b583bb335a5ceb58b4836846d52e79d38760cc85d7dfaeaa1787096dd69af2232f0437852fefde6f550521589dfeab36801a
6
+ metadata.gz: 42b5af88fa0c4b382d48779cc039f4f360ca0f99a307d40f93abe1aa439075114a43c22097d5191ccf248a78e434f147e9208f6e08d1efb1c83d774897ae1a08
7
+ data.tar.gz: 799eed594cf39ee6f922fccddf8768d95bf94131f94b828cf1d0faa0dd45d6a141f6bed55765fdcf6ac3b3dc51804fa340a7cb17e7e266525c3827f8a371c765
data/README.md CHANGED
@@ -20,6 +20,8 @@ Or install it yourself as:
20
20
 
21
21
  ## Usage
22
22
 
23
+ * Requires JQuery, JQuery-UJS (rails.js), Bootstrap and Font-Awesome (unless you override the framework specific classes with CSS)
24
+
23
25
  In your `application.css`, AFTER Bootstrap (currently only supports Bootstrap), include the css file:
24
26
 
25
27
  ```css
@@ -40,28 +42,54 @@ The bread and butter of abracadabra is its helper, `click_to_edit`. Its pretty m
40
42
  <%= click_to_edit @user, path: user_path(@user), attribute: :name %>
41
43
  ```
42
44
 
43
- When a user clicks the link generated by this helper, a form with a text field input will replace the link. It's fully Rails compliant, and looks identical to a `form_for` with `remote: true`. Currently, it only responds to javascript, but other datatypes will be supported soon. Here's what it looks like:
45
+ When a user clicks the link generated by this helper, a form with a text field input will replace the link. It's fully Rails compliant, and looks identical to a `form_for` with `remote: true`. Here's what it looks like:
44
46
 
45
- [Video of abracadabra in action!](http://recordit.co/cpwdWIyEN4)
47
+ ![Abracadabra Demo](http://recordit.co/CbgPTahYix.gif "Abracadabra Demo")
46
48
 
47
- The first parameter is the object to be edited, and the only other required parameters are `path` and `attribute`. `path` specifies where the form will be submitted, and `attribute` specifies the column being updated.
49
+ The first parameter of `click_to_edit` is the object to be edited, and the only other required parameters are `path` and `attribute`. `path` specifies where the form will be submitted, and `attribute` specifies the column being updated.
48
50
 
49
- It accepts the following optional hash keys (more will be added soon):
51
+ It accepts the following parameters:
50
52
 
51
53
  ```ruby
54
+ ### REQUIRED ###
55
+ path: user_path(@user)
56
+ # Specifies where the form will be submitted.
57
+
58
+ attribute: :name
59
+ # Specifies what attribute your text field will be updating.
60
+
61
+
62
+ ### OPTIONAL ###
52
63
  class: "my-class"
53
- # A class to be added to the text input of the form.
64
+ # Class(es) to be added to the text input of the form. The class "abracadabra" is added either way.
65
+ # Default: only "abracadabra"
54
66
 
55
67
  value: "blah"
56
68
  # An alternate value, other than what object.attribute would return.
69
+ # Default: object.attribute
57
70
 
58
71
  method: "patch"
59
72
  # HTTP REST method to use. Use anything but "get".
73
+ # Default: "patch"
74
+
75
+ remote: true
76
+ # Same as link_to's remote: true, form submits via AJAX.
77
+ # Default: true
78
+
79
+ # IMPORTANT: `type` will be ignored if `remote = false` is used. HTML is the default
80
+ # in Rails for standard form submissions.
81
+ type: :js
82
+ # Content type -- responds to any content types (:js and :script can both be used to respond with Javascript).
83
+ # Default: :script (:js)
60
84
  ```
61
85
 
62
86
  ## Future & Contributing
63
87
 
64
- I would love anyone to add date pickers and other alternate field types to this. Any other ideas, feel free to contribute!
88
+ 1. I would love anyone to add date pickers and other alternate field types to this.
89
+
90
+ 2. I would love the different Bootstrap classes to be overridable with an initializer (config/abracadabra.rb) so that any framework could be used. Same with the Font-Awesome button classes.
91
+
92
+ Any other ideas, feel free to contribute!
65
93
 
66
94
  1. Fork it ( http://github.com/TrevorHinesley/abracadabra/fork )
67
95
  2. Create your feature branch (`git checkout -b my-new-feature`)
@@ -7,10 +7,10 @@ module Abracadabra
7
7
  value = options[:value] || instance.send(options[:attribute])
8
8
  method = options[:method] || "patch"
9
9
 
10
- if (options[:remote].nil? && options[:type].nil?) || options[:remote] == true
11
- remote = true
12
- else
10
+ if !options[:remote].nil? && options[:remote] == false
13
11
  remote = false
12
+ else
13
+ remote = true
14
14
  end
15
15
 
16
16
  data_type = options[:type].to_s.gsub(/^j+s+$/, "script") || "script"
@@ -1,5 +1,5 @@
1
1
  module Abracadabra
2
2
  module Rails
3
- VERSION = "1.0.2"
3
+ VERSION = "1.0.3"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: abracadabra
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Trevor Hinesley
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-03-27 00:00:00.000000000 Z
11
+ date: 2014-03-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails