Move toolbar to widget. Show it early. Ref #224
This commit is contained in:
parent
04b2ebc780
commit
d167089c16
@ -142,6 +142,38 @@ $.widget('oc.documentOverlay', {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$.widget('oc.documentToolbar', {
|
||||||
|
options : {
|
||||||
|
innerhtml : '<div id="document-title" class="icon-noise">' +
|
||||||
|
' <div id="header">' +
|
||||||
|
' <div class="logo-wide"></div>' +
|
||||||
|
' <div id="document-title-container"> </div>' +
|
||||||
|
' </div>' +
|
||||||
|
'</div>' +
|
||||||
|
|
||||||
|
'<span id="toolbar" class="claro">' +
|
||||||
|
' <button id="odf-invite" class="drop hidden">' +
|
||||||
|
t('documents', 'Share') +
|
||||||
|
' </button>' +
|
||||||
|
' <button id="odf-close">' +
|
||||||
|
t('documents', 'Close') +
|
||||||
|
' </button>' +
|
||||||
|
' <img id="saving-document" alt=""' +
|
||||||
|
' src="' + OC.imagePath('core', 'loading.gif') + '"' +
|
||||||
|
' />' +
|
||||||
|
'</span>'
|
||||||
|
},
|
||||||
|
_create : function (){
|
||||||
|
$(this.element).html(this.options.innerhtml).hide().prependTo(document.body);
|
||||||
|
},
|
||||||
|
show : function (){
|
||||||
|
$(this.element).show();
|
||||||
|
},
|
||||||
|
hide : function(){
|
||||||
|
$(this.element).fadeOut('fast');
|
||||||
|
$(this.element).html(this.options.innerhtml);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
var documentsMain = {
|
var documentsMain = {
|
||||||
isEditormode : false,
|
isEditormode : false,
|
||||||
@ -153,25 +185,6 @@ var documentsMain = {
|
|||||||
fileName: null,
|
fileName: null,
|
||||||
|
|
||||||
UI : {
|
UI : {
|
||||||
/* Toolbar HTML */
|
|
||||||
toolbar : '<div id="odf-toolbar" class="dijitToolbar">' +
|
|
||||||
' <div id="document-title" class="icon-noise">' +
|
|
||||||
'<div id="header"><div class="logo-wide"></div>' +
|
|
||||||
'<div id="document-title-container"> </div>' +
|
|
||||||
'</div></div>' +
|
|
||||||
' <span id="toolbar" class="claro">' +
|
|
||||||
' <button id="odf-invite" class="drop hidden">' +
|
|
||||||
t('documents', 'Share') +
|
|
||||||
' </button>' +
|
|
||||||
' <button id="odf-close">' +
|
|
||||||
t('documents', 'Close') +
|
|
||||||
' </button>' +
|
|
||||||
' <img id="saving-document" alt=""' +
|
|
||||||
' src="' + OC.imagePath('core', 'loading.gif') + '"' +
|
|
||||||
' />' +
|
|
||||||
'</span>' +
|
|
||||||
'</div>',
|
|
||||||
|
|
||||||
/* Editor wrapper HTML */
|
/* Editor wrapper HTML */
|
||||||
container : '<div id = "mainContainer" class="claro">' +
|
container : '<div id = "mainContainer" class="claro">' +
|
||||||
' <div id = "editor">' +
|
' <div id = "editor">' +
|
||||||
@ -221,12 +234,12 @@ var documentsMain = {
|
|||||||
$(document.body).attr('id', 'body-login');
|
$(document.body).attr('id', 'body-login');
|
||||||
$('header,footer,nav').show();
|
$('header,footer,nav').show();
|
||||||
}
|
}
|
||||||
// Fade out toolbar
|
|
||||||
$('#odf-toolbar').fadeOut('fast');
|
documentsMain.toolbar.documentToolbar('hide');
|
||||||
|
|
||||||
// Fade out editor
|
// Fade out editor
|
||||||
$('#mainContainer').fadeOut('fast', function() {
|
$('#mainContainer').fadeOut('fast', function() {
|
||||||
$('#mainContainer').remove();
|
$('#mainContainer').remove();
|
||||||
$('#odf-toolbar').remove();
|
|
||||||
$('#content').fadeIn('fast');
|
$('#content').fadeIn('fast');
|
||||||
$(document.body).removeClass('claro');
|
$(document.body).removeClass('claro');
|
||||||
$('title').text(documentsMain.UI.mainTitle);
|
$('title').text(documentsMain.UI.mainTitle);
|
||||||
@ -284,6 +297,7 @@ var documentsMain = {
|
|||||||
documentsMain.isGuest = true;
|
documentsMain.isGuest = true;
|
||||||
|
|
||||||
if ($("[name='document']").val()){
|
if ($("[name='document']").val()){
|
||||||
|
documentsMain.toolbar.documentToolbar('show');
|
||||||
documentsMain.prepareSession();
|
documentsMain.prepareSession();
|
||||||
documentsMain.joinSession(
|
documentsMain.joinSession(
|
||||||
$("[name='document']").val()
|
$("[name='document']").val()
|
||||||
@ -339,10 +353,8 @@ var documentsMain = {
|
|||||||
return documentsMain.view(response.id);
|
return documentsMain.view(response.id);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$('#odf-toolbar').length){
|
$('header,footer,nav').hide();
|
||||||
$('header,footer,nav').hide();
|
documentsMain.toolbar.documentToolbar('show');
|
||||||
$(document.body).prepend(documentsMain.UI.toolbar);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!response || !response.status || response.status==='error'){
|
if (!response || !response.status || response.status==='error'){
|
||||||
documentsMain.onEditorShutdown(t('documents', 'Failed to load this document. Please check if it can be opened with an external odt editor. This might also mean it has been unshared or deleted recently.'));
|
documentsMain.onEditorShutdown(t('documents', 'Failed to load this document. Please check if it can be opened with an external odt editor. This might also mean it has been unshared or deleted recently.'));
|
||||||
@ -770,6 +782,7 @@ $(document).ready(function() {
|
|||||||
|
|
||||||
documentsMain.docs = $('.documentslist').documentGrid();
|
documentsMain.docs = $('.documentslist').documentGrid();
|
||||||
documentsMain.overlay = $('<div id="documents-overlay" class="icon-loading"></div><div id="documents-overlay-below" class="icon-loading-dark"></div>').documentOverlay();
|
documentsMain.overlay = $('<div id="documents-overlay" class="icon-loading"></div><div id="documents-overlay-below" class="icon-loading-dark"></div>').documentOverlay();
|
||||||
|
documentsMain.toolbar = $('<div id="odf-toolbar" class="dijitToolbar"></div>').documentToolbar();
|
||||||
|
|
||||||
$('.documentslist').on('click', 'li:not(.add-document)', function(event) {
|
$('.documentslist').on('click', 'li:not(.add-document)', function(event) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user