Commit 5bbee45f authored by Evren Kutar's avatar Evren Kutar

selective listing implementation

parent 0377c148
......@@ -245,6 +245,13 @@ angular.module('ulakbus.crud', ['schemaForm', 'ui.bootstrap', 'ulakbus.formServi
}
$scope.createListObjects();
};
// selective listing for list page todo: add to documentation
$scope.selective_list_key = 0;
$scope.update_selective_list = function () {
$scope.objects = $scope.all_objects[$scope.selective_list_key]["objects"];
};
// end of selective listing
$scope.listFormCmd = function () {
// function to set scope objects
var setpageobjects = function (data) {
......@@ -274,6 +281,12 @@ angular.module('ulakbus.crud', ['schemaForm', 'ui.bootstrap', 'ulakbus.formServi
if ($scope.object) {
$scope.createListObjects();
}
// if selective listing then change objects key to its first item
if ($scope.meta.selective_listing) {
$scope.all_objects = angular.copy($scope.objects);
$scope.objects = $scope.all_objects[0]["objects"];
}
};
$scope.reloadCmd = function () {
var pageData = Generator.getPageData();
......
......@@ -3,11 +3,21 @@
<search-directive ng-if="meta['allow_search']===true"></search-directive>
<div class="clearfix"></div>
<!--<h1>{{form_params.model || form_params.wf}}</h1>-->
<div class="row" ng-if="!objects[1]">
<div class="row" ng-if="(!meta.selective_listing && !objects[1])">
<div class="col-md-12">
<p class="no-content">Listelenecek içerik yok.</p>
</div>
</div>
<!-- todo: add `selective_list` to documentation -->
<div ng-if="meta.selective_listing === true">
<label for="selective_list">{{meta.selective_listing_label || "Sayfa içinde filtrelemek için seçim yapınız."}}</label>
<select name="selective_list" id="selective_list"
ng-change="update_selective_list()"
ng-model="selective_list_key"
class="form-control">
<option ng-repeat="item in all_objects" value="{{$index}}">{{item.key}}</option>
</select>
</div>
<div class="tablescroll" ng-if="objects[1]">
<table class="table table-bordered" style="background-color:#fff;">
<thead>
......
This diff is collapsed.
......@@ -245,11 +245,21 @@ angular.module("components/crud/templates/list.html", []).run(["$templateCache",
" <search-directive ng-if=\"meta['allow_search']===true\"></search-directive>\n" +
" <div class=\"clearfix\"></div>\n" +
" <!--<h1>{{form_params.model || form_params.wf}}</h1>-->\n" +
" <div class=\"row\" ng-if=\"!objects[1]\">\n" +
" <div class=\"row\" ng-if=\"(!meta.selective_listing && !objects[1])\">\n" +
" <div class=\"col-md-12\">\n" +
" <p class=\"no-content\">Listelenecek içerik yok.</p>\n" +
" </div>\n" +
" </div>\n" +
" <!-- todo: add `selective_list` to documentation -->\n" +
" <div ng-if=\"meta.selective_listing === true\">\n" +
" <label for=\"selective_list\">{{meta.selective_listing_label || \"Sayfa içinde filtrelemek için seçim yapınız.\"}}</label>\n" +
" <select name=\"selective_list\" id=\"selective_list\"\n" +
" ng-change=\"update_selective_list()\"\n" +
" ng-model=\"selective_list_key\"\n" +
" class=\"form-control\">\n" +
" <option ng-repeat=\"item in all_objects\" value=\"{{$index}}\">{{item.key}}</option>\n" +
" </select>\n" +
" </div>\n" +
" <div class=\"tablescroll\" ng-if=\"objects[1]\">\n" +
" <table class=\"table table-bordered\" style=\"background-color:#fff;\">\n" +
" <thead>\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