tb_media 1.0.4 → 1.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/javascripts/admin/media/picker.js +37 -0
- data/app/assets/stylesheets/admin/media/plugin.css +3 -3
- data/app/controllers/admin/media_picker_controller.rb +10 -2
- data/lib/spud_media/version.rb +1 -1
- data/spec/dummy/public/system/spud_media/1/small/test_img1.png +0 -0
- data/spec/dummy/public/system/spud_media/2/small/test_img1.png +0 -0
- data/spec/dummy/public/system/spud_media/3/small/test_img1.png +0 -0
- data/spec/dummy/public/system/spud_media/4/small/test_img1.png +0 -0
- data/spec/dummy/public/system/spud_media/5/small/test_img1.png +0 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1387c1ba0eb754c7363e2c2beab5a4d94af6dc96
|
4
|
+
data.tar.gz: 0fa036c28e19bd7cbf0d53d4062c271095bc680d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: aee37a7b86e49d30a95b1b1c7634503096a49b51b53285a9a95c1023ae356466e8aa66c6a09ef505cd61161b692faa5cc1e99ea1c6b23beb123d13e7fb6ae849
|
7
|
+
data.tar.gz: 01cca18ee17a2d9e8764ff1ffffd8010487e01411dfb9b6e22cb4c8c18c569b83e045b406c1272528ea21f3c1b66fd95cdcd39df738520bac23007e8f2f0583a
|
@@ -13,6 +13,8 @@ spud.admin.mediapicker = new function(){
|
|
13
13
|
var self = this;
|
14
14
|
var supportsHtml5Upload = false;
|
15
15
|
var selectedFile = {};
|
16
|
+
var currentPage = 1;
|
17
|
+
var pageIsLoading = false;
|
16
18
|
|
17
19
|
self.init = function(){
|
18
20
|
if(typeof(FormData) != 'undefined'){
|
@@ -29,6 +31,41 @@ spud.admin.mediapicker = new function(){
|
|
29
31
|
$('.spud_media_picker_tab_advanced').on('spud_media_picker_tab_activated', self.activatedAdvancedTab);
|
30
32
|
$('.spud_media_picker_option_dimensions').on('blur', 'input', self.dimensionsChanged);
|
31
33
|
$('.spud_media_picker_option').on('keyup', 'input[type=text]', self.pickerOptionKeyDown);
|
34
|
+
$('.spud_media_picker_list').on('scroll', onListScroll);
|
35
|
+
};
|
36
|
+
|
37
|
+
var onListScroll = function(e){
|
38
|
+
var list = $(this);
|
39
|
+
var children = list.children();
|
40
|
+
var listHeight = list.height();
|
41
|
+
var scrollHeight = (children.length * children.first().outerHeight()) - listHeight;
|
42
|
+
if(list.scrollTop() >= scrollHeight){
|
43
|
+
loadNextPage();
|
44
|
+
}
|
45
|
+
};
|
46
|
+
|
47
|
+
var loadNextPage = function(){
|
48
|
+
if(pageIsLoading){
|
49
|
+
return;
|
50
|
+
}
|
51
|
+
pageIsLoading = true;
|
52
|
+
currentPage++;
|
53
|
+
$.ajax('/admin/media_picker', {
|
54
|
+
data: {
|
55
|
+
page: currentPage,
|
56
|
+
only_list: true
|
57
|
+
},
|
58
|
+
dataType: 'html',
|
59
|
+
success: function(html){
|
60
|
+
if(html.trim() === ''){
|
61
|
+
$('.spud_media_picker_list').off('scroll', onListScroll);
|
62
|
+
}
|
63
|
+
else{
|
64
|
+
$('.spud_media_picker_list').append(html);
|
65
|
+
}
|
66
|
+
pageIsLoading = false;
|
67
|
+
}
|
68
|
+
});
|
32
69
|
};
|
33
70
|
|
34
71
|
self.clickedTab = function(e){
|
@@ -76,7 +76,7 @@
|
|
76
76
|
cursor: pointer;
|
77
77
|
padding: 3px;
|
78
78
|
font: normal 12px/20px sans-serif;
|
79
|
-
border-
|
79
|
+
border-bottom: 1px solid #ccc;
|
80
80
|
overflow: hidden;
|
81
81
|
height: 20px;
|
82
82
|
white-space: nowrap;
|
@@ -87,8 +87,8 @@
|
|
87
87
|
-ms-user-select: none;
|
88
88
|
user-select: none;
|
89
89
|
}
|
90
|
-
.spud_media_picker_item:
|
91
|
-
border-
|
90
|
+
.spud_media_picker_item:last-child{
|
91
|
+
border-bottom: none;
|
92
92
|
}
|
93
93
|
.spud_media_picker_item:last-child{
|
94
94
|
border-bottom: 1px solid #ccc;
|
@@ -6,8 +6,16 @@ class Admin::MediaPickerController < Admin::ApplicationController
|
|
6
6
|
respond_to :html
|
7
7
|
|
8
8
|
def index
|
9
|
-
@media = SpudMedia.
|
10
|
-
respond_with @media
|
9
|
+
@media = SpudMedia.order('attachment_file_name asc').paginate(:page => params[:page], :per_page => 30)
|
10
|
+
respond_with @media do |format|
|
11
|
+
format.html{
|
12
|
+
if params[:only_list]
|
13
|
+
render :partial => 'media', :collection => @media
|
14
|
+
else
|
15
|
+
render 'index'
|
16
|
+
end
|
17
|
+
}
|
18
|
+
end
|
11
19
|
end
|
12
20
|
|
13
21
|
def create
|
data/lib/spud_media/version.rb
CHANGED
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tb_media
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Westlake Design
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-05-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|