{"size": 1500, "ext": "js", "max_stars_repo_path": "app/scripts/controllers/HomeCtrl.js", "max_stars_repo_name": "Mattk205/bloc-chat", "max_stars_repo_stars_event_min_datetime": "2019-05-27T17:48:26.000Z", "max_stars_repo_stars_event_max_datetime": "2019-05-27T17:48:26.000Z", "max_issues_repo_path": "app/scripts/controllers/HomeCtrl.js", "max_issues_repo_name": "mattMusser/Chatably", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "app/scripts/controllers/HomeCtrl.js", "max_forks_repo_name": "mattMusser/Chatably", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": 1, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 29.4117647059, "max_line_length": 88, "alphanum_fraction": 0.518}
 (function() {
    function HomeCtrl(Room, $uibModal, Message, $cookies) {
        this.rooms = Room.all;
        currentUser = $cookies.get('blocChatCurrentUser');
        /**
        * @function openModal
        * @desc open modal click handler
        */
        this.openModal = function () {
            $uibModal.open({
            animation: true,
            templateUrl: '/templates/roomModal.html',
            controller: 'RoomCtrl as roomModal',
            });
        };

        /**
        * @function activeRoom
        * @desc active room click handler
        */
        this.activeRoom = function(rooms) {
            this.currentRoom = rooms;
            this.allTheMessages = Message.getByRoomId(this.currentRoom.$id);
        };

        /**
        * @function filteredMessages
        * @desc filters messages according to active room
        */
        this.filteredMessages = function(rooms) {
            this.allTheMessages = Message.getByRoomId(this.activeRoom.$id);
        };

        /**
        * @function submit message
        * @desc submission handler
        */
        this.submitMessage = function() {
            Message.send({
                roomId: this.currentRoom.$id,
                content: this.newMessage,
                username: currentUser
            });
            this.newMessage = "";
        };
    }
    angular
        .module('blocChat')
        .controller('HomeCtrl', ['Room', '$uibModal', 'Message', '$cookies', HomeCtrl]);
})();
