From f5c34f37bd3a33f51f6456bcb2123e6460f40dfc Mon Sep 17 00:00:00 2001 From: Davide Iadeluca Date: Mon, 19 Feb 2024 07:34:12 +0100 Subject: [PATCH] chore: cleanup --- js/src/forum/addRouteToSessionDropdown.js | 22 ---------------------- js/src/forum/extend.js | 21 --------------------- js/src/forum/index.ts | 4 ---- js/src/forum/utils/PollControls.tsx | 2 +- resources/locale/en.yml | 5 ++--- 5 files changed, 3 insertions(+), 51 deletions(-) delete mode 100644 js/src/forum/addRouteToSessionDropdown.js delete mode 100644 js/src/forum/extend.js diff --git a/js/src/forum/addRouteToSessionDropdown.js b/js/src/forum/addRouteToSessionDropdown.js deleted file mode 100644 index 08b91861..00000000 --- a/js/src/forum/addRouteToSessionDropdown.js +++ /dev/null @@ -1,22 +0,0 @@ -import app from 'flarum/forum/app'; -import { extend } from 'flarum/common/extend'; -import Acl from '../common/Acl'; -import SessionDropdown from 'flarum/forum/components/SessionDropdown'; -import LinkButton from 'flarum/common/components/LinkButton'; - -export default () => { - extend(SessionDropdown.prototype, 'items', (items) => { - if (Acl.canStartPoll() && m.route.get()) { - items.add( - 'fof-polls-directory', - - {app.translator.trans('fof-polls.forum.page.nav')} - , - 10, - ); - } - }); -}; \ No newline at end of file diff --git a/js/src/forum/extend.js b/js/src/forum/extend.js deleted file mode 100644 index b9d1ffc2..00000000 --- a/js/src/forum/extend.js +++ /dev/null @@ -1,21 +0,0 @@ -import Extend from 'flarum/common/extenders'; -import Post from 'flarum/common/models/Post'; -import Forum from 'flarum/common/models/Forum'; -import Discussion from 'flarum/common/models/Discussion'; -import Poll from './models/Poll'; -import PollsPage from './components/PollsPage'; -import PollOption from './models/PollOption'; -import PollVote from './models/PollVote'; - -export default [ - new Extend.Store().add('polls', Poll).add('poll_options', PollOption).add('poll_votes', PollVote), - - new Extend.Model(Post).hasMany('polls').attribute('canStartPoll'), - - new Extend.Model(Forum).attribute('canStartPolls'), - - new Extend.Model(Discussion).attribute('hasPoll').attribute('canStartPoll'), - - // new Extend.Routes().add('polls', '/polls', ), - // new Extend.Routes().add('polls', '/polls'), -]; diff --git a/js/src/forum/index.ts b/js/src/forum/index.ts index 2ab74687..bb567cbc 100755 --- a/js/src/forum/index.ts +++ b/js/src/forum/index.ts @@ -5,20 +5,16 @@ import addComposerItems from './addComposerItems'; import addPollsToPost from './addPollsToPost'; import addPostControls from './addPostControls'; import addNavItem from './addNavItem'; -import addRouteToSessionDropdown from './addRouteToSessionDropdown'; export * from './components'; export * from './models'; -import PollsPage from './components/PollsPage'; - app.initializers.add('fof/polls', () => { addDiscussionBadge(); addComposerItems(); addPollsToPost(); addPostControls(); addNavItem(); - addRouteToSessionDropdown(); }); export { default as extend } from './extend'; diff --git a/js/src/forum/utils/PollControls.tsx b/js/src/forum/utils/PollControls.tsx index 1b5d1a1e..cf683136 100644 --- a/js/src/forum/utils/PollControls.tsx +++ b/js/src/forum/utils/PollControls.tsx @@ -36,7 +36,7 @@ export default { }, /** - * Get controls for direkt modifcation actions on polls (e.g. vote, view voters). + * Get controls for direct modifcation actions on polls (e.g. vote, view voters). */ pollControls(poll: Poll, context: Component): ItemList { const items = new ItemList(); diff --git a/resources/locale/en.yml b/resources/locale/en.yml index 06a9475b..47bce614 100755 --- a/resources/locale/en.yml +++ b/resources/locale/en.yml @@ -29,9 +29,8 @@ fof-polls: cannot_start_poll_button: Cannot Start Poll poll_controls: - view_label: View Poll - edit_label: Edit Poll - delete_label: Delete Poll + edit_label: Edit + delete_label: Delete poll_form: delete: Delete Poll