<commit_before>// go.components.actions
// =====================
// Reusable components for UI actions

(function(exports) {
  var Eventable = go.components.structures.Eventable;

  var PopoverView = go.components.views.PopoverView;

  var capitalise = go.utils.capitalise,
      delayed = go.utils.delayed,
      functor = go.utils.functor,
      bindEvents = go.utils.bindEvents,
      maybeByName = go.utils.maybeByName;

  var PopoverNotifierView = PopoverView.extend({
    templates: {
      busy: 'JST.components_notifiers_popover_busy',
      message: 'JST.components_notifiers_popover_message'
    },

    bootstrapOptions: function() {
      var options = {
        trigger: 'manual',
        placement: 'top',
        container: 'body'
      };

      if (this.animate) { options.animation = true; }
      return options;
    },

    target: function() { return this.action.$el; },

    animate: true,
    busyWait: 400,
    delay: 400,

    messages: {
      success: function() {
        return capitalise(_(this.action).result('name')) + ' successful!';
      },
      error: function() {
        return capitalise(_(this.action).result('name')) + ' failed :/';
      },
    },

    initialize: function(options) {
      PopoverNotifierView.__super__.initialize.call(this, options);

      this.action = options.action;
      if ('delay' in options) { this.delay = options.delay; }
      if ('animate' in options) { this.animate = options.animate; }
      if ('busyWait' in options) { this.busyWait = options.busyWait; }

      if (options.messages) {
        this.messages = _({}).defaults(
          options.messages,
          this.messages);
      }

      bindEvents(this.bindings, this);
    },

    messageFor: function(eventName) {
      return functor(this.messages[eventName]).call(this);<commit_msg>Tweak action notification text.<commit_after>// go.components.actions
// =====================
// Reusable components for UI actions

(function(exports) {
  var Eventable = go.components.structures.Eventable;

  var PopoverView = go.components.views.PopoverView;

  var capitalise = go.utils.capitalise,
      delayed = go.utils.delayed,
      functor = go.utils.functor,
      bindEvents = go.utils.bindEvents,
      maybeByName = go.utils.maybeByName;

  var PopoverNotifierView = PopoverView.extend({
    templates: {
      busy: 'JST.components_notifiers_popover_busy',
      message: 'JST.components_notifiers_popover_message'
    },

    bootstrapOptions: function() {
      var options = {
        trigger: 'manual',
        placement: 'top',
        container: 'body'
      };

      if (this.animate) { options.animation = true; }
      return options;
    },

    target: function() { return this.action.$el; },

    animate: true,
    busyWait: 400,
    delay: 400,

    messages: {
      success: function() {
        return capitalise(_(this.action).result('name')) + ' successful.';
      },
      error: function() {
        return capitalise(_(this.action).result('name')) + ' failed.';
      },
    },

    initialize: function(options) {
      PopoverNotifierView.__super__.initialize.call(this, options);

      this.action = options.action;
      if ('delay' in options) { this.delay = options.delay; }
      if ('animate' in options) { this.animate = options.animate; }
      if ('busyWait' in options) { this.busyWait = options.busyWait; }

      if (options.messages) {
        this.messages = _({}).defaults(
          options.messages,
          this.messages);
      }

      bindEvents(this.bindings, this);
    },

    messageFor: function(eventName) {
      return functor(this.messages[eventName]).call(this);
{'fraction_non_alphanumeric': 0.14145275805570726, 'fraction_numerical': 0.0032768978700163844, 'mean_word_length': 2.711246200607903, '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': '3620332', 'n_tokens_mistral': 1122, 'n_tokens_neox': 1069, 'n_words': 214}