2013-03-02 01:45:25 +08:00
|
|
|
/**
|
|
|
|
A view to display a site setting with edit controls
|
|
|
|
|
|
|
|
@class SiteSettingView
|
|
|
|
@extends Discourse.View
|
|
|
|
@namespace Discourse
|
|
|
|
@module Discourse
|
|
|
|
**/
|
2014-02-17 01:53:18 +08:00
|
|
|
Discourse.SiteSettingView = Discourse.View.extend(Discourse.ScrollTop, {
|
2013-03-02 01:45:25 +08:00
|
|
|
classNameBindings: [':row', ':setting', 'content.overridden'],
|
|
|
|
|
|
|
|
templateName: function() {
|
2014-03-30 13:32:33 +08:00
|
|
|
// If we're editing a boolean, show a checkbox
|
2013-06-11 23:39:55 +08:00
|
|
|
if (this.get('content.type') === 'bool') return 'admin/templates/site_settings/setting_bool';
|
|
|
|
|
|
|
|
// If we're editing an enum field, show a dropdown
|
|
|
|
if (this.get('content.type') === 'enum' ) return 'admin/templates/site_settings/setting_enum';
|
2013-03-02 01:45:25 +08:00
|
|
|
|
2014-03-30 13:32:33 +08:00
|
|
|
// If we're editing a list, show a list editor
|
|
|
|
if (this.get('content.type') === 'list' ) return 'admin/templates/site_settings/setting_list';
|
|
|
|
|
2013-03-02 01:45:25 +08:00
|
|
|
// Default to string editor
|
|
|
|
return 'admin/templates/site_settings/setting_string';
|
|
|
|
|
|
|
|
}.property('content.type')
|
|
|
|
|
|
|
|
});
|