diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 0eb48c67cfa730d0350198e5f354ceb7e4575957..00eb82f8c012024fd200c1456edda512e8f5cf53 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -107,8 +107,11 @@ module ApplicationHelper end def how_long_ago(obj) - timeago(obj.created_at) - #I18n.t('ago', :time => time_ago_in_words(obj.created_at, true)) + if is_mobile_device? + time_ago_in_words(obj.created_at) + else + timeago(obj.created_at) + end end def person_url(person) diff --git a/app/views/layouts/application.mobile.haml b/app/views/layouts/application.mobile.haml index 030672138d5d756064d67a51a934f8e731daad14..23f862392fa661453bf6f0e751b75453ef73c0de 100644 --- a/app/views/layouts/application.mobile.haml +++ b/app/views/layouts/application.mobile.haml @@ -14,7 +14,7 @@ -if current_user :javascript Diaspora.widgets.i18n.loadLocale(#{get_javascript_strings_for(current_user.language).to_json}, "#{current_user.language}"); - + = stylesheet_link_tag 'vendor/jquery.mobile-1.0a3.min', 'mobile' = csrf_meta_tag @@ -80,7 +80,7 @@ = link_to t('people.edit.your_profile'), person_path(current_user.person) %li = link_to t('notifications.index.notifications'), notifications_path - .ui-li-count + .ui-li-count = @notification_count %h4 diff --git a/config/assets.yml b/config/assets.yml index 1f154e490ee91ad717a96d03f62bec164aef6a5d..f615fadbe26148a52dc25126752a542cb9a3aa8a 100644 --- a/config/assets.yml +++ b/config/assets.yml @@ -28,15 +28,10 @@ javascripts: - public/javascripts/search.js mobile: - public/javascripts/vendor/jquery144.min.js - - public/javascripts/vendor/jquery-ui-1.8.6.custom.min.js - public/javascripts/custom-mobile-scripting.js - public/javascripts/vendor/jquery.mobile-1.0a3.min.js - public/javascripts/vendor/jquery.infinitescroll.min.js - - public/javascripts/vendor/timeago.js - public/javascripts/diaspora.js - - public/javascripts/widgets/alert.js - - public/javascripts/widgets/i18n.js - - public/javascripts/widgets/timeago.js - public/javascripts/mobile.js - public/javascripts/application.js - public/javascripts/rails.js diff --git a/public/javascripts/mobile.js b/public/javascripts/mobile.js index abba63bc61b0b9624ef2c856014783a95758fdd3..5438cde536a0c87ef0b9b10f638003cae8495f30 100644 --- a/public/javascripts/mobile.js +++ b/public/javascripts/mobile.js @@ -5,18 +5,12 @@ var Mobile = { initialize: function() { - $("abbr.timeago").timeago(); $('#main_stream + .pagination').hide(); - $('#aspect_picker').change(Mobile.changeAspect); $('a').live('tap',function(){ $(this).addClass('tapped'); }) }, - - changeAspect: function() { - Mobile.windowLocation('/aspects/' + $('#aspect_picker option:selected').val()); - }, - + windowLocation: function(url) { window.location = url; } diff --git a/spec/javascripts/mobile-interface-spec.js b/spec/javascripts/mobile-interface-spec.js deleted file mode 100644 index 4b8e6ed378b17e180de233dd54c1f1508035249f..0000000000000000000000000000000000000000 --- a/spec/javascripts/mobile-interface-spec.js +++ /dev/null @@ -1,29 +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. -*/ - -describe("mobile interface", function() { - describe("initialize", function() { - it("attaches a change event to the select box", function() { - spyOn($.fn, 'change'); - Mobile.initialize(); - expect($.fn.change).toHaveBeenCalledWith(Mobile.changeAspect); - expect($.fn.change.mostRecentCall.object.selector).toEqual("#aspect_picker"); - }); - }); - - - describe("change", function() { - it("changes to the aspect show page", function() { - $('#jasmine_content').html( -'<select id="aspect_picker" name="aspect_picker" tabindex="-1">' + -' <option value="family-aspect-id">Family</option>' + -' <option value="work-aspect-id">Work</option>' + -'</select>'); - spyOn(Mobile, "windowLocation"); - $.proxy(Mobile.changeAspect, $('#aspect_picker > option').first())() - expect(Mobile.windowLocation).toHaveBeenCalledWith("/aspects/family-aspect-id"); - }); - }); -}); \ No newline at end of file