mirror of
https://github.com/discourse/discourse.git
synced 2026-09-05 04:40:41 -05:00
FEATURE: Can override any translation via an admin interface
This commit is contained in:
@@ -1,14 +1,29 @@
|
||||
export default Ember.Controller.extend({
|
||||
saved: false,
|
||||
import { popupAjaxError } from 'discourse/lib/ajax-error';
|
||||
import { bufferedProperty } from 'discourse/mixins/buffered-content';
|
||||
|
||||
saveDisabled: function() {
|
||||
return ((!this.get('allow_blank')) && Ember.isEmpty(this.get('model.value')));
|
||||
}.property('model.iSaving', 'model.value'),
|
||||
export default Ember.Controller.extend(bufferedProperty('siteText'), {
|
||||
saved: false,
|
||||
|
||||
actions: {
|
||||
saveChanges() {
|
||||
const model = this.get('model');
|
||||
model.save(model.getProperties('value')).then(() => this.set('saved', true));
|
||||
const buffered = this.get('buffered');
|
||||
this.get('siteText').save(buffered.getProperties('value')).then(() => {
|
||||
this.commitBuffer();
|
||||
this.set('saved', true);
|
||||
}).catch(popupAjaxError);
|
||||
},
|
||||
|
||||
revertChanges() {
|
||||
this.set('saved', false);
|
||||
bootbox.confirm(I18n.t('admin.site_text.revert_confirm'), result => {
|
||||
if (result) {
|
||||
this.get('siteText').revert().then(props => {
|
||||
const buffered = this.get('buffered');
|
||||
buffered.setProperties(props);
|
||||
this.commitBuffer();
|
||||
}).catch(popupAjaxError);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
import { default as computed } from 'ember-addons/ember-computed-decorators';
|
||||
|
||||
export default Ember.Controller.extend({
|
||||
_q: null,
|
||||
searching: false,
|
||||
siteTexts: null,
|
||||
preferred: false,
|
||||
|
||||
queryParams: ['q'],
|
||||
|
||||
@computed
|
||||
q: {
|
||||
set(value) {
|
||||
if (Ember.isEmpty(value)) { value = null; }
|
||||
this._q = value;
|
||||
return value;
|
||||
},
|
||||
get() {
|
||||
return this._q;
|
||||
}
|
||||
},
|
||||
|
||||
_performSearch() {
|
||||
const q = this.get('q');
|
||||
this.store.find('site-text', { q }).then(results => {
|
||||
this.set('siteTexts', results);
|
||||
}).finally(() => this.set('searching', false));
|
||||
},
|
||||
|
||||
actions: {
|
||||
edit(siteText) {
|
||||
this.transitionToRoute('adminSiteText.edit', siteText.get('id'));
|
||||
},
|
||||
|
||||
search() {
|
||||
this.set('searching', true);
|
||||
Ember.run.debounce(this, this._performSearch, 400);
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -1 +0,0 @@
|
||||
export default Ember.ArrayController.extend();
|
||||
Reference in New Issue
Block a user