Start of labs

issue #4409
This commit is contained in:
Paul Adam Davis 2014-12-14 17:56:04 +00:00 committed by Hannah Wolfe
parent b00279885f
commit cc6f698053
4 changed files with 74 additions and 2 deletions

View File

@ -1,7 +1,48 @@
var LabsController = Ember.Controller.extend(Ember.Evented, {
var LabsController = Ember.ObjectController.extend(Ember.Evented, {
uploadButtonText: 'Import',
importErrors: '',
saveLabs: function (optionName, optionValue) {
var labsConfig = this.get('labs'),
labsJSON = (this.get('labs')) ? JSON.parse(labsConfig) : {};
// Set new value in the JSON object
labsJSON[optionName] = optionValue;
this.set('labs', JSON.stringify(labsJSON));
this.get('model').save().catch(function (errors) {
self.showErrors(errors);
self.get('model').rollback();
});
},
useTagsUI: Ember.computed('tagsUI', function (key, value) {
// setter
if (arguments.length > 1) {
this.saveLabs('tagsUI', value);
}
// getter
var labsConfig = (this.get('labs')) ? JSON.parse(this.get('labs')) : false;
return (labsConfig.tagsUI) ? labsConfig.tagsUI : false;
}),
useCodeInjectionUI: Ember.computed('codeInjectionUI', function (key, value) {
// setter
if (arguments.length > 1) {
this.saveLabs('codeInjectionUI', value);
}
// getter
var labsConfig = (this.get('labs')) ? JSON.parse(this.get('labs')) : false;
return (labsConfig.codeInjectionUI) ? labsConfig.codeInjectionUI : false;
}),
actions: {
onUpload: function (file) {
var self = this,

View File

@ -16,7 +16,8 @@ var Setting = DS.Model.extend(NProgressSaveMixin, ValidationEngine, {
activeTheme: DS.attr('string'),
availableThemes: DS.attr(),
ghost_head: DS.attr('string'),
ghost_foot: DS.attr('string')
ghost_foot: DS.attr('string'),
labs: DS.attr('string')
});
export default Setting;

View File

@ -44,4 +44,31 @@
</div>
</fieldset>
</form>
<hr>
<form>
<fieldset>
<div class="form-group for-checkbox">
<label for="labs-tagsUI">Tag Management</label>
<label class="checkbox" for="labs-tagsUI">
{{input id="labs-tagsUI" name="labs[tagsUI]" type="checkbox" checked=useTagsUI}}
<span class="input-toggle-component"></span>
<p>Enable the tag management interface (work in progress)</p>
<p>A settings screen which enables you to add, edit and delete tags</p>
</label>
</div>
<div class="form-group for-checkbox">
<label for="labs-codeInjectionUI">Code Injection</label>
<label class="checkbox" for="labs-codeInjectionUI">
{{input id="labs-codeInjectionUI" name="labs[codeInjectionUI]" type="checkbox" checked=useCodeInjectionUI}}
<span class="input-toggle-component"></span>
<p>Enable the code injection interface (work in progress)</p>
<p>A settings screen which enables you to add code into your theme</p>
</label>
</div>
</fieldset>
</form>
</section>

View File

@ -67,6 +67,9 @@
},
"ghost_foot": {
"defaultValue" : ""
},
"labs": {
"defaultValue": "{}"
}
},
"theme": {