spud_videos 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/app/assets/images/spud/admin/videos_thumb.png +0 -0
- data/app/assets/images/spud/admin/videos_thumb@2x.png +0 -0
- data/app/assets/javascripts/spud/admin/videos/application.js +25 -0
- data/app/controllers/spud/admin/videos_controller.rb +19 -1
- data/app/controllers/videos_controller.rb +1 -1
- data/app/views/layouts/spud/admin/videos/detail.html.erb +4 -0
- data/app/views/spud/admin/videos/index.html.erb +5 -3
- data/config/routes.rb +4 -2
- data/lib/spud_videos/configuration.rb +11 -0
- data/lib/spud_videos/version.rb +1 -1
- data/lib/spud_videos.rb +1 -1
- metadata +14 -15
- data/app/assets/javascripts/spud/admin/videos.js +0 -2
- data/app/assets/javascripts/spud_videos/application.js +0 -15
- data/app/assets/javascripts/videos.js +0 -2
- data/app/assets/stylesheets/spud/admin/videos.css +0 -4
- data/app/assets/stylesheets/spud_videos/application.css +0 -13
- data/app/assets/stylesheets/videos.css +0 -4
Binary file
|
Binary file
|
@@ -0,0 +1,25 @@
|
|
1
|
+
//= require_self
|
2
|
+
//= require_tree .
|
3
|
+
Spud = (typeof(Spud) == 'undefined') ? {} : Spud;
|
4
|
+
Spud.Admin = (typeof(Spud.Admin) == 'undefined') ? {} : Spud.Admin;
|
5
|
+
|
6
|
+
Spud.Admin.Videos = new function() {
|
7
|
+
var self=this;
|
8
|
+
self.init = function() {
|
9
|
+
$('#video_list').sortable({axis:'y',
|
10
|
+
update: self.videoOrderChanged
|
11
|
+
});
|
12
|
+
}
|
13
|
+
self.videoOrderChanged = function(event, ui) {
|
14
|
+
var arr = $('#video_list').sortable('toArray');
|
15
|
+
// console.log(arr)
|
16
|
+
ids = [];
|
17
|
+
for(var cnt = 0;cnt < arr.length;cnt++)
|
18
|
+
{
|
19
|
+
ids.push(parseInt(arr[cnt].replace("video_",""),10));
|
20
|
+
}
|
21
|
+
|
22
|
+
// console.log(ids)
|
23
|
+
jQuery.ajax("/spud/admin/videos/reorder?order=" + ids.join(","));
|
24
|
+
}
|
25
|
+
};
|
@@ -1,6 +1,6 @@
|
|
1
1
|
class Spud::Admin::VideosController < Spud::Admin::ApplicationController
|
2
2
|
belongs_to_spud_app :videos
|
3
|
-
layout 'spud/admin/detail'
|
3
|
+
layout 'spud/admin/videos/detail'
|
4
4
|
before_filter :load_video,:only => [:edit,:update,:show,:destroy]
|
5
5
|
|
6
6
|
def index
|
@@ -50,6 +50,24 @@ class Spud::Admin::VideosController < Spud::Admin::ApplicationController
|
|
50
50
|
end
|
51
51
|
|
52
52
|
def reorder
|
53
|
+
if params[:order].blank?
|
54
|
+
render :status => 500,:text => nil and return
|
55
|
+
end
|
56
|
+
ids = params[:order].split(",")
|
57
|
+
ids.map! { |i| i.to_i }
|
58
|
+
@videos = SpudVideo.order(:video_order).where(:id => ids).all
|
59
|
+
if !@videos.blank?
|
60
|
+
startOrder = @videos[0].video_order || 0
|
61
|
+
@videos.each do |video|
|
62
|
+
index = ids.index(video.id)
|
63
|
+
video.video_order = startOrder + index
|
64
|
+
video.save
|
65
|
+
end
|
66
|
+
|
67
|
+
end
|
68
|
+
|
69
|
+
render :status => 200,:text => nil
|
70
|
+
|
53
71
|
end
|
54
72
|
|
55
73
|
private
|
@@ -2,9 +2,9 @@
|
|
2
2
|
<%=link_to "New Video",new_spud_admin_video_path(),:class => "btn btn-primary",:title => "New Video"%>
|
3
3
|
<%end%>
|
4
4
|
<%=content_for :detail do%>
|
5
|
-
<div class="page_list">
|
5
|
+
<div class="page_list" id="video_list">
|
6
6
|
<%@videos.each do |video|%>
|
7
|
-
<div class="page_row">
|
7
|
+
<div class="page_row" id="video_<%=video.id%>">
|
8
8
|
|
9
9
|
<span class="row_meta"><%=link_to video.name,edit_spud_admin_video_path(:id => video.id)%></span>
|
10
10
|
|
@@ -19,5 +19,7 @@
|
|
19
19
|
</div>
|
20
20
|
|
21
21
|
|
22
|
-
|
22
|
+
<script type="text/javascript">
|
23
|
+
$(document).ready(Spud.Admin.Videos.init);
|
24
|
+
</script>
|
23
25
|
<%end%>
|
data/config/routes.rb
CHANGED
@@ -1,9 +1,11 @@
|
|
1
1
|
Rails.application.routes.draw do
|
2
|
-
|
2
|
+
if Spud::Videos.enable_videos_route
|
3
|
+
resources :videos,:only => [:index]
|
4
|
+
end
|
3
5
|
namespace :spud do
|
4
6
|
namespace :admin do
|
5
7
|
resources :videos do
|
6
|
-
get 'reorder', :on => :
|
8
|
+
get 'reorder', :on => :collection
|
7
9
|
end
|
8
10
|
end
|
9
11
|
end
|
data/lib/spud_videos/version.rb
CHANGED
data/lib/spud_videos.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: spud_videos
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -13,7 +13,7 @@ date: 2012-03-30 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
16
|
-
requirement: &
|
16
|
+
requirement: &70194579969160 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: 3.2.2
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70194579969160
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: spud_core
|
27
|
-
requirement: &
|
27
|
+
requirement: &70194579968640 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -35,10 +35,10 @@ dependencies:
|
|
35
35
|
version: 0.9.0
|
36
36
|
type: :runtime
|
37
37
|
prerelease: false
|
38
|
-
version_requirements: *
|
38
|
+
version_requirements: *70194579968640
|
39
39
|
- !ruby/object:Gem::Dependency
|
40
40
|
name: mysql2
|
41
|
-
requirement: &
|
41
|
+
requirement: &70194579968000 !ruby/object:Gem::Requirement
|
42
42
|
none: false
|
43
43
|
requirements:
|
44
44
|
- - ! '>='
|
@@ -46,7 +46,7 @@ dependencies:
|
|
46
46
|
version: '0'
|
47
47
|
type: :development
|
48
48
|
prerelease: false
|
49
|
-
version_requirements: *
|
49
|
+
version_requirements: *70194579968000
|
50
50
|
description: This is a basic vide management admin tool for spud. Useful for allowing
|
51
51
|
customers to add videos to a video library, control order, link to vimeo or youtube.
|
52
52
|
email:
|
@@ -55,17 +55,15 @@ executables: []
|
|
55
55
|
extensions: []
|
56
56
|
extra_rdoc_files: []
|
57
57
|
files:
|
58
|
-
- app/assets/
|
59
|
-
- app/assets/
|
60
|
-
- app/assets/javascripts/videos.js
|
61
|
-
- app/assets/stylesheets/spud/admin/videos.css
|
62
|
-
- app/assets/stylesheets/spud_videos/application.css
|
63
|
-
- app/assets/stylesheets/videos.css
|
58
|
+
- app/assets/images/spud/admin/videos_thumb.png
|
59
|
+
- app/assets/images/spud/admin/videos_thumb@2x.png
|
60
|
+
- app/assets/javascripts/spud/admin/videos/application.js
|
64
61
|
- app/controllers/spud/admin/videos_controller.rb
|
65
62
|
- app/controllers/spud_videos/application_controller.rb
|
66
63
|
- app/controllers/videos_controller.rb
|
67
64
|
- app/helpers/videos_helper.rb
|
68
65
|
- app/models/spud_video.rb
|
66
|
+
- app/views/layouts/spud/admin/videos/detail.html.erb
|
69
67
|
- app/views/layouts/spud_videos/application.html.erb
|
70
68
|
- app/views/spud/admin/videos/_form.html.erb
|
71
69
|
- app/views/spud/admin/videos/edit.html.erb
|
@@ -74,6 +72,7 @@ files:
|
|
74
72
|
- app/views/videos/index.html.erb
|
75
73
|
- config/routes.rb
|
76
74
|
- db/migrate/20120330132808_create_spud_videos.rb
|
75
|
+
- lib/spud_videos/configuration.rb
|
77
76
|
- lib/spud_videos/engine.rb
|
78
77
|
- lib/spud_videos/version.rb
|
79
78
|
- lib/spud_videos.rb
|
@@ -132,7 +131,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
132
131
|
version: '0'
|
133
132
|
segments:
|
134
133
|
- 0
|
135
|
-
hash:
|
134
|
+
hash: 4381434138279785117
|
136
135
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
137
136
|
none: false
|
138
137
|
requirements:
|
@@ -141,7 +140,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
141
140
|
version: '0'
|
142
141
|
segments:
|
143
142
|
- 0
|
144
|
-
hash:
|
143
|
+
hash: 4381434138279785117
|
145
144
|
requirements: []
|
146
145
|
rubyforge_project:
|
147
146
|
rubygems_version: 1.8.15
|
@@ -1,15 +0,0 @@
|
|
1
|
-
// This is a manifest file that'll be compiled into application.js, which will include all the files
|
2
|
-
// listed below.
|
3
|
-
//
|
4
|
-
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
|
5
|
-
// or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
|
6
|
-
//
|
7
|
-
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
|
8
|
-
// the compiled file.
|
9
|
-
//
|
10
|
-
// WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD
|
11
|
-
// GO AFTER THE REQUIRES BELOW.
|
12
|
-
//
|
13
|
-
//= require jquery
|
14
|
-
//= require jquery_ujs
|
15
|
-
//= require_tree .
|
@@ -1,13 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
* This is a manifest file that'll be compiled into application.css, which will include all the files
|
3
|
-
* listed below.
|
4
|
-
*
|
5
|
-
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
|
6
|
-
* or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
|
7
|
-
*
|
8
|
-
* You're free to add application-wide styles to this file and they'll appear at the top of the
|
9
|
-
* compiled file, but it's generally better to create a new file per style scope.
|
10
|
-
*
|
11
|
-
*= require_self
|
12
|
-
*= require_tree .
|
13
|
-
*/
|