0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-01-06 22:40:14 -05:00

Activate specific tab that is tapped/clicked.

This commit is contained in:
Robert Jackson 2014-08-07 09:32:10 -04:00
parent 4b83dfd6ab
commit 493fe8183b
No known key found for this signature in database
GPG key ID: B3D10EF8171F7219
3 changed files with 19 additions and 8 deletions

View file

@ -45,9 +45,14 @@ var Codemirror = Ember.TextArea.extend(MarkerManager, {
var initMarkers = _.bind(this.initMarkers, this); var initMarkers = _.bind(this.initMarkers, this);
// Allow tabbing behaviour when viewing on small screen (not mobile) // Allow tabbing behaviour when viewing on small screen (not mobile)
$('.floatingheader').on('click', function () { $('#entry-markdown-header').on('click', function () {
$('.entry-markdown').toggleClass('active'); $('.entry-markdown').addClass('active');
$('.entry-preview').toggleClass('active'); $('.entry-preview').removeClass('active');
});
$('#entry-preview-header').on('click', function () {
$('.entry-markdown').removeClass('active');
$('.entry-preview').addClass('active');
}); });
// replaces CodeMirror with TouchEditor only if we're on mobile // replaces CodeMirror with TouchEditor only if we're on mobile

View file

@ -5,7 +5,7 @@
</header> </header>
<section class="entry-markdown active"> <section class="entry-markdown active">
<header class="floatingheader"> <header class="floatingheader" id="entry-markdown-header">
<small>Markdown</small> <small>Markdown</small>
<a class="markdown-help" href="" {{action "openModal" "markdown"}}><span class="hidden">What is Markdown?</span></a> <a class="markdown-help" href="" {{action "openModal" "markdown"}}><span class="hidden">What is Markdown?</span></a>
</header> </header>
@ -15,7 +15,7 @@
</section> </section>
<section class="entry-preview"> <section class="entry-preview">
<header class="floatingheader"> <header class="floatingheader" id="entry-preview-header">
<small>Preview <span class="entry-word-count js-entry-word-count">{{gh-count-words scratch}}</span></small> <small>Preview <span class="entry-word-count js-entry-word-count">{{gh-count-words scratch}}</span></small>
</header> </header>
<section class="entry-preview-content"> <section class="entry-preview-content">

View file

@ -29,11 +29,17 @@ init = function init() {
$('body').addClass('touch-editor'); $('body').addClass('touch-editor');
// make editor tabs touch-to-toggle in portrait mode // make editor tabs touch-to-toggle in portrait mode
$('.floatingheader').on('tap', function () { $('#entry-markdown-header').on('tap', function () {
$('.entry-markdown').toggleClass('active'); $('.entry-markdown').addClass('active');
$('.entry-preview').toggleClass('active'); $('.entry-preview').removeClass('active');
}); });
$('#entry-preview-header').on('tap', function () {
$('.entry-markdown').removeClass('active');
$('.entry-preview').addClass('active');
});
Ember.touchEditor = true; Ember.touchEditor = true;
//initialize FastClick to remove touch delays //initialize FastClick to remove touch delays
Ember.run.scheduleOnce('afterRender', null, function () { Ember.run.scheduleOnce('afterRender', null, function () {