Commit 287e49d0 authored by Evren Kutar's avatar Evren Kutar

rfix #5255

fixes GH-97
parent 3e23b0d1
...@@ -41,7 +41,8 @@ angular.module('ulakbus.crud', ['schemaForm', 'ui.bootstrap', 'ulakbus.formServi ...@@ -41,7 +41,8 @@ angular.module('ulakbus.crud', ['schemaForm', 'ui.bootstrap', 'ulakbus.formServi
* @memberof ulakbus.crud * @memberof ulakbus.crud
* @ngdoc function * @ngdoc function
* @name generateParam * @name generateParam
* @description generateParam is a function to generate required params to post backend api. * @description generateParam is a function to generate required params to send backend api.
* backend needs that params to work without errors
* @param {object} scope * @param {object} scope
* @param {object} routeParams * @param {object} routeParams
* @param {string} cmd * @param {string} cmd
...@@ -92,6 +93,8 @@ angular.module('ulakbus.crud', ['schemaForm', 'ui.bootstrap', 'ulakbus.formServi ...@@ -92,6 +93,8 @@ angular.module('ulakbus.crud', ['schemaForm', 'ui.bootstrap', 'ulakbus.formServi
angular.forEach(pageData, function (value, key) { angular.forEach(pageData, function (value, key) {
scope[key] = value; scope[key] = value;
}); });
// when selective_list is sent with meta key it means
// "objects" is a list of "objects"s
if (scope.meta['selective_listing'] === true) { if (scope.meta['selective_listing'] === true) {
angular.forEach(scope.objects, function (_v, _k) { angular.forEach(scope.objects, function (_v, _k) {
angular.forEach(_v.objects, function (value, key) { angular.forEach(_v.objects, function (value, key) {
...@@ -169,6 +172,7 @@ angular.module('ulakbus.crud', ['schemaForm', 'ui.bootstrap', 'ulakbus.formServi ...@@ -169,6 +172,7 @@ angular.module('ulakbus.crud', ['schemaForm', 'ui.bootstrap', 'ulakbus.formServi
if ($location.url().indexOf('?=') > 0) { if ($location.url().indexOf('?=') > 0) {
return $location.url($location.url().replace('?=', '')); return $location.url($location.url().replace('?=', ''));
} }
// before calling get_wf parameters need to be generated with CrudUtility.generateParam
CrudUtility.generateParam($scope, $routeParams); CrudUtility.generateParam($scope, $routeParams);
Generator.get_wf($scope); Generator.get_wf($scope);
}) })
...@@ -200,14 +204,18 @@ angular.module('ulakbus.crud', ['schemaForm', 'ui.bootstrap', 'ulakbus.formServi ...@@ -200,14 +204,18 @@ angular.module('ulakbus.crud', ['schemaForm', 'ui.bootstrap', 'ulakbus.formServi
}, 500); }, 500);
}); });
// todo: new feature wf_step is for to start a workflow from a certain step
$scope.wf_step = $routeParams.step; $scope.wf_step = $routeParams.step;
// pagination data is coming from api when too much results
$scope.paginate = function (reloadData) { $scope.paginate = function (reloadData) {
$scope.form_params.cmd = $scope.reload_cmd; $scope.form_params.cmd = $scope.reload_cmd;
$scope.form_params = angular.extend($scope.form_params, reloadData); $scope.form_params = angular.extend($scope.form_params, reloadData);
$log.debug('reload data', $scope); $log.debug('reload data', $scope);
Generator.get_wf($scope); Generator.get_wf($scope);
}; };
// reload_cmd can be broadcasted app-wide, when $on it reloadCmd is called
$scope.$on('reload_cmd', function(event, data){ $scope.$on('reload_cmd', function(event, data){
$scope.reload_cmd = data; $scope.reload_cmd = data;
$scope.reloadCmd(); $scope.reloadCmd();
...@@ -241,7 +249,6 @@ angular.module('ulakbus.crud', ['schemaForm', 'ui.bootstrap', 'ulakbus.formServi ...@@ -241,7 +249,6 @@ angular.module('ulakbus.crud', ['schemaForm', 'ui.bootstrap', 'ulakbus.formServi
}; };
$scope.do_action = function (key, todo) { $scope.do_action = function (key, todo) {
//Generator.doItemAction($scope, key, todo.cmd, todo.wf, todo.mode || 'normal');
Generator.doItemAction($scope, key, todo, todo.mode || 'normal'); Generator.doItemAction($scope, key, todo, todo.mode || 'normal');
}; };
...@@ -249,11 +256,11 @@ angular.module('ulakbus.crud', ['schemaForm', 'ui.bootstrap', 'ulakbus.formServi ...@@ -249,11 +256,11 @@ angular.module('ulakbus.crud', ['schemaForm', 'ui.bootstrap', 'ulakbus.formServi
return new Array(num); return new Array(num);
}; };
// trust as html for using markdown support $scope.markdownWorkaround = function (value) {
// this is new line workaround for markdown support
$scope.trustAsHtml = function (value) { // kind of ugly hack
return $sce.trustAsHtml(value); return value.replace('\n', '<br>');
} };
// inline edit fields // inline edit fields
$scope.datepickerstatuses = {}; $scope.datepickerstatuses = {};
......
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
<tr ng-repeat="(key, value) in obj.fields"> <tr ng-repeat="(key, value) in obj.fields">
<td class="col-md-2">{{key}}</td> <td class="col-md-2">{{key}}</td>
<!--<td class="col-md-8"><markdown ng-bind-html="value"></markdown></td>--> <!--<td class="col-md-8"><markdown ng-bind-html="value"></markdown></td>-->
<td class="col-md-8" ng-bind-html="value | markdown"></td> <td class="col-md-8" ng-bind-html="markdownWorkaround(value) | markdown"></td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
......
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