jsort 0.0.3 → 0.0.4

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.
Files changed (5) hide show
  1. data/README.md +5 -4
  2. data/VERSION +1 -1
  3. data/jsort.gemspec +8 -8
  4. data/lib/jsort.rb +8 -2
  5. metadata +15 -13
data/README.md CHANGED
@@ -39,10 +39,11 @@ _Parameters_
39
39
  * *NAME* - The div-id of the list. This will be the key of `params[:NAME]` passed to the controller.
40
40
  * *PATH* - path or url to the controller/action where the script will post to.
41
41
  * *OPTIONS* - Opional you may provide the following options:
42
-
43
- `:text => 'MOVE` - Will use this text as a drag-n-drop-handle instead of the image
44
- `:image => 'yourimage.jpg'` - use your own image (place it in assets/images path of your application
45
- `:handle_only => true` - Only the handle (image or text) can be used to drag&move. Default is 'false' which allows you to pick up by clicking anywhere on the line.
42
+ * `:text => 'MOVE` - Will use this text as a drag-n-drop-handle instead of the image
43
+ * `:image => 'yourimage.jpg'` - use your own image (place it in assets/images path of your application
44
+ * `:handle_only => true` - Only the handle (image or text) can be used to drag&move. Default is 'false' which allows you to pick up by clicking anywhere on the line.
45
+ * `:register => false` - no call to `registerSortableList($('#list-id')` will be implemented and you have to call the register-function in your own code (eg. coffee-script). Use this strategie if you're using Twitter-Bootstrap and loading the application.js at the end of your layout-file
46
+ * `:sortable_id => :id` - default's to :id.
46
47
 
47
48
 
48
49
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.3
1
+ 0.0.4
@@ -4,14 +4,14 @@
4
4
  # -*- encoding: utf-8 -*-
5
5
 
6
6
  Gem::Specification.new do |s|
7
- s.name = %q{jsort}
8
- s.version = "0.0.3"
7
+ s.name = "jsort"
8
+ s.version = "0.0.4"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Andi Altendorfer"]
12
- s.date = %q{2012-05-29}
13
- s.description = %q{Write a controller-method to do the sort and call jsort-helper in your view.}
14
- s.email = %q{andi@iboard.cc}
12
+ s.date = "2012-08-05"
13
+ s.description = "Write a controller-method to do the sort and call jsort-helper in your view."
14
+ s.email = "andi@iboard.cc"
15
15
  s.extra_rdoc_files = [
16
16
  "LICENSE.txt",
17
17
  "README.md"
@@ -34,11 +34,11 @@ Gem::Specification.new do |s|
34
34
  "vendor/assets/images/sortable_vertical.png",
35
35
  "vendor/assets/javascripts/jsort_sortable.js"
36
36
  ]
37
- s.homepage = %q{http://github.com/iboard/jsort}
37
+ s.homepage = "http://github.com/iboard/jsort"
38
38
  s.licenses = ["MIT"]
39
39
  s.require_paths = ["lib"]
40
- s.rubygems_version = %q{1.6.2}
41
- s.summary = %q{sort lists with drag & drop without coding a single line of Javascript by yourself}
40
+ s.rubygems_version = "1.8.15"
41
+ s.summary = "sort lists with drag & drop without coding a single line of Javascript by yourself"
42
42
 
43
43
  if s.respond_to? :specification_version then
44
44
  s.specification_version = 3
@@ -18,6 +18,7 @@ module ActionView
18
18
  # * `:image => 'yourimage.jpg'` - use your own image (place it in assets/images path of your application
19
19
  # * `:handle_only => true` - Only the handle (image or text) can be used to drag&move. Default is 'false' which allows you to pick up by clicking anywhere on the line.
20
20
  # * `:div_type => ['table','tr','td'] or ['ol',nil,'li'], ....
21
+ # * `:sortable_id => :id (The field used as css-id)
21
22
  def jsort(items,name,path,options={},&block)
22
23
 
23
24
  defaults = {
@@ -25,7 +26,8 @@ module ActionView
25
26
  :image => 'sortable_vertical.png',
26
27
  :text => nil,
27
28
  :div_type => ['ol',nil,'li'],
28
- :register => true
29
+ :register => true,
30
+ :sortable_id => :id
29
31
  }
30
32
  defaults.merge!(options)
31
33
  concat("<#{defaults[:div_type][0]} id='#{name.pluralize}' path='#{path}'>".html_safe)
@@ -38,7 +40,7 @@ module ActionView
38
40
 
39
41
  for item in sorted_items
40
42
  concat("<#{defaults[:div_type][1]}>") unless defaults[:div_type][1].nil?
41
- concat("<#{defaults[:div_type][2]} class='#{name}_sort_entry' id='#{name}_#{item.to_param}'>".html_safe)
43
+ concat("<#{defaults[:div_type][2]} class='#{name}_sort_entry' id='#{name}_#{get_sortable_id(item, defaults[:sortable_id])}'>".html_safe)
42
44
  concat("<span class='handle'>".html_safe)
43
45
  if options[:text]
44
46
  concat(options[:text] + " ")
@@ -66,6 +68,10 @@ module ActionView
66
68
  concat(javascript_tag( "registerSortableList($('##{name.pluralize}'));"))
67
69
  end
68
70
  end
71
+
72
+ def get_sortable_id(item,field)
73
+ item.send(field)
74
+ end
69
75
  end
70
76
  end
71
77
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jsort
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-05-29 00:00:00.000000000Z
12
+ date: 2012-08-05 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: jquery-rails
16
- requirement: &70109253187680 !ruby/object:Gem::Requirement
16
+ requirement: &70200197910680 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70109253187680
24
+ version_requirements: *70200197910680
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: shoulda
27
- requirement: &70109253187200 !ruby/object:Gem::Requirement
27
+ requirement: &70200197910100 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '0'
33
33
  type: :development
34
34
  prerelease: false
35
- version_requirements: *70109253187200
35
+ version_requirements: *70200197910100
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: bundler
38
- requirement: &70109253186720 !ruby/object:Gem::Requirement
38
+ requirement: &70200197909600 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ~>
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: 1.0.0
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *70109253186720
46
+ version_requirements: *70200197909600
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: jeweler
49
- requirement: &70109253186240 !ruby/object:Gem::Requirement
49
+ requirement: &70200197908840 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ~>
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: 1.6.4
55
55
  type: :development
56
56
  prerelease: false
57
- version_requirements: *70109253186240
57
+ version_requirements: *70200197908840
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: rcov
60
- requirement: &70109253185760 !ruby/object:Gem::Requirement
60
+ requirement: &70200197908120 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ! '>='
@@ -65,7 +65,7 @@ dependencies:
65
65
  version: '0'
66
66
  type: :development
67
67
  prerelease: false
68
- version_requirements: *70109253185760
68
+ version_requirements: *70200197908120
69
69
  description: Write a controller-method to do the sort and call jsort-helper in your
70
70
  view.
71
71
  email: andi@iboard.cc
@@ -104,6 +104,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
104
104
  - - ! '>='
105
105
  - !ruby/object:Gem::Version
106
106
  version: '0'
107
+ segments:
108
+ - 0
109
+ hash: 3135072855625993234
107
110
  required_rubygems_version: !ruby/object:Gem::Requirement
108
111
  none: false
109
112
  requirements:
@@ -118,4 +121,3 @@ specification_version: 3
118
121
  summary: sort lists with drag & drop without coding a single line of Javascript by
119
122
  yourself
120
123
  test_files: []
121
- has_rdoc: