Commit 1e6446c2 authored by Evren Kutar's avatar Evren Kutar

v0.0.3.1

parametric backendurl for development purpose
gruntfile improvements
parent e696a566
......@@ -65,7 +65,7 @@ module.exports = function (grunt) {
},
dev: {
src: ['app/components/**/*.html', 'app/shared/templates/**/*.html'],
dest: 'tmp/templates.js'
dest: 'app/tmp/templates.js'
}
},
copy: {
......@@ -98,7 +98,7 @@ module.exports = function (grunt) {
//'app/components/**/*controller.js',
//'app/components/**/*service.js',
"app/app.js",
"dist/app.js",
"app/app_routes.js",
"app/zetalib/interceptors.js",
"app/zetalib/general.js",
......@@ -196,7 +196,7 @@ module.exports = function (grunt) {
},
watch: {
dev: {
files: ['app/**/*.js', 'app/components/**/*.html', 'index.html'],
files: ['app/**/*.js', 'app/components/**/*.html', 'index.html', 'Gruntfile.js', '!app/tmp/*.js', '!app/app.js'],
tasks: ['env:dev', 'preprocess:dev', 'html2js:dev'],
options: {
atBegin: false
......@@ -253,12 +253,16 @@ module.exports = function (grunt) {
},
preprocess: {
dev: {
src: 'index.html',
dest: 'app/index.html'
files: {
'app/index.html': 'app/main.html',
'app/app.js': 'app/main.js',
}
},
prod: {
src: 'index.html',
dest: 'dist/index.html',
files: {
'dist/index.html': 'app/main.html',
'dist/app.js': 'app/main.js',
},
options: {
context: {
name: '<%= pkg.name %>',
......@@ -269,8 +273,10 @@ module.exports = function (grunt) {
}
},
prod_branch: {
src: 'index.html',
dest: 'dist/<%= grunt.branchname %>/index.html',
files: {
'dist/<%= grunt.branchname %>/index.html': 'app/main.html',
'dist/<%= grunt.branchname %>/app.js': 'app/main.js',
},
options: {
context: {
name: '<%= pkg.name %>',
......@@ -303,13 +309,13 @@ module.exports = function (grunt) {
grunt.registerTask('i18n', ['nggettext_extract', 'nggettext_compile']);
grunt.registerTask('default', [
'bower',
'env:prod',
'preprocess:prod',
'nggettext_compile',
'concat:js',
'concat:css',
'concat:components',
'copy:prod',
'env:prod',
'preprocess:prod',
'html2js:prod',
'uglify:dist'
]);
......
......@@ -24,15 +24,29 @@ var app = angular.module(
//'ulakbus.version',
'schemaForm',
'gettext',
'templates-prod'
'templates-dev',
]).
/**
* RESTURL is the url of rest api to talk
* Based on the environment it changes from dev to prod
*/
constant("RESTURL", (function () {
//return {url: "http://127.0.0.1:9001/"};
return {url: "http://api.ulakbus.net/"};
// todo: below backendurl definition is for development purpose and will be deleted
var backendurl = "http://api.ulakbus.net";
if (document.cookie.indexOf("backendurl") > -1){
var cookiearray = document.cookie.split(';');
angular.forEach(cookiearray, function(item){
if(item.indexOf("backendurl")){
backendurl = item.split('=')[1];
}
});
}
if (location.href.indexOf("backendurl") > -1){
var urlfromqstr = location.href.split('?')[1].split('=')[1];
backendurl = decodeURIComponent(urlfromqstr.replace(/\+/g, " "));
document.cookie = "backendurl="+backendurl;
}
return {url: backendurl};
})()).
/**
* USER_ROLES and AUTH_EVENTS are constant for auth functions
......
......@@ -7,30 +7,74 @@
'use strict';
$script([
"bower_components/angular/angular.js",
"bower_components/oclazyload/dist/ocLazyLoad.js",
"bower_components/angular-route/angular-route.js",
"bower_components/angular-cookies/angular-cookies.js",
"bower_components/angular-resource/angular-resource.js",
"bower_components/angular-sanitize/angular-sanitize.js",
"bower_components/tv4/tv4.js",
"bower_components/objectpath/lib/ObjectPath.js",
"bower_components/angular-schema-form/dist/schema-form.js",
"bower_components/angular-schema-form/dist/bootstrap-decorator.js",
"bower_components/angular-schema-form-datepicker/bootstrap-datepicker.js",
"app.js",
"app_routes.js",
"zetalib/interceptors.js",
"zetalib/general.js",
"zetalib/forms/form_service.js",
"components/auth/auth_controller.js",
"components/auth/auth_service.js",
"components/dashboard/dashboard.js",
"components/staff/staff_controller.js",
"components/student/student_controller.js",
"components/dashboard/dashboard.js"
], function() {
// when all is done, execute bootstrap angular application
angular.bootstrap(document, ['ulakbus']);
});
\ No newline at end of file
var app = angular.module(
'ulakbus', [
'ui.bootstrap',
'angular-loading-bar',
'ngRoute',
'ngSanitize',
'ngCookies',
'general',
'formService',
'ulakbus.dashboard',
'ulakbus.auth',
//'ulakbus.staff',
//'ulakbus.student',
'ulakbus.crud',
//'ulakbus.version',
'schemaForm',
'gettext',
// @if NODE_ENV='PRODUCTION'
'templates-prod',
// @endif
// @if NODE_ENV='DEVELOPMENT'
'templates-dev',
// @endif
]).
/**
* RESTURL is the url of rest api to talk
* Based on the environment it changes from dev to prod
*/
constant("RESTURL", (function () {
// todo: below backendurl definition is for development purpose and will be deleted
var backendurl = "http://api.ulakbus.net";
if (document.cookie.indexOf("backendurl") > -1){
var cookiearray = document.cookie.split(';');
angular.forEach(cookiearray, function(item){
if(item.indexOf("backendurl")){
backendurl = item.split('=')[1];
}
});
}
if (location.href.indexOf("backendurl") > -1){
var urlfromqstr = location.href.split('?')[1].split('=')[1];
backendurl = decodeURIComponent(urlfromqstr.replace(/\+/g, " "));
document.cookie = "backendurl="+backendurl;
}
return {url: backendurl};
})()).
/**
* USER_ROLES and AUTH_EVENTS are constant for auth functions
*/
constant("USER_ROLES", {
all: "*",
admin: "admin",
student: "student",
staff: "staff",
dean: "dean"
}).
constant('AUTH_EVENTS', {
loginSuccess: 'auth-login-success',
loginFailed: 'auth-login-failed',
logoutSuccess: 'auth-logout-success',
sessionTimeout: 'auth-session-timeout',
notAuthenticated: 'auth-not-authenticated',
notAuthorized: 'auth-not-authorized'
});
// test the code with strict di mode to see if it works when minified
//angular.bootstrap(document, ['ulakbus'], {
// strictDi: true
//});
......@@ -112,8 +112,6 @@ form_generator.factory('Generator', function ($http, $q, $log, $location, $modal
url: scope.url
};
debugger;
scope[k.type][k.title].model = scope.model[v] != null ? scope.model[v] : {};
angular.forEach(k.schema , function (item) {
......@@ -141,8 +139,6 @@ form_generator.factory('Generator', function ($http, $q, $log, $location, $modal
// lengthModels is length of the listnode models. if greater than 0 show records on template
scope[k.type][k.title]['lengthModels'] = scope.model[k.title] ? 1 : 0;
console.log(scope[k.type][k.title]['lengthModels']);
debugger;
}
});
......@@ -200,7 +196,6 @@ form_generator.factory('Generator', function ($http, $q, $log, $location, $modal
};
generator.submit = function ($scope) {
// todo: diff for all submits to recognize form change. if no change returns to view with no submit
debugger;
var data = {
"form": $scope.model,
"cmd": $scope.form_params.cmd,
......
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment