{"size": 1052, "ext": "js", "max_stars_repo_path": "src/app/components/feed/buttons/jh-sticky-button.directive.js", "max_stars_repo_name": "gaoyuqi/jangouts", "max_stars_repo_stars_event_min_datetime": "2019-05-24T07:14:47.000Z", "max_stars_repo_stars_event_max_datetime": "2019-05-24T07:14:48.000Z", "max_issues_repo_path": "src/app/components/feed/buttons/jh-sticky-button.directive.js", "max_issues_repo_name": "gaoyuqi/jangouts", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/app/components/feed/buttons/jh-sticky-button.directive.js", "max_forks_repo_name": "gaoyuqi/jangouts", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": 2, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 21.04, "max_line_length": 71, "alphanum_fraction": 0.572243346}
/*
 * Copyright (C) 2015 SUSE Linux
 *
 * This software may be modified and distributed under the terms
 * of the MIT license.  See the LICENSE.txt file for details.
 */

(function () {
  'use strict';

  angular.module('janusHangouts')
    .directive('jhStickyButton', jhStickyButton);

  function jhStickyButton() {
    return {
      restrict: 'EA',
      templateUrl: 'app/components/feed/buttons/jh-sticky-button.html',
      scope: {
        feed: '=',
        clickFn: '&',
        highlighted: '=',
        sticky: '='
      },
      controllerAs: 'vm',
      bindToController: true,
      controller: JhStickyButtonCtrl
    };

    function JhStickyButtonCtrl() {
      /* jshint: validthis */
      var vm = this;
      vm.click = click;
      vm.showsEnable = showsEnable;
      vm.showsDisable = showsDisable;

      function click() {
        vm.clickFn();
      }

      function showsEnable() {
        return (!vm.sticky && !vm.feed.isIgnored);
      }

      function showsDisable() {
        return vm.sticky;
      }
    }
  }
})();
