scrivito_ui 1.6.0.rc2 → 1.6.0.rc3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5c1b67fb17597157b57649549f73a428537bbdd4
4
- data.tar.gz: db7969d56febc4e1b98024e316600be56c0a6726
3
+ metadata.gz: 96d4ae87973c78fa558d664d06c608fe942fa2c2
4
+ data.tar.gz: 20f4cbbd4b725ea9fe24eb114f5b8ee645271162
5
5
  SHA512:
6
- metadata.gz: 0302d7827ae390e1610d7502471fc0a2b82154d14997d34cc350c2b5617df16d6360fa8a01173e90e8ca32b744d0c8cc5f78d2ddcb49922b63e3ca5c2bb87044
7
- data.tar.gz: 1f2dd06406bd7f627c0b21dfcb5d3f620634333a25826ce166ea344a1c01441fa08454663332b74c1261c11508cc8aa57542c1954da3119c93bfe9d1c70c7b31
6
+ metadata.gz: 1bfc6ce10feb6d0d4c9679eb4c22443dddd2a7f5214a4fc2e8c4e18009b248da4a5676d581c4064a34f1879541b5ce61e9a4ca476d868a17c2861e220cc26e23
7
+ data.tar.gz: 30e47b16dccb5fccace23aa6d289fb7494ba2372ed3b77b5ce45c7b470fb8f161081275f0a4f5eea7079631b895147820bcfd7da95bc513f371a2ae3acb60cd7
@@ -38808,7 +38808,7 @@ window.scrivito = {}; // jshint ignore:line
38808
38808
  },
38809
38809
 
38810
38810
  root_path: function root_path() {
38811
- return scrivito.application_window.is_frame() ? '/scrivito/' : '/';
38811
+ return scrivito.application_window.isFrame() ? '/scrivito/' : '/';
38812
38812
  },
38813
38813
 
38814
38814
  details_url_for_obj_id: function details_url_for_obj_id(id) {
@@ -38998,8 +38998,8 @@ window.scrivito = {}; // jshint ignore:line
38998
38998
 
38999
38999
  window.onbeforeunload = scrivito.warn_before_unloading;
39000
39000
 
39001
- scrivito.url_update(scrivito.application_window, scrivito.cms_window.from(window));
39002
- scrivito.application_window.use_fragment_of(scrivito.cms_window.from(window));
39001
+ scrivito.urlUpdate(scrivito.application_window, scrivito.cmsWindow.from(window));
39002
+ scrivito.application_window.useFragmentOf(scrivito.cmsWindow.from(window));
39003
39003
 
39004
39004
  inited = true;
39005
39005
  }
@@ -39619,7 +39619,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
39619
39619
  },
39620
39620
 
39621
39621
  isFile: function isFile(obj) {
39622
- return this.isBlob(obj) && _.isDate(obj.lastModifiedDate) && _.isString(obj.name);
39622
+ return this.isBlob(obj) && _.isString(obj.name);
39623
39623
  }
39624
39624
  };
39625
39625
  })();
@@ -47187,7 +47187,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
47187
47187
 
47188
47188
  new_document: function(document) {
47189
47189
  _.each(callbacks.document, function(callback) { callback(document); });
47190
- document.window().notify_new_document(document);
47190
+ document.window().notifyNewDocument(document);
47191
47191
  },
47192
47192
 
47193
47193
  on: function(event_name, callback) {
@@ -48776,24 +48776,25 @@ function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr
48776
48776
 
48777
48777
  _.extend(scrivito.transition, {immediate_mode: false});
48778
48778
  }());
48779
- (function() {
48780
- _.extend(scrivito, {
48781
- url_update: function(application_cms_window, ui_cms_window) {
48782
- if (application_cms_window === ui_cms_window) { return; }
48783
-
48784
- application_cms_window.on('document', function(application_document) {
48785
- var ui_window = ui_cms_window.browser_window();
48786
- var application_window = application_document.browser_window();
48787
-
48788
- var ui_url = ui_window.location.origin + '/scrivito' +
48789
- application_window.location.pathname +
48790
- application_window.location.search +
48791
- application_window.location.hash;
48792
- ui_window.history.replaceState({}, '', ui_url);
48793
- });
48779
+ 'use strict';
48780
+
48781
+ (function () {
48782
+ function urlUpdate(applicationCmsWindow, uiCmsWindow) {
48783
+ if (applicationCmsWindow === uiCmsWindow) {
48784
+ return;
48794
48785
  }
48795
- });
48796
- }());
48786
+
48787
+ applicationCmsWindow.on('document', function (applicationDocument) {
48788
+ var uiWindow = uiCmsWindow.browserWindow();
48789
+ var applicationWindow = applicationDocument.browser_window();
48790
+
48791
+ var uiURL = uiWindow.location.origin + '/scrivito' + applicationWindow.location.pathname + applicationWindow.location.search + applicationWindow.location.hash;
48792
+ uiWindow.history.replaceState({}, '', uiURL);
48793
+ });
48794
+ }
48795
+
48796
+ scrivito.urlUpdate = urlUpdate;
48797
+ })();
48797
48798
  (function() {
48798
48799
  var permissions;
48799
48800
 
@@ -50192,7 +50193,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
50192
50193
  connect: function() {
50193
50194
  if (connect_initiated) { $.error("document connected twice!"); }
50194
50195
 
50195
- if (scrivito.cms_window.is_living_window(browser_window)) {
50196
+ if (scrivito.cmsWindow.isLivingWindow(browser_window)) {
50196
50197
  connect_initiated = true;
50197
50198
  return that.preload_objs().then(function() {
50198
50199
  _.each(load_callbacks, function(callback) {
@@ -50238,7 +50239,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
50238
50239
  },
50239
50240
 
50240
50241
  window: function() {
50241
- return scrivito.cms_window.from(browser_window);
50242
+ return scrivito.cmsWindow.from(browser_window);
50242
50243
  },
50243
50244
 
50244
50245
  // return the given dom element using the local jQuery lib or the lib itself.
@@ -50574,141 +50575,155 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
50574
50575
  }
50575
50576
  });
50576
50577
  }());
50577
- (function() {
50578
+ 'use strict';
50578
50579
 
50579
- scrivito.cms_window = {
50580
- from: function(element) {
50581
- if (!element) { $.error("no element given!"); }
50580
+ (function () {
50581
+ var cmsWindow = {
50582
+ from: function from(element) {
50583
+ if (!element) {
50584
+ $.error('no element given!');
50585
+ }
50582
50586
 
50583
- var browser_window;
50587
+ var browserWindow = undefined;
50584
50588
 
50585
- if (element.jquery && element[0].tagName === "IFRAME") {
50589
+ if (element.jquery && element[0].tagName === 'IFRAME') {
50586
50590
  var doc = $(element).contents()[0];
50587
- browser_window = doc.defaultView;
50588
- }
50589
- else {
50590
- browser_window = element;
50591
+ browserWindow = doc.defaultView;
50592
+ } else {
50593
+ browserWindow = element;
50591
50594
  }
50592
50595
 
50593
- if (!scrivito.cms_window.is_living_window(browser_window)) {
50594
- $.error("element is a closed browser window or " +
50595
- "not a window element at all");
50596
+ if (!scrivito.cmsWindow.isLivingWindow(browserWindow)) {
50597
+ $.error('element is a closed browser window or not a window element at all');
50596
50598
  }
50597
50599
 
50598
- var instance = find_instance(browser_window);
50600
+ var instance = findInstance(browserWindow);
50599
50601
 
50600
50602
  if (!instance) {
50601
- instance = create_instance(browser_window);
50602
- store_instance(instance);
50603
+ instance = createInstance(browserWindow);
50604
+ storeInstance(instance);
50603
50605
  }
50604
50606
 
50605
50607
  return instance;
50606
50608
  },
50607
50609
 
50608
- is_living_window: function(maybe_window) {
50609
- if (!$.isWindow(maybe_window)) {
50610
+ isLivingWindow: function isLivingWindow(maybeWindow) {
50611
+ if (!$.isWindow(maybeWindow)) {
50610
50612
  return false;
50611
50613
  }
50612
50614
 
50613
50615
  // IE frees iframe resources once removed from the DOM
50614
50616
  // this way you can still test if the window is closed
50615
- if (maybe_window.parent === maybe_window.self) {
50616
- return maybe_window.self === top;
50617
+ if (maybeWindow.parent === maybeWindow.self) {
50618
+ return maybeWindow.self === top;
50617
50619
  }
50618
- return !maybe_window.closed;
50620
+ return !maybeWindow.closed;
50619
50621
  },
50620
50622
 
50621
50623
  // For test purpose only.
50622
- instances: function() {
50623
- return instances;
50624
+ instances: function instances() {
50625
+ return _instances;
50624
50626
  }
50625
50627
  };
50626
50628
 
50627
- var instances = [];
50628
-
50629
- var create_instance = function(browser_window) {
50629
+ var _instances = [];
50630
50630
 
50631
+ function createInstance(_browserWindow) {
50631
50632
  // PUBLIC
50632
50633
  var that = {
50633
- document: function() {
50634
- return scrivito.cms_element.from_dom_element($(browser_window.document));
50634
+ document: function document() {
50635
+ return scrivito.cms_element.from_dom_element($(_browserWindow.document));
50635
50636
  },
50636
50637
 
50637
- on: function(event, callback) {
50638
- if (event !== "document") { $.error("invalid event name: " + event); }
50639
- document_callbacks.push(callback);
50638
+ on: function on(event, callback) {
50639
+ if (event !== 'document') {
50640
+ $.error('invalid event name: ' + event);
50641
+ }
50642
+ documentCallbacks.push(callback);
50640
50643
  },
50641
50644
 
50642
- notify_new_document: function(document) {
50643
- _.each(document_callbacks, function(callback) {
50644
- callback(document);
50645
+ notifyNewDocument: function notifyNewDocument(document) {
50646
+ _.each(documentCallbacks, function (callback) {
50647
+ return callback(document);
50645
50648
  });
50646
50649
  },
50647
50650
 
50648
- browser_window: function() {
50649
- return browser_window;
50651
+ browserWindow: function browserWindow() {
50652
+ return _browserWindow;
50650
50653
  },
50651
50654
 
50652
- reload: function() {
50653
- return withSavingOverlay(scrivito.reload(browser_window));
50655
+ reload: function reload() {
50656
+ return withSavingOverlay(scrivito.reload(_browserWindow));
50654
50657
  },
50655
50658
 
50656
- redirect_to: function(location) {
50657
- return withSavingOverlay(scrivito.redirect_to(location, browser_window));
50659
+ redirectTo: function redirectTo(location) {
50660
+ return withSavingOverlay(scrivito.redirect_to(location, _browserWindow));
50658
50661
  },
50659
50662
 
50660
- use_fragment_of: function(other_cms_window) {
50661
- if (that === other_cms_window) { return; }
50663
+ useFragmentOf: function useFragmentOf(otherCmsWindow) {
50664
+ if (that === otherCmsWindow) {
50665
+ return;
50666
+ }
50662
50667
 
50663
- var ui_hash = other_cms_window.browser_window().location.hash;
50664
- if (ui_hash) {
50665
- var src_uri = new URI(that.iframe().src);
50666
- src_uri.fragment(ui_hash);
50667
- that.iframe().src = src_uri.href();
50668
+ var uiHash = otherCmsWindow.browserWindow().location.hash;
50669
+ if (uiHash) {
50670
+ var srcUri = new URI(that.iframe().src);
50671
+ srcUri.fragment(uiHash);
50672
+ that.iframe().src = srcUri.href();
50668
50673
  }
50669
50674
  },
50670
50675
 
50671
- is_frame: function() {
50672
- return browser_window.parent !== browser_window;
50676
+ isFrame: function isFrame() {
50677
+ return _browserWindow.parent !== _browserWindow;
50673
50678
  },
50674
50679
 
50675
- iframe: _.once(function() {
50676
- return _.find($(browser_window.parent.document).find('iframe'), function(iframe) {
50680
+ iframe: _.once(function () {
50681
+ return _.find($(_browserWindow.parent.document).find('iframe'), function (iframe) {
50677
50682
  // Remove this try-catch after non-iframe mode has been disabled.
50678
50683
  try {
50679
- return $(iframe).contents()[0].defaultView === browser_window;
50684
+ return $(iframe).contents()[0].defaultView === _browserWindow;
50680
50685
  } catch (e) {
50681
50686
  // Ignore cross-origin security errors.
50682
50687
  }
50683
50688
  });
50684
- })
50685
- };
50689
+ }),
50686
50690
 
50687
- // PRIVATE
50688
- var document_callbacks = [];
50691
+ fragment: function fragment() {
50692
+ return _browserWindow.location.hash;
50693
+ },
50689
50694
 
50690
- var withSavingOverlay = function(promise) {
50691
- promise = scrivito.withSavingOverlay(promise);
50692
- var my_frame = that.iframe();
50693
- if (my_frame) {
50694
- $(my_frame).one('load', function() { promise.resolve(); });
50695
+ queryString: function queryString() {
50696
+ return _browserWindow.location.search;
50695
50697
  }
50696
- return promise;
50697
50698
  };
50698
50699
 
50700
+ // PRIVATE
50701
+ var documentCallbacks = [];
50702
+
50703
+ function withSavingOverlay(promise) {
50704
+ var newPromise = scrivito.withSavingOverlay(promise);
50705
+ var myFrame = that.iframe();
50706
+ if (myFrame) {
50707
+ $(myFrame).one('load', function () {
50708
+ return newPromise.resolve();
50709
+ });
50710
+ }
50711
+ return newPromise;
50712
+ }
50713
+
50699
50714
  return that;
50700
- };
50715
+ }
50701
50716
 
50702
- var cleanup_instances = function() {
50717
+ function cleanupInstances() {
50703
50718
  // remove closed windows to allow the garbage collector to reap them
50704
- instances = _.reject(instances, function(instance) {
50705
- var win = instance.browser_window();
50719
+ _instances = _.reject(_instances, function (instance) {
50720
+ var win = instance.browserWindow();
50706
50721
  var closed = true;
50707
50722
 
50708
50723
  if (win) {
50709
50724
  try {
50710
- closed = !scrivito.cms_window.is_living_window(win);
50711
- } catch(e) {
50725
+ closed = !scrivito.cmsWindow.isLivingWindow(win);
50726
+ } catch (e) {
50712
50727
  // some browser prevent us from accessing closed windows
50713
50728
  // by throwing an error
50714
50729
  }
@@ -50716,21 +50731,22 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
50716
50731
 
50717
50732
  return closed;
50718
50733
  });
50719
- };
50734
+ }
50720
50735
 
50721
- var find_instance = function(browser_window) {
50722
- cleanup_instances();
50736
+ function findInstance(browserWindow) {
50737
+ cleanupInstances();
50723
50738
 
50724
- return _.detect(instances, function(instance) {
50725
- return instance.browser_window() === browser_window;
50739
+ return _.detect(_instances, function (instance) {
50740
+ return instance.browserWindow() === browserWindow;
50726
50741
  });
50727
- };
50742
+ }
50728
50743
 
50729
- var store_instance = function(instance) {
50730
- instances.push(instance);
50731
- };
50744
+ function storeInstance(instance) {
50745
+ _instances.push(instance);
50746
+ }
50732
50747
 
50733
- }());
50748
+ scrivito.cmsWindow = cmsWindow;
50749
+ })();
50734
50750
  (function() {
50735
50751
  _.extend(scrivito, {
50736
50752
  date_field_element: {
@@ -52841,7 +52857,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
52841
52857
 
52842
52858
  return scrivito.withSavingOverlay(addSubpage);
52843
52859
  }).then(function (obj) {
52844
- return scrivito.application_window.redirect_to(scrivito.path_for_id(obj.id));
52860
+ return scrivito.application_window.redirectTo(scrivito.path_for_id(obj.id));
52845
52861
  });
52846
52862
  }
52847
52863
  });
@@ -52970,7 +52986,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
52970
52986
  }
52971
52987
 
52972
52988
  function redirectToObj(objId) {
52973
- return scrivito.application_window.redirect_to(scrivito.path_for_id(objId));
52989
+ return scrivito.application_window.redirectTo(scrivito.path_for_id(objId));
52974
52990
  }
52975
52991
  })();
52976
52992
  (function() {
@@ -53146,7 +53162,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
53146
53162
  }
53147
53163
 
53148
53164
  function redirectToPage(page) {
53149
- return scrivito.application_window.redirect_to(scrivito.path_for_id(page.id));
53165
+ return scrivito.application_window.redirectTo(scrivito.path_for_id(page.id));
53150
53166
  }
53151
53167
  })();
53152
53168
  (function() {
@@ -53388,7 +53404,7 @@ function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr
53388
53404
  }
53389
53405
 
53390
53406
  function redirectToObj(objId) {
53391
- return scrivito.application_window.redirect_to(scrivito.path_for_id(objId));
53407
+ return scrivito.application_window.redirectTo(scrivito.path_for_id(objId));
53392
53408
  }
53393
53409
  })();
53394
53410
  'use strict';
@@ -53499,42 +53515,48 @@ function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr
53499
53515
  }
53500
53516
  }
53501
53517
  })();
53502
- (function() {
53503
- _.extend(scrivito, {
53504
- obj_details_command: function(obj) {
53505
- return scrivito.createCommand({
53506
- id: 'scrivito.sdk.obj_details',
53507
- title: function() {
53508
- if (scrivito.editingContext.isEditingMode()) {
53509
- return scrivito.t('commands.obj_details.title_edit');
53510
- } else {
53511
- return scrivito.t('commands.obj_details.title_view');
53512
- }
53513
- },
53514
- icon: '',
53518
+ 'use strict';
53515
53519
 
53516
- present: function() {
53517
- return obj.has_details_view();
53518
- },
53520
+ (function () {
53521
+ function objDetailsCommand(obj) {
53522
+ return scrivito.createCommand({
53523
+ id: 'scrivito.sdk.obj_details',
53524
+ title: function title() {
53525
+ if (scrivito.editingContext.isEditingMode()) {
53526
+ return scrivito.t('commands.obj_details.title_edit');
53527
+ }
53519
53528
 
53520
- execute: function() {
53521
- var title_locale;
53522
- if (scrivito.editingContext.isEditingMode()) {
53523
- title_locale = 'commands.obj_details.dialog.title_edit';
53524
- } else {
53525
- title_locale = 'commands.obj_details.dialog.title_view';
53526
- }
53527
- return scrivito.write_monitor.track_changes(function() {
53528
- return scrivito.details_dialog.open(obj.details_src(),
53529
- scrivito.t(title_locale, obj.description_for_editor()));
53530
- }, function() {
53531
- scrivito.application_window.redirect_to(scrivito.path_for_id(obj.id()));
53532
- });
53529
+ return scrivito.t('commands.obj_details.title_view');
53530
+ },
53531
+ icon: '',
53532
+
53533
+ present: function present() {
53534
+ return obj.has_details_view();
53535
+ },
53536
+
53537
+ execute: function execute() {
53538
+ var titleLocale = undefined;
53539
+ if (scrivito.editingContext.isEditingMode()) {
53540
+ titleLocale = 'commands.obj_details.dialog.title_edit';
53541
+ } else {
53542
+ titleLocale = 'commands.obj_details.dialog.title_view';
53533
53543
  }
53534
- });
53535
- }
53536
- });
53537
- }());
53544
+ return scrivito.write_monitor.track_changes(function () {
53545
+ return scrivito.details_dialog.open(obj.details_src(), scrivito.t(titleLocale, obj.description_for_editor()));
53546
+ }, function () {
53547
+ var path = scrivito.path_for_id(obj.id());
53548
+ var queryString = scrivito.application_window.queryString();
53549
+ var fragment = scrivito.application_window.fragment();
53550
+ var url = '' + path + queryString + fragment;
53551
+
53552
+ scrivito.application_window.redirectTo(url);
53553
+ });
53554
+ }
53555
+ });
53556
+ }
53557
+
53558
+ scrivito.obj_details_command = objDetailsCommand;
53559
+ })();
53538
53560
  'use strict';
53539
53561
 
53540
53562
  (function () {
@@ -53756,7 +53778,7 @@ function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr
53756
53778
  }).then(function() {
53757
53779
  return scrivito.withSavingOverlay(obj.revert()).then(function() {
53758
53780
  scrivito.application_window.reload();
53759
- scrivito.cms_window.from($('iframe[name=scrivito_details_dialog]')).reload();
53781
+ scrivito.cmsWindow.from($('iframe[name=scrivito_details_dialog]')).reload();
53760
53782
  });
53761
53783
  });
53762
53784
  }
@@ -54522,12 +54544,16 @@ function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr
54522
54544
  menu.appendTo($('#scrivito_editing'));
54523
54545
  menu.update_position(); // Bugfix IE: can't set offset before append.
54524
54546
 
54525
- var viewport = $(scrivito.application_window.browser_window());
54547
+ var $iframeWrapper = $('.iframe_wrapper');
54548
+ var absElementLeft = domElement.offset().left - $iframeWrapper.scrollLeft();
54549
+ var visibleSpaceRight = $iframeWrapper.width() - absElementLeft;
54526
54550
 
54527
- if (domElement.offset().left + box.width() > viewport.scrollLeft() + viewport.width()) {
54551
+ if (visibleSpaceRight < box.width()) {
54528
54552
  box.addClass('scrivito_left');
54529
54553
  }
54530
54554
 
54555
+ var viewport = $(scrivito.application_window.browserWindow());
54556
+
54531
54557
  var scrivitoMenuBoxTop = 25; // value of css class ".scrivito_menu_box.top"
54532
54558
  var boxHeight = box.height() + scrivitoMenuBoxTop;
54533
54559
  var visibleSpaceAbove = domElement.offset().top - viewport.scrollTop();
@@ -59314,13 +59340,13 @@ function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr
59314
59340
  (function() {
59315
59341
  $(function() {
59316
59342
  var iframe = $('iframe[name=scrivito_application]');
59317
- scrivito.application_window = scrivito.cms_window.from(iframe);
59343
+ scrivito.application_window = scrivito.cmsWindow.from(iframe);
59318
59344
 
59319
59345
  // Fallback behavior in case that application window renders a page with no SDK, e.g. an error
59320
59346
  // or a static page.
59321
59347
  iframe.on('load', function() {
59322
59348
  var application_document = scrivito.application_document();
59323
- var browser_window = scrivito.application_window.browser_window();
59349
+ var browser_window = scrivito.application_window.browserWindow();
59324
59350
 
59325
59351
  var has_config = !!application_document.page_config();
59326
59352
  var has_sdk = !!browser_window.scrivito;