This commit is contained in:
Luke Pulverenti 2015-09-02 16:21:01 -04:00
commit 5dff5c3558
4 changed files with 44 additions and 61 deletions

View File

@ -14,7 +14,7 @@
<div class="editPageInnerContent" style="visibility:hidden;">
<h1 class="itemName editPageName">&nbsp;</h1>
<br />
<paper-tabs hidescrollbuttons noink>
<paper-tabs hidescrollbuttons>
<paper-tab class="metadataTabButton">${TabMetadata}</paper-tab>
<paper-tab class="subtitleTabButton hide">${TabSubtitles}</paper-tab>
<paper-tab class="collectionItemsTabButton hide">${TabCollectionTitles}</paper-tab>

View File

@ -12,8 +12,8 @@
Dashboard.showLoadingMsg();
var promise1 = MetadataEditor.getItemPromise();
var promise2 = MetadataEditor.currentItemId ?
ApiClient.getJSON(ApiClient.getUrl('Items/' + MetadataEditor.currentItemId + '/MetadataEditor')) :
var promise2 = MetadataEditor.getCurrentItemId() ?
ApiClient.getJSON(ApiClient.getUrl('Items/' + MetadataEditor.getCurrentItemId() + '/MetadataEditor')) :
{};
$.when(promise1, promise2).done(function (response1, response2) {
@ -1455,8 +1455,6 @@
if (data.id != currentItem.Id) {
MetadataEditor.currentItemId = data.id;
MetadataEditor.currentItemType = data.itemType;
//Dashboard.navigate('edititemmetadata.html?id=' + data.id);
//$.mobile.urlHistory.ignoreNextHashChange = true;
@ -1481,7 +1479,12 @@
configurePaperLibraryTabs(page, tabs);
$(tabs).on('iron-select', function () {
Events.trigger(this, 'tabchange');
var self = this;
setTimeout(function () {
Events.trigger(self, 'tabchange');
}, 400);
}).on('tabchange', function () {
var selected = this.selected;
@ -1519,7 +1522,9 @@
tabs.hideScrollButtons = true;
tabs.noSlide = true;
tabs.noink = true;
// Unfortunately we can't disable this because it causes iron-select to not fire in IE and Safari.
//tabs.noink = true;
$(ownerpage).on('pageshowready', function () {

View File

@ -262,9 +262,23 @@
}
}
function loadJsTree() {
var deferred = DeferredBuilder.Deferred();
require([
'bower_components/jstree/dist/jstree.min'
], function () {
Dashboard.importCss('thirdparty/jstree/themes/default/style.min.css');
deferred.resolve();
});
return deferred.promise();
}
function initializeTree(page, currentUser, openItems, selectedId) {
MetadataEditor.loadJsTree().done(function () {
loadJsTree().done(function () {
initializeTreeInternal(page, currentUser, openItems, selectedId);
});
}
@ -403,7 +417,6 @@
}).on('pagebeforeshow', ".metadataEditorPage", function () {
Dashboard.importCss('css/metadataeditor.css');
window.MetadataEditor = new metadataEditor();
}).on('pagebeforeshow', ".metadataEditorPage", function () {
@ -411,7 +424,7 @@
Dashboard.getCurrentUser().done(function (user) {
var id = MetadataEditor.currentItemId;
var id = getCurrentItemId();
if (id) {
@ -438,64 +451,24 @@
});
function metadataEditor() {
function getCurrentItemId() {
var self = this;
var url = window.location.hash || getWindowUrl();
function ensureInitialValues() {
return getParameterByName('id', url);
}
if (self.currentItemType || self.currentItemId) {
return;
}
var url = window.location.hash || getWindowUrl();
var id = getParameterByName('id', url);
if (id) {
self.currentItemId = id;
self.currentItemType = null;
}
};
self.getItemPromise = function () {
var currentItemType = self.currentItemType;
var currentItemId = self.currentItemId;
if (currentItemType == "TvChannel") {
return ApiClient.getLiveTvChannel(currentItemId);
}
window.MetadataEditor = {
getItemPromise: function() {
var currentItemId = getCurrentItemId();
if (currentItemId) {
return ApiClient.getItem(Dashboard.getCurrentUserId(), currentItemId);
}
return ApiClient.getRootFolder(Dashboard.getCurrentUserId());
};
self.getEditQueryString = function (item) {
var query = "id=" + item.Id;
return query;
};
self.loadJsTree = function () {
var deferred = DeferredBuilder.Deferred();
require([
'bower_components/jstree/dist/jstree.min'
], function () {
Dashboard.importCss('thirdparty/jstree/themes/default/style.min.css');
deferred.resolve();
});
return deferred.promise();
};
ensureInitialValues();
}
},
getCurrentItemId: getCurrentItemId
};
})(jQuery, document, window);

View File

@ -2290,10 +2290,15 @@ $(document).on('pagecreate', ".page", function () {
var page = this;
var isWizardPage = page.classList.contains('wizardPage');
Dashboard.ensurePageTitle(page);
var apiClient = window.ApiClient;
if (isWizardPage) {
require(['jqmicons']);
}
if (apiClient && apiClient.accessToken() && Dashboard.getCurrentUserId()) {
var isSettingsPage = page.classList.contains('type-interior');
@ -2323,7 +2328,7 @@ $(document).on('pagecreate', ".page", function () {
}
}
if (!isConnectMode && this.id !== "loginPage" && !page.classList.contains('forgotPasswordPage') && !page.classList.contains('wizardPage') && this.id !== 'publicSharedItemPage') {
if (!isConnectMode && this.id !== "loginPage" && !page.classList.contains('forgotPasswordPage') && !isWizardPage && this.id !== 'publicSharedItemPage') {
Logger.log('Not logged into server. Redirecting to login.');
Dashboard.logout();