Upgrade to Bootstrap 3

This commit is contained in:
benweet 2013-08-08 22:53:15 +01:00
parent 25ca30ce28
commit 5225c111b4
11 changed files with 62 additions and 45 deletions

View File

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

View File

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

View File

@ -27,7 +27,7 @@ define([
};
buttonHtmlCode.onCreatePreviewButton = function() {
return buttonHtmlCodeHTML;
return '<button class="btn btn-default dropdown-toggle action-html-code" title="HTML code" data-toggle="dropdown" data-target=".panel-html-code"><i class="icon-code"></i></button>';
};
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() {

View File

@ -8,9 +8,13 @@ define([
buttonMarkdownSyntax.settingsBlock = '<p>Adds a "Markdown syntax" button over the preview.</p>';
buttonMarkdownSyntax.onCreatePreviewButton = function() {
return buttonMarkdownSyntaxHTML;
return '<button class="btn btn-default dropdown-toggle" title="Markdown syntax" data-toggle="dropdown" data-target=".panel-markdown-syntax"><i class="icon-help-circled"></i></button>';
};
buttonMarkdownSyntax.onReady = function() {
$('#extension-preview-buttons').append($(buttonMarkdownSyntaxHTML));
};
return buttonMarkdownSyntax;
});

View File

@ -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 = $('<a href="#">').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);

View File

@ -59,10 +59,10 @@
<ul class="nav collapse collapse-open-from">
<li><a data-toggle="modal"
data-target="#modal-import-harddrive-markdown"
class="action-reset-input" href="#">Import from hard drive</a></li>
class="action-reset-input action-close-panel" href="#">Import from hard drive</a></li>
<li><a data-toggle="modal"
data-target="#modal-import-harddrive-html"
class="action-reset-input" href="#">Convert HTML to Markdown</a></li>
class="action-reset-input action-close-panel" href="#">Convert HTML to Markdown</a></li>
</ul>
<a href="#" data-toggle="collapse" data-target=".collapse-save-as"
@ -95,7 +95,7 @@
to Dropbox</a></li>
</ul>
<a href="#" data-toggle="modal" data-target="#modal-manage-sync"
class="action-reset-input list-group-item"><i
class="action-reset-input list-group-item action-close-panel"><i
class="icon-refresh"></i> Manage synchronization</a>
</div>
<div class=dropdown-header>PUBLISH</div>
@ -105,7 +105,7 @@
<ul class="nav collapse collapse-publish-on">
</ul>
<a href="#" data-toggle="modal" data-target="#modal-manage-publish"
class="action-reset-input list-group-item"><i class="icon-share"></i>
class="action-reset-input list-group-item action-close-panel"><i class="icon-share"></i>
Manage publication</a>
</div>
<ul class="nav">
@ -128,6 +128,10 @@
</button>
<div class="panel-content">
<div class="list-group">
<div class="input-group">
<span class="input-group-addon"><i class="icon-search"></i></span><input
type="text" class="form-control"></input>
</div>
</div>
</div>
</div>

View File

@ -1,7 +1,6 @@
<button class="btn btn-default dropdown-toggle action-html-code" title="HTML code" data-toggle="dropdown">
<i class="icon-code"></i>
</button>
<div class="panel-html-code">
<div class="dropdown-menu pull-right">
<h3>HTML code</h3>
<textarea id="input-html-code" class="form-control"></textarea>
</div>
</div>

View File

@ -1,6 +1,4 @@
<button class="btn btn-default dropdown-toggle" title="Markdown syntax" data-toggle="dropdown">
<i class="icon-help-circled"></i>
</button>
<div class="panel-markdown-syntax">
<div class="dropdown-menu pull-right">
<h3>Markdown syntax</h3>
<div class="markdown-syntax">
@ -142,3 +140,4 @@ Violets are blue.
<p class="muted">Based on the <a target="_blank" href="https://github.com/fletcher/MultiMarkdown/blob/master/Documentation/Markdown%20Syntax.md">Markdown syntax guide</a>, by Fletcher T. Penney.</p>
</div>
</div>
</div>

View File

@ -7,7 +7,7 @@
@icon-color: #525252;
@icon-color-inv: #fff;
@menu-panel-width: 250px;
@document-panel-width: 250px;
@document-panel-width: 300px;
@panel-bg: @bg-navbar-hover;
@transparent: fade(#000, 0%);
@ -259,7 +259,7 @@ Override Bootstrap
padding-bottom: 25px;
overflow: auto;
height: 100%;
i {
a > i {
margin-right: 5px;
color: inherit;
}
@ -275,6 +275,9 @@ Override Bootstrap
border-left: 10px solid @panel-bg;
margin-left: 10px;
}
}
.input-group {
padding: 15px 20px;
}
}
}
@ -375,13 +378,10 @@ Override Bootstrap
********************/
#extension-preview-buttons {
&,
.dropdown-menu {
position: fixed;
right: 25px;
top: auto;
z-index: 1;
}
position: absolute;
right: 25px;
top: auto;
z-index: 1;
.dropdown-menu {
border: 0 !important;
margin-top: 1px;

4
tools/increment_version Executable file
View File

@ -0,0 +1,4 @@
#!/bin/sh
version_minor=`sed 's/.*-\([0-9]*\)/\1/' version`
((version_minor++))
sed -i '' "s/\(.*-\)[0-9]*/\1$version_minor/" version

1
version Normal file
View File

@ -0,0 +1 @@
2.0 beta-1