Change type in settings

This commit is contained in:
Björn Dahlgren 2014-04-07 01:46:06 +02:00
parent 26a65e5c33
commit 94cfb866d0
3 changed files with 42 additions and 13 deletions

View File

@ -1,7 +1,7 @@
define(function (require) { define(function (require) {
"use strict"; "use strict";
var $ = require('jquery'), var $ = require('jquery'),
_ = require('underscore'), _ = require('underscore'),
Backbone = require('backbone'), Backbone = require('backbone'),
@ -9,10 +9,10 @@ define(function (require) {
FormView = require('marionette-formview'), FormView = require('marionette-formview'),
Settings = require('app/models/settings'), Settings = require('app/models/settings'),
tpl = require('text!tpl/forms/settings.html'); tpl = require('text!tpl/forms/settings.html');
return FormView.extend({ return FormView.extend({
template: _.template(tpl), template: _.template(tpl),
fields: { fields: {
path: { path: {
el: ".path", el: ".path",
@ -20,9 +20,13 @@ define(function (require) {
validations: { validations: {
email: "Please enter a valid path." email: "Please enter a valid path."
} }
} },
type: {
el: ".type",
required: "Please choose a valid type."
},
}, },
initialize: function () { initialize: function () {
var self = this; var self = this;
new Settings().fetch({success: function (model, response, options) { new Settings().fetch({success: function (model, response, options) {
@ -31,5 +35,5 @@ define(function (require) {
}}); }});
} }
}); });
}); });

View File

@ -1,16 +1,17 @@
define(function (require) { define(function (require) {
"use strict"; "use strict";
var $ = require('jquery'), var $ = require('jquery'),
_ = require('underscore'), _ = require('underscore'),
Backbone = require('backbone'); Backbone = require('backbone');
return Backbone.Model.extend({ return Backbone.Model.extend({
defaults: { defaults: {
path: '', path: '',
type: 'windows',
}, },
urlRoot : '/api/settings' urlRoot : '/api/settings'
}); });
}); });

View File

@ -5,4 +5,28 @@
<input type="text" class="form-control path" id="path" data-field="path" placeholder="Path to ArmA3"> <input type="text" class="form-control path" id="path" data-field="path" placeholder="Path to ArmA3">
</div> </div>
</div> </div>
<div class="form-group">
<label for="type" class="col-sm-2 control-label">Type</label>
<div class="col-sm-10">
<div class="radio">
<label>
<input type="radio" name="type" data-field="type" id="type-linux" value="linux">
Linux
</label>
</div>
<div class="radio">
<label>
<input type="radio" name="type" data-field="type" id="type-windows" value="windows">
Windows
</label>
</div>
<div class="radio">
<label>
<input type="radio" name="type" data-field="type" id="type-wine" value="wine">
Wine
</label>
</div>
</div>
</div>
</form> </form>