mix-rails-albums 0.10.2
Sign up to get free protection for your applications and to get access to all the features.
- data/MIT-LICENSE +20 -0
- data/README.rdoc +3 -0
- data/Rakefile +27 -0
- data/app/assets/images/albums/crop.png +0 -0
- data/app/assets/images/albums/delete.png +0 -0
- data/app/assets/images/albums/photos.png +0 -0
- data/app/assets/images/albums/rotate_ccw.png +0 -0
- data/app/assets/images/albums/rotate_cw.png +0 -0
- data/app/assets/images/colorbox/border.png +0 -0
- data/app/assets/images/colorbox/controls.png +0 -0
- data/app/assets/images/colorbox/ie6/borderBottomCenter.png +0 -0
- data/app/assets/images/colorbox/ie6/borderBottomLeft.png +0 -0
- data/app/assets/images/colorbox/ie6/borderBottomRight.png +0 -0
- data/app/assets/images/colorbox/ie6/borderMiddleLeft.png +0 -0
- data/app/assets/images/colorbox/ie6/borderMiddleRight.png +0 -0
- data/app/assets/images/colorbox/ie6/borderTopCenter.png +0 -0
- data/app/assets/images/colorbox/ie6/borderTopLeft.png +0 -0
- data/app/assets/images/colorbox/ie6/borderTopRight.png +0 -0
- data/app/assets/images/colorbox/loading.gif +0 -0
- data/app/assets/images/colorbox/loading_background.png +0 -0
- data/app/assets/images/colorbox/overlay.png +0 -0
- data/app/assets/javascripts/admix/photos.js.erb +78 -0
- data/app/assets/javascripts/albums/jquery.jcarousel.min.js +16 -0
- data/app/assets/javascripts/albums/show.js.coffee +62 -0
- data/app/assets/javascripts/albums.js +0 -0
- data/app/assets/javascripts/collections/filelist.js +5 -0
- data/app/assets/javascripts/colorbox/jquery.colorbox-min.js +4 -0
- data/app/assets/javascripts/models/fileitem.js +40 -0
- data/app/assets/javascripts/models/filezip.js +8 -0
- data/app/assets/javascripts/photo_uploader.coffee +2 -0
- data/app/assets/javascripts/templates/photo_view.hamlc.erb +16 -0
- data/app/assets/javascripts/views/filelistview.js +15 -0
- data/app/assets/javascripts/views/fileview.js +34 -0
- data/app/assets/javascripts/views/filezipview.js +42 -0
- data/app/assets/stylesheets/colorbox/colorbox.css.scss +86 -0
- data/app/assets/stylesheets/skins/ie7/credits.txt +1 -0
- data/app/assets/stylesheets/skins/ie7/loading-small.gif +0 -0
- data/app/assets/stylesheets/skins/ie7/loading.gif +0 -0
- data/app/assets/stylesheets/skins/ie7/loading_small.gif +0 -0
- data/app/assets/stylesheets/skins/ie7/next-horizontal.gif +0 -0
- data/app/assets/stylesheets/skins/ie7/prev-horizontal.gif +0 -0
- data/app/assets/stylesheets/skins/ie7/skin.css +190 -0
- data/app/assets/stylesheets/skins/tango/credits.txt +1 -0
- data/app/assets/stylesheets/skins/tango/next-horizontal.png +0 -0
- data/app/assets/stylesheets/skins/tango/next-vertical.png +0 -0
- data/app/assets/stylesheets/skins/tango/prev-horizontal.png +0 -0
- data/app/assets/stylesheets/skins/tango/prev-vertical.png +0 -0
- data/app/assets/stylesheets/skins/tango/skin.css +186 -0
- data/app/controllers/admix/albums_controller.rb +5 -0
- data/app/controllers/admix/photos_controller.rb +24 -0
- data/app/controllers/albums_controller.rb +19 -0
- data/app/helpers/admix/albums_helper.rb +11 -0
- data/app/models/admix/albums_datagrid.rb +34 -0
- data/app/models/admix/photos_datagrid.rb +15 -0
- data/app/models/album.rb +29 -0
- data/app/models/photo.rb +14 -0
- data/app/uploaders/albums/image_uploader.rb +72 -0
- data/app/views/admix/albums/_form_fields.html.haml +4 -0
- data/app/views/admix/albums/_show.html.haml +7 -0
- data/app/views/admix/albums/_table_actions.html.haml +4 -0
- data/app/views/admix/photos/_upload.html.haml +26 -0
- data/app/views/admix/photos/index.html.haml +1 -0
- data/app/views/albums/index.html.haml +4 -0
- data/app/views/albums/show.html.haml +3 -0
- data/config/application.rb +1 -0
- data/config/initializers/albums.rb +1 -0
- data/config/initializers/carrierwave.rb +9 -0
- data/config/locales/albums.en.yml +13 -0
- data/config/locales/albums.pt-BR.yml +17 -0
- data/config/locales/photos.pt-BR.yml +11 -0
- data/config/routes.rb +13 -0
- data/lib/mix-rails-albums/engine.rb +19 -0
- data/lib/mix-rails-albums/version.rb +10 -0
- data/lib/mix-rails-albums.rb +10 -0
- data/lib/tasks/albums_tasks.rake +4 -0
- metadata +222 -0
data/MIT-LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright 2013 YOURNAME
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.rdoc
ADDED
data/Rakefile
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
#!/usr/bin/env rake
|
2
|
+
begin
|
3
|
+
require 'bundler/setup'
|
4
|
+
rescue LoadError
|
5
|
+
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
|
6
|
+
end
|
7
|
+
begin
|
8
|
+
require 'rdoc/task'
|
9
|
+
rescue LoadError
|
10
|
+
require 'rdoc/rdoc'
|
11
|
+
require 'rake/rdoctask'
|
12
|
+
RDoc::Task = Rake::RDocTask
|
13
|
+
end
|
14
|
+
|
15
|
+
RDoc::Task.new(:rdoc) do |rdoc|
|
16
|
+
rdoc.rdoc_dir = 'rdoc'
|
17
|
+
rdoc.title = 'Albums'
|
18
|
+
rdoc.options << '--line-numbers'
|
19
|
+
rdoc.rdoc_files.include('README.rdoc')
|
20
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
21
|
+
end
|
22
|
+
|
23
|
+
|
24
|
+
|
25
|
+
|
26
|
+
Bundler::GemHelper.install_tasks
|
27
|
+
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -0,0 +1,78 @@
|
|
1
|
+
//= require hamlcoffee
|
2
|
+
//= require ../photo_uploader
|
3
|
+
//
|
4
|
+
//= require_tree ../models
|
5
|
+
//= require_tree ../collections
|
6
|
+
//= require_tree ../views
|
7
|
+
//= require_tree ../routers
|
8
|
+
//= require_tree ../templates
|
9
|
+
|
10
|
+
<% url = Rails.application.routes.url_helpers %>
|
11
|
+
|
12
|
+
var oldSet = Backbone.Model.prototype.set;
|
13
|
+
_.extend(Backbone.Model.prototype, {
|
14
|
+
set: function(attrs, options) {
|
15
|
+
if ('_id' in attrs) { this.id = attrs._id; }
|
16
|
+
oldSet.apply(this, [attrs, options]);
|
17
|
+
return this;
|
18
|
+
}
|
19
|
+
});
|
20
|
+
|
21
|
+
|
22
|
+
jQuery(function(){
|
23
|
+
|
24
|
+
var fileZip, fileZipView;
|
25
|
+
|
26
|
+
|
27
|
+
var fileList = new FileList();
|
28
|
+
fileList.url = $("#files").data('url');
|
29
|
+
var fileListView;
|
30
|
+
|
31
|
+
jQuery("#uploader").change(function(el) {
|
32
|
+
|
33
|
+
var files = el.currentTarget.files;
|
34
|
+
|
35
|
+
for(var i = 0; i < files.length; i++) {
|
36
|
+
|
37
|
+
var fileItem = new FileItem(
|
38
|
+
{
|
39
|
+
image: files[i],
|
40
|
+
name: files[i].name
|
41
|
+
});
|
42
|
+
|
43
|
+
fileItem.url = fileList.url;
|
44
|
+
|
45
|
+
fileList.add(fileItem);
|
46
|
+
|
47
|
+
|
48
|
+
setTimeout(function(){
|
49
|
+
fileList.add(fileItem);
|
50
|
+
}, 1000);
|
51
|
+
|
52
|
+
}
|
53
|
+
|
54
|
+
fileListView.render();
|
55
|
+
});
|
56
|
+
|
57
|
+
|
58
|
+
|
59
|
+
fileListView = new FileListView({
|
60
|
+
initialize: function(){
|
61
|
+
this.render();
|
62
|
+
this.collection.on('change', this.render, this);
|
63
|
+
},
|
64
|
+
collection: fileList,
|
65
|
+
el: $("#files")
|
66
|
+
});
|
67
|
+
|
68
|
+
function updateFileList() {
|
69
|
+
fileList.fetch({
|
70
|
+
success: function() {
|
71
|
+
fileListView.render();
|
72
|
+
}
|
73
|
+
});
|
74
|
+
}
|
75
|
+
|
76
|
+
updateFileList();
|
77
|
+
|
78
|
+
});
|
@@ -0,0 +1,16 @@
|
|
1
|
+
/*!
|
2
|
+
* jCarousel - Riding carousels with jQuery
|
3
|
+
* http://sorgalla.com/jcarousel/
|
4
|
+
*
|
5
|
+
* Copyright (c) 2006 Jan Sorgalla (http://sorgalla.com)
|
6
|
+
* Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php)
|
7
|
+
* and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
|
8
|
+
*
|
9
|
+
* Built on top of the jQuery library
|
10
|
+
* http://jquery.com
|
11
|
+
*
|
12
|
+
* Inspired by the "Carousel Component" by Bill Scott
|
13
|
+
* http://billwscott.com/carousel/
|
14
|
+
*/
|
15
|
+
|
16
|
+
(function(g){var q={vertical:!1,rtl:!1,start:1,offset:1,size:null,scroll:3,visible:null,animation:"normal",easing:"swing",auto:0,wrap:null,initCallback:null,setupCallback:null,reloadCallback:null,itemLoadCallback:null,itemFirstInCallback:null,itemFirstOutCallback:null,itemLastInCallback:null,itemLastOutCallback:null,itemVisibleInCallback:null,itemVisibleOutCallback:null,animationStepCallback:null,buttonNextHTML:"<div></div>",buttonPrevHTML:"<div></div>",buttonNextEvent:"click",buttonPrevEvent:"click", buttonNextCallback:null,buttonPrevCallback:null,itemFallbackDimension:null},m=!1;g(window).bind("load.jcarousel",function(){m=!0});g.jcarousel=function(a,c){this.options=g.extend({},q,c||{});this.autoStopped=this.locked=!1;this.buttonPrevState=this.buttonNextState=this.buttonPrev=this.buttonNext=this.list=this.clip=this.container=null;if(!c||c.rtl===void 0)this.options.rtl=(g(a).attr("dir")||g("html").attr("dir")||"").toLowerCase()=="rtl";this.wh=!this.options.vertical?"width":"height";this.lt=!this.options.vertical? this.options.rtl?"right":"left":"top";for(var b="",d=a.className.split(" "),f=0;f<d.length;f++)if(d[f].indexOf("jcarousel-skin")!=-1){g(a).removeClass(d[f]);b=d[f];break}a.nodeName.toUpperCase()=="UL"||a.nodeName.toUpperCase()=="OL"?(this.list=g(a),this.clip=this.list.parents(".jcarousel-clip"),this.container=this.list.parents(".jcarousel-container")):(this.container=g(a),this.list=this.container.find("ul,ol").eq(0),this.clip=this.container.find(".jcarousel-clip"));if(this.clip.size()===0)this.clip= this.list.wrap("<div></div>").parent();if(this.container.size()===0)this.container=this.clip.wrap("<div></div>").parent();b!==""&&this.container.parent()[0].className.indexOf("jcarousel-skin")==-1&&this.container.wrap('<div class=" '+b+'"></div>');this.buttonPrev=g(".jcarousel-prev",this.container);if(this.buttonPrev.size()===0&&this.options.buttonPrevHTML!==null)this.buttonPrev=g(this.options.buttonPrevHTML).appendTo(this.container);this.buttonPrev.addClass(this.className("jcarousel-prev"));this.buttonNext= g(".jcarousel-next",this.container);if(this.buttonNext.size()===0&&this.options.buttonNextHTML!==null)this.buttonNext=g(this.options.buttonNextHTML).appendTo(this.container);this.buttonNext.addClass(this.className("jcarousel-next"));this.clip.addClass(this.className("jcarousel-clip")).css({position:"relative"});this.list.addClass(this.className("jcarousel-list")).css({overflow:"hidden",position:"relative",top:0,margin:0,padding:0}).css(this.options.rtl?"right":"left",0);this.container.addClass(this.className("jcarousel-container")).css({position:"relative"}); !this.options.vertical&&this.options.rtl&&this.container.addClass("jcarousel-direction-rtl").attr("dir","rtl");var j=this.options.visible!==null?Math.ceil(this.clipping()/this.options.visible):null,b=this.list.children("li"),e=this;if(b.size()>0){var h=0,i=this.options.offset;b.each(function(){e.format(this,i++);h+=e.dimension(this,j)});this.list.css(this.wh,h+100+"px");if(!c||c.size===void 0)this.options.size=b.size()}this.container.css("display","block");this.buttonNext.css("display","block");this.buttonPrev.css("display", "block");this.funcNext=function(){e.next()};this.funcPrev=function(){e.prev()};this.funcResize=function(){e.resizeTimer&&clearTimeout(e.resizeTimer);e.resizeTimer=setTimeout(function(){e.reload()},100)};this.options.initCallback!==null&&this.options.initCallback(this,"init");!m&&g.browser.safari?(this.buttons(!1,!1),g(window).bind("load.jcarousel",function(){e.setup()})):this.setup()};var f=g.jcarousel;f.fn=f.prototype={jcarousel:"0.2.8"};f.fn.extend=f.extend=g.extend;f.fn.extend({setup:function(){this.prevLast= this.prevFirst=this.last=this.first=null;this.animating=!1;this.tail=this.resizeTimer=this.timer=null;this.inTail=!1;if(!this.locked){this.list.css(this.lt,this.pos(this.options.offset)+"px");var a=this.pos(this.options.start,!0);this.prevFirst=this.prevLast=null;this.animate(a,!1);g(window).unbind("resize.jcarousel",this.funcResize).bind("resize.jcarousel",this.funcResize);this.options.setupCallback!==null&&this.options.setupCallback(this)}},reset:function(){this.list.empty();this.list.css(this.lt, "0px");this.list.css(this.wh,"10px");this.options.initCallback!==null&&this.options.initCallback(this,"reset");this.setup()},reload:function(){this.tail!==null&&this.inTail&&this.list.css(this.lt,f.intval(this.list.css(this.lt))+this.tail);this.tail=null;this.inTail=!1;this.options.reloadCallback!==null&&this.options.reloadCallback(this);if(this.options.visible!==null){var a=this,c=Math.ceil(this.clipping()/this.options.visible),b=0,d=0;this.list.children("li").each(function(f){b+=a.dimension(this, c);f+1<a.first&&(d=b)});this.list.css(this.wh,b+"px");this.list.css(this.lt,-d+"px")}this.scroll(this.first,!1)},lock:function(){this.locked=!0;this.buttons()},unlock:function(){this.locked=!1;this.buttons()},size:function(a){if(a!==void 0)this.options.size=a,this.locked||this.buttons();return this.options.size},has:function(a,c){if(c===void 0||!c)c=a;if(this.options.size!==null&&c>this.options.size)c=this.options.size;for(var b=a;b<=c;b++){var d=this.get(b);if(!d.length||d.hasClass("jcarousel-item-placeholder"))return!1}return!0}, get:function(a){return g(">.jcarousel-item-"+a,this.list)},add:function(a,c){var b=this.get(a),d=0,p=g(c);if(b.length===0)for(var j,e=f.intval(a),b=this.create(a);;){if(j=this.get(--e),e<=0||j.length){e<=0?this.list.prepend(b):j.after(b);break}}else d=this.dimension(b);p.get(0).nodeName.toUpperCase()=="LI"?(b.replaceWith(p),b=p):b.empty().append(c);this.format(b.removeClass(this.className("jcarousel-item-placeholder")),a);p=this.options.visible!==null?Math.ceil(this.clipping()/this.options.visible): null;d=this.dimension(b,p)-d;a>0&&a<this.first&&this.list.css(this.lt,f.intval(this.list.css(this.lt))-d+"px");this.list.css(this.wh,f.intval(this.list.css(this.wh))+d+"px");return b},remove:function(a){var c=this.get(a);if(c.length&&!(a>=this.first&&a<=this.last)){var b=this.dimension(c);a<this.first&&this.list.css(this.lt,f.intval(this.list.css(this.lt))+b+"px");c.remove();this.list.css(this.wh,f.intval(this.list.css(this.wh))-b+"px")}},next:function(){this.tail!==null&&!this.inTail?this.scrollTail(!1): this.scroll((this.options.wrap=="both"||this.options.wrap=="last")&&this.options.size!==null&&this.last==this.options.size?1:this.first+this.options.scroll)},prev:function(){this.tail!==null&&this.inTail?this.scrollTail(!0):this.scroll((this.options.wrap=="both"||this.options.wrap=="first")&&this.options.size!==null&&this.first==1?this.options.size:this.first-this.options.scroll)},scrollTail:function(a){if(!this.locked&&!this.animating&&this.tail){this.pauseAuto();var c=f.intval(this.list.css(this.lt)), c=!a?c-this.tail:c+this.tail;this.inTail=!a;this.prevFirst=this.first;this.prevLast=this.last;this.animate(c)}},scroll:function(a,c){!this.locked&&!this.animating&&(this.pauseAuto(),this.animate(this.pos(a),c))},pos:function(a,c){var b=f.intval(this.list.css(this.lt));if(this.locked||this.animating)return b;this.options.wrap!="circular"&&(a=a<1?1:this.options.size&&a>this.options.size?this.options.size:a);for(var d=this.first>a,g=this.options.wrap!="circular"&&this.first<=1?1:this.first,j=d?this.get(g): this.get(this.last),e=d?g:g-1,h=null,i=0,k=!1,l=0;d?--e>=a:++e<a;){h=this.get(e);k=!h.length;if(h.length===0&&(h=this.create(e).addClass(this.className("jcarousel-item-placeholder")),j[d?"before":"after"](h),this.first!==null&&this.options.wrap=="circular"&&this.options.size!==null&&(e<=0||e>this.options.size)))j=this.get(this.index(e)),j.length&&(h=this.add(e,j.clone(!0)));j=h;l=this.dimension(h);k&&(i+=l);if(this.first!==null&&(this.options.wrap=="circular"||e>=1&&(this.options.size===null||e<= this.options.size)))b=d?b+l:b-l}for(var g=this.clipping(),m=[],o=0,n=0,j=this.get(a-1),e=a;++o;){h=this.get(e);k=!h.length;if(h.length===0){h=this.create(e).addClass(this.className("jcarousel-item-placeholder"));if(j.length===0)this.list.prepend(h);else j[d?"before":"after"](h);if(this.first!==null&&this.options.wrap=="circular"&&this.options.size!==null&&(e<=0||e>this.options.size))j=this.get(this.index(e)),j.length&&(h=this.add(e,j.clone(!0)))}j=h;l=this.dimension(h);if(l===0)throw Error("jCarousel: No width/height set for items. This will cause an infinite loop. Aborting..."); this.options.wrap!="circular"&&this.options.size!==null&&e>this.options.size?m.push(h):k&&(i+=l);n+=l;if(n>=g)break;e++}for(h=0;h<m.length;h++)m[h].remove();i>0&&(this.list.css(this.wh,this.dimension(this.list)+i+"px"),d&&(b-=i,this.list.css(this.lt,f.intval(this.list.css(this.lt))-i+"px")));i=a+o-1;if(this.options.wrap!="circular"&&this.options.size&&i>this.options.size)i=this.options.size;if(e>i){o=0;e=i;for(n=0;++o;){h=this.get(e--);if(!h.length)break;n+=this.dimension(h);if(n>=g)break}}e=i-o+ 1;this.options.wrap!="circular"&&e<1&&(e=1);if(this.inTail&&d)b+=this.tail,this.inTail=!1;this.tail=null;if(this.options.wrap!="circular"&&i==this.options.size&&i-o+1>=1&&(d=f.intval(this.get(i).css(!this.options.vertical?"marginRight":"marginBottom")),n-d>g))this.tail=n-g-d;if(c&&a===this.options.size&&this.tail)b-=this.tail,this.inTail=!0;for(;a-- >e;)b+=this.dimension(this.get(a));this.prevFirst=this.first;this.prevLast=this.last;this.first=e;this.last=i;return b},animate:function(a,c){if(!this.locked&& !this.animating){this.animating=!0;var b=this,d=function(){b.animating=!1;a===0&&b.list.css(b.lt,0);!b.autoStopped&&(b.options.wrap=="circular"||b.options.wrap=="both"||b.options.wrap=="last"||b.options.size===null||b.last<b.options.size||b.last==b.options.size&&b.tail!==null&&!b.inTail)&&b.startAuto();b.buttons();b.notify("onAfterAnimation");if(b.options.wrap=="circular"&&b.options.size!==null)for(var c=b.prevFirst;c<=b.prevLast;c++)c!==null&&!(c>=b.first&&c<=b.last)&&(c<1||c>b.options.size)&&b.remove(c)}; this.notify("onBeforeAnimation");if(!this.options.animation||c===!1)this.list.css(this.lt,a+"px"),d();else{var f=!this.options.vertical?this.options.rtl?{right:a}:{left:a}:{top:a},d={duration:this.options.animation,easing:this.options.easing,complete:d};if(g.isFunction(this.options.animationStepCallback))d.step=this.options.animationStepCallback;this.list.animate(f,d)}}},startAuto:function(a){if(a!==void 0)this.options.auto=a;if(this.options.auto===0)return this.stopAuto();if(this.timer===null){this.autoStopped= !1;var c=this;this.timer=window.setTimeout(function(){c.next()},this.options.auto*1E3)}},stopAuto:function(){this.pauseAuto();this.autoStopped=!0},pauseAuto:function(){if(this.timer!==null)window.clearTimeout(this.timer),this.timer=null},buttons:function(a,c){if(a==null&&(a=!this.locked&&this.options.size!==0&&(this.options.wrap&&this.options.wrap!="first"||this.options.size===null||this.last<this.options.size),!this.locked&&(!this.options.wrap||this.options.wrap=="first")&&this.options.size!==null&& this.last>=this.options.size))a=this.tail!==null&&!this.inTail;if(c==null&&(c=!this.locked&&this.options.size!==0&&(this.options.wrap&&this.options.wrap!="last"||this.first>1),!this.locked&&(!this.options.wrap||this.options.wrap=="last")&&this.options.size!==null&&this.first==1))c=this.tail!==null&&this.inTail;var b=this;this.buttonNext.size()>0?(this.buttonNext.unbind(this.options.buttonNextEvent+".jcarousel",this.funcNext),a&&this.buttonNext.bind(this.options.buttonNextEvent+".jcarousel",this.funcNext), this.buttonNext[a?"removeClass":"addClass"](this.className("jcarousel-next-disabled")).attr("disabled",a?!1:!0),this.options.buttonNextCallback!==null&&this.buttonNext.data("jcarouselstate")!=a&&this.buttonNext.each(function(){b.options.buttonNextCallback(b,this,a)}).data("jcarouselstate",a)):this.options.buttonNextCallback!==null&&this.buttonNextState!=a&&this.options.buttonNextCallback(b,null,a);this.buttonPrev.size()>0?(this.buttonPrev.unbind(this.options.buttonPrevEvent+".jcarousel",this.funcPrev), c&&this.buttonPrev.bind(this.options.buttonPrevEvent+".jcarousel",this.funcPrev),this.buttonPrev[c?"removeClass":"addClass"](this.className("jcarousel-prev-disabled")).attr("disabled",c?!1:!0),this.options.buttonPrevCallback!==null&&this.buttonPrev.data("jcarouselstate")!=c&&this.buttonPrev.each(function(){b.options.buttonPrevCallback(b,this,c)}).data("jcarouselstate",c)):this.options.buttonPrevCallback!==null&&this.buttonPrevState!=c&&this.options.buttonPrevCallback(b,null,c);this.buttonNextState= a;this.buttonPrevState=c},notify:function(a){var c=this.prevFirst===null?"init":this.prevFirst<this.first?"next":"prev";this.callback("itemLoadCallback",a,c);this.prevFirst!==this.first&&(this.callback("itemFirstInCallback",a,c,this.first),this.callback("itemFirstOutCallback",a,c,this.prevFirst));this.prevLast!==this.last&&(this.callback("itemLastInCallback",a,c,this.last),this.callback("itemLastOutCallback",a,c,this.prevLast));this.callback("itemVisibleInCallback",a,c,this.first,this.last,this.prevFirst, this.prevLast);this.callback("itemVisibleOutCallback",a,c,this.prevFirst,this.prevLast,this.first,this.last)},callback:function(a,c,b,d,f,j,e){if(!(this.options[a]==null||typeof this.options[a]!="object"&&c!="onAfterAnimation")){var h=typeof this.options[a]=="object"?this.options[a][c]:this.options[a];if(g.isFunction(h)){var i=this;if(d===void 0)h(i,b,c);else if(f===void 0)this.get(d).each(function(){h(i,this,d,b,c)});else for(var a=function(a){i.get(a).each(function(){h(i,this,a,b,c)})},k=d;k<=f;k++)k!== null&&!(k>=j&&k<=e)&&a(k)}}},create:function(a){return this.format("<li></li>",a)},format:function(a,c){for(var a=g(a),b=a.get(0).className.split(" "),d=0;d<b.length;d++)b[d].indexOf("jcarousel-")!=-1&&a.removeClass(b[d]);a.addClass(this.className("jcarousel-item")).addClass(this.className("jcarousel-item-"+c)).css({"float":this.options.rtl?"right":"left","list-style":"none"}).attr("jcarouselindex",c);return a},className:function(a){return a+" "+a+(!this.options.vertical?"-horizontal":"-vertical")}, dimension:function(a,c){var b=g(a);if(c==null)return!this.options.vertical?b.outerWidth(!0)||f.intval(this.options.itemFallbackDimension):b.outerHeight(!0)||f.intval(this.options.itemFallbackDimension);else{var d=!this.options.vertical?c-f.intval(b.css("marginLeft"))-f.intval(b.css("marginRight")):c-f.intval(b.css("marginTop"))-f.intval(b.css("marginBottom"));g(b).css(this.wh,d+"px");return this.dimension(b)}},clipping:function(){return!this.options.vertical?this.clip[0].offsetWidth-f.intval(this.clip.css("borderLeftWidth"))- f.intval(this.clip.css("borderRightWidth")):this.clip[0].offsetHeight-f.intval(this.clip.css("borderTopWidth"))-f.intval(this.clip.css("borderBottomWidth"))},index:function(a,c){if(c==null)c=this.options.size;return Math.round(((a-1)/c-Math.floor((a-1)/c))*c)+1}});f.extend({defaults:function(a){return g.extend(q,a||{})},intval:function(a){a=parseInt(a,10);return isNaN(a)?0:a},windowLoaded:function(){m=!0}});g.fn.jcarousel=function(a){if(typeof a=="string"){var c=g(this).data("jcarousel"),b=Array.prototype.slice.call(arguments, 1);return c[a].apply(c,b)}else return this.each(function(){var b=g(this).data("jcarousel");b?(a&&g.extend(b.options,a),b.reload()):g(this).data("jcarousel",new f(this,a))})}})(jQuery);
|
@@ -0,0 +1,62 @@
|
|
1
|
+
photos_initCallback = (carousel) ->
|
2
|
+
jQuery(".jcarousel-control a").bind "click", ->
|
3
|
+
carousel.scroll jQuery.jcarousel.intval(jQuery(this).text())
|
4
|
+
false
|
5
|
+
|
6
|
+
jQuery(".jcarousel-scroll select").bind "change", ->
|
7
|
+
carousel.options.scroll = jQuery.jcarousel.intval(@options[@selectedIndex].value)
|
8
|
+
false
|
9
|
+
|
10
|
+
jQuery(".s-next").bind "click", (e) ->
|
11
|
+
e.preventDefault()
|
12
|
+
carousel.next()
|
13
|
+
false
|
14
|
+
|
15
|
+
jQuery(".s-prev").bind "click", (e)->
|
16
|
+
e.preventDefault()
|
17
|
+
carousel.prev()
|
18
|
+
false
|
19
|
+
|
20
|
+
$("a.trigger").click (e)->
|
21
|
+
e.preventDefault()
|
22
|
+
index = jQuery(this).attr('href').replace('#', "")
|
23
|
+
carousel.scroll jQuery.jcarousel.intval(index)
|
24
|
+
|
25
|
+
|
26
|
+
mycarousel_initCallback = (carousel) ->
|
27
|
+
jQuery(".jcarousel-control a").bind "click", ->
|
28
|
+
carousel.scroll jQuery.jcarousel.intval(jQuery(this).text())
|
29
|
+
false
|
30
|
+
|
31
|
+
jQuery(".jcarousel-scroll select").bind "change", ->
|
32
|
+
carousel.options.scroll = jQuery.jcarousel.intval(@options[@selectedIndex].value)
|
33
|
+
false
|
34
|
+
|
35
|
+
jQuery(".next-thumbs").bind "click", (e) ->
|
36
|
+
e.preventDefault()
|
37
|
+
carousel.next()
|
38
|
+
false
|
39
|
+
|
40
|
+
jQuery(".prev-thumbs").bind "click", (e) ->
|
41
|
+
e.preventDefault()
|
42
|
+
carousel.prev()
|
43
|
+
false
|
44
|
+
|
45
|
+
$ ->
|
46
|
+
|
47
|
+
photos = $("#photos-carousel").jcarousel
|
48
|
+
visible: 1
|
49
|
+
scroll: 1
|
50
|
+
initCallback: photos_initCallback
|
51
|
+
# This tells jCarousel NOT to autobuild prev/next buttons
|
52
|
+
buttonNextHTML: null
|
53
|
+
buttonPrevHTML: null
|
54
|
+
|
55
|
+
|
56
|
+
$(".mycarousel").jcarousel
|
57
|
+
visible: 6
|
58
|
+
initCallback: mycarousel_initCallback
|
59
|
+
# This tells jCarousel NOT to autobuild prev/next buttons
|
60
|
+
buttonNextHTML: null
|
61
|
+
buttonPrevHTML: null
|
62
|
+
|
File without changes
|
@@ -0,0 +1,4 @@
|
|
1
|
+
// ColorBox v1.3.20.2 - jQuery lightbox plugin
|
2
|
+
// (c) 2012 Jack Moore - jacklmoore.com
|
3
|
+
// License: http://www.opensource.org/licenses/mit-license.php
|
4
|
+
(function(a,b,c){function Z(c,d,e){var g=b.createElement(c);return d&&(g.id=f+d),e&&(g.style.cssText=e),a(g)}function $(a){var b=y.length,c=(Q+a)%b;return 0>c?b+c:c}function _(a,b){return Math.round((/%/.test(a)?("x"===b?z.width():z.height())/100:1)*parseInt(a,10))}function ab(a){return K.photo||/\.(gif|png|jp(e|g|eg)|bmp|ico)((#|\?).*)?$/i.test(a)}function bb(){var b,c=a.data(P,e);null==c?(K=a.extend({},d),console&&console.log&&console.log("Error: cboxElement missing settings object")):K=a.extend({},c);for(b in K)a.isFunction(K[b])&&"on"!==b.slice(0,2)&&(K[b]=K[b].call(P));K.rel=K.rel||P.rel||a(P).data("rel")||"nofollow",K.href=K.href||a(P).attr("href"),K.title=K.title||P.title,"string"==typeof K.href&&(K.href=a.trim(K.href))}function cb(b,c){a.event.trigger(b),c&&c.call(P)}function db(){var a,d,e,b=f+"Slideshow_",c="click."+f;K.slideshow&&y[1]?(d=function(){F.html(K.slideshowStop).unbind(c).bind(j,function(){(K.loop||y[Q+1])&&(a=setTimeout(W.next,K.slideshowSpeed))}).bind(i,function(){clearTimeout(a)}).one(c+" "+k,e),r.removeClass(b+"off").addClass(b+"on"),a=setTimeout(W.next,K.slideshowSpeed)},e=function(){clearTimeout(a),F.html(K.slideshowStart).unbind([j,i,k,c].join(" ")).one(c,function(){W.next(),d()}),r.removeClass(b+"on").addClass(b+"off")},K.slideshowAuto?d():e()):r.removeClass(b+"off "+b+"on")}function eb(b){U||(P=b,bb(),y=a(P),Q=0,"nofollow"!==K.rel&&(y=a("."+g).filter(function(){var c,b=a.data(this,e);return b&&(c=a(this).data("rel")||b.rel||this.rel),c===K.rel}),Q=y.index(P),-1===Q&&(y=y.add(P),Q=y.length-1)),S||(S=T=!0,r.show(),K.returnFocus&&a(P).blur().one(l,function(){a(this).focus()}),q.css({opacity:+K.opacity,cursor:K.overlayClose?"pointer":"auto"}).show(),K.w=_(K.initialWidth,"x"),K.h=_(K.initialHeight,"y"),W.position(),o&&z.bind("resize."+p+" scroll."+p,function(){q.css({width:z.width(),height:z.height(),top:z.scrollTop(),left:z.scrollLeft()})}).trigger("resize."+p),cb(h,K.onOpen),J.add(D).hide(),I.html(K.close).show()),W.load(!0))}function fb(){!r&&b.body&&(Y=!1,z=a(c),r=Z(X).attr({id:e,"class":n?f+(o?"IE6":"IE"):""}).hide(),q=Z(X,"Overlay",o?"position:absolute":"").hide(),C=Z(X,"LoadingOverlay").add(Z(X,"LoadingGraphic")),s=Z(X,"Wrapper"),t=Z(X,"Content").append(A=Z(X,"LoadedContent","width:0; height:0; overflow:hidden"),D=Z(X,"Title"),E=Z(X,"Current"),G=Z(X,"Next"),H=Z(X,"Previous"),F=Z(X,"Slideshow").bind(h,db),I=Z(X,"Close")),s.append(Z(X).append(Z(X,"TopLeft"),u=Z(X,"TopCenter"),Z(X,"TopRight")),Z(X,!1,"clear:left").append(v=Z(X,"MiddleLeft"),t,w=Z(X,"MiddleRight")),Z(X,!1,"clear:left").append(Z(X,"BottomLeft"),x=Z(X,"BottomCenter"),Z(X,"BottomRight"))).find("div div").css({"float":"left"}),B=Z(X,!1,"position:absolute; width:9999px; visibility:hidden; display:none"),J=G.add(H).add(E).add(F),a(b.body).append(q,r.append(s,B)))}function gb(){return r?(Y||(Y=!0,L=u.height()+x.height()+t.outerHeight(!0)-t.height(),M=v.width()+w.width()+t.outerWidth(!0)-t.width(),N=A.outerHeight(!0),O=A.outerWidth(!0),r.css({"padding-bottom":L,"padding-right":M}),G.click(function(){W.next()}),H.click(function(){W.prev()}),I.click(function(){W.close()}),q.click(function(){K.overlayClose&&W.close()}),a(b).bind("keydown."+f,function(a){var b=a.keyCode;S&&K.escKey&&27===b&&(a.preventDefault(),W.close()),S&&K.arrowKey&&y[1]&&(37===b?(a.preventDefault(),H.click()):39===b&&(a.preventDefault(),G.click()))}),a(b).delegate("."+g,"click",function(a){a.which>1||a.shiftKey||a.altKey||a.metaKey||(a.preventDefault(),eb(this))})),!0):!1}var q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,Y,d={transition:"elastic",speed:300,width:!1,initialWidth:"600",innerWidth:!1,maxWidth:!1,height:!1,initialHeight:"450",innerHeight:!1,maxHeight:!1,scalePhotos:!0,scrolling:!0,inline:!1,html:!1,iframe:!1,fastIframe:!0,photo:!1,href:!1,title:!1,rel:!1,opacity:.9,preloading:!0,current:"image {current} of {total}",previous:"previous",next:"next",close:"close",xhrError:"This content failed to load.",imgError:"This image failed to load.",open:!1,returnFocus:!0,reposition:!0,loop:!0,slideshow:!1,slideshowAuto:!0,slideshowSpeed:2500,slideshowStart:"start slideshow",slideshowStop:"stop slideshow",onOpen:!1,onLoad:!1,onComplete:!1,onCleanup:!1,onClosed:!1,overlayClose:!0,escKey:!0,arrowKey:!0,top:!1,bottom:!1,left:!1,right:!1,fixed:!1,data:void 0},e="colorbox",f="cbox",g=f+"Element",h=f+"_open",i=f+"_load",j=f+"_complete",k=f+"_cleanup",l=f+"_closed",m=f+"_purge",n=!a.support.opacity&&!a.support.style,o=n&&!c.XMLHttpRequest,p=f+"_IE6",X="div";a.colorbox||(a(fb),W=a.fn[e]=a[e]=function(b,c){var f=this;if(b=b||{},fb(),gb()){if(!f[0]){if(f.selector)return f;f=a("<a/>"),b.open=!0}c&&(b.onComplete=c),f.each(function(){a.data(this,e,a.extend({},a.data(this,e)||d,b))}).addClass(g),(a.isFunction(b.open)&&b.open.call(f)||b.open)&&eb(f[0])}return f},W.position=function(a,b){function j(a){u[0].style.width=x[0].style.width=t[0].style.width=a.style.width,t[0].style.height=v[0].style.height=w[0].style.height=a.style.height}var c,h,i,d=0,e=0,g=r.offset();z.unbind("resize."+f),r.css({top:-9e4,left:-9e4}),h=z.scrollTop(),i=z.scrollLeft(),K.fixed&&!o?(g.top-=h,g.left-=i,r.css({position:"fixed"})):(d=h,e=i,r.css({position:"absolute"})),e+=K.right!==!1?Math.max(z.width()-K.w-O-M-_(K.right,"x"),0):K.left!==!1?_(K.left,"x"):Math.round(Math.max(z.width()-K.w-O-M,0)/2),d+=K.bottom!==!1?Math.max(z.height()-K.h-N-L-_(K.bottom,"y"),0):K.top!==!1?_(K.top,"y"):Math.round(Math.max(z.height()-K.h-N-L,0)/2),r.css({top:g.top,left:g.left}),a=r.width()===K.w+O&&r.height()===K.h+N?0:a||0,s[0].style.width=s[0].style.height="9999px",c={width:K.w+O,height:K.h+N,top:d,left:e},0===a&&r.css(c),r.dequeue().animate(c,{duration:a,complete:function(){j(this),T=!1,s[0].style.width=K.w+O+M+"px",s[0].style.height=K.h+N+L+"px",K.reposition&&setTimeout(function(){z.bind("resize."+f,W.position)},1),b&&b()},step:function(){j(this)}})},W.resize=function(a){S&&(a=a||{},a.width&&(K.w=_(a.width,"x")-O-M),a.innerWidth&&(K.w=_(a.innerWidth,"x")),A.css({width:K.w}),a.height&&(K.h=_(a.height,"y")-N-L),a.innerHeight&&(K.h=_(a.innerHeight,"y")),a.innerHeight||a.height||(A.css({height:"auto"}),K.h=A.height()),A.css({height:K.h}),W.position("none"===K.transition?0:K.speed))},W.prep=function(b){function g(){return K.w=K.w||A.width(),K.w=K.mw&&K.mw<K.w?K.mw:K.w,K.w}function h(){return K.h=K.h||A.height(),K.h=K.mh&&K.mh<K.h?K.mh:K.h,K.h}if(S){var c,d="none"===K.transition?0:K.speed;A.remove(),A=Z(X,"LoadedContent").append(b),A.hide().appendTo(B.show()).css({width:g(),overflow:K.scrolling?"auto":"hidden"}).css({height:h()}).prependTo(t),B.hide(),a(R).css({"float":"none"}),o&&a("select").not(r.find("select")).filter(function(){return"hidden"!==this.style.visibility}).css({visibility:"hidden"}).one(k,function(){this.style.visibility="inherit"}),c=function(){function s(){n&&r[0].style.removeAttribute("filter")}var b,c,h,l,o,p,q,g=y.length,i="frameBorder",k="allowTransparency";if(S){if(l=function(){clearTimeout(V),C.detach().hide(),cb(j,K.onComplete)},n&&R&&A.fadeIn(100),D.html(K.title).add(A).show(),g>1){if("string"==typeof K.current&&E.html(K.current.replace("{current}",Q+1).replace("{total}",g)).show(),G[K.loop||g-1>Q?"show":"hide"]().html(K.next),H[K.loop||Q?"show":"hide"]().html(K.previous),K.slideshow&&F.show(),K.preloading)for(b=[$(-1),$(1)];c=y[b.pop()];)q=a.data(c,e),q&&q.href?(o=q.href,a.isFunction(o)&&(o=o.call(c))):o=c.href,ab(o)&&(p=new Image,p.src=o)}else J.hide();K.iframe?(h=Z("iframe")[0],i in h&&(h[i]=0),k in h&&(h[k]="true"),K.scrolling||(h.scrolling="no"),a(h).attr({src:K.href,name:(new Date).getTime(),"class":f+"Iframe",allowFullScreen:!0,webkitAllowFullScreen:!0,mozallowfullscreen:!0}).one("load",l).one(m,function(){h.src="//about:blank"}).appendTo(A),K.fastIframe&&a(h).trigger("load")):l(),"fade"===K.transition?r.fadeTo(d,1,s):s()}},"fade"===K.transition?r.fadeTo(d,0,function(){W.position(0,c)}):W.position(d,c)}},W.load=function(b){var c,d,e=W.prep;T=!0,R=!1,P=y[Q],b||bb(),cb(m),cb(i,K.onLoad),K.h=K.height?_(K.height,"y")-N-L:K.innerHeight&&_(K.innerHeight,"y"),K.w=K.width?_(K.width,"x")-O-M:K.innerWidth&&_(K.innerWidth,"x"),K.mw=K.w,K.mh=K.h,K.maxWidth&&(K.mw=_(K.maxWidth,"x")-O-M,K.mw=K.w&&K.w<K.mw?K.w:K.mw),K.maxHeight&&(K.mh=_(K.maxHeight,"y")-N-L,K.mh=K.h&&K.h<K.mh?K.h:K.mh),c=K.href,V=setTimeout(function(){C.show().appendTo(t)},100),K.inline?(Z(X).hide().insertBefore(a(c)[0]).one(m,function(){a(this).replaceWith(A.children())}),e(a(c))):K.iframe?e(" "):K.html?e(K.html):ab(c)?(a(R=new Image).addClass(f+"Photo").error(function(){K.title=!1,e(Z(X,"Error").html(K.imgError))}).load(function(){var a;R.onload=null,K.scalePhotos&&(d=function(){R.height-=R.height*a,R.width-=R.width*a},K.mw&&R.width>K.mw&&(a=(R.width-K.mw)/R.width,d()),K.mh&&R.height>K.mh&&(a=(R.height-K.mh)/R.height,d())),K.h&&(R.style.marginTop=Math.max(K.h-R.height,0)/2+"px"),y[1]&&(K.loop||y[Q+1])&&(R.style.cursor="pointer",R.onclick=function(){W.next()}),n&&(R.style.msInterpolationMode="bicubic"),setTimeout(function(){e(R)},1)}),setTimeout(function(){R.src=c},1)):c&&B.load(c,K.data,function(b,c){e("error"===c?Z(X,"Error").html(K.xhrError):a(this).contents())})},W.next=function(){!T&&y[1]&&(K.loop||y[Q+1])&&(Q=$(1),W.load())},W.prev=function(){!T&&y[1]&&(K.loop||Q)&&(Q=$(-1),W.load())},W.close=function(){S&&!U&&(U=!0,S=!1,cb(k,K.onCleanup),z.unbind("."+f+" ."+p),q.fadeTo(200,0),r.stop().fadeTo(300,0,function(){r.add(q).css({opacity:1,cursor:"auto"}).hide(),cb(m),A.remove(),setTimeout(function(){U=!1,cb(l,K.onClosed)},1)}))},W.remove=function(){a([]).add(r).add(q).remove(),r=null,a("."+g).removeData(e).removeClass(g),a(b).undelegate("."+g)},W.element=function(){return a(P)},W.settings=d)})(jQuery,document,window);
|
@@ -0,0 +1,40 @@
|
|
1
|
+
var FileItem = Backbone.Model.extend({
|
2
|
+
defaults: {
|
3
|
+
progress:0
|
4
|
+
},
|
5
|
+
initialize: function(){
|
6
|
+
this.on('add', this.onAdd, this);
|
7
|
+
},
|
8
|
+
onAdd: function(file) {
|
9
|
+
var _self = this;
|
10
|
+
|
11
|
+
var xhr = new XMLHttpRequest();
|
12
|
+
xhr.open("POST", this.url);
|
13
|
+
var datas = new FormData();
|
14
|
+
datas.append('image', this.get('image'));
|
15
|
+
|
16
|
+
xhr.upload.addEventListener("progress", function(e) {
|
17
|
+
if(e.lengthComputable) {
|
18
|
+
var currentState = (e.loaded / e.total) * 100;
|
19
|
+
_self.set({progress: currentState});
|
20
|
+
}
|
21
|
+
});
|
22
|
+
|
23
|
+
xhr.onreadystatechange = function(e) {
|
24
|
+
if(e.currentTarget.readyState == 4) {
|
25
|
+
_self.set({progress: 100});
|
26
|
+
_self.trigger('uploadCompleted');
|
27
|
+
if(xhr.responseText){
|
28
|
+
var responseObject = JSON.parse(xhr.responseText);
|
29
|
+
_self.set(responseObject);
|
30
|
+
} else {
|
31
|
+
console.log("Não foi possível enviar o arquivo");
|
32
|
+
}
|
33
|
+
|
34
|
+
}
|
35
|
+
};
|
36
|
+
|
37
|
+
// Start send the file.
|
38
|
+
xhr.send(datas);
|
39
|
+
}
|
40
|
+
});
|
@@ -0,0 +1,16 @@
|
|
1
|
+
.thumbnail.file-item
|
2
|
+
.file-title
|
3
|
+
= @title
|
4
|
+
%a.link-popover{"data-content" => "<i class=icon-edit></i> Edit"}
|
5
|
+
.loading-file
|
6
|
+
- if @image.url
|
7
|
+
%a.colorbox{href: ROOT_PATH + @image.medium.url}
|
8
|
+
%img{src: ROOT_PATH + @image.thumb.url}
|
9
|
+
- else
|
10
|
+
%img{src: "http://placehold.it/130x90&text=Carregando"}
|
11
|
+
-if (@progress != null && @progress < 100)
|
12
|
+
%div{class: (@progress < 100) ? 'progress progress-striped active' : 'progress'}
|
13
|
+
.bar{style: "width:#{@progress}%;"}
|
14
|
+
.caption
|
15
|
+
%a.file-action.delete{href: "#"}
|
16
|
+
<%= image_tag "albums/delete.png" %>
|
@@ -0,0 +1,15 @@
|
|
1
|
+
var FileListView = Backbone.View.extend({
|
2
|
+
tagName: 'ul',
|
3
|
+
className: 'thumbnails',
|
4
|
+
render: function(){
|
5
|
+
this.$el.html('');
|
6
|
+
this.collection.forEach(this.addOne, this);
|
7
|
+
//$('[id^=popover]').popover({trigger:'click'});
|
8
|
+
return this;
|
9
|
+
},
|
10
|
+
addOne: function(fileItem){
|
11
|
+
var fileView = new FileView({model: fileItem});
|
12
|
+
this.$el.append(fileView.render().el);
|
13
|
+
}
|
14
|
+
|
15
|
+
});
|
@@ -0,0 +1,34 @@
|
|
1
|
+
var FileView = Backbone.View.extend({
|
2
|
+
tagName: 'li',
|
3
|
+
className: 'span2',
|
4
|
+
events: {
|
5
|
+
"click .delete": "delete"
|
6
|
+
},
|
7
|
+
initialize: function(){
|
8
|
+
this.template = JST['photo_view']
|
9
|
+
this.model.on('change', this.render, this);
|
10
|
+
this.model.on('uploadCompleted', this.removeProgressBar, this);
|
11
|
+
},
|
12
|
+
removeProgressBar: function(){
|
13
|
+
if(this.$el != undefined)
|
14
|
+
this.$el.find('.progress').fadeOut();
|
15
|
+
},
|
16
|
+
render : function(){
|
17
|
+
var data = _.defaults(this.model.attributes, {progress: null, id: null, title: null})
|
18
|
+
var html = this.template(this.model.attributes);
|
19
|
+
$(this.el).html(html);
|
20
|
+
return this;
|
21
|
+
},
|
22
|
+
delete: function(e) {
|
23
|
+
e.preventDefault();
|
24
|
+
this.model.destroy({
|
25
|
+
success: function(model, response){
|
26
|
+
console.log("Success");
|
27
|
+
},
|
28
|
+
error: function(model, response){
|
29
|
+
console.log("Error");
|
30
|
+
}
|
31
|
+
});
|
32
|
+
this.$el.fadeOut();
|
33
|
+
}
|
34
|
+
});
|
@@ -0,0 +1,42 @@
|
|
1
|
+
function bytesToSize(bytes) {
|
2
|
+
var sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB'];
|
3
|
+
if (bytes == 0) return 'n/a';
|
4
|
+
var i = parseInt(Math.floor(Math.log(bytes) / Math.log(1024)));
|
5
|
+
return Math.round(bytes / Math.pow(1024, i), 2) + ' ' + sizes[[i]];
|
6
|
+
};
|
7
|
+
|
8
|
+
var FileZipView = Backbone.View.extend({
|
9
|
+
initialize: function() {
|
10
|
+
this.model.on('change', this.render, this);
|
11
|
+
this.model.on('uploadCompleted', this.removeProgressBar);
|
12
|
+
this.model.on('uploadCompleted', this.activeButtons);
|
13
|
+
this.model.on('uploadCompleted', updateFileList);
|
14
|
+
},
|
15
|
+
activeButtons: function(){
|
16
|
+
jQuery('#upload-buttons').fadeIn();
|
17
|
+
},
|
18
|
+
removeProgressBar: function(){
|
19
|
+
with({model: this.model}){
|
20
|
+
if(this.$el != undefined) {
|
21
|
+
this.$el.find('.progress').fadeOut();
|
22
|
+
this.$el.find('.progress').fadeOut(500, function(){
|
23
|
+
model.set({fadeOutProgress: true});
|
24
|
+
});
|
25
|
+
}
|
26
|
+
}
|
27
|
+
|
28
|
+
},
|
29
|
+
render : function(){
|
30
|
+
var html;
|
31
|
+
|
32
|
+
html = '<p>'+ this.model.get('loadingMessage') +'</p>';
|
33
|
+
html += '<p>' + bytesToSize(this.model.get('loadedBytes'), 3)+ ' / <b>' + bytesToSize(this.model.get('totalBytes'), 3) + '</b>'+'</p>';
|
34
|
+
html += '<div class="progress '+ (this.model.get('progress') < 100 ? 'progress-striped active' : '') +'">';
|
35
|
+
if(!this.model.has('fadeOutProgress'))
|
36
|
+
html += ' <div class="bar" style="width:'+this.model.get('progress')+'%"></div>';
|
37
|
+
html += '</div>';
|
38
|
+
|
39
|
+
this.$el.html(html);
|
40
|
+
|
41
|
+
}
|
42
|
+
});
|
@@ -0,0 +1,86 @@
|
|
1
|
+
/*
|
2
|
+
ColorBox Core Style:
|
3
|
+
The following CSS is consistent between example themes and should not be altered.
|
4
|
+
*/
|
5
|
+
#colorbox, #cboxOverlay, #cboxWrapper{position:absolute; top:0; left:0; z-index:9999; overflow:hidden;}
|
6
|
+
#cboxOverlay{position:fixed; width:100%; height:100%;}
|
7
|
+
#cboxMiddleLeft, #cboxBottomLeft{clear:left;}
|
8
|
+
#cboxContent{position:relative;}
|
9
|
+
#cboxLoadedContent{overflow:auto;}
|
10
|
+
#cboxTitle{margin:0;}
|
11
|
+
#cboxLoadingOverlay, #cboxLoadingGraphic{position:absolute; top:0; left:0; width:100%; height:100%;}
|
12
|
+
#cboxPrevious, #cboxNext, #cboxClose, #cboxSlideshow{cursor:pointer;}
|
13
|
+
.cboxPhoto{float:left; margin:auto; border:0; display:block; max-width:none;}
|
14
|
+
.cboxIframe{width:100%; height:100%; display:block; border:0;}
|
15
|
+
#colorbox, #cboxContent, #cboxLoadedContent{box-sizing:content-box; -moz-box-sizing:content-box; -webkit-box-sizing:content-box;}
|
16
|
+
|
17
|
+
/*
|
18
|
+
User Style:
|
19
|
+
Change the following styles to modify the appearance of ColorBox. They are
|
20
|
+
ordered & tabbed in a way that represents the nesting of the generated HTML.
|
21
|
+
*/
|
22
|
+
#cboxOverlay{background:url(image_path("colorbox/overlay.png")) repeat 0 0;}
|
23
|
+
#colorbox{}
|
24
|
+
#cboxTopLeft{width:21px; height:21px; background:url(image_path("colorbox/controls.png")) no-repeat -101px 0;}
|
25
|
+
#cboxTopRight{width:21px; height:21px; background:url(image_path("colorbox/controls.png")) no-repeat -130px 0;}
|
26
|
+
#cboxBottomLeft{width:21px; height:21px; background:url(image_path("colorbox/controls.png")) no-repeat -101px -29px;}
|
27
|
+
#cboxBottomRight{width:21px; height:21px; background:url(image_path("colorbox/controls.png")) no-repeat -130px -29px;}
|
28
|
+
#cboxMiddleLeft{width:21px; background:url(image_path("colorbox/controls.png")) left top repeat-y;}
|
29
|
+
#cboxMiddleRight{width:21px; background:url(image_path("colorbox/controls.png")) right top repeat-y;}
|
30
|
+
#cboxTopCenter{height:21px; background:url(image_path("colorbox/border.png")) 0 0 repeat-x;}
|
31
|
+
#cboxBottomCenter{height:21px; background:url(image_path("colorbox/border.png")) 0 -29px repeat-x;}
|
32
|
+
#cboxContent{background:#fff; overflow:hidden;}
|
33
|
+
.cboxIframe{background:#fff;}
|
34
|
+
#cboxError{padding:50px; border:1px solid #ccc;}
|
35
|
+
#cboxLoadedContent{margin-bottom:28px;}
|
36
|
+
#cboxTitle{position:absolute; bottom:4px; left:0; text-align:center; width:100%; color:#949494;}
|
37
|
+
#cboxCurrent{position:absolute; bottom:4px; left:58px; color:#949494;}
|
38
|
+
#cboxSlideshow{position:absolute; bottom:4px; right:30px; color:#0092ef;}
|
39
|
+
#cboxPrevious{position:absolute; bottom:0; left:0; background:url(image_path("colorbox/controls.png")) no-repeat -75px 0; width:25px; height:25px; text-indent:-9999px;}
|
40
|
+
#cboxPrevious:hover{background-position:-75px -25px;}
|
41
|
+
#cboxNext{position:absolute; bottom:0; left:27px; background:url(image_path("colorbox/controls.png")) no-repeat -50px 0; width:25px; height:25px; text-indent:-9999px;}
|
42
|
+
#cboxNext:hover{background-position:-50px -25px;}
|
43
|
+
#cboxLoadingOverlay{background:url(image_path("colorbox/loading_background.png")) no-repeat center center;}
|
44
|
+
#cboxLoadingGraphic{background:url(image_path("colorbox/loading.gif")) no-repeat center center;}
|
45
|
+
#cboxClose{position:absolute; bottom:0; right:0; background:url(image_path("colorbox/controls.png")) no-repeat -25px 0; width:25px; height:25px; text-indent:-9999px;}
|
46
|
+
#cboxClose:hover{background-position:-25px -25px;}
|
47
|
+
|
48
|
+
/*
|
49
|
+
The following fixes a problem where IE7 and IE8 replace a PNG's alpha transparency with a black fill
|
50
|
+
when an alpha filter (opacity change) is set on the element or ancestor element. This style is not applied to or needed in IE9.
|
51
|
+
See: http://jacklmoore.com/notes/ie-transparency-problems/
|
52
|
+
*/
|
53
|
+
.cboxIE #cboxTopLeft,
|
54
|
+
.cboxIE #cboxTopCenter,
|
55
|
+
.cboxIE #cboxTopRight,
|
56
|
+
.cboxIE #cboxBottomLeft,
|
57
|
+
.cboxIE #cboxBottomCenter,
|
58
|
+
.cboxIE #cboxBottomRight,
|
59
|
+
.cboxIE #cboxMiddleLeft,
|
60
|
+
.cboxIE #cboxMiddleRight {
|
61
|
+
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#00FFFFFF,endColorstr=#00FFFFFF);
|
62
|
+
}
|
63
|
+
|
64
|
+
/*
|
65
|
+
The following provides PNG transparency support for IE6
|
66
|
+
Feel free to remove this and the /ie6/ directory if you have dropped IE6 support.
|
67
|
+
*/
|
68
|
+
.cboxIE6 #cboxTopLeft{background:url(image_path("colorbox/ie6/borderTopLeft.png"));}
|
69
|
+
.cboxIE6 #cboxTopCenter{background:url(image_path("colorbox/ie6/borderTopCenter.png"));}
|
70
|
+
.cboxIE6 #cboxTopRight{background:url(image_path("colorbox/ie6/borderTopRight.png"));}
|
71
|
+
.cboxIE6 #cboxBottomLeft{background:url(image_path("colorbox/ie6/borderBottomLeft.png"));}
|
72
|
+
.cboxIE6 #cboxBottomCenter{background:url(image_path("colorbox/ie6/borderBottomCenter.png"));}
|
73
|
+
.cboxIE6 #cboxBottomRight{background:url(image_path("colorbox/ie6/borderBottomRight.png"));}
|
74
|
+
.cboxIE6 #cboxMiddleLeft{background:url(image_path("colorbox/ie6/borderMiddleLeft.png"));}
|
75
|
+
.cboxIE6 #cboxMiddleRight{background:url(image_path("colorbox/ie6/borderMiddleRight.png"));}
|
76
|
+
|
77
|
+
.cboxIE6 #cboxTopLeft,
|
78
|
+
.cboxIE6 #cboxTopCenter,
|
79
|
+
.cboxIE6 #cboxTopRight,
|
80
|
+
.cboxIE6 #cboxBottomLeft,
|
81
|
+
.cboxIE6 #cboxBottomCenter,
|
82
|
+
.cboxIE6 #cboxBottomRight,
|
83
|
+
.cboxIE6 #cboxMiddleLeft,
|
84
|
+
.cboxIE6 #cboxMiddleRight {
|
85
|
+
_behavior: expression(this.src = this.src ? this.src : this.currentStyle.backgroundImage.split('"')[1], this.style.background = "none", this.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src=" + this.src + ", sizingMethod='scale')");
|
86
|
+
}
|
@@ -0,0 +1 @@
|
|
1
|
+
Button images copyright by Microsoft Corporation (http://microsoft.com)
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|