API Docs for: 1.0.0
Show:

File: Resources/public/js/models/ez-sectionmodel.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-sectionmodel', function (Y) {
  6. "use strict";
  7. /**
  8. * Provides the Section model class
  9. *
  10. * @module ez-sectionmodel
  11. */
  12.  
  13. Y.namespace('eZ');
  14.  
  15. /**
  16. * Section model
  17. *
  18. * @namespace eZ
  19. * @class Section
  20. * @constructor
  21. * @extends eZ.RestModel
  22. */
  23. Y.eZ.Section = Y.Base.create('sectionModel', Y.eZ.RestModel, [], {
  24. /**
  25. * sync implementation that relies on the JS REST client.
  26. * It only supports the 'read' action. The callback is
  27. * directly passed to the corresponding ContentService methods.
  28. *
  29. * @method sync
  30. * @param {String} action the action, currently only 'read' is supported
  31. * @param {Object} options the options for the sync.
  32. * @param {Object} options.api (required) the JS REST client instance
  33. * @param {Function} callback a callback executed when the operation is finished
  34. */
  35. sync: function (action, options, callback) {
  36. var api = options.api;
  37.  
  38. if ( action === 'read' ) {
  39. api.getContentService().loadSection(
  40. this.get('id'), callback
  41. );
  42. } else {
  43. callback("Only read operation is supported at the moment");
  44. }
  45. },
  46. }, {
  47. REST_STRUCT_ROOT: "Section",
  48. ATTRS_REST_MAP: [
  49. 'identifier', 'name', 'sectionId', {'_href': 'id'}
  50. ],
  51. ATTRS: {
  52. /**
  53. * The section's identifier
  54. *
  55. * @attribute identifier
  56. * @default ''
  57. * @type string
  58. */
  59. identifier: {
  60. value: ''
  61. },
  62.  
  63. /**
  64. * The section's name
  65. *
  66. * @attribute name
  67. * @default ''
  68. * @type string
  69. */
  70. name: {
  71. value: ''
  72. },
  73.  
  74. /**
  75. * The section's id
  76. *
  77. * @attribute id
  78. * @default null
  79. * @type number
  80. */
  81. sectionId: {
  82. value: null
  83. },
  84. }
  85. });
  86. });
  87.