API Docs for: 1.0.0
Show:

File: Resources/public/js/apps/plugins/ez-updatetreeplugin.js

  1. /*
  2. * Copyright (C) eZ Systems AS. All rights reserved.
  3. * For full copyright and license information view LICENSE file distributed with this source code.
  4. */
  5. YUI.add('ez-updatetreeplugin', function (Y) {
  6. "use strict";
  7. /**
  8. * Provides the update tree plugin
  9. *
  10. * @module ez-updatetreeplugin
  11. */
  12. Y.namespace('eZ.Plugin');
  13.  
  14. console.log('[DEPRECRATED] eZ.Plugin.UpdateTree is deprecated');
  15. console.log('[DEPRECRATED] it will be removed from PlatformUI 2.0');
  16. /**
  17. * The update tree plugin for the application. It will update the discoveryBar tree
  18. * after catching an associated event. Events can be send by actions like DELETE/MOVE/COPY/EDIT/CREATE
  19. *
  20. * @namespace eZ.Plugin
  21. * @class UpdateTree
  22. * @constructor
  23. * @extends Plugin.Base
  24. */
  25. Y.eZ.Plugin.UpdateTree = Y.Base.create('updateTreePlugin', Y.Plugin.Base, [], {
  26. initializer: function () {
  27. var app = this.get('host'),
  28. events = [
  29. '*:sentToTrash', '*:restoredLocation', '*:copiedContent',
  30. '*:movedContent', '*:publishedDraft', '*:savedDraft',
  31. '*:deletedContent', '*:swappedLocation', '*:updatedLocationSorting',
  32. ];
  33.  
  34. app.on(events, Y.bind(this._clearTree, this));
  35. },
  36.  
  37. /**
  38. * Clear the tree if it is already loaded
  39. *
  40. * @method _clearTree
  41. * @protected
  42. */
  43. _clearTree: function () {
  44. var discoveryBarView = this.get('host').sideViews.discoveryBar.instance,
  45. tree = discoveryBarView ? discoveryBarView.getAction('tree').get('tree') : null;
  46.  
  47. if (tree) {
  48. tree.clear();
  49. }
  50. },
  51. }, {
  52. NS: 'updateTree',
  53. });
  54.  
  55. Y.eZ.PluginRegistry.registerPlugin(
  56. Y.eZ.Plugin.UpdateTree, ['platformuiApp']
  57. );
  58. });
  59.