arma-server-web-admin/public/js/app/views/missions/index.js

65 lines
1.6 KiB
JavaScript
Raw Normal View History

2014-07-26 09:01:53 +00:00
define(function (require) {
"use strict";
var $ = require('jquery'),
_ = require('underscore'),
Backbone = require('backbone'),
Marionette = require('marionette'),
2015-08-15 15:12:50 +00:00
UploadView = require('app/views/missions/upload'),
WorkshopView = require('app/views/missions/workshop'),
2014-07-26 09:01:53 +00:00
ListView = require('app/views/missions/list'),
tpl = require('text!tpl/missions/index.html');
return Marionette.LayoutView.extend({
2014-07-26 09:01:53 +00:00
template: _.template(tpl),
2019-06-23 18:32:04 +00:00
templateHelpers: function() {
return {
filterValue: this.filterValue
}
},
2014-07-26 09:01:53 +00:00
regions: {
2015-08-15 15:12:50 +00:00
uploadView: "#upload",
workshopView: "#workshop",
2014-07-26 09:01:53 +00:00
listView: "#list",
},
2018-08-18 11:04:33 +00:00
events: {
"click #refresh": "refresh",
2019-06-23 18:32:04 +00:00
"keyup #filterMissions": "updateFilter",
},
initialize: function () {
this.filterValue = ''
},
updateFilter: function (event) {
this.filterValue = event.target.value;
this.listView.currentView.filterValue = this.filterValue;
this.listView.currentView.render();
2018-08-18 11:04:33 +00:00
},
2014-07-26 09:01:53 +00:00
onRender: function() {
2018-08-18 11:04:33 +00:00
this.uploadView.show(new UploadView());
this.workshopView.show(new WorkshopView());
2019-06-23 18:32:04 +00:00
this.listView.show(new ListView({collection: this.options.missions, filterValue: this.filterValue}));
2014-07-26 09:01:53 +00:00
},
2018-08-18 11:04:33 +00:00
refresh: function (event) {
event.preventDefault();
$.ajax({
url: "/api/missions/refresh",
type: 'POST',
success: function (resp) {
},
error: function (resp) {
},
});
},
2014-07-26 09:01:53 +00:00
});
});