Commit a8603069 authored by Evren Kutar's avatar Evren Kutar

Merge branch 'Feature/issue39'

parents 0e38699b 16f86cd2
...@@ -18,6 +18,23 @@ body { ...@@ -18,6 +18,23 @@ body {
background-color:#999; background-color:#999;
} }
.panel {
border:none;
-webkit-box-shadow: 0 0px 4px rgba(0,0,0,.15);
box-shadow: 0 0px 4px rgba(0,0,0,.15);
}
.panel-footer {
border-top: 1px solid #F3F3F3;
background-color:#fff;
}
.panel-info>.panel-heading {
background-color: #6CBECC;
border:none;
color:#fff;
}
.badge { .badge {
border-radius: 100%; border-radius: 100%;
width: 22px; width: 22px;
...@@ -340,6 +357,7 @@ select { ...@@ -340,6 +357,7 @@ select {
} }
.manager-view-content { .manager-view-content {
width: calc(100% - 300px);
padding:35px 40px; padding:35px 40px;
overflow:auto; overflow:auto;
-webkit-flex-grow: 1; -webkit-flex-grow: 1;
...@@ -1017,7 +1035,7 @@ table.dataTable thead .sorting:after { ...@@ -1017,7 +1035,7 @@ table.dataTable thead .sorting:after {
} }
.dashboard-main-search { .dashboard-main-search {
width: calc(100% - 300px);
} }
.dashboard-main-search .dashboard-student-search h3, .dashboard-main-search .dashboard-student-search h3,
...@@ -1046,6 +1064,7 @@ table.dataTable thead .sorting:after { ...@@ -1046,6 +1064,7 @@ table.dataTable thead .sorting:after {
background-color: #FBF9F9; background-color: #FBF9F9;
cursor:pointer; cursor:pointer;
color:#5A5A5A; color:#5A5A5A;
margin-left:-4px;
} }
.dashboard-student-search { .dashboard-student-search {
......
...@@ -13,15 +13,15 @@ ...@@ -13,15 +13,15 @@
<table class="table table-bordered" style="background-color:#fff;"> <table class="table table-bordered" style="background-color:#fff;">
<thead> <thead>
<tr> <tr>
<th colspan="2"> <td colspan="2">
<label> <label>
<input type="checkbox" style="zoom:1.5; margin:5px 0 0 8px;"> <input type="checkbox" style="zoom:1.5; margin:5px 0 0 8px;">
Hepsini Seç Hepsini Seç
</label> </label>
</th> </td>
<th ng-repeat="value in nobjects[0]" ng-if="nobjects[0]!='-1'">{{ value }}</th> <td ng-repeat="value in nobjects[0]" ng-if="nobjects[0]!='-1' && !$last">{{ value }}</td>
<th ng-if="nobjects[0]=='-1'">{{ model }}</th> <td ng-if="nobjects[0]=='-1'">{{ model }}</td>
<th>action</th> <td>action</td>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
...@@ -31,18 +31,18 @@ ...@@ -31,18 +31,18 @@
<input type="checkbox" style="zoom:1.5; margin:5px 0 0 8px;"> <input type="checkbox" style="zoom:1.5; margin:5px 0 0 8px;">
</label> </label>
</td> </td>
<th scope="row" style="text-align:center">{{$index}}</th> <td scope="row" style="text-align:center">{{$index}}</td>
<!-- below 2 of object will not be listed there for ng repeat loops 2 less --> <!-- below 2 of object will not be listed there for ng repeat loops 2 less -->
<td ng-repeat="k in object track by $index" ng-if="nobjects[0]=='-1' && $index>1"> <td ng-repeat="k in object track by $index" ng-if="nobjects[0]=='-1' && $index>0 && !$last">
<a ng-href="{{object[2].detailLink}}">{{object[1]}}</a> <a ng-href="{{object[object.length-1].detailLink}}">{{object[1]}}</a>
</td> </td>
<td ng-repeat="(key,value) in object track by $index" ng-if="nobjects[0]!='-1' && $index>1"> <td ng-repeat="(key,value) in object track by $index" ng-if="nobjects[0]!='-1' && $index>0 && !$last">
<a ng-href="{{object[2].detailLink}}" ng-if="$index==1">{{object[key]}}</a> <a ng-href="{{object[object.length-1].detailLink}}" ng-if="$index==1">{{object[key]}}</a>
<span ng-if="$index!=1">{{object[key]}}</span> <span ng-if="$index!=1">{{object[key]}}</span>
</td> </td>
<td> <td>
<a ng-href="{{object[2].editLink}}">Edit</a> <a ng-href="{{object[object.length-1].editLink}}">Edit</a>
<br> <br>
</td> </td>
</tr> </tr>
......
...@@ -324,6 +324,18 @@ app.directive('notifications', function () { ...@@ -324,6 +324,18 @@ app.directive('notifications', function () {
}; };
}); });
/**
* msgbox directive
*/
app.directive('msgbox', function () {
return {
templateUrl: 'shared/templates/directives/msgbox.html',
restrict: 'E',
replace: false
};
});
/** /**
* search directive in sidebar * search directive in sidebar
*/ */
......
<div class="col-lg-4">
<div class="panel" ng-class="{'info':'panel-info', 'error': 'panel-red', 'warning': 'panel-yellow'}[msgbox.type]">
<div class="panel-heading">
{{msgbox.title}}
</div>
<div class="panel-body">
<p>{{msgbox.msg}}</p>
</div>
<!--<div class="panel-footer">-->
<!--</div>-->
</div>
</div>
<!--<div class="row">-->
<!--<div class="col-lg-4">-->
<!--<div class="panel panel-primary">-->
<!--<div class="panel-heading">-->
<!--Primary Panel-->
<!--</div>-->
<!--<div class="panel-body">-->
<!--<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum tincidunt est vitae ultrices accumsan. Aliquam ornare lacus adipiscing, posuere lectus et, fringilla augue.</p>-->
<!--</div>-->
<!--<div class="panel-footer">-->
<!--Panel Footer-->
<!--</div>-->
<!--</div>-->
<!--</div>-->
<!--<div class="col-lg-4">-->
<!--<div class="panel panel-green">-->
<!--<div class="panel-heading">-->
<!--Success Panel-->
<!--</div>-->
<!--<div class="panel-body">-->
<!--<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum tincidunt est vitae ultrices accumsan. Aliquam ornare lacus adipiscing, posuere lectus et, fringilla augue.</p>-->
<!--</div>-->
<!--<div class="panel-footer">-->
<!--Panel Footer-->
<!--</div>-->
<!--</div>-->
<!--&lt;!&ndash; /.col-lg-4 &ndash;&gt;-->
<!--</div>-->
<!--<div class="col-lg-4">-->
<!--<div class="panel panel-yellow">-->
<!--<div class="panel-heading">-->
<!--Warning Panel-->
<!--</div>-->
<!--<div class="panel-body">-->
<!--<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum tincidunt est vitae ultrices accumsan. Aliquam ornare lacus adipiscing, posuere lectus et, fringilla augue.</p>-->
<!--</div>-->
<!--<div class="panel-footer">-->
<!--Panel Footer-->
<!--</div>-->
<!--</div>-->
<!--&lt;!&ndash; /.col-lg-4 &ndash;&gt;-->
<!--</div>-->
<!--</div>-->
<!--<div class="row">-->
<!--<div class="col-lg-4">-->
<!--<div class="panel panel-red">-->
<!--<div class="panel-heading">-->
<!--Danger Panel-->
<!--</div>-->
<!--<div class="panel-body">-->
<!--<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum tincidunt est vitae ultrices accumsan. Aliquam ornare lacus adipiscing, posuere lectus et, fringilla augue.</p>-->
<!--</div>-->
<!--<div class="panel-footer">-->
<!--Panel Footer-->
<!--</div>-->
<!--</div>-->
<!--&lt;!&ndash; /.col-lg-4 &ndash;&gt;-->
<!--</div>-->
<!--</div>-->
\ No newline at end of file
<div class="navbar-default sidebar" role="navigation" ng-mouseenter="openSidebar()" ng-mouseleave="closeSidebar()"> <div class="navbar-default sidebar" role="navigation" ng-mouseenter="openSidebar()" ng-mouseleave="closeSidebar()">
<div class="brand"> <div class="brand">
<a href="" class="logo"><img src="/img/brand-logo.png" /></a> <a href="#/dashboard" class="logo"><img src="/img/brand-logo.png" /></a>
</div> </div>
<div class="sidebar-nav navbar-collapse"> <div class="sidebar-nav navbar-collapse">
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
var form_generator = angular.module('formService', ['general']); var form_generator = angular.module('formService', ['general']);
form_generator.factory('Generator', function ($http, $q, $timeout, $location, RESTURL, FormDiff, $rootScope) { form_generator.factory('Generator', function ($http, $q, $timeout, $location, $compile, RESTURL, FormDiff, $rootScope) {
var generator = {}; var generator = {};
generator.makeUrl = function (scope) { generator.makeUrl = function (scope) {
var getparams = scope.form_params.param ? "?" + scope.form_params.param + "=" + scope.form_params.id : ""; var getparams = scope.form_params.param ? "?" + scope.form_params.param + "=" + scope.form_params.id : "";
...@@ -65,12 +65,13 @@ form_generator.factory('Generator', function ($http, $q, $timeout, $location, RE ...@@ -65,12 +65,13 @@ form_generator.factory('Generator', function ($http, $q, $timeout, $location, RE
// generically change _id fields model value // generically change _id fields model value
if ('form_params' in scope) {
if (k == scope.form_params.param) { if (k == scope.form_params.param) {
scope.model[k] = scope.form_params.id; scope.model[k] = scope.form_params.id;
scope.form.splice(scope.form.indexOf(k), 1); scope.form.splice(scope.form.indexOf(k), 1);
return; return;
} }
}
if (v.type === 'select') { if (v.type === 'select') {
scope.form[scope.form.indexOf(k)] = { scope.form[scope.form.indexOf(k)] = {
...@@ -261,8 +262,9 @@ form_generator.factory('Generator', function ($http, $q, $timeout, $location, RE ...@@ -261,8 +262,9 @@ form_generator.factory('Generator', function ($http, $q, $timeout, $location, RE
} }
if (value !== '-1') { if (value !== '-1') {
value[2] = {detailLink: makelink("detail/"), editLink: makelink("edit/")}; value.push({detailLink: makelink("detail/"), editLink: makelink("edit/")});
} }
console.log(value);
}); });
}; };
generator.get_form = function (scope) { generator.get_form = function (scope) {
...@@ -336,7 +338,7 @@ form_generator.factory('Generator', function ($http, $q, $timeout, $location, RE ...@@ -336,7 +338,7 @@ form_generator.factory('Generator', function ($http, $q, $timeout, $location, RE
var data = { var data = {
"form": $scope.model, "form": $scope.model,
"cmd": $scope.form_params.cmd, "cmd": $scope.form_params.cmd,
"subcmd": "do_list", //"subcmd": "do_list",
"model": $scope.form_params.model, "model": $scope.form_params.model,
"token": $scope.token "token": $scope.token
}; };
...@@ -348,20 +350,28 @@ form_generator.factory('Generator', function ($http, $q, $timeout, $location, RE ...@@ -348,20 +350,28 @@ form_generator.factory('Generator', function ($http, $q, $timeout, $location, RE
return $http.post(generator.makeUrl($scope), data) return $http.post(generator.makeUrl($scope), data)
.success(function (data) { .success(function (data) {
// if return data consists forms key then trogger redraw the form with updated data // if return data consists forms key then trigger redraw the form with updated data
if (data.forms) { if (data.forms) {
delete $scope.form, $scope.model, $scope.schema, $scope.form_params.cmd;
generator.generate($scope, data); generator.generate($scope, data);
$scope.$broadcast('schemaFormRedraw') $scope.$broadcast('schemaFormRedraw')
} }
// if submit returns nobjects after save // if submit returns nobjects after save
if (data.nobjects) { if (data.nobjects) {
generator.itemLinksGenerator($scope, data); generator.itemLinksGenerator($scope, data);
data[$scope.form_params.param] = $scope.form_params.id; data[$scope.form_params.param] = $scope.form_params.id;
$location.path('/crud/' + $scope.form_params.model + '/list').search(angular.fromJson(data)); $location.path('/crud/' + $scope.form_params.model + '/list').search(angular.fromJson(data));
} }
// if submit returns msgbox after save
if (data.msgbox) {
$scope.msgbox = data.msgbox;
var newElement = $compile( "<msgbox ></msgbox>" )( $scope );
angular.element(document.querySelector('.main.ng-scope')).children().remove();
angular.element(document.querySelector('.main.ng-scope')).append( newElement );
}
}); });
}; };
return generator; return generator;
......
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