diff --git a/app/assets/javascripts/discourse.js b/app/assets/javascripts/discourse.js index 55d09cc9935..d45c22fa3a2 100644 --- a/app/assets/javascripts/discourse.js +++ b/app/assets/javascripts/discourse.js @@ -143,6 +143,8 @@ Discourse = Ember.Application.createWithMixins(Discourse.Ajax, { bootbox.animate(false); bootbox.backdrop(true); // clicking outside a bootbox modal closes it + this.set('mobile', $html.hasClass('mobile')); + setInterval(function(){ Discourse.Formatter.updateRelativeAge($('.relative-date')); },60 * 1000); diff --git a/app/assets/javascripts/discourse/ember/resolver.js b/app/assets/javascripts/discourse/ember/resolver.js index ab854b88e77..50c4c1e7d5d 100644 --- a/app/assets/javascripts/discourse/ember/resolver.js +++ b/app/assets/javascripts/discourse/ember/resolver.js @@ -16,6 +16,15 @@ Discourse.Resolver = Ember.DefaultResolver.extend({ @returns {Template} the template (if found) **/ resolveTemplate: function(parsedName) { + if (Discourse.get('mobile')) { + var mobileParsedName = this.parseName(parsedName.fullName.replace("template:", "template:mobile/")); + var mobileTemplate = this.findTemplate(mobileParsedName); + if (mobileTemplate) return mobileTemplate; + } + return this.findTemplate(parsedName) || Ember.TEMPLATES.not_found; + }, + + findTemplate: function(parsedName) { var resolvedTemplate = this._super(parsedName); if (resolvedTemplate) { return resolvedTemplate; } @@ -36,7 +45,6 @@ Discourse.Resolver = Ember.DefaultResolver.extend({ resolvedTemplate = Ember.TEMPLATES[decamelized]; if (resolvedTemplate) { return resolvedTemplate; } } - return Ember.TEMPLATES.not_found; } }); \ No newline at end of file diff --git a/app/assets/javascripts/discourse/templates/mobile/topic.js.handlebars b/app/assets/javascripts/discourse/templates/mobile/topic.js.handlebars new file mode 100644 index 00000000000..f2a45cebe11 --- /dev/null +++ b/app/assets/javascripts/discourse/templates/mobile/topic.js.handlebars @@ -0,0 +1,9 @@ +{{#if postStream.loaded}} +