Commit 34d81dc0 authored by Evren Kutar's avatar Evren Kutar

build version in dist folder

parent 2ec25304
This source diff could not be displayed because it is too large. You can view the blob instead.
/*! ulakbus-ui 2015-08-19 */
"use strict";var app=angular.module("ulakbus",["ngRoute","ngSanitize","ngCookies","general","formService","ulakbus.dashboard","ulakbus.auth","ulakbus.staff","ulakbus.student","schemaForm","gettext"]).constant("RESTURL",function(){return{url:"http://"+window.location.hostname+":9001/"}}()).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"}).directive("activeLink",["$location",function($location){return{restrict:"A",link:function($scope,$element,$attrs){var clazz=$attrs.activeLink,path=$location.path();path=path,$scope.location=$location,$scope.$watch("location.path()",function(newPath){path===newPath?$element.addClass(clazz):$element.removeClass(clazz)})}}}]).directive("logout",function($http,$location){return{link:function($scope,$element,$rootScope){$element.on("click",function(){$http.post("http://"+window.location.hostname+":9001/logout",{}).then(function(){$rootScope.loggedInUser=!1,console.log($rootScope.loggedInUser),$location.path("/login"),$scope.$apply()})})}}});app.config(["$routeProvider",function($routeProvider){$routeProvider.when("/login",{templateUrl:"components/auth/login.html",controller:"LoginCtrl"}).when("/dashboard",{templateUrl:"components/dashboard/dashboard.html",controller:"DashCtrl"}).when("/student/add",{templateUrl:"components/student/student_add_template.html",controller:"StudentAddEditCtrl"}).when("/student/edit/:id",{templateUrl:"components/student/student_add_template.html",controller:"StudentAddEditCtrl"}).when("/students",{templateUrl:"components/student/student_list_template.html",controller:"StudentListCtrl"}).when("/student/:id",{templateUrl:"components/student/student_list_template.html",controller:"StudentShowCtrl"}).when("/staff/add",{templateUrl:"components/staff/templates/add.html",controller:"StaffAddEditCtrl"}).when("/staff/edit/:id",{templateUrl:"components/staff/templates/edit.html",controller:"StaffAddEditCtrl"}).when("/staffs",{templateUrl:"components/staff/templates/list.html",controller:"StaffListCtrl"}).when("/staff/:id",{templateUrl:"components/staff/templates/show.html",controller:"StaffShowCtrl"}).otherwise({redirectTo:"/dashboard"})}]).run(function($rootScope,$location,$cookies){$rootScope.loggedInUser?$rootScope.loggedInUser:!1,$rootScope.$on("$routeChangeStart",function(event,next,current){null==$rootScope.loggedInUser&&("login/login.html"===next.templateUrl||$location.path("/login"))})}).config(["$httpProvider",function($httpProvider){$httpProvider.defaults.withCredentials=!0}]).run(function(gettextCatalog){gettextCatalog.setCurrentLanguage("tr"),gettextCatalog.debug=!0});var form_generator=angular.module("formService",["general","ui.bootstrap"]);form_generator.factory("Generator",function($http,$q,$log,$modal,$timeout,RESTURL,FormDiff){var generator={};return generator.makeUrl=function(url){return RESTURL.url+url},generator.generate=function(scope,forms){for(var key in forms)scope[key]=forms[key];return scope.initialModel=angular.copy(scope.model),scope.form.push({type:"submit",title:"Save"}),scope.listnodeform={},(scope.listnode&&scope.listnodes[0]||scope.nodes&&scope.nodes[0])&&angular.forEach(scope.form,function(key,val){"object"==typeof key&&"fieldset"==key.type&&(key.type="template",key.templateUrl="shared/templates/fieldset.html",scope.listnodes.indexOf(key.title)>=0&&(scope.listnodeform[key.title]={},scope.listnodeform[key.title].schema={title:angular.copy(key.title),type:"object",properties:{},required:[]},angular.forEach(scope.schema.properties,function(k,v){angular.forEach(key.items,function(item){item.key==v&&(scope.listnodeform[key.title].schema.properties[v]=angular.copy(k))})}),key.setType="ListNode",scope.listnodeform[key.title].form=[angular.copy(key)],scope.listnodeform[key.title].model={},key.type="list",delete key.templateUrl,delete key.items))}),scope.isCollapsed=!0,scope.object_id=scope.form_params.object_id,scope.openmodal=function(listnode,nodeID){var modalInstance=$modal.open({animation:!1,templateUrl:"shared/templates/listnodeModalContent.html",controller:"ListNodeModalCtrl",size:"lg",resolve:{items:function(){return nodeID&&(scope.listnodeform[listnode].model=1),scope.listnodeform[listnode]}}});modalInstance.result.then(function(childmodel,key){angular.forEach(childmodel,function(v,k){scope.model[k]?scope.model[k][v.idx]=v:(scope.model[k]={},scope.model[k][v.idx]=v),scope.$broadcast("schemaFormRedraw")})})},generator.group(scope)},generator.group=function(formObject){return formObject},generator.get_form=function(scope){return $http.post(generator.makeUrl(scope.url),scope.form_params).then(function(res){return generator.generate(scope,res.data.forms)})},generator.get_list=function(scope){return $http.post(generator.makeUrl(scope.url),scope.form_params).then(function(res){return res})},generator.get_single_item=function(scope){return $http.post(generator.makeUrl(scope.url),scope.form_params).then(function(res){return res})},generator.isValidEmail=function(email){var re=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i;return re.test(email)},generator.asyncValidators={emailNotValid:function(value){var deferred=$q.defer();return $timeout(function(){generator.isValidEmail(value)?deferred.resolve():deferred.reject()},500),deferred.promise}},generator.submit=function($scope){if($scope.object_id)var get_diff=FormDiff.get_diff($scope.model,$scope.initialModel),data={object_id:$scope.object_id,form:get_diff,cmd:"do"};else data={form:$scope.model,cmd:"do"};return $http.post(generator.makeUrl($scope.url),data)},generator}),form_generator.controller("ListNodeModalCtrl",function($scope,$modalInstance,items){for(var key in items)$scope[key]=items[key];$scope.onSubmit=function(form){$modalInstance.close($scope.model,$scope.form.title)},$scope.cancel=function(){$modalInstance.dismiss("cancel")}});var general=angular.module("general",[]);general.factory("FormDiff",function(){var formDiff={};return formDiff.get_diff=function(obj1,obj2){var result={};for(key in obj1)obj2[key]!=obj1[key]&&(result[key]=obj1[key]),"array"==typeof obj2[key]&&"array"==typeof obj1[key]&&(result[key]=arguments.callee(obj1[key],obj2[key])),"object"==typeof obj2[key]&&"object"==typeof obj1[key]&&(result[key]=arguments.callee(obj1[key],obj2[key]));return result},formDiff}),app.config(["$httpProvider",function($httpProvider){$httpProvider.interceptors.push(function($q,$rootScope,$location){return{request:function(config){return"POST"==config.method&&(config.headers["Content-Type"]="text/plain"),config},response:function(response){return response.data.is_login===!0&&($rootScope.loggedInUser=response.data.is_login,$location.replace(),"/login"===$location.path()&&$location.path("/dashboard")),response.data.screen&&$location.path(response.data.screen),response},responseError:function(rejection){return 400===rejection.status&&$location.reload(),401===rejection.status&&("/login"===$location.path()?console.log("show errors on login form"):$location.path("/login")),$q.reject(rejection)}}})}]);var auth=angular.module("ulakbus.auth",["ngRoute","schemaForm","ngCookies","general"]);auth.controller("LoginCtrl",function($scope,$q,$timeout,$routeParams,Generator,LoginService){$scope.url="simple_login",$scope.form_params={},$scope.form_params.clear_wf=1,Generator.get_form($scope).then(function(data){$scope.form=["*",{key:"password",type:"password"},{type:"submit",title:"Save"}]}),$scope.onSubmit=function(form){$scope.$broadcast("schemaFormValidate"),form.$valid?LoginService.login($scope.url,$scope.model).error(function(data){$scope.message=data.title}):console.log("not valid")}}),auth.factory("LoginService",function($http,$rootScope,$location,$log,$cookies,$window,Session,RESTURL){var loginService={};return loginService.login=function(url,credentials){return credentials={login_crd:credentials,cmd:"do"},$http.post(RESTURL.url+url,credentials).success(function(data,status,headers,config){$rootScope.loggedInUser=!0}).error(function(data,status,headers,config){return data})},loginService.logout=function(){console.log("logout"),$http.post(RESTURL.url+"logout",{}).then(function(){$rootScope.loggedInUser=!1,$location.path("/login")}),console.log("loggedout")},loginService.isAuthenticated=function(){return!!Session.userId},loginService.isAuthorized=function(authorizedRoles){return angular.isArray(authorizedRoles)||(authorizedRoles=[authorizedRoles]),loginService.isAuthenticated()&&-1!==loginService.indexOf(Session.userRole)},loginService.isValidEmail=function(email){var re=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i;return re.test(email)},loginService}),auth.service("Session",function(){this.create=function(sessionId,userId,userRole){this.id=sessionId,this.userId=userId,this.userRole=userRole},this.destroy=function(){this.id=null,this.userId=null,this.userRole=null}}),angular.module("ulakbus.dashboard",["ngRoute"]).controller("DashCtrl",function($scope){$scope.testData="<h1>This is main Dashboard</h1>"});var staff=angular.module("ulakbus.staff",["ngRoute","schemaForm","formService","ui.bootstrap"]);staff.controller("StaffAddEditCtrl",function($scope,$rootScope,$location,$http,$log,$modal,Generator,$routeParams){$scope.url="personel_duzenle_basitlestirilmis",$scope.form_params={},$routeParams.id?($scope.form_params.object_id=$routeParams.id,$scope.form_params.cmd="edit_object"):$scope.form_params.cmd="add_object",$scope.form_params.clear_wf=1,Generator.get_form($scope),$scope.onSubmit=function(form){$scope.$broadcast("schemaFormValidate"),form.$valid&&Generator.submit($scope).success(function(data){$location.path("/staffs")}).error(function(data){$scope.message=data.title})}}),staff.controller("StaffListCtrl",function($scope,$rootScope,Generator){$scope.url="personel_duzenle_basitlestirilmis",$scope.form_params={clear_wf:1},Generator.get_list($scope).then(function(res){var data=res.data.employees;for(var item in data)delete data[item].data.deleted,delete data[item].data.timestamp;$scope.staffs=data})}),staff.controller("StaffShowCtrl",function($scope,$rootScope,Generator,$routeParams){$scope.url="personel_duzenle_basitlestirilmis",$scope.form_params={object_id:$routeParams.id,clear_wf:1},Generator.get_single_item($scope).then(function(res){$scope.staff=res.data.employees[0].data})});var student=angular.module("ulakbus.student",["ngRoute","schemaForm","formService","general"]);student.controller("StudentAddEditCtrl",function($scope,$http,$log,Generator,$routeParams){Generator.get_form("add_student",$routeParams).then(function(d){$scope.schema=d.schema,$scope.form=d.form,$scope.model=d.model?d.model:{},$scope.initialModel=angular.copy(d.model),$scope.form[0].$asyncValidators=Generator.asyncValidators,$scope.form.push({type:"submit",title:"Save"})}),$scope.onSubmit=function(form){$scope.$broadcast("schemaFormValidate"),form.$valid&&Generator.submit("add_staff",$scope)}}),student.controller("StudentListCtrl",function($scope,$http){$http.get("http://127.0.0.1:3000/api/list_student").then(function(res){$scope.students=res.data})});var staff=angular.module("ulakbus.types",["ngRoute","schemaForm","formService"]);staff.controller("TypeCtrl",function($scope,$http,$log,Generator,$routeParams){Generator.get_form("input_types",$routeParams).then(function(d){$scope.congressFilter="Choice",$scope.schema=d.schema,$scope.form=d.form,$scope.model={},$scope.form[0].$asyncValidators=Generator.asyncValidators,$scope.form.push({type:"submit",title:"Save"})}),$scope.onSubmit=function(form){$scope.$broadcast("schemaFormValidate"),form.$valid&&$log.info($scope)}}),auth.factory("LoginService",function($http,$rootScope,$location,$log,$cookies,$window,Session,RESTURL){var loginService={};return loginService.login=function(url,credentials){return credentials={login_crd:credentials,cmd:"do"},$http.post(RESTURL.url+url,credentials).success(function(data,status,headers,config){$rootScope.loggedInUser=!0}).error(function(data,status,headers,config){return data})},loginService.logout=function(){console.log("logout"),$http.post(RESTURL.url+"logout",{}).then(function(){$rootScope.loggedInUser=!1,$location.path("/login")}),console.log("loggedout")},loginService.isAuthenticated=function(){return!!Session.userId},loginService.isAuthorized=function(authorizedRoles){return angular.isArray(authorizedRoles)||(authorizedRoles=[authorizedRoles]),loginService.isAuthenticated()&&-1!==loginService.indexOf(Session.userRole)},loginService.isValidEmail=function(email){var re=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i;return re.test(email)},loginService}),auth.service("Session",function(){this.create=function(sessionId,userId,userRole){this.id=sessionId,this.userId=userId,this.userRole=userRole},this.destroy=function(){this.id=null,this.userId=null,this.userRole=null}});
\ No newline at end of file
<!DOCTYPE html>
<!--[if lt IE 7]>
<html lang="en" ng-app="ulakbus" class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
<!--[if IE 7]>
<html lang="en" ng-app="ulakbus" class="no-js lt-ie9 lt-ie8"> <![endif]-->
<!--[if IE 8]>
<html lang="en" ng-app="ulakbus" class="no-js lt-ie9"> <![endif]-->
<!--[if gt IE 8]><!-->
<html lang="en" ng-app="ulakbus" class="no-js"> <!--<![endif]-->
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>ULAKBUS</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="app.css">
<!--<script src="bower_components/html5-boilerplate/js/vendor/modernizr-2.6.2.min.js"></script>-->
</head>
<body>
<nav class="navbar navbar-inverse navbar-fixed-top">
<div class="container-fluid">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed"
data-toggle="collapse" data-target="#navbar"
aria-expanded="false" aria-controls="navbar">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="#">ULAKBUS</a>
</div>
<div id="navbar" class="navbar-collapse collapse">
<ul class="nav navbar-nav navbar-right">
<li><a href="#/dashboard" translate>Dashboard</a></li>
<li><a href="#/login"translate>Login</a></li>
<li><a href="javascript:void(0);" logout translate>Logout</a></li>
</ul>
<form class="navbar-form navbar-right">
<input type="text" class="form-control" placeholder="Search...">
</form>
</div>
</div>
</nav>
<div class="container-fluid">
<div class="row">
<div class="col-sm-3 col-md-2 sidebar">
<ul class="nav nav-sidebar">
<!--<li active-link="active"><a href="#/students">Students</a></li>-->
<!--<li active-link="active"><a href="#/student/add">New Student</a></li>-->
<li active-link="active"><a href="#/staffs" translate>Staffs
</a></li>
<li active-link="active"><a href="#/staff/add" translate>New Staff</a>
</li>
<!--<li active-link="active"><a href="#/input_types">Types</a></li>-->
</ul>
</div>
<div class="col-sm-9 col-sm-offset-3 col-md-10 col-md-offset-2 main"
ng-view>
</div>
<hr>
<div>UlakbusUI app: v<span app-version></span></div>
</div>
</div>
<!-- In production use:
<script src="//ajax.googleapis.com/ajax/libs/angularjs/x.x.x/angular.min.js"></script>
-->
<script src="bower_components/components.js"></script>
<script src="shared/translations.js"></script>
<script src="templates.js"></script>
<script src="app.js"></script>
</body>
</html>
angular.module('gettext').run(['gettextCatalog', function (gettextCatalog) {
/* jshint -W100 */
gettextCatalog.setStrings('tr', {"Dashboard":"Panel","Login":"Giriş","Logout":"Çıkış","New Staff":"Yeni Personel","Staffs":"Personeller"});
/* jshint +W100 */
}]);
\ No newline at end of file
angular.module('templates-prod', ['components/auth/login.html', 'components/dashboard/dashboard.html', 'components/staff/templates/add.html', 'components/staff/templates/edit.html', 'components/staff/templates/list.html', 'components/staff/templates/show.html', 'components/student/student_add_template.html', 'components/student/student_list_template.html', 'components/types/types_template.html']);
angular.module("components/auth/login.html", []).run(["$templateCache", function($templateCache) {
$templateCache.put("components/auth/login.html",
"<div ng-app=\"ulakbus.auth\">\n" +
" <div class=\"col-md-6\">\n" +
" <h1>Ulakbüs Login Form</h1>\n" +
" <span class=\"label label-warning\">{{message}}</span>\n" +
" <form name=\"loginForm\" sf-schema=\"schema\" sf-form=\"form\" sf-model=\"model\" ng-submit=\"onSubmit(loginForm)\"></form>\n" +
" </div>\n" +
"</div>");
}]);
angular.module("components/dashboard/dashboard.html", []).run(["$templateCache", function($templateCache) {
$templateCache.put("components/dashboard/dashboard.html",
"<div ng-app=\"ulakbus.dashboard\">\n" +
" <div class=\"starter-template\">\n" +
" <h1>Main Dashboard</h1>\n" +
" {{ testData }}\n" +
" </div>\n" +
"</div>");
}]);
angular.module("components/staff/templates/add.html", []).run(["$templateCache", function($templateCache) {
$templateCache.put("components/staff/templates/add.html",
"<div ng-app=\"ulakbus.staff\">\n" +
" <ng-include src=\"'shared/templates/add.html'\"></ng-include>\n" +
"</div>");
}]);
angular.module("components/staff/templates/edit.html", []).run(["$templateCache", function($templateCache) {
$templateCache.put("components/staff/templates/edit.html",
"<div ng-app=\"ulakbus.staff\">\n" +
" <div class=\"col-md-6\">\n" +
" <h1>{{ schema.title }}</h1>\n" +
" <form name=\"formgenerated\" sf-schema=\"schema\" sf-form=\"form\" sf-model=\"model\" ng-submit=\"onSubmit(formgenerated)\"></form>\n" +
" </div>\n" +
"</div>");
}]);
angular.module("components/staff/templates/list.html", []).run(["$templateCache", function($templateCache) {
$templateCache.put("components/staff/templates/list.html",
"<table class=\"table table-bordered table-responsive\">\n" +
" <thead>\n" +
" <tr>\n" +
" <!--<th>{{ staffs[0].key }}</th>-->\n" +
" <th ng-repeat=\"(key,value) in staffs[0].data\">{{ key }}</th>\n" +
" <th>action</th>\n" +
" </tr>\n" +
" </thead>\n" +
" <tbody>\n" +
" <tr ng-repeat=\"staff in staffs\">\n" +
" <!--<td><a ng-href=\"#/staff/{{staff.id}}\">{{staff.name}}</a></td>-->\n" +
" <td ng-repeat=\"(key,value) in staff.data\">{{value}}</td>\n" +
" <td>\n" +
" <a ng-href=\"#/staff/edit/{{staff.key}}\">Edit</a><br>\n" +
" <a ng-href=\"#/staff/{{staff.key}}\">Show</a>\n" +
" </td>\n" +
" </tr>\n" +
" </tbody>\n" +
"</table>");
}]);
angular.module("components/staff/templates/show.html", []).run(["$templateCache", function($templateCache) {
$templateCache.put("components/staff/templates/show.html",
"<p ng-repeat=\"(key, value) in staff\"><span class=\"col-md-3\">{{ key }}:</span>{{\n" +
" value}}</p>");
}]);
angular.module("components/student/student_add_template.html", []).run(["$templateCache", function($templateCache) {
$templateCache.put("components/student/student_add_template.html",
"<div ng-app=\"ulakbus.student\">\n" +
" <div class=\"col-md-6\">\n" +
" <h1>{{ schema.title }}</h1>\n" +
" <form name=\"formgenerated\" sf-schema=\"schema\" sf-form=\"form\" sf-model=\"model\" ng-submit=\"onSubmit(formgenerated)\"></form>\n" +
" </div>\n" +
"</div>");
}]);
angular.module("components/student/student_list_template.html", []).run(["$templateCache", function($templateCache) {
$templateCache.put("components/student/student_list_template.html",
"<table class=\"table table-bordered\">\n" +
" <thead>\n" +
" <tr>\n" +
" <th ng-repeat=\"(key,value) in students[0]\">{{ key }}</th>\n" +
" </tr>\n" +
" </thead>\n" +
" <tbody>\n" +
" <tr ng-repeat=\"student in students\">\n" +
" <td ng-repeat=\"(key,value) in student\">{{value}}</td>\n" +
" <td><a ng-href=\"#/s/edit/{{student.id}}\">Edit</a></td>\n" +
" </tr>\n" +
" </tbody>\n" +
"</table>");
}]);
angular.module("components/types/types_template.html", []).run(["$templateCache", function($templateCache) {
$templateCache.put("components/types/types_template.html",
"<div ng-app=\"ulakbus.types\">\n" +
" <div class=\"col-md-6\">\n" +
" <h1>{{ schema.title }}</h1>\n" +
" <form name=\"formgenerated\" sf-schema=\"schema\" sf-form=\"form\" sf-model=\"model\" ng-submit=\"onSubmit(formgenerated)\"></form>\n" +
" </div>\n" +
"</div>");
}]);
<div ng-app="ulakbus.types">
<div class="col-md-6">
<h1>{{ schema.title }}</h1>
<form name="formgenerated" sf-schema="schema" sf-form="form" sf-model="model" ng-submit="onSubmit(formgenerated)"></form>
</div>
</div>
\ No newline at end of file
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