Commit 6faeed33 authored by Evren Kutar's avatar Evren Kutar

resolves #67

remove console.logs
configure debug log settings in app.js based on production / development
parent 73d325c1
......@@ -62,14 +62,17 @@ constant("USER_ROLES", {
staff: "staff",
dean: "dean"
}).
constant('AUTH_EVENTS', {
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'
});
})
.config(function ($logProvider) {
$logProvider.debugEnabled(true);
});
// test the code with strict di mode to see if it works when minified
......
......@@ -67,14 +67,22 @@ constant("USER_ROLES", {
staff: "staff",
dean: "dean"
}).
constant('AUTH_EVENTS', {
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'
});
})
.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
......
......@@ -235,7 +235,6 @@ app.directive('logout', function ($http, $location, RESTURL) {
$scope.style = 'width:calc(100% - 300px);';
$scope.$on('$routeChangeStart', function () {
$scope.style = $location.path() === '/dashboard' ? 'width:calc(100% - 300px);' : 'width:%100 !important;';
console.log('style of header', $location.path())
});
}
};
......
......@@ -8,11 +8,12 @@
<div class="form-group input-group">
<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>
</button>
<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">
<a ng-click="form.onDropdownSelect(item, form.model_name)">{{item
.name}}</a>
......@@ -21,8 +22,10 @@
</span>
<input type="text"
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-loading="loadingTitleMap" typeahead-no-results="noResults"
typeahead-wait-ms="500"
placeholder="{{form.title}}"
ng-model-options="form.ngModelOptions"
ng-disabled="form.readonly"
......@@ -31,6 +34,10 @@
schema-validate="form"
name="{{form.model_name}}"/>
</div>
<div ng-show="loadingTitleMap" class="loader"></div>
<div ng-show="noResults">
<i class="fa fa-close"></i> bulunamadı
</div>
<!--<select ng-model="$$value$$"-->
<!--value="$$value$$"-->
......
......@@ -259,7 +259,7 @@ angular.module('formService', ['ui.bootstrap'])
//});
scope.generateTitleMap = function (modelScope) {
generator.get_list(modelScope).then(function (res) {
return generator.get_list(modelScope).then(function (res) {
formitem.titleMap = [];
angular.forEach(res.data.objects, function (item) {
if (item !== "-1") {
......@@ -268,26 +268,31 @@ angular.module('formService', ['ui.bootstrap'])
"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 + ']'),
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) {
angular.element(document.querySelector('input[name=' + v.model_name + ']')).val(formitem.selected_item.name);
catch(e) {
angular.element(document.querySelector('input[name=' + v.model_name + ']')).val(data.data.object.unicode);
$log.debug('exception', e);
}
})
};
});
}
formitem = {
type: "template",
......@@ -300,13 +305,30 @@ angular.module('formService', ['ui.bootstrap'])
name: v.model_name,
model_name: v.model_name,
selected_item: {},
titleMap: scope.generateTitleMap(modelScope),
titleMap: [],
onSelect: function (item) {
scope.model[k] = item.value;
},
onDropdownSelect: function (item, inputname) {
scope.model[k] = item.value;
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("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('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/login.html", []).run(["$templateCache", function($templateCache) {
$templateCache.put("components/auth/login.html",
......@@ -1466,11 +1454,12 @@ angular.module("shared/templates/foreignKey.html", []).run(["$templateCache", fu
"\n" +
" <div class=\"form-group input-group\">\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" +
" </button>\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" +
" <a ng-click=\"form.onDropdownSelect(item, form.model_name)\">{{item\n" +
" .name}}</a>\n" +
......@@ -1479,8 +1468,10 @@ angular.module("shared/templates/foreignKey.html", []).run(["$templateCache", fu
" </span>\n" +
" <input type=\"text\"\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-loading=\"loadingTitleMap\" typeahead-no-results=\"noResults\"\n" +
" typeahead-wait-ms=\"500\"\n" +
" placeholder=\"{{form.title}}\"\n" +
" ng-model-options=\"form.ngModelOptions\"\n" +
" ng-disabled=\"form.readonly\"\n" +
......@@ -1489,6 +1480,10 @@ angular.module("shared/templates/foreignKey.html", []).run(["$templateCache", fu
" schema-validate=\"form\"\n" +
" name=\"{{form.model_name}}\"/>\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" +
" <!--<select ng-model=\"$$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