{"size": 1355, "ext": "js", "max_stars_repo_path": "WebApp/Review/line-actions.js", "max_stars_repo_name": "gpandrei/code-reaction", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "WebApp/Review/line-actions.js", "max_issues_repo_name": "gpandrei/code-reaction", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "WebApp/Review/line-actions.js", "max_forks_repo_name": "gpandrei/code-reaction", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 35.6578947368, "max_line_length": 128, "alphanum_fraction": 0.4915129151}
﻿/*
** Component code-line_actions
*/
var lineActions = {
    name: 'code-line-actions',
    props : ['line'],
    data: function () { return {}; },
    template:
        '<span id="line-hover-panel" class="line-hover-in" v-on:removeLike>' +
            '<button v-if="canLike" class="btn btn-primary btn-xs"  v-on:click="addLike"><i class="fa fa-heart"></i></button>' +
            '<button v-if="canUnlike" class="btn btn-xs btn-primary disabled" ><i class="fa fa-heart"></i></button>' +
            '&nbsp;<button class="btn btn-primary btn-xs" v-on:click="addComment"><i class="fa fa-comment"></i></button>' +
        '</span>',
    computed : {
        canLike : function() {
            return this.line.Author !== getUsername() && this.canUnlike === false;
        },
        canUnlike: function () {
            for (var i = 0; i < this.line.Likes.length; i++) {
                if (this.line.Likes[i] === getUsername()) {
                    return true;
                }
            }
            return false;
        }
    },
    methods: {
        addComment: function () {
            this.$emit('add-comment');
        },
        addLike: function () {
            BUS.$emit('like-line', { Line: this.line } );
        },
        //removeLike: function() {
        //    BUS.$emit('unlike-line', { Line: this.line } );
        //}
    }
};