MigrationView.js 1.4 KB

1234567891011121314151617181920212223242526272829303132
  1. define([ "require", "backbone", "hbs!tmpl/migration/MigrationView_tmpl" ], function(require, Backbone, MigrationViewTmpl) {
  2. "use strict";
  3. var ProfileLayoutView = Backbone.Marionette.LayoutView.extend({
  4. _viewName: "MigrationView",
  5. template: MigrationViewTmpl,
  6. regions: {
  7. RStatisticsView: "#r_statisticsView"
  8. },
  9. ui: {},
  10. events: function() {},
  11. initialize: function(options) {
  12. this.apiBaseUrl = this.getBaseUrl(window.location.pathname);
  13. },
  14. bindEvents: function() {},
  15. getBaseUrl: function(url) {
  16. var path = url.replace(/\/[\w-]+.(jsp|html)|\/+$/gi, ""), splitPath = path.split("/");
  17. return splitPath && "n" === splitPath[splitPath.length - 1] ? (splitPath.pop(),
  18. splitPath.join("/")) : path;
  19. },
  20. onRender: function() {
  21. var that = this;
  22. require([ "views/site/Statistics", "collection/VTagList", "utils/UrlLinks" ], function(Statistics, VTagList, UrlLinks) {
  23. that.metricCollection = new VTagList(), that.metricCollection.url = UrlLinks.metricsApiUrl(),
  24. that.metricCollection.modelAttrName = "data", that.RStatisticsView.show(new Statistics({
  25. metricCollection: that.metricCollection,
  26. isMigrationView: !0
  27. }));
  28. });
  29. }
  30. });
  31. return ProfileLayoutView;
  32. });