dataset-stats.js 848 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. define(
  2. function( require ) {
  3. var Backbone = require( "backbone" ),
  4. _ = require( "underscore" ),
  5. fui = require( "app/fui" ),
  6. datasetStatsViewTpl = require( "plugins/text!app/templates/dataset-stats.tpl" );
  7. var DatasetStatsView = Backbone.Marionette.ItemView.extend( {
  8. initialize: function() {
  9. _.bindAll( this, "onShowTab" );
  10. fui.vent.on( "shown.bs.tab", this.onShowTab );
  11. },
  12. template: _.template( datasetStatsViewTpl ),
  13. ui: {
  14. },
  15. el: "#statistics",
  16. modelEvents: {
  17. 'change': "modelChanged"
  18. },
  19. modelChanged: function() {
  20. this.render();
  21. },
  22. onShowTab: function( tab ) {
  23. if (tab.attr("href") === "#info") {
  24. this.model.refresh();
  25. }
  26. }
  27. });
  28. return DatasetStatsView;
  29. }
  30. );