fix status message show page and break out Post to it's own javascript widget
This commit is contained in:
parent
009985169d
commit
864233eb63
6 changed files with 82 additions and 51 deletions
|
|
@ -1,32 +1,42 @@
|
|||
-# Copyright (c) 2010, Diaspora Inc. This file is
|
||||
-# licensed under the Affero General Public License version 3 or later. See
|
||||
-# the COPYRIGHT file.
|
||||
|
||||
|
||||
.span-16.append-4.prepend-4.last
|
||||
#original_post_info
|
||||
= render 'shared/author_info', :person => @status_message.author, :post => @status_message
|
||||
|
||||
#show_text
|
||||
%p
|
||||
= markdownify(@status_message.text, :youtube_maps => @status_message[:youtube_titles])
|
||||
|
||||
- for photo in @status_message.photos
|
||||
= link_to (image_tag photo.url(:thumb_small), :class => 'thumb_small'), photo_path(photo)
|
||||
|
||||
%p.time
|
||||
= how_long_ago(@status_message)
|
||||
|
||||
%hr
|
||||
|
||||
= link_to t('.permalink'), post_path(@status_message) if @status_message.public
|
||||
%br
|
||||
- if current_user.owns? @status_message
|
||||
= link_to t('.destroy'), @status_message, :confirm => t('are_you_sure'), :method => :delete
|
||||
|
||||
|
||||
%h5
|
||||
= t('_comments')
|
||||
#status_message_stream.stream.show
|
||||
%div{:data=>{:guid=>@status_message.id}}
|
||||
= render "comments/comments", :post => @status_message, :comments => @status_message.comments, :always_expanded => true
|
||||
#main_stream.stream.status_message_show
|
||||
= render 'shared/stream_element', :post => @status_message, :all_aspects => @status_message.aspects
|
||||
%br
|
||||
%br
|
||||
%br
|
||||
/.span-16.append-4.prepend-4.last
|
||||
/ #original_post_info
|
||||
/ = render 'shared/author_info', :person => @status_message.author, :post => @status_message
|
||||
/
|
||||
/ #show_text
|
||||
/ %p
|
||||
/ = markdownify(@status_message.text, :youtube_maps => @status_message[:youtube_titles])
|
||||
/
|
||||
/ - for photo in @status_message.photos
|
||||
/ = link_to (image_tag photo.url(:thumb_small), :class => 'thumb_small'), photo_path(photo)
|
||||
/
|
||||
/ %p.time
|
||||
/ = how_long_ago(@status_message)
|
||||
/ - unless (defined?(@commenting_disabled) && @commenting_disabled)
|
||||
/ %span.like_action
|
||||
/ = like_action(@status_message, current_user)
|
||||
/
|
||||
/ %hr
|
||||
//
|
||||
/ = link_to t('.permalink'), post_path(@status_message) if @status_message.public
|
||||
/ %br
|
||||
/ - if current_user.owns? @status_message
|
||||
/ = link_to t('.destroy'), @status_message, :confirm => t('are_you_sure'), :method => :delete
|
||||
/
|
||||
/
|
||||
//
|
||||
/ .likes
|
||||
/ - if @status_message.likes.count > 0
|
||||
/ = render "likes/likes", :post_id => @status_message.id, :likes => @status_message.likes, :dislikes => @status_message.dislikes, :current_user => current_user
|
||||
/
|
||||
/ #status_message_stream.stream.show
|
||||
/ %div{:data=>{:guid=>@status_message.id}}
|
||||
/ = render "comments/comments", :post => @status_message, :comments => @status_message.comments, :always_expanded => true
|
||||
|
|
|
|||
|
|
@ -34,6 +34,7 @@ javascripts:
|
|||
- public/javascripts/widgets/directionDetector.js
|
||||
- public/javascripts/widgets/notifications.js
|
||||
- public/javascripts/widgets/flashes.js
|
||||
- public/javascripts/widgets/post.js
|
||||
- public/javascripts/view.js
|
||||
- public/javascripts/stream.js
|
||||
- public/javascripts/content-updater.js
|
||||
|
|
|
|||
|
|
@ -4,6 +4,9 @@
|
|||
*/
|
||||
|
||||
var ContentUpdater = {
|
||||
elementWithGuid: function(selector, guid) {
|
||||
return $(selector + "[data-guid='" + guid + "']");
|
||||
},
|
||||
addPostToStream: function(html) {
|
||||
var streamElement = $(html);
|
||||
var postId = streamElement.attr("data-guid");
|
||||
|
|
@ -21,5 +24,15 @@ var ContentUpdater = {
|
|||
Diaspora.widgets.timeago.updateTimeAgo();
|
||||
Diaspora.widgets.directionDetector.updateBinds();
|
||||
}
|
||||
},
|
||||
|
||||
addLikesToPost: function(postId, html) {
|
||||
var post = ContentUpdater.elementWithGuid("div", postId);
|
||||
|
||||
$(".likes_container", post)
|
||||
.fadeOut("fast")
|
||||
.html(html)
|
||||
.fadeIn("fast");
|
||||
}
|
||||
|
||||
};
|
||||
|
|
@ -42,15 +42,6 @@ var Stream = {
|
|||
|
||||
this.setUpComments();
|
||||
|
||||
$("a.expand_likes", this.selector).live('click',function(evt) {
|
||||
evt.preventDefault();
|
||||
$(this).siblings(".likes_list").fadeToggle("fast");
|
||||
});
|
||||
|
||||
$("a.expand_dislikes", this.selector).live('click',function(evt) {
|
||||
evt.preventDefault();
|
||||
$(this).siblings(".dislikes_list").fadeToggle("fast");
|
||||
});
|
||||
},
|
||||
|
||||
setUpComments: function(){
|
||||
|
|
@ -88,21 +79,8 @@ var Stream = {
|
|||
});
|
||||
},
|
||||
|
||||
setUpLikes: function() {
|
||||
var likes = $(".like_it, .dislike_it", this.selector);
|
||||
|
||||
likes.live("ajax:loading", function() {
|
||||
$(this).parent().fadeOut("fast");
|
||||
});
|
||||
|
||||
likes.live("ajax:failure", function() {
|
||||
Diaspora.widgets.alert.alert(Diaspora.widgets.i18n.t("failed_to_like"));
|
||||
$(this).parent().fadeIn("fast");
|
||||
});
|
||||
},
|
||||
|
||||
setUpAudioLinks: function() {
|
||||
$(".stream a[target='_blank']").each(function() {
|
||||
$(".stream a[target='_blank']").each(function(r){
|
||||
var link = $(this);
|
||||
if(this.href.match(/\.mp3$|\.ogg$/)) {
|
||||
$("<audio/>", {
|
||||
|
|
|
|||
|
|
@ -456,6 +456,23 @@ ul.dropdown
|
|||
.from
|
||||
a
|
||||
:color $blue
|
||||
.status_message_show
|
||||
.stream_element
|
||||
.content
|
||||
p
|
||||
:font
|
||||
:size 1em
|
||||
|
||||
.comments
|
||||
:padding
|
||||
:bottom 6px
|
||||
> li:last-child
|
||||
:border-bottom none
|
||||
.comment_box
|
||||
:width 475px
|
||||
:margin
|
||||
:bottom 5px
|
||||
|
||||
|
||||
.time,
|
||||
.timeago,
|
||||
|
|
@ -583,10 +600,21 @@ ul.dropdown
|
|||
|
||||
|
||||
.stream ul.comments
|
||||
:padding
|
||||
:bottom 6px
|
||||
|
||||
> li:last-child
|
||||
:border-bottom none
|
||||
|
||||
.avatar
|
||||
:width 30px
|
||||
:height 30px
|
||||
|
||||
.comment_box
|
||||
:margin
|
||||
:bottom 5px
|
||||
|
||||
|
||||
.submit_button
|
||||
:text
|
||||
:align right
|
||||
|
|
|
|||
|
|
@ -32,6 +32,7 @@ src_files:
|
|||
- public/javascripts/widgets/infinite-scroll.js
|
||||
- public/javascripts/widgets/notifications.js
|
||||
- public/javascripts/widgets/flashes.js
|
||||
- public/javascripts/widgets/post.js
|
||||
- public/javascripts/mobile.js
|
||||
- public/javascripts/contact-list.js
|
||||
- public/javascripts/web-socket-receiver.js
|
||||
|
|
|
|||
Loading…
Reference in a new issue