Skip to content
Snippets Groups Projects

Resolve "Add icon/badge/indicator that you are subscribed to issue/MR"

Closed Annabel Gray requested to merge 16988-subscription-toggle into master
1 unresolved thread

Restyles Subscribe button as a toggle

Before After
button toggle
Closes #16988 (moved)

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • Annabel Gray resolved all discussions

    resolved all discussions

  • Annabel Gray added 2 commits

    added 2 commits

    • ffc8e706 - Fix sidebar spec
    • 2fdae7ef - Change toggle to a tag to add focus style on tab but not on click

    Compare with previous version

  • Annabel Gray added 1 commit

    added 1 commit

    • 20090d42 - Refactor; remove labels from toggle buttons

    Compare with previous version

  • Annabel Gray added 1 commit

    added 1 commit

    Compare with previous version

  • Annabel Gray added 1 commit

    added 1 commit

    • e7e93891 - Refactor; remove labels from toggle buttons

    Compare with previous version

  • Annabel Gray added 1 commit

    added 1 commit

    • 4279556a - Refactor; remove labels from toggle buttons

    Compare with previous version

  • Annabel Gray added 143 commits

    added 143 commits

    • 4279556a...86d1e42a - 136 commits from branch master
    • 403e7113 - First pass at creating toggle button
    • 283abf49 - Refactor scss; add toggle button to issue board sidebar (still needs fixing)
    • 54c55376 - Fix toggle text margin
    • 6f894b5d - Fix lint errors
    • 88077e0b - Fix sidebar spec
    • c4fe407b - Change toggle to a tag to add focus style on tab but not on click
    • 8f8709af - Refactor; remove labels from toggle buttons

    Compare with previous version

  • Annabel Gray added 1 commit

    added 1 commit

    • 3a6f9096 - Add subscribed icon in collapsed sidebar

    Compare with previous version

  • Annabel Gray unmarked as a Work In Progress

    unmarked as a Work In Progress

  • @alfredo1 can you please review this? Thanks!

  • Annabel Gray assigned to @alfredo1

    assigned to @alfredo1

  • 18 const buttonSpan = button.querySelector('span');
    19 if (!buttonSpan || button.classList.contains('disabled')) {
    18 const toggleButton = $('.toggle-button');
    19 const toggleIcon = $('.subscription-collapsed-icon');
    20 if (button.classList.contains('disabled')) {
    20 21 return;
    21 22 }
    22 23 button.classList.add('disabled');
    23 24
    24 const isSubscribed = buttonSpan.innerHTML.trim().toLowerCase() !== 'subscribe';
    25 25 const toggleActionUrl = this.containerElm.dataset.url;
    26 26
    27 27 $.post(toggleActionUrl, () => {
    28 28 button.classList.remove('disabled');
    29 toggleButton.toggleClass('subscribed unsubscribed');
    30 toggleIcon.toggleClass('subscribed unsubscribed');
    • If you end up using plain DOM elements instead of jQuery you can use .add and .remove

      element.classList.add('foo-class', 'bar-class');
    • I'm toggling between the classes, so I'd have to add one class, remove the other class; and then when the status is changed do the opposite. Each of these toggleClasss would be expanded into a lot more code. Is there a better way to do this?

    • Please register or sign in to reply
  • @annabeldunstone A few comments for you. Also, can you please rebase?

  • Annabel Gray changed milestone to %9.1

    changed milestone to %9.1

  • Annabel Gray added 550 commits

    added 550 commits

    • 3a6f9096...a57a0e3d - 542 commits from branch master
    • 329daee6 - First pass at creating toggle button
    • b1c78a48 - Refactor scss; add toggle button to issue board sidebar (still needs fixing)
    • a3be9999 - Fix toggle text margin
    • d65f2360 - Fix lint errors
    • 32bc4051 - Fix sidebar spec
    • 4418fda9 - Change toggle to a tag to add focus style on tab but not on click
    • fd25a838 - Refactor; remove labels from toggle buttons
    • 7802fc4f - Add subscribed icon in collapsed sidebar

    Compare with previous version

  • Annabel Gray added 1 commit

    added 1 commit

    • aff7b8cb - Add subscribed icon in collapsed sidebar; set role to button

    Compare with previous version

  • Annabel Gray added 488 commits

    added 488 commits

    • aff7b8cb...c2d3ea04 - 480 commits from branch master
    • c5d174e3 - First pass at creating toggle button
    • 41e98de3 - Refactor scss; add toggle button to issue board sidebar (still needs fixing)
    • 70679528 - Fix toggle text margin
    • c4554eda - Fix lint errors
    • d154d2a3 - Fix sidebar spec
    • c59bc970 - Change toggle to a tag to add focus style on tab but not on click
    • a2cf00fc - Refactor; remove labels from toggle buttons
    • 0b708374 - Add subscribed icon in collapsed sidebar; set role to button

    Compare with previous version

  • Annabel Gray added 324 commits

    added 324 commits

    • 0b708374...d576fd82 - 316 commits from branch master
    • a3cb260d - First pass at creating toggle button
    • 81f494ca - Refactor scss; add toggle button to issue board sidebar (still needs fixing)
    • 77e89fb9 - Fix toggle text margin
    • 9e494c79 - Fix lint errors
    • e6716f17 - Fix sidebar spec
    • 2a8a89a7 - Change toggle to a tag to add focus style on tab but not on click
    • 381acfb3 - Refactor; remove labels from toggle buttons
    • 6033176e - Add subscribed icon in collapsed sidebar; set role to button

    Compare with previous version

  • Annabel Gray added 460 commits

    added 460 commits

    • 6033176e...bf0590b3 - 452 commits from branch master
    • f36c1990 - First pass at creating toggle button
    • 15c67c27 - Refactor scss; add toggle button to issue board sidebar (still needs fixing)
    • 25a686b1 - Fix toggle text margin
    • f975347a - Fix lint errors
    • 87510e71 - Fix sidebar spec
    • 69b4b779 - Change toggle to a tag to add focus style on tab but not on click
    • d0397e59 - Refactor; remove labels from toggle buttons
    • 1085192e - Add subscribed icon in collapsed sidebar; set role to button

    Compare with previous version

  • Annabel Gray changed milestone to %9.2

    changed milestone to %9.2

  • Annabel Gray added 1728 commits

    added 1728 commits

    • 1085192e...cc52dfab - 1719 commits from branch master
    • 84516c85 - First pass at creating toggle button
    • 3eb5d138 - Refactor scss; add toggle button to issue board sidebar (still needs fixing)
    • ab3e9fb0 - Fix toggle text margin
    • 6907f29f - Fix lint errors
    • 53f7ca07 - Fix sidebar spec
    • 787f5b1f - Change toggle to a tag to add focus style on tab but not on click
    • dd5101b1 - Refactor; remove labels from toggle buttons
    • 33ed4518 - Add subscribed icon in collapsed sidebar; set role to button
    • 03aa0f99 - Fix specs; change class name to prevent false positives

    Compare with previous version

  • Annabel Gray added 107 commits

    added 107 commits

    • 03aa0f99...465a8180 - 97 commits from branch master
    • 036701a9 - First pass at creating toggle button
    • f7121a06 - Refactor scss; add toggle button to issue board sidebar (still needs fixing)
    • dc4b0f95 - Fix toggle text margin
    • 4b6a969b - Fix lint errors
    • 9537d4b9 - Fix sidebar spec
    • a48246b7 - Change toggle to a tag to add focus style on tab but not on click
    • 06b4c3c1 - Refactor; remove labels from toggle buttons
    • 7bd3320b - Add subscribed icon in collapsed sidebar; set role to button
    • 0abc2e88 - Fix specs; change class name to prevent false positives
    • addabfb0 - Add title

    Compare with previous version

  • Annabel Gray added 107 commits

    added 107 commits

    • addabfb0...479d21d5 - 97 commits from branch master
    • d7ee6315 - First pass at creating toggle button
    • 67a7769b - Refactor scss; add toggle button to issue board sidebar (still needs fixing)
    • 89c856b9 - Fix toggle text margin
    • 32a52a33 - Fix lint errors
    • bef18c0f - Fix sidebar spec
    • f407248d - Change toggle to a tag to add focus style on tab but not on click
    • 497d563f - Refactor; remove labels from toggle buttons
    • a2c08b1d - Add subscribed icon in collapsed sidebar; set role to button
    • 526ce8df - Fix specs; change class name to prevent false positives
    • c7c63a49 - Add title

    Compare with previous version

  • Annabel Gray added 1 commit

    added 1 commit

    Compare with previous version

  • Annabel Gray added 574 commits

    added 574 commits

    • 87d1100f...7e0e45db - 563 commits from branch master
    • fd2ec864 - First pass at creating toggle button
    • a9d6ba35 - Refactor scss; add toggle button to issue board sidebar (still needs fixing)
    • bdbfb486 - Fix toggle text margin
    • 1c53235d - Fix lint errors
    • 56a3c232 - Fix sidebar spec
    • b643412d - Change toggle to a tag to add focus style on tab but not on click
    • f30d8338 - Refactor; remove labels from toggle buttons
    • 33b5703f - Add subscribed icon in collapsed sidebar; set role to button
    • 88b74f62 - Fix specs; change class name to prevent false positives
    • afb169e2 - Add title
    • 3de101cd - Add changelog

    Compare with previous version

  • Annabel Gray added 1062 commits

    added 1062 commits

    • 3de101cd...e4eec191 - 1051 commits from branch master
    • c154c779 - First pass at creating toggle button
    • ec7e9b68 - Refactor scss; add toggle button to issue board sidebar (still needs fixing)
    • 5b9b57c4 - Fix toggle text margin
    • db9c6a22 - Fix lint errors
    • 4675411e - Fix sidebar spec
    • 9258de62 - Change toggle to a tag to add focus style on tab but not on click
    • 5fc05e00 - Refactor; remove labels from toggle buttons
    • 47f1c898 - Add subscribed icon in collapsed sidebar; set role to button
    • bc090ac6 - Fix specs; change class name to prevent false positives
    • 0760552a - Add title
    • 1bcfca9c - Add changelog

    Compare with previous version

  • Annabel Gray changed milestone to %9.3

    changed milestone to %9.3

  • Annabel Gray added 356 commits

    added 356 commits

    • 1bcfca9c...41441445 - 344 commits from branch master
    • aa973ef9 - First pass at creating toggle button
    • 96648710 - Refactor scss; add toggle button to issue board sidebar (still needs fixing)
    • 9d34d3fd - Fix toggle text margin
    • 6cf5c924 - Fix lint errors
    • 6a279ed8 - Fix sidebar spec
    • 65f4c062 - Change toggle to a tag to add focus style on tab but not on click
    • 18b59969 - Refactor; remove labels from toggle buttons
    • 442b4fd3 - Add subscribed icon in collapsed sidebar; set role to button
    • b9a70918 - Fix specs; change class name to prevent false positives
    • 305a395e - Add title
    • 678c1f8e - Add changelog
    • 16a79253 - Wait for requests

    Compare with previous version

  • Annabel Gray changed milestone to %9.4

    changed milestone to %9.4

  • Annabel Gray removed milestone

    removed milestone

  • closed

  • Please register or sign in to reply
    Loading