stream is now a div. generalized some partial extentions for mobile site.
This commit is contained in:
parent
9db2d8854f
commit
055fbe3e00
23 changed files with 65 additions and 120 deletions
|
|
@ -3,17 +3,17 @@
|
|||
# the COPYRIGHT file.
|
||||
|
||||
class ApplicationController < ActionController::Base
|
||||
# has_mobile_fu
|
||||
#has_mobile_fu
|
||||
protect_from_forgery :except => :receive
|
||||
|
||||
# before_filter :mobile_except_ipad
|
||||
#before_filter :mobile_except_ipad
|
||||
before_filter :set_contacts_notifications_and_status, :except => [:create, :update]
|
||||
before_filter :count_requests
|
||||
before_filter :set_invites
|
||||
before_filter :set_locale
|
||||
|
||||
def set_contacts_notifications_and_status
|
||||
if user_signed_in?
|
||||
if user_signed_in?
|
||||
@aspect = nil
|
||||
@aspects = current_user.aspects.fields(:name)
|
||||
@aspects_dropdown_array = @aspects.collect{|x| [x.to_s, x.id]}
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ class PeopleController < ApplicationController
|
|||
def index
|
||||
@aspect = :search
|
||||
|
||||
@people = Person.search(params[:q]).paginate :page => params[:page], :per_page => 25, :order => 'created_at DESC'
|
||||
@people = Person.search(params[:q]).paginate :page => params[:page], :per_page => 15, :order => 'created_at DESC'
|
||||
if @people.count == 1
|
||||
redirect_to @people.first
|
||||
else
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@
|
|||
= render 'aspects/no_contacts_message', :aspect => @aspect, :contact_count => @contacts.count
|
||||
= render 'aspects/no_posts_message', :post_count => @post_hashes.length, :contact_count => @contacts.count
|
||||
|
||||
%ul{:class => 'stream', :id => 'main_stream'}
|
||||
#main_stream.stream
|
||||
= render 'shared/stream', :posts => @post_hashes
|
||||
= will_paginate @posts
|
||||
|
||||
|
|
|
|||
|
|
@ -2,14 +2,10 @@
|
|||
-# licensed under the Affero General Public License version 3 or later. See
|
||||
-# the COPYRIGHT file.
|
||||
|
||||
%div
|
||||
%h1
|
||||
= person_image_tag (current_user.person)
|
||||
= current_user.name
|
||||
= select_tag "aspect_picker", aspect_select_options(@aspects, @aspect)
|
||||
|
||||
%div{:data => {:role => 'content'}}
|
||||
%div{:data => {:role => 'fieldcontain'}}
|
||||
=render 'shared/publisher', :aspect => @aspect
|
||||
|
||||
= render 'shared/stream', :posts => @posts
|
||||
= render 'shared/stream', :posts => @post_hashes
|
||||
|
|
|
|||
|
|
@ -10,17 +10,19 @@
|
|||
|
||||
%meta{"http-equiv"=>"Content-Type", :content=>"text/html; charset=utf-8"}/
|
||||
|
||||
= include_javascripts :mobile
|
||||
= include_javascripts :mobile
|
||||
= stylesheet_link_tag 'vendor/jquery_mobile.min', 'mobile'
|
||||
= csrf_meta_tag
|
||||
|
||||
|
||||
:javascript
|
||||
$(document).ready(Mobile.initialize);
|
||||
|
||||
= yield(:head)
|
||||
|
||||
%body
|
||||
%div{:data => {:role => 'header', :nobackbtn => 'true'}}
|
||||
= link_to image_tag('logo_large.png', :height => "32px", :width => "321px", :class => "diaspora_header_logo"), root_path
|
||||
#content{:data => {:role => 'page', :theme => "b"}}
|
||||
#content{:data => {:role => 'page'}}
|
||||
%div{:data => {:role => 'header', :nobackbtn => 'true'}}
|
||||
%h4
|
||||
DIASPORA*
|
||||
/= link_to image_tag('logo_large.png', :height => "32px", :width => "321px", :class => "diaspora_header_logo"), root_path
|
||||
= yield
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
:javascript
|
||||
$('.message').live('click', function(evt){
|
||||
var note = $(this).closest('.message'),
|
||||
$('.stream_element').live('click', function(evt){
|
||||
var note = $(this).closest('.stream_element'),
|
||||
note_id = note.attr('data-guid'),
|
||||
nBadge = $("#notification_badge_number");
|
||||
|
||||
|
|
@ -34,7 +34,7 @@
|
|||
%h4= day
|
||||
%ul.notifications_for_day
|
||||
- notes.each do |note|
|
||||
%li.message{:data=>{:guid => note.id}, :class => "#{note.unread ? 'unread' : ''}"}
|
||||
.stream_element{:data=>{:guid => note.id}, :class => "#{note.unread ? 'unread' : ''}"}
|
||||
%span.from
|
||||
= link_to "#{note.person.name.titleize}", person_path(note.person)
|
||||
= object_link(note)
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
-# licensed under the Affero General Public License version 3 or later. See
|
||||
-# the COPYRIGHT file.
|
||||
|
||||
%li.message{:id => person.id}
|
||||
.stream_element{:id => person.id}
|
||||
|
||||
.right{:style=>"display:inline;"}
|
||||
- if person.owner_id == current_user.id
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@
|
|||
=t('.no_one_found')
|
||||
|
||||
- else
|
||||
%ul{:class => 'stream people', :id => 'people_stream'}
|
||||
#people_stream.stream
|
||||
- for hash in @hashes
|
||||
= render :partial => 'people/person', :locals => hash
|
||||
|
||||
|
|
|
|||
|
|
@ -52,12 +52,12 @@
|
|||
- else
|
||||
= t('.recent_public_posts')
|
||||
|
||||
%ul{:class => 'stream', :id => 'main_stream'}
|
||||
#main_stream.stream
|
||||
= render 'shared/stream', :posts => @post_hashes
|
||||
= will_paginate @posts
|
||||
|
||||
- else
|
||||
%ul#stream
|
||||
#stream
|
||||
%li
|
||||
%h3= t('.no_posts')
|
||||
|
||||
|
|
|
|||
|
|
@ -60,6 +60,6 @@
|
|||
|
||||
%h4= t('_comments')
|
||||
|
||||
%ul{:id => 'photo_stream', :class => 'stream show'}
|
||||
%li.message{:data=>{:guid=>@parent.id}}
|
||||
#photo_stream.stream.show
|
||||
%div{:data=>{:guid=>@parent.id}}
|
||||
= render "comments/comments", :post_id => @parent.id, :comment_hashes => @comment_hashes, :always_expanded => true
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
-# licensed under the Affero General Public License version 3 or later. See
|
||||
-# the COPYRIGHT file.
|
||||
|
||||
%li.message{:data=>{:guid=>post.id}}
|
||||
.stream_element{:data=>{:guid=>post.id}}
|
||||
- if person.owner_id == current_user.id
|
||||
.right.controls
|
||||
- reshare_aspects = aspects_without_post(aspects, post)
|
||||
|
|
@ -1,28 +0,0 @@
|
|||
-# Copyright (c) 2010, Diaspora Inc. This file is
|
||||
-# licensed under the Affero General Public License version 3 or later. See
|
||||
-# the COPYRIGHT file.
|
||||
|
||||
%li.message{:data=>{:guid=>post.id}}
|
||||
= person_image_link(post.person)
|
||||
|
||||
.content
|
||||
.from
|
||||
= link_to post.person.name, post.person
|
||||
.aspect
|
||||
➔
|
||||
- if post.public?
|
||||
= t('the_world')
|
||||
- else
|
||||
= current_user.aspects_with_post( post.id ).join(', ')
|
||||
|
||||
= render type_partial(post), :post => post
|
||||
|
||||
.info
|
||||
%span.time= link_to(how_long_ago(post), object_path(post))
|
||||
/= link_to "#{t('.show_comments')} (#{post.comments.count})", '#', :class => "show_post_comments"
|
||||
|
||||
- if current_user.owns?(post)
|
||||
.right
|
||||
= link_to t('delete'), photo_path(post), :confirm => t('are_you_sure'), :method => :delete, :remote => true, :class => "delete"
|
||||
/= render "comments/comments", :post => post
|
||||
|
||||
|
|
@ -25,7 +25,8 @@
|
|||
#original_post_info
|
||||
= render 'shared/author_info', :person => @status_message.person, :post => @status_message
|
||||
|
||||
%h4{:style=>"margin-bottom:5px;"}= t('_comments')
|
||||
%ul{:class => 'stream show', :id => 'status_message_stream'}
|
||||
%li.message{:data=>{:guid=>@status_message.id}}
|
||||
%h4= t('_comments')
|
||||
|
||||
#status_message_stream.stream.show
|
||||
%div{:data=>{:guid=>@status_message.id}}
|
||||
= render "comments/comments", :post_id => @status_message.id, :comment_hashes => @comment_hashes, :always_expanded => true
|
||||
|
|
|
|||
|
|
@ -1,14 +1,14 @@
|
|||
$(document).ready(function() {
|
||||
$(document).ready(function() {
|
||||
$('#main_stream').infinitescroll({
|
||||
navSelector : "div.pagination",
|
||||
navSelector : "div.pagination",
|
||||
// selector for the paged navigation (it will be hidden)
|
||||
nextSelector : ".pagination a.next_page",
|
||||
nextSelector : ".pagination a.next_page",
|
||||
// selector for the NEXT link (to page 2)
|
||||
itemSelector : "#main_stream li.message",
|
||||
itemSelector : "#main_stream .stream_element",
|
||||
// selector for all items you'll retrieve
|
||||
bufferPx: 300,
|
||||
donetext: "no more.",
|
||||
loadingText: "",
|
||||
loadingText: "",
|
||||
loadingImg: '/images/ajax-loader.gif'
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -131,7 +131,7 @@ var Stream = {
|
|||
});
|
||||
|
||||
$(".stream").find(".delete").live('ajax:success', function(data, html, xhr) {
|
||||
$(this).parents(".message").fadeOut(150);
|
||||
$(this).parents(".status_message").fadeOut(150);
|
||||
});
|
||||
|
||||
},
|
||||
|
|
@ -141,8 +141,8 @@ var Stream = {
|
|||
var $this = $(this),
|
||||
text = $this.html(),
|
||||
showUl = $(this).closest('li'),
|
||||
commentBlock = $this.closest("li.message").find("ul.comments", ".content"),
|
||||
commentBlockMore = $this.closest("li.message").find(".older_comments", ".content"),
|
||||
commentBlock = $this.closest(".stream_element").find("ul.comments", ".content"),
|
||||
commentBlockMore = $this.closest(".stream_element").find(".older_comments", ".content"),
|
||||
show = (text.indexOf("show") != -1);
|
||||
|
||||
if( commentBlockMore.hasClass("inactive") ) {
|
||||
|
|
@ -165,7 +165,7 @@ var Stream = {
|
|||
|
||||
focusNewComment: function(toggle, evt) {
|
||||
evt.preventDefault();
|
||||
var commentBlock = toggle.closest("li.message").find("ul.comments", ".content");
|
||||
var commentBlock = toggle.closest(".stream_element").find("ul.comments", ".content");
|
||||
|
||||
if(commentBlock.hasClass('hidden')) {
|
||||
commentBlock.removeClass('hidden');
|
||||
|
|
|
|||
|
|
@ -121,7 +121,7 @@ var View = {
|
|||
|
||||
newRequest: {
|
||||
submit: function() {
|
||||
$(this).hide().parent().find(".message").removeClass("hidden");
|
||||
$(this).hide().parent().find(".stream_element").removeClass("hidden");
|
||||
},
|
||||
selector: ".new_request"
|
||||
},
|
||||
|
|
|
|||
|
|
@ -117,7 +117,7 @@ var WebSocketReceiver = {
|
|||
},
|
||||
|
||||
addPostToStream: function(postId, html) {
|
||||
if( $(".message[data-guid='" + postId + "']").length == 0 ) {
|
||||
if( $(".stream_element[data-guid='" + postId + "']").length == 0 ) {
|
||||
var showMessage = function() {
|
||||
$("#main_stream:not('.show')").prepend(
|
||||
$(html).fadeIn("fast", function() {
|
||||
|
|
@ -160,7 +160,7 @@ var WebSocketReceiver = {
|
|||
return ((c =='') || (c== '1'));
|
||||
},
|
||||
debug: function(str) {
|
||||
$("#debug").append("<p>" + str);
|
||||
$("#debug").append("<p>" + str);
|
||||
}
|
||||
};
|
||||
var WSR = WebSocketReceiver;
|
||||
|
|
|
|||
|
|
@ -226,9 +226,7 @@ header
|
|||
:right 1em
|
||||
|
||||
.stream
|
||||
:margin 0
|
||||
:padding 0
|
||||
> li
|
||||
.stream_element
|
||||
:padding 0.7em 1em
|
||||
:min-height 50px
|
||||
:border
|
||||
|
|
@ -294,9 +292,7 @@ header
|
|||
:margin
|
||||
:right 2em
|
||||
|
||||
|
||||
|
||||
li.message
|
||||
.stream_element
|
||||
:position relative
|
||||
:word-wrap break-word
|
||||
:color #777
|
||||
|
|
@ -307,9 +303,6 @@ li.message
|
|||
a
|
||||
:color #444
|
||||
|
||||
.avatar
|
||||
:float left
|
||||
|
||||
.content
|
||||
:margin
|
||||
:top 0
|
||||
|
|
@ -610,45 +603,29 @@ ul.show_comments
|
|||
:margin
|
||||
:bottom 2em
|
||||
|
||||
|
||||
.stream, #profile,
|
||||
.comments
|
||||
img.person_picture
|
||||
|
||||
:-webkit-border-radius 3px
|
||||
:-moz-border-radius 3px
|
||||
:border-radius 3px
|
||||
|
||||
:display inline block
|
||||
:height 30px
|
||||
:display absolute
|
||||
:float left
|
||||
:margin
|
||||
:right 10px
|
||||
|
||||
|
||||
.pagination
|
||||
a
|
||||
:padding 3px
|
||||
|
||||
li.message .right
|
||||
:display none
|
||||
:position absolute
|
||||
:right 12px
|
||||
.stream_element
|
||||
.right
|
||||
:display none
|
||||
:position absolute
|
||||
:right 12px
|
||||
|
||||
&.controls
|
||||
:font
|
||||
:size 12px
|
||||
:color #999
|
||||
a
|
||||
:color #999
|
||||
&.controls
|
||||
:font
|
||||
:weight normal
|
||||
&:hover
|
||||
:text
|
||||
:decoration underline
|
||||
:size 12px
|
||||
:color #999
|
||||
a
|
||||
:color #999
|
||||
:font
|
||||
:weight normal
|
||||
&:hover
|
||||
:text
|
||||
:decoration underline
|
||||
|
||||
li.message:hover
|
||||
.stream_element:hover
|
||||
.right
|
||||
:display inline
|
||||
|
||||
|
|
@ -2056,6 +2033,8 @@ h3,h4
|
|||
:color #ccc
|
||||
|
||||
.stream
|
||||
.avatar
|
||||
:float left
|
||||
.arrow,
|
||||
.aspect_badge
|
||||
:position relative
|
||||
|
|
@ -2106,11 +2085,8 @@ h3,h4
|
|||
:top 6px
|
||||
:right 0
|
||||
|
||||
ul.notifications_for_day
|
||||
:margin 0
|
||||
:padding 0
|
||||
|
||||
li.message
|
||||
.notifications_for_day
|
||||
.stream_element
|
||||
:margin
|
||||
:bottom 0.3em
|
||||
:padding 0.2em 0.5em
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@
|
|||
:weight bold
|
||||
:text-shadow 0 1px 3px #999
|
||||
:line-height 1.5
|
||||
|
||||
|
||||
p
|
||||
:padding 12px
|
||||
:background
|
||||
|
|
@ -39,14 +39,12 @@
|
|||
label
|
||||
:font-weight bold
|
||||
|
||||
img
|
||||
:border-radius 5px
|
||||
ul
|
||||
:list-style none
|
||||
|
||||
.avatar
|
||||
:width 50px
|
||||
:height 50px
|
||||
:width 40px
|
||||
:height 40px
|
||||
:padding 0
|
||||
|
||||
li.message
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ describe("Stream", function() {
|
|||
jasmine.Clock.useMock();
|
||||
$('#jasmine_content').html(
|
||||
'<div class="stream">' +
|
||||
'<li class="message" data-guid="4ceef7ba2367bc2e4d0001e9">' +
|
||||
'<li class="stream_element" data-guid="4ceef7ba2367bc2e4d0001e9">' +
|
||||
'<div class="content">' +
|
||||
'<div class="info">' +
|
||||
'<a href="#" class="show_post_comments">show comments (0)</a>' +
|
||||
|
|
|
|||
Loading…
Reference in a new issue