Refactored view js
This commit is contained in:
parent
a42c8da114
commit
19e8aa5c35
5 changed files with 35 additions and 24 deletions
|
|
@ -1,3 +1,9 @@
|
|||
- content_for :head do
|
||||
:javascript
|
||||
$(document).ready(function(){
|
||||
$("#add_album_button").fancybox();
|
||||
});
|
||||
|
||||
.back= link_to "⇧ home", root_path
|
||||
%h1.big_text
|
||||
Albums
|
||||
|
|
|
|||
|
|
@ -1,8 +1,5 @@
|
|||
- content_for :head do
|
||||
:javascript
|
||||
$(document).ready(function(){
|
||||
reset_photo_fancybox();
|
||||
});
|
||||
= javascript_include_tag 'photos', 'jquery.html5_upload'
|
||||
|
||||
.album_id{:id => @album.id, :style => "display:hidden;"}
|
||||
.back= link_to '⇧ albums', albums_path
|
||||
|
|
|
|||
|
|
@ -23,8 +23,6 @@
|
|||
= csrf_meta_tag
|
||||
= yield(:head)
|
||||
|
||||
= javascript_include_tag 'jquery.html5_upload'
|
||||
|
||||
%body
|
||||
- flash.each do |name, msg|
|
||||
= content_tag :div, msg, :id => "flash_#{name}"
|
||||
|
|
|
|||
24
public/javascripts/photos.js
Normal file
24
public/javascripts/photos.js
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
$(document).ready(function(){
|
||||
reset_photo_fancybox();
|
||||
|
||||
$("#add_photo_button").fancybox({
|
||||
'onClosed' : function(){
|
||||
if($("#add_photo_button").hasClass("uploading_complete")){
|
||||
$("#add_photo_button").removeClass("uploading_complete");
|
||||
reset_photo_fancybox();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
$(".image_thumb img").load( function() {
|
||||
$(this).fadeIn("slow");
|
||||
});
|
||||
|
||||
});//end document ready
|
||||
|
||||
function reset_photo_fancybox(){
|
||||
album_id = $(".album_id")[0].id;
|
||||
ajax = $.get("/photos/new?album_id=" + album_id, function(){
|
||||
$("#new_photo_pane").html(ajax.responseText)
|
||||
});
|
||||
}
|
||||
|
|
@ -20,25 +20,16 @@ $(document).ready(function(){
|
|||
//buttons//////
|
||||
|
||||
|
||||
$("#add_album_button").fancybox();
|
||||
$("#add_group_button").fancybox();
|
||||
$("#add_request_button").fancybox({ 'titleShow': false });
|
||||
$("#add_photo_button").fancybox({
|
||||
'onClosed' : function(){
|
||||
if($("#add_photo_button").hasClass("uploading_complete")){
|
||||
$("#add_photo_button").removeClass("uploading_complete");
|
||||
reset_photo_fancybox();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
//pane_toggler_button("photo");
|
||||
|
||||
$("input[type='submit']").addClass("button");
|
||||
|
||||
$(".image_thumb img").load( function() {
|
||||
$(this).fadeIn("slow");
|
||||
});
|
||||
|
||||
|
||||
$(".image_cycle img").load( function() {
|
||||
$(this).fadeIn("slow");
|
||||
|
|
@ -48,12 +39,7 @@ $(document).ready(function(){
|
|||
|
||||
});//end document ready
|
||||
|
||||
function reset_photo_fancybox(){
|
||||
album_id = $(".album_id")[0].id;
|
||||
ajax = $.get("/photos/new?album_id=" + album_id, function(){
|
||||
$("#new_photo_pane").html(ajax.responseText)
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
function pane_toggler_button( name ) {
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue