Skip to content

Commit

Permalink
Revert "feature 8783: Implement rich text links in custom forms (#8957)…
Browse files Browse the repository at this point in the history
…" (#8961)

This reverts commit b17a83e.
  • Loading branch information
mariobehling authored Jul 16, 2023
1 parent b058d75 commit 35b4d99
Show file tree
Hide file tree
Showing 15 changed files with 74 additions and 726 deletions.
17 changes: 0 additions & 17 deletions app/components/forms/orders/attendee-list.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,23 +84,6 @@ export default class AttendeeList extends Component {
return groupBy(customFields, field => field.get('form'));
}

prepareFieldId(fieldIdentifier, holderIndex, fieldIndex) {
return `${fieldIdentifier}_${holderIndex}_${fieldIndex}`;
}

get fieldNameConvertRichText() {
const fields = orderBy(this.fields.toArray(), 'position');
this.holders.forEach((holder, indexHolder) => {
fields.forEach((field, index) => {
const elem = document.getElementById(this.prepareFieldId(field.fieldIdentifier, indexHolder, index));
if (elem) {
elem.innerHTML = field.transName;
}
});
});
return null;
}

@action
toggleEditFields() {
this.editFields = !this.editFields;
Expand Down
20 changes: 3 additions & 17 deletions app/components/forms/orders/order-form.js
Original file line number Diff line number Diff line change
Expand Up @@ -630,7 +630,9 @@ export default Component.extend(FormMixin, {
if ((main_language && main_language.split('-')[0] === current_locale) || !field.translations || !field.translations.length) {
field.transName = field.name;
} else if (field.translations?.length) {

const transName = field.translations.filter(trans => trans.language_code.split('-')[0] === current_locale);

if (transName.length) {
field.transName = transName[0].name;
} else {
Expand All @@ -639,6 +641,7 @@ export default Component.extend(FormMixin, {
} else {
field.transName = field.name;
}

return !isFixed;
}), ['position']);
return groupBy(requiredFixed.concat(customFields), field => field.get('form'));
Expand All @@ -661,23 +664,6 @@ export default Component.extend(FormMixin, {
return 'hello';
},

prepareFieldId(fieldIdentifier, holderIndex, fieldIndex) {
return `${fieldIdentifier}_${holderIndex}_${fieldIndex}`;
},

get fieldNameConvertRichText() {
const fields = orderBy(this.fields.toArray(), 'position');
this.holders.forEach((holder, indexHolder) => {
fields.forEach((field, index) => {
const elem = document.getElementById(this.prepareFieldId(field.fieldIdentifier, indexHolder, index));
if (elem) {
elem.innerHTML = field.transName;
}
});
});
return null;
},

actions: {
submit(data) {
this.onValid(() => {
Expand Down
51 changes: 21 additions & 30 deletions app/components/forms/wizard/custom-form-input-translation.hbs
Original file line number Diff line number Diff line change
@@ -1,34 +1,25 @@
{{#if (eq @type "number")}}
<div class="rich-text-type-number" >
<Widgets::Forms::RichTextLink
@value={{@data.name}}/>
{{#if (not-eq @type "number")}}
<div style="width: 30%">
<Input type="text" placeholder={{t "Field Name"}} @value={{@data.name}}/>
</div>
{{else}}
<div class="rich-text-other" >
<Widgets::Forms::RichTextLink
@value={{@data.name}}/>
<div style="width: 20%">
<Input type="text" placeholder={{t "Field Name"}} @value={{@data.name}}/>
</div>
{{/if}}
<div style="width: 11rem">
<div class="ui hidden divider wrapper-button"></div>
<UiDropdown class="ui selection dropdown custom-form-dropdown-attendee"
@selected={{@data.selectedLang}}
@onChange={{action 'onChangeLanguage'}}
style="line-height: inherit; min-width: 11rem;">
<div class="default text">
{{ @data.selectedLang }}
</div>
<i class="dropdown icon"></i>
<div class="menu">
{{#each this.languageList as |language|}}
<div class="item" data-value={{language.code}}>{{language.name}}</div>
{{/each}}
</div>
</UiDropdown>
</div>
<div>
<div class="ui hidden divider wrapper-button"></div>
<button class="ui compact icon negative button btn-delele-lang" data-tooltip="{{t 'Delete'}}" {{action (confirm (t "Are you sure you want to delete this?") (action 'onRemoveForm' ))}}>
<i class="trash box icon"></i>
</button>
</div>
<UiDropdown class="ui selection dropdown custom-form-dropdown-attendee"
@selected={{@data.selectedLang}}
@onChange={{action 'onChangeLanguage' }}>
<div class="default text">
{{ @data.selectedLang }}
</div>
<i class="dropdown icon"></i>
<div class="menu">
{{#each this.languageList as |language|}}
<div class="item" data-value={{language.code}}>{{language.name}}</div>
{{/each}}
</div>
</UiDropdown>
<button style="font-size: 1.1em;" class="ui compact icon negative circular button" data-tooltip="{{t 'Delete'}}" {{action (confirm (t "Are you sure you want to delete this?") (action 'onRemoveForm' ))}}>
<i class="trash box icon"></i>
</button>
6 changes: 3 additions & 3 deletions app/components/forms/wizard/custom-form-input.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,14 @@
</UiDropdown>
{{/if}}
{{#if (or (eq this.type "number") (eq this.type "year"))}}
<div class="ui action input input-attendee-custom-form number-item">
<div class="ui action input input-attendee-custom-form" style="width: 8%;">
<Input
@type="number"
@name="min_price"
placeholder={{t "Min"}}
@value={{this.min}} />
</div>
<div class="ui action input input-attendee-custom-form number-item">
<div class="ui action input input-attendee-custom-form" style="width: 8%;">
<Input
@type="number"
@name="max_price"
Expand Down Expand Up @@ -71,7 +71,7 @@
</div>
<div style="display: flex; flex-direction: column">
{{#each this.visibleForm as |sub|}}
<div {{did-update this.updated @field}} class="ui action input sub child-language">
<div {{did-update this.updated @field}} class="ui action input sub" style="width: inherit; margin-top: 10px">
{{#unless sub.isDeleted }}
<Forms::Wizard::CustomFormInputTranslation
@data={{sub}}
Expand Down
99 changes: 0 additions & 99 deletions app/components/forms/wizard/custom-form-rich-text.hbs

This file was deleted.

Loading

1 comment on commit 35b4d99

@vercel
Copy link

@vercel vercel bot commented on 35b4d99 Jul 16, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.