admin_it 1.2.0 → 1.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/admin_it.gemspec +1 -0
- data/app/assets/javascript/admin_it/admin_it.js +10 -0
- data/app/assets/javascript/admin_it/index.js +8 -0
- data/app/assets/javascript/admin_it/jquery.fileupload-main.js +75 -0
- data/app/assets/javascript/admin_it/jquery.fileupload-process.js +172 -0
- data/app/assets/javascript/admin_it/jquery.fileupload-ui.js +699 -0
- data/app/assets/javascript/admin_it/jquery.fileupload.js +1426 -0
- data/app/assets/javascript/admin_it/jquery.ui.widget.js +530 -0
- data/app/assets/stylesheets/admin_it/admin_it.css +3 -0
- data/app/assets/stylesheets/admin_it/index.css +7 -0
- data/app/assets/stylesheets/admin_it/jquery.fileupload-ui.css +57 -0
- data/app/assets/stylesheets/admin_it/jquery.fileupload.css +36 -0
- data/app/views/admin_it/context/_show.html.slim +2 -2
- data/app/views/admin_it/context/_tiles.html.slim +10 -5
- data/app/views/admin_it/editors/_image.html.slim +2 -2
- data/app/views/layouts/admin_it.html.slim +14 -21
- data/lib/admin_it/engine.rb +3 -2
- data/lib/admin_it/version.rb +1 -1
- metadata +25 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 23227402f984ba9bcd6dd0f25a801b7171acef22
|
4
|
+
data.tar.gz: ad8ef38ebb8836aa18461a5c0c52396902135536
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ef40e89deeb37e124babee26cf47415d466d9f0d48b5d747380c3c08315bff0c7e40a6ee27aceb67cac817c3ba7b6dc35d58009aefefd0255f68ae86920c4fe7
|
7
|
+
data.tar.gz: eb042138351ebab7c1b9b12c3139c133b53438739a140dbbaf043ee9e55137516acc1343ed18e2ebfba4cbd012a362aa8d118b9ac6a4fcb248bf8ee9432fb14f
|
data/admin_it.gemspec
CHANGED
@@ -22,6 +22,7 @@ Gem::Specification.new do |spec|
|
|
22
22
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
23
23
|
spec.require_paths = ['lib']
|
24
24
|
|
25
|
+
spec.add_dependency 'sprockets'
|
25
26
|
spec.add_dependency 'rails', '~> 4.0'
|
26
27
|
spec.add_dependency 'devise'
|
27
28
|
spec.add_dependency 'wrap_it'
|
@@ -45,6 +45,16 @@ var initTiles = function() {
|
|
45
45
|
.mouseleave(function() {
|
46
46
|
$(this).find('.admin-tile-actions').removeClass('in');
|
47
47
|
});
|
48
|
+
$('.admin-tile-actions').each(function() {
|
49
|
+
var $this = $(this);
|
50
|
+
var $parent = $this.parent();
|
51
|
+
var pos = $parent.position();
|
52
|
+
$this.css({
|
53
|
+
position: 'absolute',
|
54
|
+
top: pos.top + 10,
|
55
|
+
left: pos.left + $parent.outerWidth() - $this.outerWidth() - 10
|
56
|
+
});
|
57
|
+
});
|
48
58
|
}
|
49
59
|
|
50
60
|
var initPopups = function() {
|
@@ -0,0 +1,8 @@
|
|
1
|
+
//= require jquery
|
2
|
+
//= require jquery_ujs
|
3
|
+
//= require admin_it/bootstrap.min
|
4
|
+
//= require admin_it/jquery.ui.widget
|
5
|
+
//= require admin_it/jquery.fileupload
|
6
|
+
//= require admin_it/jquery.fileupload-ui
|
7
|
+
//= require admin_it/jquery.fileupload-process
|
8
|
+
//= require admin_it/admin_it
|
@@ -0,0 +1,75 @@
|
|
1
|
+
/*
|
2
|
+
* jQuery File Upload Plugin JS Example 8.9.1
|
3
|
+
* https://github.com/blueimp/jQuery-File-Upload
|
4
|
+
*
|
5
|
+
* Copyright 2010, Sebastian Tschan
|
6
|
+
* https://blueimp.net
|
7
|
+
*
|
8
|
+
* Licensed under the MIT license:
|
9
|
+
* http://www.opensource.org/licenses/MIT
|
10
|
+
*/
|
11
|
+
|
12
|
+
/* global $, window */
|
13
|
+
|
14
|
+
$(function () {
|
15
|
+
'use strict';
|
16
|
+
|
17
|
+
// Initialize the jQuery File Upload widget:
|
18
|
+
$('#fileupload').fileupload({
|
19
|
+
// Uncomment the following to send cross-domain cookies:
|
20
|
+
//xhrFields: {withCredentials: true},
|
21
|
+
url: 'server/php/'
|
22
|
+
});
|
23
|
+
|
24
|
+
// Enable iframe cross-domain access via redirect option:
|
25
|
+
$('#fileupload').fileupload(
|
26
|
+
'option',
|
27
|
+
'redirect',
|
28
|
+
window.location.href.replace(
|
29
|
+
/\/[^\/]*$/,
|
30
|
+
'/cors/result.html?%s'
|
31
|
+
)
|
32
|
+
);
|
33
|
+
|
34
|
+
if (window.location.hostname === 'blueimp.github.io') {
|
35
|
+
// Demo settings:
|
36
|
+
$('#fileupload').fileupload('option', {
|
37
|
+
url: '//jquery-file-upload.appspot.com/',
|
38
|
+
// Enable image resizing, except for Android and Opera,
|
39
|
+
// which actually support image resizing, but fail to
|
40
|
+
// send Blob objects via XHR requests:
|
41
|
+
disableImageResize: /Android(?!.*Chrome)|Opera/
|
42
|
+
.test(window.navigator.userAgent),
|
43
|
+
maxFileSize: 5000000,
|
44
|
+
acceptFileTypes: /(\.|\/)(gif|jpe?g|png)$/i
|
45
|
+
});
|
46
|
+
// Upload server status check for browsers with CORS support:
|
47
|
+
if ($.support.cors) {
|
48
|
+
$.ajax({
|
49
|
+
url: '//jquery-file-upload.appspot.com/',
|
50
|
+
type: 'HEAD'
|
51
|
+
}).fail(function () {
|
52
|
+
$('<div class="alert alert-danger"/>')
|
53
|
+
.text('Upload server currently unavailable - ' +
|
54
|
+
new Date())
|
55
|
+
.appendTo('#fileupload');
|
56
|
+
});
|
57
|
+
}
|
58
|
+
} else {
|
59
|
+
// Load existing files:
|
60
|
+
$('#fileupload').addClass('fileupload-processing');
|
61
|
+
$.ajax({
|
62
|
+
// Uncomment the following to send cross-domain cookies:
|
63
|
+
//xhrFields: {withCredentials: true},
|
64
|
+
url: $('#fileupload').fileupload('option', 'url'),
|
65
|
+
dataType: 'json',
|
66
|
+
context: $('#fileupload')[0]
|
67
|
+
}).always(function () {
|
68
|
+
$(this).removeClass('fileupload-processing');
|
69
|
+
}).done(function (result) {
|
70
|
+
$(this).fileupload('option', 'done')
|
71
|
+
.call(this, $.Event('done'), {result: result});
|
72
|
+
});
|
73
|
+
}
|
74
|
+
|
75
|
+
});
|
@@ -0,0 +1,172 @@
|
|
1
|
+
/*
|
2
|
+
* jQuery File Upload Processing Plugin 1.3.0
|
3
|
+
* https://github.com/blueimp/jQuery-File-Upload
|
4
|
+
*
|
5
|
+
* Copyright 2012, Sebastian Tschan
|
6
|
+
* https://blueimp.net
|
7
|
+
*
|
8
|
+
* Licensed under the MIT license:
|
9
|
+
* http://www.opensource.org/licenses/MIT
|
10
|
+
*/
|
11
|
+
|
12
|
+
/* jshint nomen:false */
|
13
|
+
/* global define, window */
|
14
|
+
|
15
|
+
(function (factory) {
|
16
|
+
'use strict';
|
17
|
+
if (typeof define === 'function' && define.amd) {
|
18
|
+
// Register as an anonymous AMD module:
|
19
|
+
define([
|
20
|
+
'jquery',
|
21
|
+
'./jquery.fileupload'
|
22
|
+
], factory);
|
23
|
+
} else {
|
24
|
+
// Browser globals:
|
25
|
+
factory(
|
26
|
+
window.jQuery
|
27
|
+
);
|
28
|
+
}
|
29
|
+
}(function ($) {
|
30
|
+
'use strict';
|
31
|
+
|
32
|
+
var originalAdd = $.blueimp.fileupload.prototype.options.add;
|
33
|
+
|
34
|
+
// The File Upload Processing plugin extends the fileupload widget
|
35
|
+
// with file processing functionality:
|
36
|
+
$.widget('blueimp.fileupload', $.blueimp.fileupload, {
|
37
|
+
|
38
|
+
options: {
|
39
|
+
// The list of processing actions:
|
40
|
+
processQueue: [
|
41
|
+
/*
|
42
|
+
{
|
43
|
+
action: 'log',
|
44
|
+
type: 'debug'
|
45
|
+
}
|
46
|
+
*/
|
47
|
+
],
|
48
|
+
add: function (e, data) {
|
49
|
+
var $this = $(this);
|
50
|
+
data.process(function () {
|
51
|
+
return $this.fileupload('process', data);
|
52
|
+
});
|
53
|
+
originalAdd.call(this, e, data);
|
54
|
+
}
|
55
|
+
},
|
56
|
+
|
57
|
+
processActions: {
|
58
|
+
/*
|
59
|
+
log: function (data, options) {
|
60
|
+
console[options.type](
|
61
|
+
'Processing "' + data.files[data.index].name + '"'
|
62
|
+
);
|
63
|
+
}
|
64
|
+
*/
|
65
|
+
},
|
66
|
+
|
67
|
+
_processFile: function (data, originalData) {
|
68
|
+
var that = this,
|
69
|
+
dfd = $.Deferred().resolveWith(that, [data]),
|
70
|
+
chain = dfd.promise();
|
71
|
+
this._trigger('process', null, data);
|
72
|
+
$.each(data.processQueue, function (i, settings) {
|
73
|
+
var func = function (data) {
|
74
|
+
if (originalData.errorThrown) {
|
75
|
+
return $.Deferred()
|
76
|
+
.rejectWith(that, [originalData]).promise();
|
77
|
+
}
|
78
|
+
return that.processActions[settings.action].call(
|
79
|
+
that,
|
80
|
+
data,
|
81
|
+
settings
|
82
|
+
);
|
83
|
+
};
|
84
|
+
chain = chain.pipe(func, settings.always && func);
|
85
|
+
});
|
86
|
+
chain
|
87
|
+
.done(function () {
|
88
|
+
that._trigger('processdone', null, data);
|
89
|
+
that._trigger('processalways', null, data);
|
90
|
+
})
|
91
|
+
.fail(function () {
|
92
|
+
that._trigger('processfail', null, data);
|
93
|
+
that._trigger('processalways', null, data);
|
94
|
+
});
|
95
|
+
return chain;
|
96
|
+
},
|
97
|
+
|
98
|
+
// Replaces the settings of each processQueue item that
|
99
|
+
// are strings starting with an "@", using the remaining
|
100
|
+
// substring as key for the option map,
|
101
|
+
// e.g. "@autoUpload" is replaced with options.autoUpload:
|
102
|
+
_transformProcessQueue: function (options) {
|
103
|
+
var processQueue = [];
|
104
|
+
$.each(options.processQueue, function () {
|
105
|
+
var settings = {},
|
106
|
+
action = this.action,
|
107
|
+
prefix = this.prefix === true ? action : this.prefix;
|
108
|
+
$.each(this, function (key, value) {
|
109
|
+
if ($.type(value) === 'string' &&
|
110
|
+
value.charAt(0) === '@') {
|
111
|
+
settings[key] = options[
|
112
|
+
value.slice(1) || (prefix ? prefix +
|
113
|
+
key.charAt(0).toUpperCase() + key.slice(1) : key)
|
114
|
+
];
|
115
|
+
} else {
|
116
|
+
settings[key] = value;
|
117
|
+
}
|
118
|
+
|
119
|
+
});
|
120
|
+
processQueue.push(settings);
|
121
|
+
});
|
122
|
+
options.processQueue = processQueue;
|
123
|
+
},
|
124
|
+
|
125
|
+
// Returns the number of files currently in the processsing queue:
|
126
|
+
processing: function () {
|
127
|
+
return this._processing;
|
128
|
+
},
|
129
|
+
|
130
|
+
// Processes the files given as files property of the data parameter,
|
131
|
+
// returns a Promise object that allows to bind callbacks:
|
132
|
+
process: function (data) {
|
133
|
+
var that = this,
|
134
|
+
options = $.extend({}, this.options, data);
|
135
|
+
if (options.processQueue && options.processQueue.length) {
|
136
|
+
this._transformProcessQueue(options);
|
137
|
+
if (this._processing === 0) {
|
138
|
+
this._trigger('processstart');
|
139
|
+
}
|
140
|
+
$.each(data.files, function (index) {
|
141
|
+
var opts = index ? $.extend({}, options) : options,
|
142
|
+
func = function () {
|
143
|
+
if (data.errorThrown) {
|
144
|
+
return $.Deferred()
|
145
|
+
.rejectWith(that, [data]).promise();
|
146
|
+
}
|
147
|
+
return that._processFile(opts, data);
|
148
|
+
};
|
149
|
+
opts.index = index;
|
150
|
+
that._processing += 1;
|
151
|
+
that._processingQueue = that._processingQueue.pipe(func, func)
|
152
|
+
.always(function () {
|
153
|
+
that._processing -= 1;
|
154
|
+
if (that._processing === 0) {
|
155
|
+
that._trigger('processstop');
|
156
|
+
}
|
157
|
+
});
|
158
|
+
});
|
159
|
+
}
|
160
|
+
return this._processingQueue;
|
161
|
+
},
|
162
|
+
|
163
|
+
_create: function () {
|
164
|
+
this._super();
|
165
|
+
this._processing = 0;
|
166
|
+
this._processingQueue = $.Deferred().resolveWith(this)
|
167
|
+
.promise();
|
168
|
+
}
|
169
|
+
|
170
|
+
});
|
171
|
+
|
172
|
+
}));
|