1
0
mirror of https://github.com/flarum/core.git synced 2025-10-11 06:54:26 +02:00

Turn "Rename Discussion" dialog into a modal, closes #616 (#1083)

* Changed "Rename Discussion" prompt into a modal.
* Added DiscussionRenameModal component (Modal)
* Changed DiscussionControls.renameAction to use the modal (I may have removed the ability to return a promise)

* Added punycode.js back to js/forum dist

* Fixed some formatting, removed some unnecessary variables
This commit is contained in:
David Sevilla Martín
2017-02-03 14:56:28 -05:00
committed by Franz Liedke
parent b7d6ba4893
commit 26d07699e9
3 changed files with 188 additions and 38 deletions

View File

@@ -3,6 +3,7 @@ import ReplyComposer from 'flarum/components/ReplyComposer';
import LogInModal from 'flarum/components/LogInModal';
import Button from 'flarum/components/Button';
import Separator from 'flarum/components/Separator';
import DiscussionRenameModal from 'flarum/components/DiscussionRenameModal';
import ItemList from 'flarum/utils/ItemList';
import extractText from 'flarum/utils/extractText';
@@ -227,19 +228,9 @@ export default {
* @return {Promise}
*/
renameAction() {
const currentTitle = this.title();
const title = prompt(extractText(app.translator.trans('core.forum.discussion_controls.rename_text')), currentTitle);
// If the title is different to what it was before, then save it. After the
// save has completed, update the post stream as there will be a new post
// indicating that the discussion was renamed.
if (title && title !== currentTitle) {
return this.save({title}).then(() => {
if (app.viewingDiscussion(this)) {
app.current.stream.update();
}
m.redraw();
});
}
return app.modal.show(new DiscussionRenameModal({
currentTitle: this.title(),
discussion: this
}));
}
};