From 5225c111b449bfeda66b84ceade87d54c822089d Mon Sep 17 00:00:00 2001 From: benweet Date: Thu, 8 Aug 2013 22:53:15 +0100 Subject: [PATCH] Upgrade to Bootstrap 3 --- js/core.js | 37 +++++++++++++-------------- js/eventMgr.js | 10 ++++++-- js/extensions/buttonHtmlCode.js | 3 ++- js/extensions/buttonMarkdownSyntax.js | 8 ++++-- js/extensions/documentSelector.js | 4 +-- js/html/bodyIndex.html | 12 ++++++--- js/html/buttonHtmlCode.html | 5 ++-- js/html/buttonMarkdownSyntax.html | 5 ++-- js/styles/default.less | 18 ++++++------- tools/increment_version | 4 +++ version | 1 + 11 files changed, 62 insertions(+), 45 deletions(-) create mode 100755 tools/increment_version create mode 100644 version diff --git a/js/core.js b/js/core.js index cf9eac53..e3a8d164 100644 --- a/js/core.js +++ b/js/core.js @@ -165,12 +165,13 @@ define([ if(forceHide === true || layout.state.north.isClosed) { menuPanelElt.hide(); documentPanelElt.hide(); - } else { + } + else { menuPanelElt.show(); documentPanelElt.show(); } } - + // Create the layout function createLayout() { if(viewerMode === true) { @@ -412,37 +413,35 @@ define([ $(".dropdown-submenu > a").click(function(e) { e.stopPropagation(); }); - + menuPanelElt = $('.menu-panel'); var isMenuPanelShown = false; menuPanelElt.on('shown.bs.collapse', function() { isMenuPanelShown = true; // Register a click listener when menu panel is open - $(document).on("click.hide-menu-panel", function(e) { - if(!$(e.target).is('.menu-panel [data-toggle=collapse]')) { - // If click outside the panel, close the panel and unregister the listener - menuPanelElt.collapse('hide'); - $(document).off("click.hide-menu-panel"); - isMenuPanelShown = false; - } + $('body').on('click.hide-menu-panel', '.action-close-panel, :not(.menu-panel, .menu-panel *)', function(e) { + // If click outside the panel, close the panel and unregister + // the listener + menuPanelElt.collapse('hide'); + $('body').off('click.hide-menu-panel'); + isMenuPanelShown = false; }); }); - + documentPanelElt = $('.document-panel'); var isDocumentPanelShown = false; documentPanelElt.on('shown.bs.collapse', function() { isDocumentPanelShown = true; // Register a click listener when document panel is open - $(document).on("click.hide-document-panel", function(e) { - if(!$(e.target).is('.document-panel [data-toggle=collapse]')) { - // If click outside the panel, close the panel and unregister the listener - documentPanelElt.collapse('hide'); - $(document).off("click.hide-document-panel"); - isDocumentPanelShown = false; - } + $('body').on('click.hide-document-panel', '.action-close-panel, :not(.document-panel, .document-panel *)', function(e) { + // If click outside the panel, close the panel and unregister + // the listener + documentPanelElt.collapse('hide'); + $(document).off('click.hide-document-panel'); + isDocumentPanelShown = false; }); }); - + var isModalShown = false; $('.modal').on('shown.bs.modal', function() { // Focus on the first input when modal opens diff --git a/js/eventMgr.js b/js/eventMgr.js index 27b3cacb..e783eb4b 100644 --- a/js/eventMgr.js +++ b/js/eventMgr.js @@ -238,9 +238,15 @@ define([ logger.log("onCreatePreviewButton"); var onCreatePreviewButtonListenerList = getExtensionListenerList("onCreatePreviewButton"); var extensionPreviewButtonsFragment = document.createDocumentFragment(); - _.each(onCreatePreviewButtonListenerList, function(listener) { - extensionPreviewButtonsFragment.appendChild(createBtn(listener)); + var buttonGrpElt = crel('div', { + class: 'btn-group' }); + extensionPreviewButtonsFragment.appendChild(buttonGrpElt); + var buttonGroupInnerHtml = ""; + _.each(onCreatePreviewButtonListenerList, function(listener) { + buttonGroupInnerHtml += listener(); + }); + buttonGrpElt.innerHTML = buttonGroupInnerHtml; document.getElementById('extension-preview-buttons').appendChild(extensionPreviewButtonsFragment); } diff --git a/js/extensions/buttonHtmlCode.js b/js/extensions/buttonHtmlCode.js index 8836496c..ebf9a53f 100644 --- a/js/extensions/buttonHtmlCode.js +++ b/js/extensions/buttonHtmlCode.js @@ -27,7 +27,7 @@ define([ }; buttonHtmlCode.onCreatePreviewButton = function() { - return buttonHtmlCodeHTML; + return ''; }; var selectedFileDesc = undefined; @@ -52,6 +52,7 @@ define([ }; buttonHtmlCode.onReady = function() { + $('#extension-preview-buttons').append($(buttonHtmlCodeHTML)); textareaElt = document.getElementById('input-html-code'); $(".action-html-code").click(function() { _.defer(function() { diff --git a/js/extensions/buttonMarkdownSyntax.js b/js/extensions/buttonMarkdownSyntax.js index 38e8a563..15329a3e 100644 --- a/js/extensions/buttonMarkdownSyntax.js +++ b/js/extensions/buttonMarkdownSyntax.js @@ -8,9 +8,13 @@ define([ buttonMarkdownSyntax.settingsBlock = '

Adds a "Markdown syntax" button over the preview.

'; buttonMarkdownSyntax.onCreatePreviewButton = function() { - return buttonMarkdownSyntaxHTML; + return ''; }; - + + buttonMarkdownSyntax.onReady = function() { + $('#extension-preview-buttons').append($(buttonMarkdownSyntaxHTML)); + }; + return buttonMarkdownSyntax; }); \ No newline at end of file diff --git a/js/extensions/documentSelector.js b/js/extensions/documentSelector.js index 1b23ce95..867973c0 100644 --- a/js/extensions/documentSelector.js +++ b/js/extensions/documentSelector.js @@ -62,10 +62,10 @@ define([ var fileSelectorElt = $(".file-selector"); fileSelectorElt.empty(); var documentPanelSelectorElt = $(".document-panel > .panel-content > .list-group"); - documentPanelSelectorElt.empty(); + documentPanelSelectorElt.find('.list-group-item').remove(); _.chain(fileSystem).sortBy(sortFunction).each(function(fileDesc) { var a = $('').html(composeTitle(fileDesc)); - var documentPanelItemElt = a.clone().addClass('list-group-item'); + var documentPanelItemElt = a.clone().addClass('list-group-item action-close-panel'); documentPanelItemElt.add(a).click(function() { if(!liMap[fileDesc.fileIndex].is(".disabled")) { fileMgr.selectFile(fileDesc); diff --git a/js/html/bodyIndex.html b/js/html/bodyIndex.html index 2eac9104..f2c6bafb 100644 --- a/js/html/bodyIndex.html +++ b/js/html/bodyIndex.html @@ -59,10 +59,10 @@ Manage synchronization @@ -105,7 +105,7 @@ + class="action-reset-input list-group-item action-close-panel"> Manage publication