Jade ПРОБЛЕМ Telerik-Academy-Courses add-course.jade не работи


1

Здравейте, не мога да открия причината да не се зарежда фаила add-course.jade

Не работи, защот не се зарежда. Кода е от уроците mean stack :
свалил съм от тук без да променям нищо: https://github.com/ivaylokenov/Telerik-Academy-Courses

Ако някои знае, къде е проблема нека ме насочи :)

express.js

        var express = require('express'),
    stylus = require('stylus'),
    bodyParser = require('body-parser'),
    cookieParser = require('cookie-parser'),
    session = require('express-session'),
    passport = require('passport');

module.exports = function(app, config) {
    app.set('view engine', 'jade');
    app.set('views', config.rootPath + '/server/views');
    app.use(cookieParser());
    app.use(bodyParser.json());
    app.use(bodyParser.urlencoded({
        extended: true
    }));
    //app.use(session({secret: 'magic unicorns'}));
    app.use(session({ secret: 'keyboard cat', cookie: { maxAge: 60000 }, resave: true, saveUninitialized: true }));
    app.use(stylus.middleware(
        {
            src: config.rootPath + '/public',
            compile: function(str, path) {
                return stylus(str).set('filename', path);
            }
        }
    ));
    app.use(passport.initialize());
    app.use(passport.session());
    app.use(express.static(config.rootPath + '/public'));

app.js

var app = angular.module('app', ['ngResource', 'ngRoute']).value('toastr', toastr);

app.config(function($routeProvider, $locationProvider) {
    // $locationProvider.html5Mode(true);

    var routeUserChecks = {
        adminRole: {
            authenticate: function(auth) { //сървиса винаги
                return auth.isAuthorizedForRole('admin');
            }
        },
        authenticated: {
            authenticate: function(auth) {//сървиса винаги
                return auth.isAuthenticated();
            }
        }
    };

    $routeProvider
        .when('/', {
            templateUrl: '/partials/main/home',
            controller: 'MainCtrl'
        })
        .when('/courses', {
            templateUrl: '/partials/courses/courses-list',
            controller: 'CoursesListCtrl'
        })
        .when('/courses/:id', {
            templateUrl: '/partials/courses/course-details',
            controller: 'CourseDetailsCtrl'
        })
        .when('/signup', {
            templateUrl: '/partials/account/signup',
            controller: 'SignUpCtrl'
        })
        .when('/profile', {
            templateUrl: '/partials/account/profile',
            controller: 'ProfileCtrl',
            resolve: routeUserChecks.authenticated
        })
        .when('/admin/users', {
            templateUrl: '/partials/admin/users-list',
            controller: 'UserListCtrl',
            resolve: routeUserChecks.adminRole
        })
        .when('account/add-course', {
            templateUrl: '/account/add-course',
            controller: 'AddCourse',
            resolve: routeUserChecks.authenticated
        }) //това е най-горе кода и е проверка преди да зареди view-то
});

app.run(function($rootScope, $location) {
    $rootScope.$on('$routeChangeError', function(ev, current, previous, rejection) {
        if (rejection === 'not authorized') {
            $location.path('/');
        }
    })
});

add-course.jade

.container
    .well
    .form-horizontal
        fieldset
           legend Legend
            form-group
                label(for="inputTitle").col-lg-2.control-label Title
                .col-lg-10
                    input.form-control(placeholder="Article Title", ng-model="article.textTitle", required)


            .form-group
                label(for="textArea").col-lg-2.control-label Textarea
                .col-lg-10
                    textarea.form-control(id="inputText", placeholder="Article", ng-model="article.textArticle", required)
                    .help-block A longer block of help text that breaks onto a new line and may extend beyond one line.


            .form-group
                .col-lg-10 col-lg-offset-2
                    button.btn.btn-primary(ng-click="addarticle(article)", ng-disabled="signUpForm.$invalid") Submit
                    a.btn.btn-primary(href="#/") Cancel

AddCourse.js

    app.controller('AddCourse', function($scope, $location, auth, notifier) {
    $scope.addarticle = function(article) {
        auth.addarticle(article).then(function() {
            notifier.success('Article submitted successful!');
            console.log('Article has been submitted');
            $location.path('/');
        })
    }
});




Отговори



1

Здравей! Не съм сигурен но във add-course.jade  .form-horizontal Трябва да е с един таб навътре за да се визуализира.

.container
    .well
         .form-horizontal


от TodorDimitrov (757 точки)