jquery_rails_sortable 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +18 -0
- data/Gemfile +4 -0
- data/LICENSE +22 -0
- data/README.md +4 -0
- data/Rakefile +2 -0
- data/app/assets/images/sortable/move.png +0 -0
- data/app/helpers/sortable_helper.rb +18 -0
- data/app/views/shared/_sortable.html.erb +28 -0
- data/jquery_rails_sortable.gemspec +17 -0
- data/lib/jquery_rails_sortable/version.rb +3 -0
- data/lib/jquery_rails_sortable.rb +10 -0
- metadata +56 -0
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2012 TODO: Write your name
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
data/Rakefile
ADDED
Binary file
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
module SortableHelper
|
3
|
+
def sortable_for(tbody_name, url, container)
|
4
|
+
render "shared/sortable",
|
5
|
+
:tbody_name => tbody_name,
|
6
|
+
:url => url,
|
7
|
+
:container => container
|
8
|
+
end
|
9
|
+
|
10
|
+
def link_to_move(object)
|
11
|
+
dom_identifier = "#{object.class.to_s.downcase}_#{object.id}_move"
|
12
|
+
link_to image_tag("/assets/sortable/move.png", :alt => t('move')), '',
|
13
|
+
:title => t('move'),
|
14
|
+
:id => dom_identifier,
|
15
|
+
:class => "move",
|
16
|
+
:onclick => "return false;"
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
<%= content_for :javascripts do %>
|
2
|
+
<%= javascript_include_tag "jquery-ui-base" %>
|
3
|
+
<% end %>
|
4
|
+
<%= content_for :footer_javascripts do %>
|
5
|
+
<script type="text/javascript">
|
6
|
+
$('#'+ "<%= tbody_name %>").sortable({
|
7
|
+
containment: 'parent',
|
8
|
+
axis: 'y',
|
9
|
+
dropOnEmpty: false,
|
10
|
+
handle: '.move',
|
11
|
+
cursor: 'crosshair',
|
12
|
+
items: "<%= container %>",
|
13
|
+
opacity: 1.0,
|
14
|
+
scroll: true,
|
15
|
+
update: function(){
|
16
|
+
$.ajax({
|
17
|
+
type: 'post',
|
18
|
+
data: $('#'+"<%= tbody_name %>").sortable('serialize'),
|
19
|
+
dataType: 'script',
|
20
|
+
complete: function(request){
|
21
|
+
$('#'+"<%= tbody_name %>").effect('highlight');
|
22
|
+
},
|
23
|
+
url: "<%= url %>"
|
24
|
+
});
|
25
|
+
}
|
26
|
+
});
|
27
|
+
</script>
|
28
|
+
<% end %>
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
require File.expand_path('../lib/jquery_rails_sortable/version', __FILE__)
|
3
|
+
|
4
|
+
Gem::Specification.new do |gem|
|
5
|
+
gem.authors = ["Andrey"]
|
6
|
+
gem.email = ["railscode@gmail.com"]
|
7
|
+
gem.description = "JQuery Rails Sortable"
|
8
|
+
gem.summary = "summary"
|
9
|
+
gem.homepage = "https://github.com/vav/jquery_rails_sortable"
|
10
|
+
|
11
|
+
gem.files = `git ls-files`.split($\)
|
12
|
+
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
13
|
+
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
14
|
+
gem.name = "jquery_rails_sortable"
|
15
|
+
gem.require_paths = ["lib"]
|
16
|
+
gem.version = JqueryRailsSortable::VERSION
|
17
|
+
end
|
@@ -0,0 +1,10 @@
|
|
1
|
+
require "jquery_rails_sortable/version"
|
2
|
+
|
3
|
+
module JqueryRailsSortable
|
4
|
+
class Engine < ::Rails::Engine
|
5
|
+
isolate_namespace JqueryRailsSortable
|
6
|
+
initializer "jquery_rails_sortable" do |app|
|
7
|
+
ActionView::Base.send :include, JqueryRailsSortable::SortableHelper
|
8
|
+
end
|
9
|
+
end
|
10
|
+
end
|
metadata
ADDED
@@ -0,0 +1,56 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: jquery_rails_sortable
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Andrey
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2013-03-05 00:00:00.000000000 Z
|
13
|
+
dependencies: []
|
14
|
+
description: JQuery Rails Sortable
|
15
|
+
email:
|
16
|
+
- railscode@gmail.com
|
17
|
+
executables: []
|
18
|
+
extensions: []
|
19
|
+
extra_rdoc_files: []
|
20
|
+
files:
|
21
|
+
- .gitignore
|
22
|
+
- Gemfile
|
23
|
+
- LICENSE
|
24
|
+
- README.md
|
25
|
+
- Rakefile
|
26
|
+
- app/assets/images/sortable/move.png
|
27
|
+
- app/helpers/sortable_helper.rb
|
28
|
+
- app/views/shared/_sortable.html.erb
|
29
|
+
- jquery_rails_sortable.gemspec
|
30
|
+
- lib/jquery_rails_sortable.rb
|
31
|
+
- lib/jquery_rails_sortable/version.rb
|
32
|
+
homepage: https://github.com/vav/jquery_rails_sortable
|
33
|
+
licenses: []
|
34
|
+
post_install_message:
|
35
|
+
rdoc_options: []
|
36
|
+
require_paths:
|
37
|
+
- lib
|
38
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
39
|
+
none: false
|
40
|
+
requirements:
|
41
|
+
- - ! '>='
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: '0'
|
44
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
45
|
+
none: false
|
46
|
+
requirements:
|
47
|
+
- - ! '>='
|
48
|
+
- !ruby/object:Gem::Version
|
49
|
+
version: '0'
|
50
|
+
requirements: []
|
51
|
+
rubyforge_project:
|
52
|
+
rubygems_version: 1.8.23
|
53
|
+
signing_key:
|
54
|
+
specification_version: 3
|
55
|
+
summary: summary
|
56
|
+
test_files: []
|