From f96cac605759c98c3bf5cd314009bc625caccd0f Mon Sep 17 00:00:00 2001 From: Toby Zerner Date: Wed, 29 Jul 2015 21:00:09 +0930 Subject: [PATCH] Implement basic settings page --- js/admin/src/components/BasicsPage.js | 137 ++++++++++++++++++++++++ js/lib/Model.js | 14 ++- js/lib/components/Button.js | 10 +- js/lib/models/Forum.js | 6 +- less/admin/BasicsPage.less | 33 ++++++ less/forum/Composer.less | 5 - less/lib/Button.less | 16 +++ src/Api/Actions/Forum/ShowAction.php | 11 +- src/Api/Actions/Forum/UpdateAction.php | 53 +++++++++ src/Api/ApiServiceProvider.php | 7 ++ src/Api/Serializers/ForumSerializer.php | 21 +++- src/Locale/LocaleManager.php | 12 +++ src/Locale/LocaleServiceProvider.php | 5 +- 13 files changed, 313 insertions(+), 17 deletions(-) create mode 100644 js/admin/src/components/BasicsPage.js create mode 100644 less/admin/BasicsPage.less create mode 100644 src/Api/Actions/Forum/UpdateAction.php diff --git a/js/admin/src/components/BasicsPage.js b/js/admin/src/components/BasicsPage.js new file mode 100644 index 000000000..a3d8f2f69 --- /dev/null +++ b/js/admin/src/components/BasicsPage.js @@ -0,0 +1,137 @@ +import Component from 'flarum/Component'; +import FieldSet from 'flarum/components/FieldSet'; +import Select from 'flarum/components/Select'; +import Button from 'flarum/components/Button'; + +export default class BasicsPage extends Component { + constructor(...args) { + super(...args); + + this.loading = false; + + this.fields = [ + 'forum_title', + 'forum_description', + 'default_locale', + 'default_route', + 'welcome_title', + 'welcome_message' + ]; + this.values = {}; + + const config = app.forum.attribute('config'); + this.fields.forEach(key => this.values[key] = m.prop(config[key])); + + this.localeOptions = {}; + const locales = app.forum.attribute('availableLocales'); + for (const i in locales) { + this.localeOptions[i] = `${locales[i]} (${i})`; + } + } + + view() { + return ( +
+
+
+ {FieldSet.component({ + label: 'Forum Title', + children: [ + + ] + })} + + {FieldSet.component({ + label: 'Forum Description', + children: [ +
+ Enter a short sentence or two that describes your community. This will appear in the meta tag and show up in search engines. +
, +