Commit 299b8a16 authored by Evren Kutar's avatar Evren Kutar

Merge branch 'Feature/issue67'

parents 73d325c1 6faeed33
...@@ -62,14 +62,17 @@ constant("USER_ROLES", { ...@@ -62,14 +62,17 @@ constant("USER_ROLES", {
staff: "staff", staff: "staff",
dean: "dean" dean: "dean"
}). }).
constant('AUTH_EVENTS', { constant('AUTH_EVENTS', {
loginSuccess: 'auth-login-success', loginSuccess: 'auth-login-success',
loginFailed: 'auth-login-failed', loginFailed: 'auth-login-failed',
logoutSuccess: 'auth-logout-success', logoutSuccess: 'auth-logout-success',
sessionTimeout: 'auth-session-timeout', sessionTimeout: 'auth-session-timeout',
notAuthenticated: 'auth-not-authenticated', notAuthenticated: 'auth-not-authenticated',
notAuthorized: 'auth-not-authorized' notAuthorized: 'auth-not-authorized'
}); })
.config(function ($logProvider) {
$logProvider.debugEnabled(true);
});
// test the code with strict di mode to see if it works when minified // test the code with strict di mode to see if it works when minified
......
...@@ -67,14 +67,22 @@ constant("USER_ROLES", { ...@@ -67,14 +67,22 @@ constant("USER_ROLES", {
staff: "staff", staff: "staff",
dean: "dean" dean: "dean"
}). }).
constant('AUTH_EVENTS', { constant('AUTH_EVENTS', {
loginSuccess: 'auth-login-success', loginSuccess: 'auth-login-success',
loginFailed: 'auth-login-failed', loginFailed: 'auth-login-failed',
logoutSuccess: 'auth-logout-success', logoutSuccess: 'auth-logout-success',
sessionTimeout: 'auth-session-timeout', sessionTimeout: 'auth-session-timeout',
notAuthenticated: 'auth-not-authenticated', notAuthenticated: 'auth-not-authenticated',
notAuthorized: 'auth-not-authorized' notAuthorized: 'auth-not-authorized'
}); })
.config(function ($logProvider) {
// @if NODE_ENV='PRODUCTION'
$logProvider.debugEnabled(false);
// @endif
// @if NODE_ENV='DEVELOPMENT'
$logProvider.debugEnabled(true);
// @endif
});
// test the code with strict di mode to see if it works when minified // test the code with strict di mode to see if it works when minified
......
...@@ -235,7 +235,6 @@ app.directive('logout', function ($http, $location, RESTURL) { ...@@ -235,7 +235,6 @@ app.directive('logout', function ($http, $location, RESTURL) {
$scope.style = 'width:calc(100% - 300px);'; $scope.style = 'width:calc(100% - 300px);';
$scope.$on('$routeChangeStart', function () { $scope.$on('$routeChangeStart', function () {
$scope.style = $location.path() === '/dashboard' ? 'width:calc(100% - 300px);' : 'width:%100 !important;'; $scope.style = $location.path() === '/dashboard' ? 'width:calc(100% - 300px);' : 'width:%100 !important;';
console.log('style of header', $location.path())
}); });
} }
}; };
......
...@@ -8,11 +8,12 @@ ...@@ -8,11 +8,12 @@
<div class="form-group input-group"> <div class="form-group input-group">
<span class="input-group-btn"> <span class="input-group-btn">
<button class="btn btn-default dropdown-toggle" type="button" data-toggle="dropdown"> <button class="btn btn-default dropdown-toggle" type="button" ng-click="form.getDropdownTitleMap()"
data-toggle="dropdown">
<span class="caret"></span> <span class="caret"></span>
</button> </button>
<ul class="dropdown-menu"> <ul class="dropdown-menu">
<li class="text-center"><a><span class="loader"></span></a></li> <li class="text-center" ng-if="form.gettingTitleMap"><a><span class="loader"></span></a></li>
<li ng-repeat="item in form.titleMap"> <li ng-repeat="item in form.titleMap">
<a ng-click="form.onDropdownSelect(item, form.model_name)">{{item <a ng-click="form.onDropdownSelect(item, form.model_name)">{{item
.name}}</a> .name}}</a>
...@@ -21,8 +22,10 @@ ...@@ -21,8 +22,10 @@
</span> </span>
<input type="text" <input type="text"
ng-model="$$value$$" ng-model="$$value$$"
uib-typeahead="item as item.name for item in form.getTitleMap($viewValue) | filter:{name:$viewValue}" uib-typeahead="item as item.name for item in form.getTitleMap($viewValue)"
typeahead-on-select="form.onSelect($item)" typeahead-on-select="form.onSelect($item)"
typeahead-loading="loadingTitleMap" typeahead-no-results="noResults"
typeahead-wait-ms="500"
placeholder="{{form.title}}" placeholder="{{form.title}}"
ng-model-options="form.ngModelOptions" ng-model-options="form.ngModelOptions"
ng-disabled="form.readonly" ng-disabled="form.readonly"
...@@ -31,6 +34,10 @@ ...@@ -31,6 +34,10 @@
schema-validate="form" schema-validate="form"
name="{{form.model_name}}"/> name="{{form.model_name}}"/>
</div> </div>
<div ng-show="loadingTitleMap" class="loader"></div>
<div ng-show="noResults">
<i class="fa fa-close"></i> bulunamadı
</div>
<!--<select ng-model="$$value$$"--> <!--<select ng-model="$$value$$"-->
<!--value="$$value$$"--> <!--value="$$value$$"-->
......
...@@ -259,7 +259,7 @@ angular.module('formService', ['ui.bootstrap']) ...@@ -259,7 +259,7 @@ angular.module('formService', ['ui.bootstrap'])
//}); //});
scope.generateTitleMap = function (modelScope) { scope.generateTitleMap = function (modelScope) {
generator.get_list(modelScope).then(function (res) { return generator.get_list(modelScope).then(function (res) {
formitem.titleMap = []; formitem.titleMap = [];
angular.forEach(res.data.objects, function (item) { angular.forEach(res.data.objects, function (item) {
if (item !== "-1") { if (item !== "-1") {
...@@ -268,26 +268,31 @@ angular.module('formService', ['ui.bootstrap']) ...@@ -268,26 +268,31 @@ angular.module('formService', ['ui.bootstrap'])
"name": item.value "name": item.value
}); });
} }
// get selected item from titleMap using model value
if (item.key === scope.model[k]) {
formitem.selected_item = {value: item.key, name: item.value};
}
}); });
try {
// after rendering change input value to model value return formitem.titleMap;
});
};
// get selected item from titleMap using model value
if (scope.model[k]) {
generator.get_list({url: 'crud', form_params: {model: v.model_name, object_id: scope.model[k], cmd: 'show'}})
.then(function (data) {
try{
scope.$watch(document.querySelector('input[name=' + v.model_name + ']'), scope.$watch(document.querySelector('input[name=' + v.model_name + ']'),
function () { function () {
angular.element(document.querySelector('input[name=' + v.model_name + ']')).val(formitem.selected_item.name); angular.element(document.querySelector('input[name=' + v.model_name + ']')).val(data.data.object.unicode);
} }
); );
} }
catch (e) { catch(e) {
angular.element(document.querySelector('input[name=' + v.model_name + ']')).val(formitem.selected_item.name); angular.element(document.querySelector('input[name=' + v.model_name + ']')).val(data.data.object.unicode);
$log.debug('exception', e); $log.debug('exception', e);
} }
}) });
}; }
formitem = { formitem = {
type: "template", type: "template",
...@@ -300,13 +305,30 @@ angular.module('formService', ['ui.bootstrap']) ...@@ -300,13 +305,30 @@ angular.module('formService', ['ui.bootstrap'])
name: v.model_name, name: v.model_name,
model_name: v.model_name, model_name: v.model_name,
selected_item: {}, selected_item: {},
titleMap: scope.generateTitleMap(modelScope), titleMap: [],
onSelect: function (item) { onSelect: function (item) {
scope.model[k] = item.value; scope.model[k] = item.value;
}, },
onDropdownSelect: function (item, inputname) { onDropdownSelect: function (item, inputname) {
scope.model[k] = item.value; scope.model[k] = item.value;
jQuery('input[name=' + inputname + ']').val(item.name); jQuery('input[name=' + inputname + ']').val(item.name);
},
getTitleMap: function (viewValue) {
modelScope.form_params.query = viewValue;
return scope.generateTitleMap(modelScope);
},
getDropdownTitleMap: function () {
formitem.gettingTitleMap = true;
if (formitem.titleMap.length > 0) {
formitem.gettingTitleMap = false;
} else {
scope.generateTitleMap(modelScope)
.then(function (data) {
formitem.titleMap = data;
formitem.gettingTitleMap = false;
});
}
} }
}; };
......
This diff is collapsed.
This diff is collapsed.
angular.module('templates-prod', ['components/auth/fieldset.html', 'components/auth/login.html', 'components/crud/templates/crud.html', 'components/crud/templates/filter.html', 'components/crud/templates/form.html', 'components/crud/templates/list.html', 'components/crud/templates/show.html', 'components/dashboard/dashboard.html', 'components/debug/debug.html', 'components/devSettings/devSettings.html', 'components/error_pages/404.html', 'components/error_pages/500.html', 'components/uitemplates/404.html', 'components/uitemplates/500.html', 'shared/templates/add.html', 'shared/templates/datefield.html', 'shared/templates/directives/alert.html', 'shared/templates/directives/chat.html', 'shared/templates/directives/header-breadcrumb.html', 'shared/templates/directives/header-notification.html', 'shared/templates/directives/header-sub-menu.html', 'shared/templates/directives/menuCollapse.html', 'shared/templates/directives/msgbox.html', 'shared/templates/directives/notifications.html', 'shared/templates/directives/search.html', 'shared/templates/directives/selected-user.html', 'shared/templates/directives/selectedUserPopover.html', 'shared/templates/directives/sidebar-notification.html', 'shared/templates/directives/sidebar-search.html', 'shared/templates/directives/sidebar.html', 'shared/templates/directives/sort.html', 'shared/templates/directives/stats.html', 'shared/templates/directives/timeline.html', 'shared/templates/fieldset.html', 'shared/templates/foreignKey.html', 'shared/templates/linkedModelModalContent.html', 'shared/templates/listnodeModalContent.html', 'shared/templates/modalContent.html', 'shared/templates/multiselect.html', 'shared/templates/nodeTable.html', 'shared/templates/select.html']); angular.module('templates-prod', ['components/auth/login.html', 'components/crud/templates/crud.html', 'components/crud/templates/filter.html', 'components/crud/templates/form.html', 'components/crud/templates/list.html', 'components/crud/templates/show.html', 'components/dashboard/dashboard.html', 'components/debug/debug.html', 'components/devSettings/devSettings.html', 'components/error_pages/404.html', 'components/error_pages/500.html', 'components/uitemplates/404.html', 'components/uitemplates/500.html', 'shared/templates/add.html', 'shared/templates/datefield.html', 'shared/templates/directives/alert.html', 'shared/templates/directives/chat.html', 'shared/templates/directives/header-breadcrumb.html', 'shared/templates/directives/header-notification.html', 'shared/templates/directives/header-sub-menu.html', 'shared/templates/directives/menuCollapse.html', 'shared/templates/directives/msgbox.html', 'shared/templates/directives/notifications.html', 'shared/templates/directives/search.html', 'shared/templates/directives/selected-user.html', 'shared/templates/directives/selectedUserPopover.html', 'shared/templates/directives/sidebar-notification.html', 'shared/templates/directives/sidebar-search.html', 'shared/templates/directives/sidebar.html', 'shared/templates/directives/sort.html', 'shared/templates/directives/stats.html', 'shared/templates/directives/timeline.html', 'shared/templates/fieldset.html', 'shared/templates/foreignKey.html', 'shared/templates/linkedModelModalContent.html', 'shared/templates/listnodeModalContent.html', 'shared/templates/modalContent.html', 'shared/templates/multiselect.html', 'shared/templates/nodeTable.html', 'shared/templates/select.html']);
angular.module("components/auth/fieldset.html", []).run(["$templateCache", function($templateCache) {
$templateCache.put("components/auth/fieldset.html",
"<div ng-app=\"ulakbus.fieldset\" class=\"\">\n" +
" <div style=\"margin-top: 50px;\">\n" +
" <span class=\"label label-warning\">{{message}}</span>\n" +
"\n" +
" <form name=\"loginForm\" sf-schema=\"schema\" sf-form=\"form\" sf-model=\"model\"\n" +
" ng-submit=\"onSubmit(loginForm)\"></form>\n" +
" </div>\n" +
"</div>");
}]);
angular.module("components/auth/login.html", []).run(["$templateCache", function($templateCache) { angular.module("components/auth/login.html", []).run(["$templateCache", function($templateCache) {
$templateCache.put("components/auth/login.html", $templateCache.put("components/auth/login.html",
...@@ -1466,11 +1454,12 @@ angular.module("shared/templates/foreignKey.html", []).run(["$templateCache", fu ...@@ -1466,11 +1454,12 @@ angular.module("shared/templates/foreignKey.html", []).run(["$templateCache", fu
"\n" + "\n" +
" <div class=\"form-group input-group\">\n" + " <div class=\"form-group input-group\">\n" +
" <span class=\"input-group-btn\">\n" + " <span class=\"input-group-btn\">\n" +
" <button class=\"btn btn-default dropdown-toggle\" type=\"button\" data-toggle=\"dropdown\">\n" + " <button class=\"btn btn-default dropdown-toggle\" type=\"button\" ng-click=\"form.getDropdownTitleMap()\"\n" +
" data-toggle=\"dropdown\">\n" +
" <span class=\"caret\"></span>\n" + " <span class=\"caret\"></span>\n" +
" </button>\n" + " </button>\n" +
" <ul class=\"dropdown-menu\">\n" + " <ul class=\"dropdown-menu\">\n" +
" <li class=\"text-center\"><a><span class=\"loader\"></span></a></li>\n" + " <li class=\"text-center\" ng-if=\"form.gettingTitleMap\"><a><span class=\"loader\"></span></a></li>\n" +
" <li ng-repeat=\"item in form.titleMap\">\n" + " <li ng-repeat=\"item in form.titleMap\">\n" +
" <a ng-click=\"form.onDropdownSelect(item, form.model_name)\">{{item\n" + " <a ng-click=\"form.onDropdownSelect(item, form.model_name)\">{{item\n" +
" .name}}</a>\n" + " .name}}</a>\n" +
...@@ -1479,8 +1468,10 @@ angular.module("shared/templates/foreignKey.html", []).run(["$templateCache", fu ...@@ -1479,8 +1468,10 @@ angular.module("shared/templates/foreignKey.html", []).run(["$templateCache", fu
" </span>\n" + " </span>\n" +
" <input type=\"text\"\n" + " <input type=\"text\"\n" +
" ng-model=\"$$value$$\"\n" + " ng-model=\"$$value$$\"\n" +
" uib-typeahead=\"item as item.name for item in form.getTitleMap($viewValue) | filter:{name:$viewValue}\"\n" + " uib-typeahead=\"item as item.name for item in form.getTitleMap($viewValue)\"\n" +
" typeahead-on-select=\"form.onSelect($item)\"\n" + " typeahead-on-select=\"form.onSelect($item)\"\n" +
" typeahead-loading=\"loadingTitleMap\" typeahead-no-results=\"noResults\"\n" +
" typeahead-wait-ms=\"500\"\n" +
" placeholder=\"{{form.title}}\"\n" + " placeholder=\"{{form.title}}\"\n" +
" ng-model-options=\"form.ngModelOptions\"\n" + " ng-model-options=\"form.ngModelOptions\"\n" +
" ng-disabled=\"form.readonly\"\n" + " ng-disabled=\"form.readonly\"\n" +
...@@ -1489,6 +1480,10 @@ angular.module("shared/templates/foreignKey.html", []).run(["$templateCache", fu ...@@ -1489,6 +1480,10 @@ angular.module("shared/templates/foreignKey.html", []).run(["$templateCache", fu
" schema-validate=\"form\"\n" + " schema-validate=\"form\"\n" +
" name=\"{{form.model_name}}\"/>\n" + " name=\"{{form.model_name}}\"/>\n" +
" </div>\n" + " </div>\n" +
" <div ng-show=\"loadingTitleMap\" class=\"loader\"></div>\n" +
" <div ng-show=\"noResults\">\n" +
" <i class=\"fa fa-close\"></i> bulunamadı\n" +
" </div>\n" +
"\n" + "\n" +
" <!--<select ng-model=\"$$value$$\"-->\n" + " <!--<select ng-model=\"$$value$$\"-->\n" +
" <!--value=\"$$value$$\"-->\n" + " <!--value=\"$$value$$\"-->\n" +
......
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