fixed comments not showing up through websocket on photo show page
This commit is contained in:
parent
82e947a74a
commit
8e175be2ba
6 changed files with 72 additions and 68 deletions
|
|
@ -8,10 +8,14 @@
|
|||
$("#add_album_button").fancybox();
|
||||
});
|
||||
|
||||
.span-4.append-1.last
|
||||
= render "shared/aspect_friends"
|
||||
%h2
|
||||
= @aspect
|
||||
.friend_pictures.horizontal
|
||||
= owner_image_link
|
||||
- for friend in @friends
|
||||
= person_image_link(friend)
|
||||
|
||||
.span-15.last
|
||||
.span-24.last
|
||||
%h3
|
||||
= @aspect
|
||||
Albums
|
||||
|
|
|
|||
|
|
@ -44,17 +44,19 @@
|
|||
}
|
||||
|
||||
function processComment(post_id, html){
|
||||
post = $('#' + post_id)[0]
|
||||
post = $("*[data-guid='"+post_id+"']'");
|
||||
$(' .comment_set li:last', post ).before(
|
||||
$(html).fadeIn("fast", function(){})
|
||||
);
|
||||
toggler = $('.show_post_comments', post)
|
||||
|
||||
toggler.html(
|
||||
toggler.html().replace(/\d+/,$('.comment_set', post)[0].childElementCount -1));
|
||||
if(toggler.length > 0){
|
||||
toggler.html(
|
||||
toggler.html().replace(/\d+/,$('.comment_set', post)[0].childElementCount -1));
|
||||
|
||||
if( !$(".comments", post).is(':visible') ){
|
||||
toggler.click();
|
||||
if( !$(".comments", post).is(':visible') ){
|
||||
toggler.click();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2,57 +2,58 @@
|
|||
-# licensed under the Affero General Public License version 3 or later. See
|
||||
-# the COPYRIGHT file.
|
||||
|
||||
:javascript
|
||||
$(document).keydown(function(e){
|
||||
switch(e.keyCode) {
|
||||
case 37:
|
||||
if(!$("textarea").hasClass("hasfocus")){//prevent redirect if textarea has focus
|
||||
window.location.replace( "#{url_to_prev(@photo,@album)}" );
|
||||
- content_for :head do
|
||||
:javascript
|
||||
$(document).keydown(function(e){
|
||||
switch(e.keyCode) {
|
||||
case 37:
|
||||
if(!$("textarea").hasClass("hasfocus")){//prevent redirect if textarea has focus
|
||||
window.location.replace( "#{url_to_prev(@photo,@album)}" );
|
||||
}
|
||||
break;
|
||||
case 39:
|
||||
if(!$("textarea").hasClass("hasfocus")){
|
||||
window.location.replace( "#{url_to_next(@photo,@album)}" );
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 39:
|
||||
if(!$("textarea").hasClass("hasfocus")){
|
||||
window.location.replace( "#{url_to_next(@photo,@album)}" );
|
||||
}
|
||||
break;
|
||||
}
|
||||
});
|
||||
|
||||
$(document).ready(function(){
|
||||
//add a clas to verify if a textarea has focus
|
||||
$("textarea").live('focus',function(){
|
||||
$(this).addClass("hasfocus");
|
||||
});
|
||||
$("textarea").live('blur',function(){
|
||||
$(this).removeClass("hasfocus");
|
||||
});
|
||||
|
||||
//show form to add description
|
||||
$(".edit-desc").click(function(){
|
||||
$(".edit_photo").toggle();
|
||||
});
|
||||
$(document).ready(function(){
|
||||
//add a clas to verify if a textarea has focus
|
||||
$("textarea").live('focus',function(){
|
||||
$(this).addClass("hasfocus");
|
||||
});
|
||||
$("textarea").live('blur',function(){
|
||||
$(this).removeClass("hasfocus");
|
||||
});
|
||||
|
||||
//Add a description with ajax request
|
||||
$("#photo_submit").click(function(evenet){
|
||||
event.preventDefault();
|
||||
var method = $(".edit_photo").attr("method");
|
||||
var url = $(".edit_photo").attr("action");
|
||||
var data = $(".edit_photo").serialize();
|
||||
$(".description").text($("#photo_caption").val());
|
||||
$(".edit_photo").toggle();
|
||||
//show form to add description
|
||||
$(".edit-desc").click(function(){
|
||||
$(".edit_photo").toggle();
|
||||
});
|
||||
|
||||
$.ajax({
|
||||
type: method,
|
||||
url: url,
|
||||
data: data,
|
||||
success: function(response){
|
||||
$("#add-description").remove();
|
||||
}
|
||||
});
|
||||
//Add a description with ajax request
|
||||
$("#photo_submit").click(function(evenet){
|
||||
event.preventDefault();
|
||||
var method = $(".edit_photo").attr("method");
|
||||
var url = $(".edit_photo").attr("action");
|
||||
var data = $(".edit_photo").serialize();
|
||||
$(".description").text($("#photo_caption").val());
|
||||
$(".edit_photo").toggle();
|
||||
|
||||
});
|
||||
$.ajax({
|
||||
type: method,
|
||||
url: url,
|
||||
data: data,
|
||||
success: function(response){
|
||||
$("#add-description").remove();
|
||||
}
|
||||
});
|
||||
|
||||
});//end document ready
|
||||
});
|
||||
|
||||
});//end document ready
|
||||
|
||||
%h2
|
||||
= @aspect
|
||||
|
|
@ -64,6 +65,12 @@
|
|||
%h3
|
||||
= link_to @photo.album.name, @photo.album
|
||||
|
||||
= link_to "<< #{t('.prev')}", url_to_prev(@photo, @album), :rel => 'prefetch'
|
||||
|
|
||||
= link_to "#{t('.full_size')}", @photo.url
|
||||
|
|
||||
= link_to "#{t('.next')} >>", url_to_next(@photo, @album), :rel => 'prefetch'
|
||||
|
||||
.span-14.append-1.last
|
||||
%div{:data=>{:guid=>@photo.id}}
|
||||
#show_photo
|
||||
|
|
@ -72,8 +79,6 @@
|
|||
.edit_pane
|
||||
.controls{:data=>{:actor=>"#{@photo.person.owner.id}",:actor_person=>"#{@photo.person.id}",:image_url=>"#{@photo.url(:thumb_medium)}"}}
|
||||
= link_to 'make profile photo', '#', :class => "make_profile_photo"
|
||||
|
|
||||
= link_to 'edit', '#', :class => "make_profile_photo"
|
||||
= linked_scaled_photo @photo, @album
|
||||
-else
|
||||
= linked_scaled_photo @photo, @album
|
||||
|
|
@ -100,13 +105,6 @@
|
|||
= link_to t('.delete_photo'), @photo, :confirm => t('.are_you_sure'), :method => :delete, :class => 'button'
|
||||
|
||||
.span-9.last
|
||||
= link_to "<< #{t('.prev')}", url_to_prev(@photo, @album), :rel => 'prefetch'
|
||||
|
|
||||
= link_to "#{t('.full_size')}", @photo.url
|
||||
|
|
||||
= link_to "#{t('.next')} >>", url_to_next(@photo, @album), :rel => 'prefetch'
|
||||
%br
|
||||
%br
|
||||
#stream.show
|
||||
%li.message{:id => @photo.id}
|
||||
%li.message{:data=>{:guid=>@photo.id}}
|
||||
= render "comments/comments", :post => @photo
|
||||
|
|
|
|||
|
|
@ -26,5 +26,5 @@
|
|||
|
||||
.span-9.last
|
||||
#stream.show
|
||||
%li.message{:id => @status_message.id}
|
||||
%li.message{:data=>{:guid=>@status_message.id}}
|
||||
= render "comments/comments", :post => @status_message
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ $(document).ready(function(){
|
|||
}
|
||||
);
|
||||
|
||||
$("#publisher textarea, .comment textarea").keydown( function(e) {
|
||||
$("#publisher textarea, .comment_box").keydown( function(e) {
|
||||
if (e.keyCode == 13) {
|
||||
$(this).closest("form").submit();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -180,7 +180,7 @@ header
|
|||
|
||||
#global_search
|
||||
:margin
|
||||
:left 425px
|
||||
:left 432px
|
||||
|
||||
#stream
|
||||
:margin 0
|
||||
|
|
@ -1015,8 +1015,8 @@ ul#settings_nav
|
|||
:left 20px
|
||||
|
||||
img
|
||||
:width 20px
|
||||
:height 20px
|
||||
:width 30px
|
||||
:height 30px
|
||||
:margin-right -4px
|
||||
|
||||
#thumbnails
|
||||
|
|
@ -1070,7 +1070,7 @@ input[type="search"]
|
|||
|
||||
header
|
||||
input[type="search"]
|
||||
:width 200px
|
||||
:width 192px
|
||||
|
||||
.fancybox_content
|
||||
:display none
|
||||
|
|
|
|||
Loading…
Reference in a new issue