<commit_before>'use strict';

angular.module('myApp.reviewBlog', ['ngRoute'])

    .config(['$routeProvider', function($routeProvider) {
        $routeProvider.when('/reviewBlog/:blogID/:title', {
            templateUrl: 'reviewBlog/reviewBlog.html',
            controller: 'reviewBlogCtrl'
        });
    }])

    .controller('reviewBlogCtrl',function($http,$scope,$window,$routeParams,toastr) {


        $scope.url='http://172.16.58.3:8085/';
        $scope.blogId=$routeParams.blogID;

        $scope.getBlog=function(){
        $http({
            method: 'GET',
            url: baseUrl + '/blogs/'+$routeParams.blogID,
            headers: {'token': $window.localStorage.getItem('tokenData')}}
        ).success( function( data )
        {
            $scope.blogData=data;
        }).error( function( data)
        {
        });
      };

        $scope.getBlog();


        $scope.isAdmin = function()
        {
            if($window.localStorage.getItem('role')=='admin'){
                return true;}
            else{
                return false;}
        };

        $scope.publish=function()
        {
            $http({
                method: 'POST',
                url: baseUrl + '/blogs/publish/'+$scope.blogId,
                headers: {'token': $window.localStorage.getItem('tokenData')},
                data: $scope.blogData
            }).success(function(data){
                $scope.getBlog();
                toastr.info('Successfully Published', 'Publish');

            }).error(function(data){
                toastr.error('Error publishing', 'Publish');
            });
        };

        $scope.rejectBlog=function()
        {
            $http({
                method: 'POST',
                url: baseUrl + '/blogs/depublish/'+$scope.blogId,
                headers: {'token': $window.localStorage.getItem('tokenData')},
                data: $scope.blogData
            }).success(function(data){
                $scope.getBlog();
                toastr.info('Successfully depublished', 'Depublish');
            }).error(function(data){
                toastr.error('Error depublishing', 'Depublish');
            });
        };

    });<commit_msg>blog login<commit_after>'use strict';

angular.module('myApp.reviewBlog', ['ngRoute'])

.config(['$routeProvider', function($routeProvider) {
    $routeProvider.when('/reviewBlog/:blogID/:title', {
        templateUrl: 'reviewBlog/reviewBlog.html',
        controller: 'reviewBlogCtrl'
    });
}])

.controller('reviewBlogCtrl', function($http, $scope, $window, $routeParams, toastr) {

if($window.localStorage.getItem('role'))
{
    $window.location.href='#';
    toastr.info('Please login to view the blogs.', 'Login');
}

    $scope.url = 'http://172.16.58.3:8085/';
    $scope.blogId = $routeParams.blogID;

    $scope.getBlog = function() {
        $http({
            method: 'GET',
            url: baseUrl + '/blogs/' + $routeParams.blogID,
            headers: {
                'token': $window.localStorage.getItem('tokenData')
            }
        }).success(function(data) {
            $scope.blogData = data;
        }).error(function(data) {});
    };

    $scope.getBlog();


    $scope.isAdmin = function() {
        if ($window.localStorage.getItem('role') == 'admin') {
            return true;
        } else {
            return false;
        }
    };

    $scope.publish = function() {
        $http({
            method: 'POST',
            url: baseUrl + '/blogs/publish/' + $scope.blogId,
            headers: {
                'token': $window.localStorage.getItem('tokenData')
            },
            data: $scope.blogData
        }).success(function(data) {
            $scope.getBlog();
            toastr.info('Successfully Published', 'Publish');

        }).error(function(data) {
            toastr.error('Error publishing', 'Publish');
        });
    };

    $scope.rejectBlog = function() {
        $http({
            method: 'POST',
            url: baseUrl + '/blogs/depublish/' + $scope.blogId,
            headers: {
                'token': $window.localStorage.getItem('tokenData')
            },
            data: $scope.blogData
        }).success(function(data) {
            $scope.getBlog();
            toastr.info('Successfully depublished', 'Depublish');
        }).error(function(data) {
            toastr.error('Error depublishing', 'Depublish');
        });
    };

});
{'fraction_non_alphanumeric': 0.16519774011299435, 'fraction_numerical': 0.005423728813559322, 'mean_word_length': 1.848133848133848, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, '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': '2200932', 'n_tokens_mistral': 1300, 'n_tokens_neox': 1237, 'n_words': 186}