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

Menu should use Angular2 concepts instead of JQuery #9

Open
Syntaf opened this issue Feb 28, 2017 · 0 comments
Open

Menu should use Angular2 concepts instead of JQuery #9

Syntaf opened this issue Feb 28, 2017 · 0 comments

Comments

@Syntaf
Copy link
Member

Syntaf commented Feb 28, 2017

The template used for the site is built off html5 & JQuery, so we should adapt certain features to use Angular2 instead of JQuery where possible. The menu currently has this logic:

    $menu
      .appendTo($body)
      .on('click', function(event) {
        // prevent element from bubbling up propagation tree
        event.stopPropagation();
        // hide
        $menu._hide();
      })
      .find('.inner')
      .on('click', '.close', function(event) {
        // stop all dat propagation
        event.preventDefault();
        event.stopPropagation();
        event.stopImmediatePropagation();
        // hide
        $menu._hide();
      })
      .on('click', function(event) {
        // we really hate propagation if you haven't noticed
        event.stopPropagation();
      })
      .on('click', 'a', function(event) {
        // TODO use angular router here instead of jquery href
        if ($(this).attr('href')) {
        
          let href = $(this).attr('href');

          event.preventDefault();
          event.stopPropagation();

          // hide
          $menu._hide();

          // redirect
          window.setTimeout(function() {
            window.location.href = href;
          }, 350);
        }
      });

This logic should be phased in favor of the Angular2 Router

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant