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
|
.back= link_to "⇧ home", root_path
|
||||||
%h1.big_text
|
%h1.big_text
|
||||||
Albums
|
Albums
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,5 @@
|
||||||
- content_for :head do
|
- content_for :head do
|
||||||
:javascript
|
= javascript_include_tag 'photos', 'jquery.html5_upload'
|
||||||
$(document).ready(function(){
|
|
||||||
reset_photo_fancybox();
|
|
||||||
});
|
|
||||||
|
|
||||||
.album_id{:id => @album.id, :style => "display:hidden;"}
|
.album_id{:id => @album.id, :style => "display:hidden;"}
|
||||||
.back= link_to '⇧ albums', albums_path
|
.back= link_to '⇧ albums', albums_path
|
||||||
|
|
|
||||||
|
|
@ -23,8 +23,6 @@
|
||||||
= csrf_meta_tag
|
= csrf_meta_tag
|
||||||
= yield(:head)
|
= yield(:head)
|
||||||
|
|
||||||
= javascript_include_tag 'jquery.html5_upload'
|
|
||||||
|
|
||||||
%body
|
%body
|
||||||
- flash.each do |name, msg|
|
- flash.each do |name, msg|
|
||||||
= content_tag :div, msg, :id => "flash_#{name}"
|
= 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//////
|
//buttons//////
|
||||||
|
|
||||||
|
|
||||||
$("#add_album_button").fancybox();
|
|
||||||
$("#add_group_button").fancybox();
|
$("#add_group_button").fancybox();
|
||||||
$("#add_request_button").fancybox({ 'titleShow': false });
|
$("#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");
|
//pane_toggler_button("photo");
|
||||||
|
|
||||||
$("input[type='submit']").addClass("button");
|
$("input[type='submit']").addClass("button");
|
||||||
|
|
||||||
$(".image_thumb img").load( function() {
|
|
||||||
$(this).fadeIn("slow");
|
|
||||||
});
|
|
||||||
|
|
||||||
$(".image_cycle img").load( function() {
|
$(".image_cycle img").load( function() {
|
||||||
$(this).fadeIn("slow");
|
$(this).fadeIn("slow");
|
||||||
|
|
@ -48,12 +39,7 @@ $(document).ready(function(){
|
||||||
|
|
||||||
});//end document ready
|
});//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 ) {
|
function pane_toggler_button( name ) {
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue