Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

Remove dead code

Christophe Bliard791e69005408
diff --git a/frontend/src/app/shared/components/remote-field-updater/remote-field-updater.component.ts b/frontend/src/app/shared/components/remote-field-updater/remote-field-updater.component.ts
index 5f541cd9adb..fa37bd1a4ab 100644
--- a/frontend/src/app/shared/components/remote-field-updater/remote-field-updater.component.ts
+++ b/frontend/src/app/shared/components/remote-field-updater/remote-field-updater.component.ts
@@ -45,12 +45,8 @@ export class RemoteFieldUpdaterComponent implements OnInit, OnDestroy {
private url:string;
- private htmlMode:boolean;
-
private form:HTMLFormElement;
- private target:HTMLElement;
-
private debouncedUpdaterBound:EventListener;
private spentOnTextField:HTMLInputElement | null = null;
@@ -60,12 +56,10 @@ export class RemoteFieldUpdaterComponent implements OnInit, OnDestroy {
ngOnInit():void {
const element = this.elementRef.nativeElement as HTMLElement;
this.form = element.closest('form') as HTMLFormElement;
- this.target = this.form.querySelector('.remote-field--target') as HTMLElement;
this.costTypeSelect = this.form.querySelector('#cost_entry_cost_type_id');
this.unitsTextField = this.form.querySelector('#cost_entry_units');
this.url = element.dataset.url as string;
- this.htmlMode = element.dataset.mode === 'html';
this.debouncedUpdaterBound = _.debounce(this.updater.bind(this), 500);
@@ -111,12 +105,7 @@ export class RemoteFieldUpdaterComponent implements OnInit, OnDestroy {
private request(params:Record<string, string>) {
const headers:Record<string, string> = {};
- // In HTML mode, expect html response
- if (this.htmlMode) {
- headers.Accept = 'text/html';
- } else {
- headers.Accept = 'application/json';
- }
+ headers.Accept = 'application/json';
return this.http
.get(
@@ -124,7 +113,7 @@ export class RemoteFieldUpdaterComponent implements OnInit, OnDestroy {
{
params,
headers,
- responseType: (this.htmlMode ? 'text' : 'json') as any,
+ responseType: 'json',
withCredentials: true,
},
);
@@ -143,21 +132,16 @@ export class RemoteFieldUpdaterComponent implements OnInit, OnDestroy {
this
.request(params)
- .subscribe((response:string|object) => {
- if (this.htmlMode) {
- // Replace the given target
- this.target.innerHTML = response as string;
- } else {
- _.each(response as object, (val:string, selector:string) => {
- const element = document.getElementById(selector) as HTMLElement|HTMLInputElement;
-
- if (element instanceof HTMLInputElement) {
- element.value = val;
- } else if (element) {
- element.textContent = val;
- }
- });
- }
+ .subscribe((response:object) => {
+ _.each(response, (val:string, selector:string) => {
+ const element = document.getElementById(selector) as HTMLElement|HTMLInputElement;
+
+ if (element instanceof HTMLInputElement) {
+ element.value = val;
+ } else if (element) {
+ element.textContent = val;
+ }
+ });
});
}
}
diff --git a/modules/costs/app/views/costlog/edit.html.erb b/modules/costs/app/views/costlog/edit.html.erb
index 373153a8956..3fe2059fa27 100644
--- a/modules/costs/app/views/costlog/edit.html.erb
+++ b/modules/costs/app/views/costlog/edit.html.erb
@@ -152,7 +152,6 @@ See COPYRIGHT and LICENSE files for more details.
<%= styled_button_tag t(:button_save), class: "-with-icon icon-checkmark" %>
- <opce-remote-field-updater data-url="<%= url_for(controller: :budgets, action: :update_material_budget_item, project_id: @cost_entry.project) %>"
- data-mode="json">
+ <opce-remote-field-updater data-url="<%= url_for(controller: :budgets, action: :update_material_budget_item, project_id: @cost_entry.project) %>">
</opce-remote-field-updater>
<% end %>