remove some js assets from mobile

This commit is contained in:
danielvincent 2011-02-06 23:09:04 -08:00
parent 42993de739
commit bf20e5a9e8
5 changed files with 8 additions and 45 deletions

View file

@ -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)

View file

@ -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

View file

@ -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

View file

@ -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;
}

View file

@ -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");
});
});
});