You can override the default configuration of Tasklist using a central configuration filelocated in app/tasklist/scripts/config.js. Currently, the following configuration options areavailable:

Date Format

Dates can be configured by specifying a dateFormat object. The values of the properties of thisobject must be strings representing date formats in accordance withmoment.js. Following date formats are used within Tasklist:

  • monthName represents the name of a month (e.g., January).
  • day represents the number of a day in a month (1..31).
  • abbr represents a short format of a date including time.
  • normal represents the standard format of a date including time.
  • long represents a verbose format of a date including time and day of the week.
  • short represents a short format of a date excluding time.

    Example

  1. "dateFormat": {
  2. "monthName": "MMM",
  3. "long": "LLLL"
  4. }

Localization

The localization of Tasklist is contained in the app/tasklist/locales/ directory. Thisdirectory contains a separate localization file for every available language. The file nameconsists of the language code and the suffix .json (e.g., en.json).

Tasklist uses a locale file corresponding to the language settings of the browser. You canset the availableLocales property in the configuration file to provide a list of availablelocales. Every locale which is contained in this list must have a locale file in the localesdirectory with the corresponding language code.

If the browser uses a language which is not available, Tasklist uses the locale which isdefined via the fallbackLocale property in the configuration file:

  1. "locales": {
  2. "availableLocales": ["en", "de"],
  3. "fallbackLocale": "en"
  4. }

To create a new localization for Tasklist, copy the provided language file, translate it andsave it as new localization file with the corresponding language code. To make the new translationavailable, add it to the list of available locales in the configuration file.

Custom Scripts

If you want to add scripts (to add new AngularJS directives orother libraries) you should add a customScripts property to the app/tasklist/scripts/config.jsfile with something like this:

  1. var camTasklistConf = {
  2. // …
  3. customScripts: {
  4. // names of angular modules defined in your custom script files.
  5. // will be added to the 'cam.tasklist.custom' as dependencies
  6. ngDeps: ['my.custom.module'],
  7. // RequireJS modules to load.
  8. deps: ['custom-ng-module'],
  9. // RequreJS path definitions
  10. paths: {
  11. 'custom-ng-module': '../custom-ng-module/script'
  12. }
  13. }
  14. };

This includes a custom-ng-module/script.js file. The path is relative to theapp/tasklist/ folder in the Camunda webapp .war file.

Note: The content of the customScripts property will be treated as aRequireJS configuration except for thenodeIdCompat and skipDataMain which are irrelevant and deps which will be used like:

  1. require(config.deps, callback);

In your scripts, you can add a controller and directive like this:

  1. 'use strict';
  2. define('custom-ng-module', [
  3. 'angular'
  4. ], function (angular) {
  5. // define a new angular module named my.custom.module
  6. // it will be added as angular module dependency to builtin 'cam.tasklist.custom' module
  7. // see the config.js entry above
  8. var customModule = angular.module('my.custom.module', []);
  9. // …so now, you can safely add your controllers…
  10. customModule.controller('customController', ['$scope', function ($scope) {
  11. $scope.var1 = 'First variable';
  12. $scope.var2 = 'Second variable';
  13. }]);
  14. // …directives or else.
  15. customModule.directive('customDirective', function () {
  16. return {
  17. template: 'Directive example: "{{ var1 }}", "{{ var2 }}"'
  18. };
  19. });
  20. // it is not necessary to 'return' the customModule but it might come handy
  21. return customModule;
  22. });

And finally, in your UI or embedded forms, you can use the new features like this:

  1. <div ng-controller="customController">
  2. <div custom-directive> - (in this case; will be overwritten) - </div>
  3. </div>

Shortcuts

If you want to change the keyboard shortcuts for certain tasklist operations, you can change the key-combination and the description of the shortcuts in the shortcuts section of the config file.

Removing an existing entry from the list will disable this shortcut (you can still perform the operation normally within the tasklist, i.e. removing the Claim Task shortcut will not remove the ability to claim a task either with the mouse or with the normal keyboard navigation).

You can also add additional shortcuts. If you do so, whenever the user presses the registered combination of keys, an angular event in the form of shortcut:{{nameOfShortcut}} will be broadcasted across the application. A Tasklist plugin can then react to this event.

Logo and Header Color

To change visual aspects of Tasklist, you can edit the user stylesheet file located inapp/tasklist/styles/user-styles.css. This file contains CSS which is loaded into Tasklistand can override the standard styles.

  1. .navbar-brand {
  2. /* hides the "Camunda Tasklist" text */
  3. text-indent: -999em;
  4. /* put your logo */
  5. background-image: url(./path/to/the/logo.png);
  6. /* sets the width to match the logo's width */
  7. width: 80px;
  8. }
  9. /* changes the header bottom border color */
  10. [cam-widget-header] {
  11. border-bottom-color: blue;
  12. }

Note: you can also change the app name (Tasklist) and vendor (Camunda)by changing the app/tasklist/scripts/config.js configuration file as follow:

  1. // …
  2. app: {
  3. name: 'Todos',
  4. vendor: 'Company'
  5. },
  6. // …

Advanced Styles Customization

In addition to the basic user-styles.css file, you can edit the source style- and layout filesusing less to change the overall appearance of Tasklist.

If you want to customize the interface with less, you should probably start by having a lookat the variables defined in the following files:

  • node_modules/camunda-commons-ui/node_modules/bootstrap/less/variables.lessdefines the original Bootstrap variables
  • node_modules/camunda-commons-ui/resources/less/cam-variables.lessoverrides some Bootstrap variables (above) and add some custom ones

    Compiling with Grunt

From within the camunda-bpm-webapp directory:

  1. grunt build:tasklist

The command will build the frontend assets (of Tasklist), styles included.

原文: https://docs.camunda.org/manual/7.9/webapps/tasklist/configuration/