dynaspan 0.1.3 → 0.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: e9b455af36f7c95a7137eb21eaf324fde00ea1f2
4
- data.tar.gz: fcb4fe125d655e073758f0abac44b2e482d9ec03
3
+ metadata.gz: 9a6d88f02b0f8e7c140de6c419a7fa391d7d9aed
4
+ data.tar.gz: 817aa769f8db94ce27e00f2955bcd88c6ef7bcc9
5
5
  SHA512:
6
- metadata.gz: a64c0720b725150455340c76ef4a582840289f8885185eb1fbcc7991de51dd60c881f40f80999aec0cbedb6ef46fcb64b08afa407f84b12c227fbc106a083996
7
- data.tar.gz: 93241c205fda5b256c85baaaa90c277b723e905a4ebe7786a4094c2c91c801052454cf9c5b4f1816bee2206ffc406635d8a91f3adefbc9820be77ebb8bfd00d3
6
+ metadata.gz: 16b9ad7c7aeb3076fedd671d2867a2cb42a52463d000c427f577b000d67fe4b0f803b0dbbd3993c1af21bde31192098b415675ae037dc5bc994d0d19036c7564
7
+ data.tar.gz: 2df958a70f54d49faed2a9b20481299c1f9b304242a0cd1a8f35e616d7fc517afb7bb1f068755c1a071b6e08b7b5d2510e8597456879f6b33a9ee6fabbf475c7
@@ -0,0 +1,3 @@
1
+ # Contributor Code of Conduct
2
+
3
+ For you, brethren, have been called to liberty; only do not use liberty as an opportunity for the flesh, but through love serve one another. For all the law is fulfilled in one word, even in this: “You shall love your neighbor as yourself.” But if you bite and devour one another, beware lest you be consumed by one another! - [Galatians 5:13-15](https://www.biblegateway.com/passage/?search=Gal.5.13-Gal.5.15&version=NKJV)
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- ##Dynaspan
1
+ ##Dynaspan - The magic AJAX just happens!
2
2
  [![Gem Version](https://badge.fury.io/rb/dynaspan.svg)](http://badge.fury.io/rb/dynaspan)
3
3
  [![Code Climate](https://codeclimate.com/github/danielpclark/dynaspan/badges/gpa.svg)](https://codeclimate.com/github/danielpclark/dynaspan)
4
4
  #####[JSFiddle Demo](http://jsfiddle.net/680v09y8/)
@@ -46,6 +46,7 @@ You can use either `dynaspan_text_field` or `dynaspan_text_area` in any of your
46
46
  ```ruby
47
47
  dynaspan_text_field(Object,OptionalNestedObject,SymField,OptionalEditText,OptionalOptionsHash)
48
48
  dynaspan_text_area(Object,OptionalNestedObject,SymField,OptionalEditText,OptionalOptionsHash)
49
+ dynaspan_select(Object,OptionalNestedObject,SymField,OptionalEditText,OptionsHash)
49
50
  ```
50
51
  The order is important. And yes it does NOT change even if you just do:
51
52
  ```ruby
@@ -69,16 +70,14 @@ is a way to be able to click somewhere to open up the input to initially enter t
69
70
  The options Hash currently has these options.
70
71
 
71
72
  - **:hidden_fields** will put in as many hidden fields as you include in a Hash with key->value matching to name->value
72
- - **:callback_on_update** is a no frills callback. It runs whatever command you give it whenever Dynaspan submits an update
73
- to the server
74
- - **:callback_with_values** will allow you to put a JavaScript command you want called on update and include as many parameters
75
- as you'd like. It will dynamically append a last parameter which is a Hash of two values. The first is the CSS selector id
76
- of the Dynaspan block that just performed the action, the second value is the actual text that was entered. The keys in this
77
- Hash are **ds_selector** and **ds_input**
78
- - **:unique_id** allows custom ID labelling which is ideal for JavaScript generated usage.
79
- - **:form_for** allows adding or over-writing any form_for parameter (besides the object being written to). This takes a Hash
80
- of parameters just like you would give in a view for your form_for form. If you have a namespaced object to update use
81
- the **url:** option in the hash for the path to use in updating your object.
73
+ - **:callback_on_update** is a no frills callback. It runs whatever command you give it whenever Dynaspan submits an update to the server
74
+ - **:callback_with_values** will allow you to put a JavaScript command you want called on update and include as many parameters as you'd like. It will dynamically append a last parameter which is a Hash of two values. The first is the CSS selector id of the Dynaspan block that just performed the action, the second value is the actual text that was entered. The keys in this Hash are **ds_selector** and **ds_input**
75
+ - **:unique_id** allows custom ID labelling. This is no longer recommended to be used as the in-built method is thorough in its uniqeness.
76
+ - **:form_for** allows adding or over-writing any form_for parameter (besides the object being written to). This takes a Hash of parameters just like you would give in a view for your form_for form. If you have a namespaced object to update use the **url:** option in the hash for the path to use in updating your object.
77
+ - **:html_options** add your own html options to the input field. Includes ability to add additional classes with `html_options: {class: "example"}`. **:id**, **:onfocus**, and **:onblur** are reserved.
78
+ - **:choices** used for **dynaspan_select** for the choices of the select box.
79
+ - **:options** used for **dynaspan_select** for the options of the select box; such as **:disabled**, **:prompt**, or **:include_blank**.
80
+ - **&block** used only with **dynaspan_select** for passing a block to Rails' form select method.
82
81
 
83
82
  ###How it updates
84
83
 
@@ -120,6 +119,19 @@ calling parents with selectors. Example usage:
120
119
 
121
120
  ###What's New
122
121
 
122
+ ####Version 0.1.3
123
+
124
+ Changed **:unique_id** to work based on the object being rendered and some additional random characters in case the same object will be used more than once.
125
+
126
+ Added **:html_options** add your own html options to the input field. Includes ability to add additional classes with `html_options: {class: "example"}`. **:id**, **:onfocus**, and **:onblur** are reserved.
127
+
128
+ Added **dynaspan_select** for having a select box dynamically appear.
129
+ - Added **:choices** used for **dynaspan_select** for the choices of the select box.
130
+ - Added **:options** used for **dynaspan_select** for the options of the select box; such as **:disabled**, **:prompt**, or **:include_blank**.
131
+ - Added **&block** used only with **dynaspan_select** for passing a block to Rails' form select method.
132
+
133
+
134
+
123
135
  ####Version 0.1.2
124
136
 
125
137
  Added **unique_id** parameter to the options Hash allowing custom ID labelling which is ideal for JavaScript generated usage.
data/Rakefile CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env rake
2
2
  require 'bundler/gem_tasks'
3
- require File.expand_path('../lib/dynaspan/source_file', __FILE__)
3
+ #require File.expand_path('../lib/dynaspan/source_file', __FILE__)
4
4
 
5
5
  desc 'Update Dynaspan Library, VERSION is required.'
6
6
  task 'update_dynaspan' do
@@ -19,6 +19,8 @@
19
19
  <% end %>
20
20
  <% end %>
21
21
  </div>
22
- <%= content_tag 'span', attr_object.try(attrib) || master_ds_object.try(attrib), id: "dyna_span_span#{unique_ref_id}", onclick: "$().dynaspan.upShow('#{unique_ref_id}');", class: 'dyna-span dyna-span-text', style: 'display:block;' %>
22
+ <% current_value = attr_object.try(attrib) || master_ds_object.try(attrib) %>
23
+ <% display_text = choices.match(/value="#{current_value}".*>(.+)</)[1] %>
24
+ <%= content_tag 'span', display_text || current_value, id: "dyna_span_span#{unique_ref_id}", onclick: "$().dynaspan.upShow('#{unique_ref_id}');", class: 'dyna-span dyna-span-text', style: 'display:block;' %>
23
25
  <%= content_tag('div', dyna_span_edit_text, class: 'dyna-span-edit-text pull-right', onclick: "$().dynaspan.upShow('#{unique_ref_id}');", style: 'cursor:pointer;') %>
24
26
  </div>
@@ -1,3 +1,3 @@
1
1
  module Dynaspan
2
- VERSION = '0.1.3'
2
+ VERSION = '0.1.4'
3
3
  end
@@ -29,6 +29,9 @@
29
29
  var field_val = $('#dyna_span_field_val_' + uniq_id_ref).val();
30
30
  $('#dyna_span_div' + uniq_id_ref + ' > form').trigger('submit.rails');
31
31
  $('#last_dyna_span_val_' + uniq_id_ref).val(field_val);
32
+ $('select#dyna_span_field_val_' + uniq_id_ref).each(function(){
33
+ field_val = $(this).children("option:selected").text()
34
+ });
32
35
  $('#dyna_span_span' + uniq_id_ref).show().html(field_val);
33
36
  $('#dyna_span_div' + uniq_id_ref).hide();
34
37
  var ds_block = $("#dyna_span_block" + uniq_id_ref);
@@ -50,4 +53,4 @@
50
53
  eval(ds_block.data('dsCallbackOnUpdate'))
51
54
  }
52
55
  };
53
- })(jQuery);
56
+ })(jQuery);
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dynaspan
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel P. Clark
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-06-07 00:00:00.000000000 Z
11
+ date: 2016-03-14 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: In place text editing with AJAX substituting text to input field.
14
14
  email:
@@ -18,6 +18,7 @@ extensions: []
18
18
  extra_rdoc_files: []
19
19
  files:
20
20
  - ".gitignore"
21
+ - CODE_OF_CONDUCT.md
21
22
  - Gemfile
22
23
  - LICENSE
23
24
  - README.md
@@ -56,7 +57,7 @@ requirements:
56
57
  - jQuery
57
58
  - Rails
58
59
  rubyforge_project:
59
- rubygems_version: 2.4.7
60
+ rubygems_version: 2.5.1
60
61
  signing_key:
61
62
  specification_version: 4
62
63
  summary: Text to AJAX editing in place.