Begin JavaScript cleanup

This commit is contained in:
Toby Zerner 2015-08-26 16:56:24 +09:30
parent 156462d33e
commit 941479edb8
5 changed files with 55 additions and 11 deletions

View File

@ -1,3 +1,12 @@
/*
* This file is part of Flarum.
*
* (c) Toby Zerner <toby.zerner@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
import Modal from 'flarum/components/Modal';
export default class AddExtensionModal extends Modal {
@ -14,7 +23,7 @@ export default class AddExtensionModal extends Modal {
<div className="Modal-body">
<p>One day in the not-too-distant future, this dialog will allow you to add an extension to your forum with ease. We're building an ecosystem as we speak!</p>
<p>In the meantime, if you manage to get your hands on a new extension, simply drop it in your forum's <code>extensions</code> directory.</p>
<p>If you're a developer, you can <a href="">read the docs</a> and have a go at building your own.</p>
<p>If you're a developer, you can <a href="http://flarum.org/docs/extend">read the docs</a> and have a go at building your own.</p>
</div>
);
}

View File

@ -1,3 +1,12 @@
/*
* This file is part of Flarum.
*
* (c) Toby Zerner <toby.zerner@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
import LinkButton from 'flarum/components/LinkButton';
export default class AdminLinkButton extends LinkButton {

View File

@ -1,3 +1,12 @@
/*
* This file is part of Flarum.
*
* (c) Toby Zerner <toby.zerner@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
import Component from 'flarum/Component';
import AdminLinkButton from 'flarum/components/AdminLinkButton';
import SelectDropdown from 'flarum/components/SelectDropdown';
@ -6,13 +15,20 @@ import ItemList from 'flarum/utils/ItemList';
export default class AdminNav extends Component {
view() {
return SelectDropdown.component({
className: 'AdminNav App-titleControl',
buttonClassName: 'Button',
children: this.items().toArray()
});
return (
<SelectDropdown
className="AdminNav App-titleControl"
buttonClassName="Button"
children={this.items().toArray()}
/>
);
}
/**
* Build an item list of links to show in the admin navigation.
*
* @return {ItemList}
*/
items() {
const items = new ItemList();

View File

@ -1,3 +1,12 @@
/*
* This file is part of Flarum.
*
* (c) Toby Zerner <toby.zerner@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
/**
* The `Component` class defines a user interface 'building block'. A component
* can generate a virtual DOM to be rendered on each redraw.

View File

@ -35,11 +35,12 @@ export default class Alert extends Component {
const dismissControl = [];
if (dismissible || dismissible === undefined) {
dismissControl.push(Button.component({
icon: 'times',
className: 'Button Button--link Button--icon Alert-dismiss',
onclick: ondismiss
}));
dismissControl.push(
<Button
icon="times"
className="Button Button--link Button--icon Alert-dismiss"
onclick={ondismiss}/>
);
}
return (