2013-05-05 18:15:48 -07:00
|
|
|
|
(function ($, document, window) {
|
|
|
|
|
|
2016-02-15 21:54:20 -07:00
|
|
|
|
var currentItemId;
|
2013-08-02 13:36:44 -07:00
|
|
|
|
|
|
|
|
|
function reload(page) {
|
|
|
|
|
|
2015-08-15 17:41:55 -07:00
|
|
|
|
page = $(page)[0];
|
|
|
|
|
|
2013-08-02 13:36:44 -07:00
|
|
|
|
Dashboard.showLoadingMsg();
|
|
|
|
|
|
2016-02-15 21:54:20 -07:00
|
|
|
|
var itemId = MetadataEditor.getCurrentItemId();
|
|
|
|
|
currentItemId = itemId;
|
2013-12-28 09:58:13 -07:00
|
|
|
|
|
2016-02-15 21:54:20 -07:00
|
|
|
|
if (itemId) {
|
|
|
|
|
require(['components/metadataeditor/metadataeditor'], function (metadataeditor) {
|
2013-12-28 09:58:13 -07:00
|
|
|
|
|
2016-02-15 21:54:20 -07:00
|
|
|
|
metadataeditor.embed(page.querySelector('.editPageInnerContent'), itemId);
|
2014-02-09 14:11:11 -07:00
|
|
|
|
});
|
2016-02-15 21:54:20 -07:00
|
|
|
|
} else {
|
|
|
|
|
page.querySelector('.editPageInnerContent').innerHTML = '';
|
|
|
|
|
Dashboard.hideLoadingMsg();
|
2015-06-29 11:45:42 -07:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2015-09-01 07:01:59 -07:00
|
|
|
|
$(document).on('pageinit', "#editItemMetadataPage", function () {
|
2015-07-15 04:26:47 -07:00
|
|
|
|
|
|
|
|
|
var page = this;
|
2013-05-22 12:49:12 -07:00
|
|
|
|
|
2013-08-02 13:36:44 -07:00
|
|
|
|
$('.libraryTree', page).on('itemclicked', function (event, data) {
|
2013-05-05 18:15:48 -07:00
|
|
|
|
|
2016-02-15 21:54:20 -07:00
|
|
|
|
if (data.id != currentItemId) {
|
2013-05-05 18:15:48 -07:00
|
|
|
|
|
2013-12-24 11:37:29 -07:00
|
|
|
|
//$.mobile.urlHistory.ignoreNextHashChange = true;
|
2013-08-02 13:36:44 -07:00
|
|
|
|
window.location.hash = 'editItemMetadataPage?id=' + data.id;
|
2015-09-17 09:04:04 -07:00
|
|
|
|
reload(page);
|
2013-08-02 13:36:44 -07:00
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
2015-09-24 10:08:10 -07:00
|
|
|
|
}).on('pageshow', "#editItemMetadataPage", function () {
|
2013-05-05 18:15:48 -07:00
|
|
|
|
|
|
|
|
|
var page = this;
|
|
|
|
|
|
2015-09-17 09:04:04 -07:00
|
|
|
|
reload(page);
|
2015-07-14 13:29:51 -07:00
|
|
|
|
|
2015-06-20 17:49:42 -07:00
|
|
|
|
}).on('pagebeforehide', "#editItemMetadataPage", function () {
|
2014-10-06 16:58:46 -07:00
|
|
|
|
|
|
|
|
|
var page = this;
|
2013-05-05 18:15:48 -07:00
|
|
|
|
});
|
|
|
|
|
|
2013-08-02 13:36:44 -07:00
|
|
|
|
})(jQuery, document, window);
|
|
|
|
|
|