Commit a31b54cb authored by Evren Kutar's avatar Evren Kutar

versioning 0.6.0

parent 1e601f4a
......@@ -79,9 +79,7 @@ module.exports = function (grunt) {
{expand: true, cwd: 'app/styles/images/', src: '*', dest: 'dist/css/images/', flatten: true},
{expand: true, cwd: 'app/bower_components/bootstrap/dist/fonts/', src: '*', dest: 'dist/fonts/', flatten: true, filter: 'isFile'},
{expand: true, cwd: 'app/bower_components/jquery/dist/', src: 'jquery.min.js', dest: 'dist/bower_components/', flatten: true, filter: 'isFile'},
{expand: true, cwd: 'app/bower_components/angular/', src: 'angular.min.js', dest: 'dist/bower_components/', flatten: true, filter: 'isFile'},
//{expand: true, cwd: 'app/shared/scripts/', src: 'theme.js', dest: 'dist/bower_components/', flatten: true, filter: 'isFile'},
{expand: true, cwd: 'app/shared/scripts/', src: 'jquery-ui.min.js', dest: 'dist/bower_components/', flatten: true, filter: 'isFile'}
{expand: true, cwd: 'app/bower_components/angular/', src: 'angular.min.js', dest: 'dist/bower_components/', flatten: true, filter: 'isFile'}
]
},
local_prod: {
......@@ -94,8 +92,7 @@ module.exports = function (grunt) {
{expand: true, cwd: 'app/styles/images/', src: '*', dest: 'dist/css/images/', flatten: true},
{expand: true, cwd: 'app/bower_components/bootstrap/dist/fonts/', src: '*', dest: 'dist/fonts/', flatten: true, filter: 'isFile'},
{expand: true, cwd: 'app/bower_components/jquery/dist/', src: 'jquery.min.js', dest: 'dist/bower_components/', flatten: true, filter: 'isFile'},
{expand: true, cwd: 'app/bower_components/angular/', src: 'angular.js', dest: 'dist/bower_components/', flatten: true, filter: 'isFile'},
{expand: true, cwd: 'app/shared/scripts/', src: 'jquery-ui.min.js', dest: 'dist/bower_components/', flatten: true, filter: 'isFile'}
{expand: true, cwd: 'app/bower_components/angular/', src: 'angular.js', dest: 'dist/bower_components/', flatten: true, filter: 'isFile'}
]
}
},
......@@ -127,8 +124,7 @@ module.exports = function (grunt) {
},
components: {
src: [
//"app/bower_components/angular/angular.js",
//"app/bower_components/jquery/dist/jquery.js",
"app/bower_components/angular-i18n/angular-locale_tr.js",
"app/bower_components/bootstrap/dist/js/bootstrap.js",
"app/bower_components/angular-route/angular-route.js",
"app/bower_components/angular-cookies/angular-cookies.js",
......@@ -179,7 +175,7 @@ module.exports = function (grunt) {
},
components_branch: {
src: [
//"app/bower_components/jquery/dist/jquery.min.js",
"app/bower_components/angular-i18n/angular-locale_tr.js",
"app/bower_components/angular-route/angular-route.min.js",
"app/bower_components/angular-cookies/angular-cookies.min.js",
"app/bower_components/angular-resource/angular-resource.min.js",
......
......@@ -51,6 +51,7 @@ app.config(['$routeProvider', function ($routeProvider, $route) {
.run(function ($rootScope) {
$rootScope.loggedInUser = true;
$rootScope.loginAttempt = 0;
$rootScope.$on("$routeChangeStart", function (event, next, current) {
// will be used when needed
});
......
......@@ -9,7 +9,7 @@
'use strict';
var auth = angular.module('ulakbus.auth', ['ngRoute', 'schemaForm', 'ngCookies']);
auth.controller('LoginCtrl', function ($scope, $q, $timeout, $routeParams, Generator, LoginService) {
auth.controller('LoginCtrl', function ($scope, $q, $timeout, $routeParams, $rootScope, $log, Generator, LoginService) {
$scope.url = 'login';
$scope.form_params = {};
$scope.form_params['clear_wf'] = 1;
......@@ -23,13 +23,16 @@ auth.controller('LoginCtrl', function ($scope, $q, $timeout, $routeParams, Gener
$scope.onSubmit = function (form) {
$scope.$broadcast('schemaFormValidate');
if (form.$valid) {
$rootScope.loginAttempt = 1;
LoginService.login($scope.url, $scope.model)
.error(function(data){
$scope.message = data.title;
})
}
else {
console.log("not valid");
$log.debug("not valid");
}
}
};
$log.debug('login attempt: ', $rootScope.loginAttempt);
});
\ No newline at end of file
......@@ -29,24 +29,29 @@ angular.module('ulakbus.crud', ['ui.bootstrap', 'schemaForm', 'formService'])
* @returns {*}
*/
generateParam: function (scope, routeParams, cmd) {
// define api request url path
scope.url = routeParams.wf;
// why do this??
angular.forEach(routeParams, function (value, key) {
if (key.indexOf('_id') > -1 && key !== 'param_id') {
scope.param = key;
scope.param_id = value;
}
});
scope.form_params = {
//cmd: cmd,
model: routeParams.model,
param: scope.param || routeParams.param,
id: scope.param_id || routeParams.param_id,
wf: routeParams.wf,
object_id: routeParams.key
object_id: routeParams.key,
filters: []
};
scope.form_params[scope.param] = scope.param_id;
if (scope.param_id) {
scope.form_params.filters.push({field: scope.param, values: [scope.param_id], type: 'check'});
}
scope.model = scope.form_params.model;
scope.wf = scope.form_params.wf;
scope.param = scope.form_params.param;
......@@ -150,16 +155,6 @@ angular.module('ulakbus.crud', ['ui.bootstrap', 'schemaForm', 'formService'])
}
};
$scope.filter = {};
$scope.addToFilter = function (field, filterValue) {
};
$scope.filterSubmit = function () {
};
$scope.do_action = function (key, cmd, mode) {
Generator.doItemAction($scope, key, cmd, mode || 'normal');
};
......@@ -168,22 +163,7 @@ angular.module('ulakbus.crud', ['ui.bootstrap', 'schemaForm', 'formService'])
return new Array(num);
};
$timeout(function () {
jQuery('.filterDate').datepicker({
changeMonth: true,
changeYear: true,
dateFormat: "dd.mm.yy",
onSelect: function (date, inst) {
//scope.model[k] = date;
//if (scope.modalElements) {
// scope.validateModalDate(k);
//}
//else {
// scope.$broadcast('schemaForm.error.' + k, 'tv4-302', true);
//}
}
}).datepicker("setDate", new Date());
});
;
//
$scope.showCmd = function () {
......@@ -299,6 +279,70 @@ angular.module('ulakbus.crud', ['ui.bootstrap', 'schemaForm', 'formService'])
return {
templateUrl: 'components/crud/templates/filter.html',
restrict: 'E',
replace: true
replace: true,
link: function ($scope) {
$scope.filters = {};
angular.forEach($scope.listFilters, function (value, key) {
$scope.filters[value.field] = {field: value.field, values: [], type: value.type};
//if (value.type === 'date') {
// $scope.form_params.filters.push({field: value.field, values: [$scope.filterStartDate, $scope.filterEndDate], type: value.type});
//}
});
$scope.filterStartDate;
$scope.filterEndDate;
$scope.status = {startOpened: false, endOpened: false};
$scope.dateFilterOpen = function ($event, which) {
this.status[which] = true;
};
$scope.format = 'dd.MM.yyyy'
}
};
})
.directive('dateFilter', function () {
return {
templateUrl: 'components/crud/templates/dateFilter.html',
restrict: 'E',
replace: true,
link: function ($scope) {
$scope.filterStartDate;
$scope.filterEndDate;
$scope.status = {startOpened: false, endOpened: false};
$scope.dateFilterOpen = function ($event, which) {
this.status[which] = true;
};
$scope.format = 'dd.MM.yyyy'
}
}
})
.directive('checkboxFilter', function () {
return {
templateUrl: 'components/crud/templates/dateFilter.html',
restrict: 'E',
replace: true,
link: function ($scope) {
$scope.filterStartDate;
$scope.filterEndDate;
$scope.status = {startOpened: false, endOpened: false};
$scope.dateFilterOpen = function ($event, which) {
this.status[which] = true;
};
$scope.format = 'dd.MM.yyyy'
}
}
})
.directive('selectFilter', function () {
return {
templateUrl: 'components/crud/templates/dateFilter.html',
restrict: 'E',
replace: true,
link: function ($scope) {
$scope.filterStartDate;
$scope.filterEndDate;
$scope.status = {startOpened: false, endOpened: false};
$scope.dateFilterOpen = function ($event, which) {
this.status[which] = true;
};
$scope.format = 'dd.MM.yyyy'
}
}
});
\ No newline at end of file
<div>
<h2>Filtrele</h2>
<div ng-repeat="filter in list_filters">
<div>
<div class=" clearfix">
......@@ -8,28 +9,57 @@
<div ng-if="filter.type==='check' || !filter.type">
<div class="checkbox" ng-repeat="filterItem in filter.values">
<input type="checkbox" name="filter_group[]" value="{{filterItem.value}}"/>{{filterItem.name}}<br />
<label class="checkbox-inline">
<input type="checkbox" name="filter_group[]" value="{{filterItem.value}}"/>
{{filterItem.name}}
</label>
</div>
</div>
<div ng-if="filter.type==='select'">
<div class="col-md-12">
<select name="filterSelect" id="filterSelect" class="form-control">
<option ng-repeat="filterItem in filter.values" value="{{filterItem.value}}">{{filterItem.name}}</option>
<option ng-repeat="filterItem in filter.values" value="{{filterItem.value}}">
{{filterItem.name}}
</option>
</select>
</div>
</div>
<div ng-if="filter.type==='date'">
<div class="col-md-6">
<br>
<div class="col-md-12">
<label class="control-label" for="startDate">Başlangıç</label>
<input type="text" name="startDate" class="form-control filterDate"/>
<p class="input-group">
<span class="input-group-btn">
<button type="button" class="btn btn-default" ng-click="dateFilterOpen($event, 'startOpened')">
<i class="fa fa-calendar"></i>
</button>
</span>
<input type="text" name="startDate" class="form-control" ng-model="filterStartDate"
uib-datepicker-popup="{{format}}"
is-open="status.startOpened"
close-text="Kapat"
current-text="Bugün"
clear-text="Temizle"
ng-click="dateFilterOpen($event, 'startOpened')"/></p>
</div>
<div class="col-md-6">
<br>
<div class="col-md-12">
<label class="control-label" for="endDate">Bitiş</label>
<input type="text" name="endDate" class="form-control filterDate"/>
<p class="input-group">
<span class="input-group-btn">
<button type="button" class="btn btn-default" ng-click="dateFilterOpen($event, 'endOpened')">
<i class="fa fa-calendar"></i>
</button>
</span>
<input type="text" name="endDate" class="form-control" ng-model="filterEndDate"
uib-datepicker-popup="{{format}}"
is-open="status.endOpened"
close-text="Kapat"
current-text="Bugün"
clear-text="Temizle"
ng-click="dateFilterOpen($event, 'endOpened')"/></p>
</div>
</div>
</div>
......
......@@ -12,7 +12,7 @@
<div class="dashboard-search-results">
<ul ng-if="students.length > 0">
<li ng-repeat="student in students">
<a href="javascript:void(0)" ng-click="select(student, 'ogrenci')">{{student}}</a>
<a href="javascript:void(0)" ng-click="select(student, 'ogrenci')">{{student[0]}}</a>
</li>
</ul>
</div>
......
......@@ -5,4 +5,4 @@ angular.module('ulakbus.version', [
'ulakbus.version.version-directive'
])
.value('version', '0.5.1');
.value('version', '0.6.0');
......@@ -5,7 +5,7 @@ describe('ulakbus.version module', function() {
describe('version service', function() {
it('should return current version', inject(function(version) {
expect(version).toEqual('0.5.1');
expect(version).toEqual('0.6.0');
}));
});
});
......@@ -93,7 +93,7 @@
<script src="tmp/templates.js"></script>
<script src="app.js"></script>
<script src="app_routes.js"></script>
<script src="shared/scripts/jquery-ui.min.js"></script>
<!--<script src="shared/scripts/jquery-ui.min.js"></script>-->
<script src="shared/directives.js"></script>
<script src="zetalib/interceptors.js"></script>
<script src="zetalib/form_service.js"></script>
......
......@@ -101,7 +101,7 @@
<script src="tmp/templates.js"></script>
<script src="app.js"></script>
<script src="app_routes.js"></script>
<script src="shared/scripts/jquery-ui.min.js"></script>
<!--<script src="shared/scripts/jquery-ui.min.js"></script>-->
<script src="shared/directives.js"></script>
<script src="zetalib/interceptors.js"></script>
<script src="zetalib/form_service.js"></script>
......
......@@ -331,8 +331,9 @@ app.directive('logout', function ($http, $location, RESTURL) {
// changing menu items by listening for broadcast
$scope.$on("menuitems", function (event, data) {
var menu = {other: $scope.allMenuItems.other};
var menu = {};
menu[data] = $scope.allMenuItems[data];
menu['other'] = $scope.allMenuItems.other;
$scope.menuItems = $scope.prepareMenu(menu);
$timeout(function () {
sidebarmenu.metisMenu()
......
......@@ -184,12 +184,17 @@ angular.module('formService', ['ui.bootstrap'])
// check if type is date and if type date found change it to string
if (v.type === 'date') {
var modelDate = angular.copy(scope.model[k]);
if (isNaN(new Date(scope.model[k]))) {
var modelDate;
}
else {
var modelDate = new Date(scope.model[k]);
}
scope.model[k] = generator.dateformatter(scope.model[k]);
scope.form[scope.form.indexOf(k)] = {
key: k, name: k, title: v.title,
type: 'template',
modelDate: new Date(modelDate),
modelDate: modelDate,
templateUrl: 'shared/templates/datefield.html',
validationMessage: {
'dateNotValid': "Girdiğiniz tarih geçerli değildir. <i>orn: '01.01.2015'<i/>",
......@@ -200,6 +205,9 @@ angular.module('formService', ['ui.bootstrap'])
var deferred = $q.defer();
$timeout(function () {
scope.model[k] = angular.copy(generator.dateformatter(value));
if (scope.schema.required.indexOf(k) > -1) {
deferred.resolve();
}
if (value.constructor === Date) {
deferred.resolve();
}
......
This diff is collapsed.
......@@ -39,6 +39,7 @@ app.config(['$httpProvider', function ($httpProvider) {
}
if (response.data.is_login === true) {
$rootScope.loggedInUser = true;
$rootScope.loginAttempt = 1; // this needs for popup errors
if ($location.path() === "/login") {
$location.path("/dashboard");
}
......@@ -52,6 +53,10 @@ app.config(['$httpProvider', function ($httpProvider) {
'responseError': function (rejection) {
var errorModal = function () {
if ($rootScope.loginAttempt === 0) {
console.log('not logged in, no alert message triggered');
return;
}
var codefield = "";
if (rejection.data.error) {
codefield = '<p><pre>' +
......
This diff is collapsed.
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