mirror of
https://github.com/flarum/core.git
synced 2025-10-12 15:34:26 +02:00
Rename JS sub-components so that descriptors are before the noun, not after
To be consistent with the naming in PHP world. e.g. ReplyComposer instead of ComposerReply
This commit is contained in:
54
js/forum/src/components/edit-composer.js
Normal file
54
js/forum/src/components/edit-composer.js
Normal file
@@ -0,0 +1,54 @@
|
||||
import ItemList from 'flarum/utils/item-list';
|
||||
import ComposerBody from 'flarum/components/composer-body';
|
||||
import Alert from 'flarum/components/alert';
|
||||
import ActionButton from 'flarum/components/action-button';
|
||||
|
||||
/**
|
||||
The composer body for editing a post. Sets the initial content to the
|
||||
content of the post that is being edited, and adds a title control to
|
||||
indicate which post is being edited.
|
||||
*/
|
||||
export default class EditComposer extends ComposerBody {
|
||||
constructor(props) {
|
||||
props.submitLabel = props.submitLabel || 'Save Changes';
|
||||
props.confirmExit = props.confirmExit || 'You have not saved your changes. Do you wish to discard them?';
|
||||
props.originalContent = props.originalContent || props.post.content();
|
||||
props.user = props.user || props.post.user();
|
||||
|
||||
super(props);
|
||||
}
|
||||
|
||||
headerItems() {
|
||||
var items = new ItemList();
|
||||
var post = this.props.post;
|
||||
|
||||
items.add('title', m('h3', [
|
||||
'Editing ',
|
||||
m('a', {href: app.route.discussion(post.discussion(), post.number()), config: m.route}, 'Post #'+post.number()),
|
||||
' in ', post.discussion().title()
|
||||
]));
|
||||
|
||||
return items;
|
||||
}
|
||||
|
||||
data() {
|
||||
return {
|
||||
content: this.content()
|
||||
};
|
||||
}
|
||||
|
||||
onsubmit() {
|
||||
var post = this.props.post;
|
||||
|
||||
this.loading(true);
|
||||
m.redraw();
|
||||
|
||||
post.save(this.data()).then(post => {
|
||||
app.composer.hide();
|
||||
m.redraw();
|
||||
}, response => {
|
||||
this.loading(false);
|
||||
m.redraw();
|
||||
});
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user