From 8b3beba93f657f320407e358eadd07165ce78632 Mon Sep 17 00:00:00 2001 From: maxwell Date: Mon, 24 Jan 2011 17:36:37 -0800 Subject: [PATCH] adding login page to mobile, and adding timeago WIP --- app/controllers/home_controller.rb | 3 +- app/views/aspects/_aspect_stream.haml | 2 + app/views/aspects/index.mobile.haml | 4 +- app/views/aspects/show.html.haml | 2 + app/views/layouts/application.mobile.haml | 51 ++++++++++++----------- app/views/people/show.html.haml | 3 +- app/views/people/show.mobile.haml | 3 +- app/views/shared/_stream.haml | 5 +-- config/assets.yml | 3 ++ public/javascripts/application.js | 1 - public/javascripts/mobile.js | 1 + 11 files changed, 45 insertions(+), 33 deletions(-) diff --git a/app/controllers/home_controller.rb b/app/controllers/home_controller.rb index ef6f410d2..60a53a381 100644 --- a/app/controllers/home_controller.rb +++ b/app/controllers/home_controller.rb @@ -7,10 +7,11 @@ class HomeController < ApplicationController def show if current_user redirect_to aspects_path + elsif is_mobile_device? + redirect_to user_session_path else @landing_page = true render :show end end - end diff --git a/app/views/aspects/_aspect_stream.haml b/app/views/aspects/_aspect_stream.haml index deb9cefee..ec60e948c 100644 --- a/app/views/aspects/_aspect_stream.haml +++ b/app/views/aspects/_aspect_stream.haml @@ -6,4 +6,6 @@ = render 'shared/publisher', :aspect => aspect, :aspect_ids => aspect_ids #main_stream.stream{:data => {:guids => aspect_ids.join(',')}} = render 'shared/stream', :posts => fakes + %a.paginate + = t("more") = will_paginate posts diff --git a/app/views/aspects/index.mobile.haml b/app/views/aspects/index.mobile.haml index 9f9edc561..43f88ceb2 100644 --- a/app/views/aspects/index.mobile.haml +++ b/app/views/aspects/index.mobile.haml @@ -12,7 +12,9 @@ = render 'shared/publisher', :aspect_ids => @aspect_ids #main_stream.stream - = render 'shared/stream', :posts => @posts + = render 'shared/stream', :posts => @fakes + %a.paginate + = t("more") = will_paginate @posts diff --git a/app/views/aspects/show.html.haml b/app/views/aspects/show.html.haml index a7f618211..78fb386cb 100644 --- a/app/views/aspects/show.html.haml +++ b/app/views/aspects/show.html.haml @@ -26,4 +26,6 @@ #main_stream.stream{:data => {:guids => @aspect.id}} = render 'shared/stream', :posts => @posts + %a.paginate + = t("more") =will_paginate @posts diff --git a/app/views/layouts/application.mobile.haml b/app/views/layouts/application.mobile.haml index 3139d7c90..a2eff9207 100644 --- a/app/views/layouts/application.mobile.haml +++ b/app/views/layouts/application.mobile.haml @@ -11,6 +11,8 @@ %meta{"http-equiv"=>"Content-Type", :content=>"text/html; charset=utf-8"}/ = include_javascripts :mobile + - if ["cz", "da", "de", "el", "es", "fr", "he", "hu", "id", "it", "ja", "ko", "nl", "pl", "pt", "ro", "ru", "sv", "zh-CN"].include?(I18n.locale.to_s) + = javascript_include_tag "vendor/timeago_locale/jquery.timeago.#{I18n.locale.to_s}.js" = stylesheet_link_tag 'vendor/jquery_mobile.min', 'mobile' = csrf_meta_tag @@ -57,38 +59,37 @@ = link_to 'logout', destroy_user_session_path - #menu{:data => {:role => 'page'}} - #header - - if current_user + -if current_user + #menu{:data => {:role => 'page'}} + #header .right = link_to(image_tag('icons/search_white.png'), people_path) - = link_to(image_tag('white.png'), aspects_path) + = link_to(image_tag('white.png'), aspects_path) - %div{:data => {:role => 'content'}} - %h2 - = current_user.name + %div{:data => {:role => 'content'}} + %h2 + = current_user.name - %ul{:data => {:role => 'listview', :inset => 'true'}} - %li - = link_to t('people.edit.your_profile'), person_path(current_user.person) - %li - = link_to t('notifications.index.notifications'), notifications_path - .ui-li-count - = @notification_count - - %h4 - your aspects - - %ul{:data => {:role => 'listview', :inset => 'true'}} - %li - = link_to t('application.helper.aspect_badge.all_aspects'), aspects_path - - for aspect in @all_aspects + %ul{:data => {:role => 'listview', :inset => 'true'}} %li - = link_to aspect, aspects_path('a_ids[]' => aspect.id) + = link_to t('people.edit.your_profile'), person_path(current_user.person) + %li + = link_to t('notifications.index.notifications'), notifications_path + .ui-li-count + = @notification_count + + %h4 + your aspects + + %ul{:data => {:role => 'listview', :inset => 'true'}} + %li + = link_to t('application.helper.aspect_badge.all_aspects'), aspects_path + - for aspect in @all_aspects + %li + = link_to aspect, aspects_path('a_ids[]' => aspect.id) - #footer - - if current_user + #footer logged in as = link_to current_user.name, current_user.person diff --git a/app/views/people/show.html.haml b/app/views/people/show.html.haml index 677dfa717..41139fd1a 100644 --- a/app/views/people/show.html.haml +++ b/app/views/people/show.html.haml @@ -56,7 +56,8 @@ - else #main_stream.stream = render 'shared/stream', :posts => @fakes - + %a.paginate + = t("more") = will_paginate @posts - else diff --git a/app/views/people/show.mobile.haml b/app/views/people/show.mobile.haml index f7941b2e4..b2c228855 100644 --- a/app/views/people/show.mobile.haml +++ b/app/views/people/show.mobile.haml @@ -39,7 +39,8 @@ - else #main_stream.stream = render 'shared/stream', :posts => @posts - + %a.paginate + = t("more") = will_paginate @posts - else diff --git a/app/views/shared/_stream.haml b/app/views/shared/_stream.haml index e09ebbc17..0d7f2924c 100644 --- a/app/views/shared/_stream.haml +++ b/app/views/shared/_stream.haml @@ -6,7 +6,6 @@ - if posts.length > 0 - for post in posts = render 'shared/stream_element', :post => post, :all_aspects => @all_aspects, :commenting_disabled => defined?(@commenting_disabled) - %a.paginate - = t("more") + - else - = render 'aspects/no_posts_message', :post_count => posts.length + = render 'aspects/no_posts_message', :post_count => posts.length diff --git a/config/assets.yml b/config/assets.yml index 04e8e34fb..acbdc1443 100644 --- a/config/assets.yml +++ b/config/assets.yml @@ -27,7 +27,10 @@ javascripts: - public/javascripts/custom-mobile-scripting.js - public/javascripts/vendor/jquery-ui-1.8.6.custom.min.js - public/javascripts/vendor/jquery_mobile_a2.min.js + - public/javascripts/vendor/jquery.infinitescroll.min.js + - public/javascripts/vendor/timeago.js - public/javascripts/mobile.js + - public/javascripts/application.js mailchimp: - public/javascripts/vendor/mailchimp/jquery.form.js - public/javascripts/vendor/mailchimp/jquery.validate.js diff --git a/public/javascripts/application.js b/public/javascripts/application.js index 5a3534ee5..f9ff57539 100644 --- a/public/javascripts/application.js +++ b/public/javascripts/application.js @@ -18,7 +18,6 @@ $(document).ready(function() { }); $(window).unbind('.infscr'); - $("a.paginate").live("click", function() { $(this).css("display", "none"); $(document).trigger("retrieve.infscr"); diff --git a/public/javascripts/mobile.js b/public/javascripts/mobile.js index 616b145c6..b522e24a7 100644 --- a/public/javascripts/mobile.js +++ b/public/javascripts/mobile.js @@ -5,6 +5,7 @@ var Mobile = { initialize: function() { + $("abbr.timeago").timeago(); $('#aspect_picker').change(Mobile.changeAspect); },