diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index dcf04921c..019c19b19 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -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]} diff --git a/app/controllers/people_controller.rb b/app/controllers/people_controller.rb index 85038f197..2c204c0af 100644 --- a/app/controllers/people_controller.rb +++ b/app/controllers/people_controller.rb @@ -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 diff --git a/app/views/aspects/index.html.haml b/app/views/aspects/index.html.haml index 13e656ce7..a22f04eed 100644 --- a/app/views/aspects/index.html.haml +++ b/app/views/aspects/index.html.haml @@ -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 diff --git a/app/views/aspects/index.mobile.haml b/app/views/aspects/index.mobile.haml index 173cd861d..c71345411 100644 --- a/app/views/aspects/index.mobile.haml +++ b/app/views/aspects/index.mobile.haml @@ -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 diff --git a/app/views/comments/_comment.html.haml b/app/views/comments/_comment.haml similarity index 100% rename from app/views/comments/_comment.html.haml rename to app/views/comments/_comment.haml diff --git a/app/views/comments/_comments.html.haml b/app/views/comments/_comments.haml similarity index 100% rename from app/views/comments/_comments.html.haml rename to app/views/comments/_comments.haml diff --git a/app/views/comments/_new_comment.html.haml b/app/views/comments/_new_comment.haml similarity index 100% rename from app/views/comments/_new_comment.html.haml rename to app/views/comments/_new_comment.haml diff --git a/app/views/layouts/application.mobile.haml b/app/views/layouts/application.mobile.haml index 48eff6949..d13432019 100644 --- a/app/views/layouts/application.mobile.haml +++ b/app/views/layouts/application.mobile.haml @@ -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 diff --git a/app/views/notifications/index.html.haml b/app/views/notifications/index.html.haml index 45d504841..b1173fc69 100644 --- a/app/views/notifications/index.html.haml +++ b/app/views/notifications/index.html.haml @@ -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) diff --git a/app/views/people/_person.html.haml b/app/views/people/_person.html.haml index 6ac250463..d006a63f0 100644 --- a/app/views/people/_person.html.haml +++ b/app/views/people/_person.html.haml @@ -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 diff --git a/app/views/people/index.html.haml b/app/views/people/index.html.haml index dd6ff969f..f40c91695 100644 --- a/app/views/people/index.html.haml +++ b/app/views/people/index.html.haml @@ -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 diff --git a/app/views/people/show.html.haml b/app/views/people/show.html.haml index dc2c8330f..793bd8701 100644 --- a/app/views/people/show.html.haml +++ b/app/views/people/show.html.haml @@ -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') diff --git a/app/views/photos/show.html.haml b/app/views/photos/show.html.haml index 7152bb0c6..fc576dfa4 100644 --- a/app/views/photos/show.html.haml +++ b/app/views/photos/show.html.haml @@ -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 diff --git a/app/views/shared/_stream_element.html.haml b/app/views/shared/_stream_element.haml similarity index 96% rename from app/views/shared/_stream_element.html.haml rename to app/views/shared/_stream_element.haml index 42bf7ba5e..ed51bd1e9 100644 --- a/app/views/shared/_stream_element.html.haml +++ b/app/views/shared/_stream_element.haml @@ -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) diff --git a/app/views/shared/_stream_element.mobile.haml b/app/views/shared/_stream_element.mobile.haml deleted file mode 100644 index 08b6e6a40..000000000 --- a/app/views/shared/_stream_element.mobile.haml +++ /dev/null @@ -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 - diff --git a/app/views/status_messages/show.html.haml b/app/views/status_messages/show.html.haml index de3c3e45d..d61742f07 100644 --- a/app/views/status_messages/show.html.haml +++ b/app/views/status_messages/show.html.haml @@ -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 diff --git a/public/javascripts/application.js b/public/javascripts/application.js index b7e4bcdef..7d8cffb99 100644 --- a/public/javascripts/application.js +++ b/public/javascripts/application.js @@ -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' }); }); diff --git a/public/javascripts/stream.js b/public/javascripts/stream.js index 4900ad799..aa9d23103 100644 --- a/public/javascripts/stream.js +++ b/public/javascripts/stream.js @@ -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'); diff --git a/public/javascripts/view.js b/public/javascripts/view.js index a2f1b3b2d..2ca2b533a 100644 --- a/public/javascripts/view.js +++ b/public/javascripts/view.js @@ -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" }, diff --git a/public/javascripts/web-socket-receiver.js b/public/javascripts/web-socket-receiver.js index d1af18fff..0304a3525 100644 --- a/public/javascripts/web-socket-receiver.js +++ b/public/javascripts/web-socket-receiver.js @@ -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("

" + str); + $("#debug").append("

" + str); } }; var WSR = WebSocketReceiver; diff --git a/public/stylesheets/sass/application.sass b/public/stylesheets/sass/application.sass index a14d9b856..c7635a1c5 100644 --- a/public/stylesheets/sass/application.sass +++ b/public/stylesheets/sass/application.sass @@ -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 diff --git a/public/stylesheets/sass/mobile.sass b/public/stylesheets/sass/mobile.sass index dc622b362..3c2ee9153 100644 --- a/public/stylesheets/sass/mobile.sass +++ b/public/stylesheets/sass/mobile.sass @@ -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 diff --git a/spec/javascripts/stream-spec.js b/spec/javascripts/stream-spec.js index 2345062b6..4d2bc64a9 100644 --- a/spec/javascripts/stream-spec.js +++ b/spec/javascripts/stream-spec.js @@ -20,7 +20,7 @@ describe("Stream", function() { jasmine.Clock.useMock(); $('#jasmine_content').html( '

' + - '
  • ' + + '
  • ' + '
    ' + '