BusinessMetadataDetailLayoutView.js 1.2 KB

12345678910111213141516171819202122232425262728
  1. define([ "require", "backbone", "hbs!tmpl/business_metadata/BusinessMetadataDetailLayoutView_tmpl", "utils/Utils" ], function(require, Backbone, BusinessMetadataDetailLayoutViewTmpl, Utils) {
  2. "use strict";
  3. var BusinessMetadataDetailLayoutView = Backbone.Marionette.LayoutView.extend({
  4. template: BusinessMetadataDetailLayoutViewTmpl,
  5. regions: {},
  6. ui: {
  7. title: '[data-id="title"]',
  8. description: '[data-id="description"]'
  9. },
  10. events: function() {
  11. var events = {};
  12. return events;
  13. },
  14. initialize: function(options) {
  15. _.extend(this, _.pick(options, "model")), $("body").addClass("detail-page");
  16. },
  17. onRender: function() {
  18. this.renderDetail();
  19. },
  20. renderDetail: function() {
  21. this.ui.title.html("<span>" + this.model.get("name") + "</span>"), this.model.get("description") && this.ui.description.text(this.model.get("description"));
  22. },
  23. onDestroy: function() {
  24. Utils.getUrlState.isBSDetail() || $("body").removeClass("detail-page");
  25. }
  26. });
  27. return BusinessMetadataDetailLayoutView;
  28. });