Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(tags): admin tag selection component (reusable tag selection modal) #3686

Merged
merged 5 commits into from
Dec 12, 2022

Conversation

SychO9
Copy link
Member

@SychO9 SychO9 commented Nov 19, 2022

Replaces #3495

Changes proposed in this pull request:
A lot of times you need a way to provide a tag selection component in extensions, especially the admin settings. This PR:

  • Extracts a reusable TagSelectionModal from the existing TagDiscussionModal so it can be used in different contexts.
  • Adds a tag selection admin setting component which uses the new generic modal.

Reviewers should focus on:

  • The real changes happen between TagDiscussionModal and TagSelectionModal.
  • Custom setting component general code quality.
  • KeyboardNavigatable was moved to common, should we keep a KeyboardNavigatable export in forum? I currently kept a deprecated compat export only.

Code Snippet

app.extensionData
    .for('flarum-acme')
    .registerSetting({
      setting: 'flarum-suspend.tags',
      type: 'flarum-tags.select-tags',
      label: 'Relevant Tags',
      help: 'Lorem ipsum dolor sit amet.',
      options: {
        requireParentTag: true,
        limits: {
          max: {
            primary: 2,
          },
          min: {
            primary: 1,
            secondary: 1
          }
        }
      },
    })

Screenshot
Screenshot from 2022-11-19 23-16-14Screenshot from 2022-11-19 23-10-37
Screenshot from 2022-11-19 23-10-50

Necessity

  • Has the problem that is being solved here been clearly explained?
  • If applicable, have various options for solving this problem been considered?
  • For core PRs, does this need to be in core, or could it be in an extension?
  • Are we willing to maintain this for years / potentially forever?

Confirmed

  • Frontend changes: tested on a local Flarum installation.
  • Backend changes: tests are green (run composer test).
  • Core developer confirmed locally this works as intended.
  • Tests have been added, or are not appropriate here.

davwheat and others added 5 commits November 19, 2022 10:56
Signed-off-by: Sami Mazouz <sychocouldy@gmail.com>
Signed-off-by: Sami Mazouz <sychocouldy@gmail.com>
Signed-off-by: Sami Mazouz <sychocouldy@gmail.com>
Signed-off-by: Sami Mazouz <sychocouldy@gmail.com>
@SychO9 SychO9 requested a review from a team as a code owner November 19, 2022 22:14
@SychO9 SychO9 self-assigned this Nov 19, 2022
@SychO9 SychO9 changed the title feat: admin tag selection component (reusable tag selection modal) feat(tags): admin tag selection component (reusable tag selection modal) Nov 19, 2022
@luceos luceos merged commit a53a0db into main Dec 12, 2022
@luceos luceos deleted the dw/tag-select-modal-v2 branch December 12, 2022 09:44
@luceos luceos added this to the 1.7 milestone Dec 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
javascript Pull requests that update Javascript code type/extensibility type/feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants