hobo_jquery_ui 2.0.0.pre7 → 2.0.0.pre8

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 2.0.0.pre7
1
+ 2.0.0.pre8
@@ -1,3 +1,4 @@
1
+ require 'hobo_jquery'
1
2
  require 'hobo_jquery_ui'
2
3
  require 'rails'
3
4
  module HoboJqueryUi
@@ -5,7 +5,7 @@
5
5
  </dialog-box>
6
6
  </def>
7
7
 
8
- <!-- use jQuery-UI for date inputs. To switch back to vanilla Rails (`<select-date>`) add to your application.dryml:
8
+ <!-- use jQuery-UI for date inputs. To switch back to vanilla Rails (`<datepicker-rails>`) add to your application.dryml:
9
9
 
10
10
  <def tag="input" for="Date">
11
11
  <date-select merge/>
@@ -0,0 +1,36 @@
1
+ <!-- An enhanced version of Rapid's `<collection>` tag that supports drag-and-drop re-ordering.
2
+
3
+ Each item in the collection has a `<div class="ordering-handle" param="handle">` added, which can be used to drag the item up and down.
4
+
5
+ ### Attributes
6
+
7
+ `sortable-collection` supports all of the options and events defined by [jQuery UI's Sortable](http://jqueryui.com/demos/sortable/).
8
+
9
+ Sortable also supports all of the standard [Hobo AJAX callbacks](http://cookbook.hobocentral.net/api_taglibs/rapid_forms).
10
+
11
+ The jQuery UI option `update` is used internally to save the new order via Ajax. If you modify this option, your function may call `$(this).hjq_sortable_collection('update')` to retain this functionality.
12
+
13
+ ### Controller support
14
+
15
+ This tag assumes the controller has a `reorder` action and the model has a `position_column` method. This action is added automatically by Hobo's model-controller if the model declares `acts_as_list`. See also [Drag and Drop Reordering](/manual/controllers#drag_and_drop_reordering) in the [Controllers and Routing](/manual/controllers) chapter of the manual.
16
+ -->
17
+ <def tag="sortable-collection">
18
+ <%
19
+ options, attrs = attributes.partition_hash(['disabled', 'appendTo', 'axis', 'cancel', 'connectWith', 'containment', 'cursor', 'cursorAt', 'delay', 'distance', 'dropOnEmpty', 'forceHelperSize', 'forcePlaceholderSize', 'grid', 'handle', 'helper', 'items', 'opacity', 'placeholder', 'revert', 'scroll', 'scrollSensitivity', 'scrollSpeed', 'tolerance', 'zIndex'])
20
+ events, html_attrs = attrs.partition_hash(['create', 'start', 'sort', 'change', 'beforeStop', 'stop', 'update', 'receive', 'remove', 'over', 'out', 'activate', 'deactivate'])
21
+ ajax_attrs, html_attrs = attrs.partition_hash(HoboRapidHelper::AJAX_CALLBACKS)
22
+
23
+ singular_name = this.member_class.name.underscore
24
+ route_method = subsite ? "#{subsite}_reorder_#{singular_name.pluralize}_url" : "reorder_#{singular_name.pluralize}_url"
25
+ reorder_url = send(route_method)
26
+
27
+ add_classes!(html_attrs, "sortable-collection")
28
+ add_data_rapid!(html_attrs, "sortable-collection", :options => options, :events => events, :ajax_attrs => ajax_attrs, :reorder_url => reorder_url, :reorder_parameter => "#{singular_name}_ordering")
29
+ %>
30
+ <collection class="sortable" merge-attrs="&html_attrs" merge-params>
31
+ <item: param>
32
+ <div class="ordering-handle" param="handle" if="&can_edit?(this.position_column)">&uarr;<br/>&darr;</div>
33
+ <do param="default"><card param/></do>
34
+ </item:>
35
+ </collection>
36
+ </def>
@@ -0,0 +1,35 @@
1
+ <!-- An enhanced version of [`<input-many>`](/api_tag_defs/input-many) that supports drag-and-drop re-ordering.
2
+
3
+ Each item in the collection has a `<div class="ordering-handle" param="handle">` added, which can be used to drag the item up and down.
4
+
5
+ If the items in the collection contain an [`acts_as_list`](http://ar.rubyonrails.org/classes/ActiveRecord/Acts/List/ClassMethods.html) declaration, it is updated.
6
+
7
+ The specified sort order may be maintained even without `acts_as_list`. The items will be passed to the controller in the correct order, so the order may be persisted there.
8
+
9
+ ### Attributes
10
+
11
+ - `position-column`: The position column may be specified via `acts_as_list`, via a `position_column` method on your model or via this attribute.
12
+ - others: all other attributes are passed through to [jQuery UI's Sortable](http://jqueryui.com/demos/sortable/) or to `<input-many>`, as appropriate.
13
+
14
+ The jQuery UI option `update` is used internally to update the order. If you modify this option, your function may call `$(this).hjq_sortable_input_many('update')` to retain this functionality.
15
+ -->
16
+
17
+ <def tag="sortable-input-many" attrs="position-column, template">
18
+ <%
19
+ options, attributes = attributes.partition_hash(['disabled', 'appendTo', 'axis', 'cancel', 'connectWith', 'containment', 'cursor', 'cursorAt', 'delay', 'distance', 'dropOnEmpty', 'forceHelperSize', 'forcePlaceholderSize', 'grid', 'handle', 'helper', 'items', 'opacity', 'placeholder', 'revert', 'scroll', 'scrollSensitivity', 'scrollSpeed', 'tolerance', 'zIndex'])
20
+ events, attributes = attributes.partition_hash(['create', 'start', 'sort', 'change', 'beforeStop', 'stop', 'update', 'receive', 'remove', 'over', 'out', 'activate', 'deactivate'])
21
+
22
+ data_rapid_options = { :options => options, :events => events }
23
+ %>
24
+ <% template ||= this.try.new_candidate || this.member_class.new %>
25
+ <% position_column ||= template.try.position_column -%>
26
+ <input-many merge class="sortable-input-many" template="&template" more-skip="&position_column" data-rapid="&data_rapid('sortable-input-many', data_rapid_options)">
27
+ <default: replace>
28
+ <div class="ordering-handle" param="handle" if="&can_edit?">&uarr;<br/>&darr;</div>
29
+ <if test="&position_column">
30
+ <input class="sortable-position" type="hidden" value="&this.send(position_column)" name="#{param_name_for_this}[#{position_column}]" />
31
+ </if>
32
+ <default restore/>
33
+ </default:>
34
+ </input-many>
35
+ </def>
@@ -0,0 +1,39 @@
1
+ /* hjq-sortable-collection */
2
+ (function($) {
3
+ var methods = {
4
+ init: function(annotations) {
5
+ var options = $.extend({update: methods.update}, this.hjq('getOptions', annotations));
6
+ this.sortable(options);
7
+ },
8
+
9
+ update: function() {
10
+ var that=$(this);
11
+ var annotations=that.data('rapid')['sortable-collection'];
12
+ var roptions = that.hjq('buildRequest', {type: 'post',
13
+ attrs: annotations.ajax_attrs
14
+ });
15
+ roptions.data['authenticity_token']=that.hjq('pageData').form_auth_token.value;
16
+ roptions.data=$.param(roptions.data);
17
+ that.children("*[data-rapid-context]").each(function(i) {
18
+ roptions.data = roptions.data+"&"+annotations.reorder_parameter+"[]="+$(this).hjq('contextId');
19
+ });
20
+
21
+ $.ajax(annotations.reorder_url, roptions);
22
+ return that;
23
+ }
24
+
25
+ };
26
+
27
+
28
+ $.fn.hjq_sortable_collection = function( method ) {
29
+
30
+ if ( methods[method] ) {
31
+ return methods[method].apply( this, Array.prototype.slice.call( arguments, 1 ));
32
+ } else if ( typeof method === 'object' || ! method ) {
33
+ return methods.init.apply( this, arguments );
34
+ } else {
35
+ $.error( 'Method ' + method + ' does not exist on hjq_sortable_collection' );
36
+ }
37
+ };
38
+
39
+ })( jQuery );
@@ -0,0 +1,33 @@
1
+ /* hjq-input-many */
2
+ (function($) {
3
+ var methods = {
4
+ init: function(annotations) {
5
+ var options = $.extend({update: methods.update}, this.hjq('getOptions', annotations));
6
+ this.sortable(options);
7
+ this.on('rapid:change', methods.update);
8
+ },
9
+
10
+ update: function() {
11
+ var that=$(this);
12
+ var annotations=that.data('rapid')['sortable-input-many'];
13
+ that.find("li:visible input.sortable-position").each(function(index) {
14
+ $(this).val(index+1);
15
+ });
16
+ return that;
17
+ }
18
+
19
+ };
20
+
21
+
22
+ $.fn.hjq_sortable_input_many = function( method ) {
23
+
24
+ if ( methods[method] ) {
25
+ return methods[method].apply( this, Array.prototype.slice.call( arguments, 1 ));
26
+ } else if ( typeof method === 'object' || ! method ) {
27
+ return methods.init.apply( this, arguments );
28
+ } else {
29
+ $.error( 'Method ' + method + ' does not exist on hjq_sortable_collection' );
30
+ }
31
+ };
32
+
33
+ })( jQuery );
metadata CHANGED
@@ -1,70 +1,85 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: hobo_jquery_ui
3
- version: !ruby/object:Gem::Version
4
- version: 2.0.0.pre7
3
+ version: !ruby/object:Gem::Version
4
+ hash: -2480710916
5
5
  prerelease: 6
6
+ segments:
7
+ - 2
8
+ - 0
9
+ - 0
10
+ - pre
11
+ - 8
12
+ version: 2.0.0.pre8
6
13
  platform: ruby
7
- authors:
14
+ authors:
8
15
  - Bryan Larsen
9
16
  autorequire:
10
17
  bindir: bin
11
18
  cert_chain: []
12
- date: 2012-12-06 00:00:00.000000000 Z
13
- dependencies:
14
- - !ruby/object:Gem::Dependency
19
+
20
+ date: 2013-02-04 00:00:00 Z
21
+ dependencies:
22
+ - !ruby/object:Gem::Dependency
15
23
  name: jquery-ui-themes
16
- requirement: !ruby/object:Gem::Requirement
17
- none: false
18
- requirements:
19
- - - ~>
20
- - !ruby/object:Gem::Version
21
- version: 0.0.4
22
- type: :runtime
23
24
  prerelease: false
24
- version_requirements: !ruby/object:Gem::Requirement
25
+ requirement: &id001 !ruby/object:Gem::Requirement
25
26
  none: false
26
- requirements:
27
+ requirements:
27
28
  - - ~>
28
- - !ruby/object:Gem::Version
29
+ - !ruby/object:Gem::Version
30
+ hash: 23
31
+ segments:
32
+ - 0
33
+ - 0
34
+ - 4
29
35
  version: 0.0.4
30
- - !ruby/object:Gem::Dependency
31
- name: hobo
32
- requirement: !ruby/object:Gem::Requirement
33
- none: false
34
- requirements:
35
- - - '='
36
- - !ruby/object:Gem::Version
37
- version: 2.0.0.pre7
38
36
  type: :runtime
37
+ version_requirements: *id001
38
+ - !ruby/object:Gem::Dependency
39
+ name: hobo
39
40
  prerelease: false
40
- version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
- requirements:
43
- - - '='
44
- - !ruby/object:Gem::Version
45
- version: 2.0.0.pre7
46
- - !ruby/object:Gem::Dependency
47
- name: hobo_jquery
48
- requirement: !ruby/object:Gem::Requirement
41
+ requirement: &id002 !ruby/object:Gem::Requirement
49
42
  none: false
50
- requirements:
51
- - - '='
52
- - !ruby/object:Gem::Version
53
- version: 2.0.0.pre7
43
+ requirements:
44
+ - - "="
45
+ - !ruby/object:Gem::Version
46
+ hash: -2480710916
47
+ segments:
48
+ - 2
49
+ - 0
50
+ - 0
51
+ - pre
52
+ - 8
53
+ version: 2.0.0.pre8
54
54
  type: :runtime
55
+ version_requirements: *id002
56
+ - !ruby/object:Gem::Dependency
57
+ name: hobo_jquery
55
58
  prerelease: false
56
- version_requirements: !ruby/object:Gem::Requirement
59
+ requirement: &id003 !ruby/object:Gem::Requirement
57
60
  none: false
58
- requirements:
59
- - - '='
60
- - !ruby/object:Gem::Version
61
- version: 2.0.0.pre7
61
+ requirements:
62
+ - - "="
63
+ - !ruby/object:Gem::Version
64
+ hash: -2480710916
65
+ segments:
66
+ - 2
67
+ - 0
68
+ - 0
69
+ - pre
70
+ - 8
71
+ version: 2.0.0.pre8
72
+ type: :runtime
73
+ version_requirements: *id003
62
74
  description: JQuery UI support for Hobo
63
75
  email: bryan@larsen.st
64
76
  executables: []
77
+
65
78
  extensions: []
79
+
66
80
  extra_rdoc_files: []
67
- files:
81
+
82
+ files:
68
83
  - .gitmodules
69
84
  - LICENSE.txt
70
85
  - README.markdown
@@ -82,6 +97,8 @@ files:
82
97
  - taglibs/hobo_jquery_ui.dryml
83
98
  - taglibs/name_one.dryml
84
99
  - taglibs/overrides.dryml
100
+ - taglibs/sortable_collection.dryml
101
+ - taglibs/sortable_input_many.dryml
85
102
  - taglibs/tabs.dryml
86
103
  - taglibs/toggle.dryml
87
104
  - vendor/assets/javascripts/combobox.js
@@ -90,6 +107,8 @@ files:
90
107
  - vendor/assets/javascripts/hobo-jquery-ui/hjq-combobox.js
91
108
  - vendor/assets/javascripts/hobo-jquery-ui/hjq-datepicker.js
92
109
  - vendor/assets/javascripts/hobo-jquery-ui/hjq-dialog.js
110
+ - vendor/assets/javascripts/hobo-jquery-ui/hjq-sortable-collection.js
111
+ - vendor/assets/javascripts/hobo-jquery-ui/hjq-sortable-input-many.js
93
112
  - vendor/assets/javascripts/hobo-jquery-ui/hjq-tabs.js
94
113
  - vendor/assets/javascripts/hobo-jquery-ui/hjq-toggle.js
95
114
  - vendor/assets/javascripts/hobo_jquery_ui.js
@@ -97,30 +116,41 @@ files:
97
116
  - vendor/assets/stylesheets/hobo_jquery_ui.css
98
117
  homepage: http://hobocentral.net
99
118
  licenses: []
119
+
100
120
  post_install_message:
101
- rdoc_options:
121
+ rdoc_options:
102
122
  - --charset=UTF-8
103
- require_paths:
123
+ require_paths:
104
124
  - lib
105
125
  - vendor
106
126
  - taglibs
107
- required_ruby_version: !ruby/object:Gem::Requirement
127
+ required_ruby_version: !ruby/object:Gem::Requirement
108
128
  none: false
109
- requirements:
110
- - - ! '>='
111
- - !ruby/object:Gem::Version
112
- version: '0'
113
- required_rubygems_version: !ruby/object:Gem::Requirement
129
+ requirements:
130
+ - - ">="
131
+ - !ruby/object:Gem::Version
132
+ hash: 3
133
+ segments:
134
+ - 0
135
+ version: "0"
136
+ required_rubygems_version: !ruby/object:Gem::Requirement
114
137
  none: false
115
- requirements:
116
- - - ! '>='
117
- - !ruby/object:Gem::Version
138
+ requirements:
139
+ - - ">="
140
+ - !ruby/object:Gem::Version
141
+ hash: 23
142
+ segments:
143
+ - 1
144
+ - 3
145
+ - 6
118
146
  version: 1.3.6
119
147
  requirements: []
148
+
120
149
  rubyforge_project:
121
- rubygems_version: 1.8.24
150
+ rubygems_version: 1.8.25
122
151
  signing_key:
123
152
  specification_version: 3
124
153
  summary: JQuery UI support for Hobo
125
154
  test_files: []
155
+
126
156
  has_rdoc: