abracadabra 1.1.3 → 1.1.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3c899beafe18d929653a5b9bacc1c6e6f183cd24
4
- data.tar.gz: 3444425c261b8f51e4fcabdfc2eb1fd3385d01f7
3
+ metadata.gz: 0f6be915a98686f681e12658208d1597ee3d0114
4
+ data.tar.gz: 048b658309331f1170ba7955dee5beca1bb5cbd8
5
5
  SHA512:
6
- metadata.gz: 664782d7c2229e3cb112f24f8438dce6aa38ca1f9bae8db6ebbc5b4e1ccd5068019e37a03c3207eea6a78d8e103ac60af6d6ecb03671e89e5cc1bf592f685d3e
7
- data.tar.gz: 6428bb075a016c431e9eb519e9b3fa5fe9c7ea2fbb248a7fb5fe818d0ff99e458db32bcfdbd13d410899b279af00dbe206b23a036a5c4b4cd0d9bbf5cba4e72f
6
+ metadata.gz: 9193a97298456380a147ce104f474886a2e13f71dc4b57d035d2f799b0c98e693479094dfd6b8e08efc87c407406408ca0ca346237b4602b163ed537a0b29daf
7
+ data.tar.gz: 1679b17fb3bff3d262953b039708ba54086d32831cb95b0eee2c4120483435e2cde3dc0ce2b58de2a3a58ee373acee4c0e3cdb944933e6f258772fec33bf5662
data/README.md CHANGED
@@ -1,3 +1,5 @@
1
+ [![Gem Version](https://badge.fury.io/rb/abracadabra.svg)](http://badge.fury.io/rb/abracadabra)
2
+
1
3
  # Abracadabra
2
4
 
3
5
  The gem that swaps out text with a fully-compliant Rails form in one click.
@@ -51,94 +53,44 @@ The first parameter of `click_to_edit` is the object to be edited, and the only
51
53
 
52
54
  It accepts the following parameters:
53
55
 
56
+ #### REQUIRED
57
+ - `path: user_path(@user)` - Specifies where the form will be submitted.
58
+
59
+ - `attribute: :name` - Specifies what attribute your text field will be updating.
60
+
61
+ #### OPTIONAL
62
+ - `class: "my-class"` - Class(es) to be added to the abracadabra link. The class "abracadabra" is added # either way. [*Default:* `"abracadabra"`]
63
+
64
+ - `id: "my-id"` - ID to be added to the abracadabra link. [*Default:* `nil`]
65
+
66
+ - `value: "blah"` - An alternate value, other than what object.attribute would return. [*Default:* `object.attribute`]
67
+
68
+ - `method: "patch"` - HTTP REST method to use. Use anything but "get". [*Default:* `"patch"`]
69
+
70
+ - `buttonless: true` - Removes submit and cancel buttons, submission and cancellation is then one through the Enter/Tab and Escape keys, respectively. [*Default:* `false`]
71
+
72
+ - `remote: true` - Same as link_to's `remote: true`, form submits via AJAX. [*Default:* `true`]
73
+
74
+ - `type: :js` - Content type -- responds to any content type (`:js` and `:script` are interchangeable). [*Default:* `:script`] ***IMPORTANT: `type` will be ignored if `remote = false` is used. HTML is the default in Rails for standard form submissions.***
75
+
76
+ - `deletable: true` OR `deletable: "Are you sure?"` - Puts a link to DELETE the object (obviously, it always uses DELETE as the HTTP verb). If a boolean is used, it is submitted upon clicking. If a string is used, a confirmation dialog will prompt them using the string before submitting. [*Default:* `false`] ***IMPORTANT: On `ajax:success`, this will remove the specific abracadabra instance from the DOM entirely. ALSO, this will be remote if the main form is remote.***
77
+
78
+ - `deletable_path: user_path(@user)` - Specifies where the form will be submitted. [*Default:* `path` (uses the same path as the main form)]
79
+
80
+ - `deletable_type: :js` - Deletable content type -- responds to any content type (:js and :script can both be used to respond with Javascript). [*Default:* `:script`]
81
+
82
+ - `tab_to_next: true` OR `tab_to_next: ".my-class"` - Opens the next abracadabra instance after successful form submission (main form, not the DELETE link's submission). If a boolean is used, `.abracadabra` is the selector used to find the next instance to open. If a string is used, that will be the selector, so be sure to use standard JQuery selector syntax (i.e. `.class` and `#id`). [*Default:* `false`] ***IMPORTANT: If you use a string, and it's a class, this abracadabra instance MUST have the same class as well.***
83
+
84
+ - `submit_on_blur: true` - Submit form when focus leaves the input, rather than simply closing it out. [*Default:* `false`]
85
+
86
+ #### EXAMPLES
87
+ ##### *SIMPLE*
54
88
  ```ruby
55
- ### REQUIRED ###
56
- path: user_path(@user)
57
- # Description: Specifies where the form will be submitted.
58
-
59
- attribute: :name
60
- # Description: Specifies what attribute your text field will be updating.
61
-
62
-
63
- ### OPTIONAL ###
64
- class: "my-class"
65
- # Description: Class(es) to be added to the abracadabra link. The class
66
- # "abracadabra" is added # either way.
67
- # Default: only "abracadabra"
68
-
69
- id: "my-id"
70
- # Description: ID to be added to the abracadabra link.
71
- # Default: nil (No ID)
72
-
73
- value: "blah"
74
- # Description: An alternate value, other than what object.attribute would return.
75
- # Default: object.attribute
76
-
77
- method: "patch"
78
- # Description: HTTP REST method to use. Use anything but "get".
79
- # Default: "patch"
80
-
81
- buttonless: true
82
- # Description: Removes submit and cancel buttons, submission and cancellation is then
83
- # done through the Enter/Tab and Escape keys, respectively.
84
- # Default: false
85
-
86
- remote: true
87
- # Description: Same as link_to's `remote: true`, form submits via AJAX.
88
- # Default: true
89
-
90
- type: :js
91
- # IMPORTANT: `type` will be ignored if `remote = false` is used. HTML is the default
92
- # in Rails for standard form submissions.
93
- # Description: Content type -- responds to any content type (:js and :script can both be
94
- # used to respond with Javascript).
95
- # Default: :script (:js)
96
-
97
- deletable: true
98
- # OR
99
- deletable: "Are you sure?"
100
- # IMPORTANT: On ajax:success, this will remove the specific abracadabra instance from
101
- # the DOM entirely. ALSO, this will be remote if the main form is remote.
102
- # Boolean: DELETE will be submitted without a confirmation dialog
103
- # String: Confirmation dialog, with the string as the message, will be displayed after
104
- # clicking the DELETE link
105
- # Description: Puts a link to DELETE the object (obviously, it always uses DELETE as
106
- # the HTTP verb).
107
- # Default: false
108
-
109
- deletable_path: user_path(@user)
110
- # Description: Specifies where the form will be submitted.
111
- # Default: path (uses the same path as the main form if `deletable_path` isn't declared).
112
-
113
- deletable_type: :js
114
- # Description: Deletable content type -- responds to any content type (:js and :script
115
- # can both be used to respond with Javascript).
116
- # Default: :script (:js)
117
-
118
- tab_to_next: true
119
- # OR
120
- tab_to_next: ".my-class"
121
- # IMPORTANT: If use a string, and it's a class, this abracadabra instance MUST have the same
122
- # class as well.
123
- # Boolean: Open the next abracadabra instance after successful form submission (main
124
- # form, not the DELETE link's submission) by using `.abracadabra` as the selector.
125
- # String: The class or ID of the next abracadabra instance to open on successful form
126
- # submission. Use `.` before a class selector or `#` before a an ID selector just as you
127
- # would when finding an element in Javascript.
128
- # Description: Puts a link to DELETE the object (obviously, it always uses DELETE as the
129
- # HTTP verb).
130
- # Default: false
131
-
132
- submit_on_blur: true
133
- # Description: Submit form when focus leaves the input, rather than simply closing it
134
- # out.
135
- # Default: false
136
-
137
- ### EXAMPLE ###
138
- # Simple
139
89
  click_to_edit @friend, path: friend_path(@friend), attribute: :name, deletable: true
90
+ ```
140
91
 
141
- # Using a bunch of options
92
+ ##### *COMPLEX*
93
+ ```ruby
142
94
  click_to_edit @friend,
143
95
  path: friend_path(@friend),
144
96
  attribute: :name,
@@ -0,0 +1,22 @@
1
+ .abracadabra { border-bottom: 1px dashed; }
2
+
3
+ .abracadabra:hover { text-decoration: none; }
4
+
5
+ .abracadabra-container { display: block; }
6
+
7
+ .abracadabra-container > .abracadabra-form > .control-group > .abracadabra-input-and-button-wrapper > .abracadabra-input-container {
8
+ width: 60%;
9
+ display: inline-block;
10
+ position: relative;
11
+ }
12
+
13
+ .abracadabra-container > .abracadabra-form > .control-group > .abracadabra-input-and-button-wrapper > .abracadabra-buttons {
14
+ width: 40%;
15
+ display: inline-block;
16
+ }
17
+
18
+ .abracadabra-container > .abracadabra-form > .control-group > .abracadabra-input-and-button-wrapper > .abracadabra-input-container > .abracadabra-delete-container {
19
+ position: absolute;
20
+ top: 50%;
21
+ right: 6px;
22
+ }
@@ -1,5 +1,5 @@
1
1
  module Abracadabra
2
2
  module Rails
3
- VERSION = "1.1.3"
3
+ VERSION = "1.1.4"
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.1.3
4
+ version: 1.1.4
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-04-15 00:00:00.000000000 Z
11
+ date: 2014-05-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -67,6 +67,7 @@ files:
67
67
  - Rakefile
68
68
  - abracadabra.gemspec
69
69
  - app/assets/javascripts/abracadabra.js
70
+ - app/assets/stylesheets/abracadabra-scss.css.scss
70
71
  - app/assets/stylesheets/abracadabra.css
71
72
  - app/helpers/abracadabra/rails/view_helper.rb
72
73
  - lib/abracadabra.rb