From 5f1db93e3de0dec9d806c326dbdc31aa9321ea31 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 ++++++++++++++++++ framework/core/js/lib/Model.js | 14 +- framework/core/js/lib/components/Button.js | 10 +- framework/core/js/lib/models/Forum.js | 6 +- framework/core/less/admin/BasicsPage.less | 33 +++++ framework/core/less/forum/Composer.less | 5 - framework/core/less/lib/Button.less | 16 ++ .../core/src/Api/Actions/Forum/ShowAction.php | 11 +- .../src/Api/Actions/Forum/UpdateAction.php | 53 +++++++ framework/core/src/Api/ApiServiceProvider.php | 7 + .../src/Api/Serializers/ForumSerializer.php | 21 ++- framework/core/src/Locale/LocaleManager.php | 12 ++ .../core/src/Locale/LocaleServiceProvider.php | 5 +- 13 files changed, 313 insertions(+), 17 deletions(-) create mode 100644 framework/core/js/admin/src/components/BasicsPage.js create mode 100644 framework/core/less/admin/BasicsPage.less create mode 100644 framework/core/src/Api/Actions/Forum/UpdateAction.php diff --git a/framework/core/js/admin/src/components/BasicsPage.js b/framework/core/js/admin/src/components/BasicsPage.js new file mode 100644 index 000000000..a3d8f2f69 --- /dev/null +++ b/framework/core/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. +
, +