<commit_before>import Ember from 'ember';
import ClickElseWhereMixin from 'ember-cli-coreweb-ui/mixins/click-else-where';

export default Ember.Component.extend(ClickElseWhereMixin, {
  tagName: 'li',
  classNameBindings: [':dropdown', 'isActive:open'],

  isActive: false,
  // menu option
  options: [],

  primaryAction: Ember.computed('options', function() {
    return this.get('options').findBy('primary', true);
  }),

  optionsWithoutPrimaryAction: Ember.computed.filter('options', function(option) {
    return !option.primary;
  }),

  actions: {
    toggleActive: function(event)  {
      var isOutside = false,
        $self;

      if (event && ($self = this.$()[0])) {
        isOutside = !$self.contains(event.target);
        if (isOutside) {
          this.set('isActive', false);
        }
      } else {
        this.set('isActive', !this.get('isActive'));
      }
    },

    sendAc: function(action) {
      if (action) {
        this.set('menuClick', action);
        this.sendAction('menuClick', this.get('context'));
      }
    }
  }
});<commit_msg>close dropdown menu after click the menu.<commit_after>import Ember from 'ember';
import ClickElseWhereMixin from 'ember-cli-coreweb-ui/mixins/click-else-where';

export default Ember.Component.extend(ClickElseWhereMixin, {
  tagName: 'li',
  classNameBindings: [':dropdown', 'isActive:open'],

  isActive: false,
  // menu option
  options: [],

  primaryAction: Ember.computed('options', function() {
    return this.get('options').findBy('primary', true);
  }),

  optionsWithoutPrimaryAction: Ember.computed.filter('options', function(option) {
    return !option.primary;
  }),

  actions: {
    toggleActive: function(event)  {
      var isOutside = false,
        $self;

      if (event && ($self = this.$()[0])) {
        isOutside = !$self.contains(event.target);
        if (isOutside) {
          this.set('isActive', false);
        }
      } else {
        this.set('isActive', !this.get('isActive'));
      }
    },

    sendAc: function(action) {
      if (action) {
        this.set('menuClick', action);
        this.sendAction('menuClick', this.get('context'));
        this.send('toggleActive');
      }
    }
  }
});
{'fraction_non_alphanumeric': 0.16417910447761194, 'fraction_numerical': 0.0009045680687471732, 'mean_word_length': 3.0072463768115942, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2260070', 'n_tokens_mistral': 705, 'n_tokens_neox': 681, 'n_words': 127}