Add configureForm Link to settings menu in WP list

pull/5433/head
Wieland Lindenthal 8 years ago
parent 10f06bc598
commit ca1ee47645
  1. 15
      frontend/app/components/context-menus/settings-menu/settings-menu.controller.ts
  2. 7
      frontend/app/components/context-menus/settings-menu/settings-menu.service.html
  3. 9
      lib/api/v3/work_packages/create_project_form_representer.rb

@ -31,6 +31,8 @@ import {WorkPackageTableHierarchiesService} from '../../wp-fast-table/state/wp-t
import {WorkPackageTableSumService} from '../../wp-fast-table/state/wp-table-sum.service';
import {WorkPackageTableGroupByService} from '../../wp-fast-table/state/wp-table-group-by.service';
import {WorkPackagesListService} from '../../wp-list/wp-list.service';
import {WorkPackageEditModeStateService} from "../../wp-edit/wp-edit-mode-state.service";
import {States} from '../../states.service';
interface IMyScope extends ng.IScope {
@ -74,6 +76,7 @@ function SettingsDropdownMenuController($scope:IMyScope,
wpTableSum:WorkPackageTableSumService,
wpTableGroupBy:WorkPackageTableGroupByService,
wpListService:WorkPackagesListService,
wpEditModeState: WorkPackageEditModeStateService,
states:States,
AuthorisationService:any,
NotificationsService:any) {
@ -109,6 +112,18 @@ function SettingsDropdownMenuController($scope:IMyScope,
$scope.queryCustomFields = query.results.customFields;
}
if (wpEditModeState.form && wpEditModeState.form.workPackage) {
if (wpEditModeState.form.inEditMode) {
wpEditModeState.form.workPackage.getForm().then(
(loadedForm:any) => {
$scope.configureFormLink = loadedForm.configureForm;
}
);
} else {
$scope.configureFormLink = wpEditModeState.form.workPackage.configureForm;
}
}
$scope.saveQuery = function (event:JQueryEventObject) {
event.stopPropagation();
if (!query.id && allowQueryAction(event, 'updateImmediately')) {

@ -72,9 +72,12 @@
ng-class="{'inactive': showSettingsModalInvalid()}">
<i class="icon-action-menu icon-settings"></i>{{ I18n.t('js.toolbar.settings.page_settings') }}</a>
</li>
<li class="dropdown-divider" ng-if="queryCustomFields"></li>
<li><a class="menu-item" href="{{queryCustomFields.href}}" ng-if="queryCustomFields">
<li class="dropdown-divider" ng-if="queryCustomFields || configureFormLink"></li>
<li ng-if="queryCustomFields"><a class="menu-item" href="{{queryCustomFields.href}}">
<i class="icon-action-menu icon-custom-fields"></i>{{ queryCustomFields.name }}</a>
</li>
<li ng-if="configureFormLink"><a class="menu-item" href="{{configureFormLink.href}}">
<i class="icon-action-menu icon-settings3"></i>{{ configureFormLink.name }}</a>
</li>
</ul>
</div>

@ -59,6 +59,15 @@ module API
} if current_user.allowed_to?(:edit_work_packages, represented.project) &&
@errors.empty?
end
link :configureForm do
{
href: edit_type_path(represented.type_id, tab: 'form_configuration'),
type: 'text/html',
title: "Configure form"
} if current_user.admin?
end
end
end
end

Loading…
Cancel
Save