diff --git a/app/components/forms/wizard/other-details-step.js b/app/components/forms/wizard/other-details-step.js index 497981b2b97..7f4ab1b0a41 100644 --- a/app/components/forms/wizard/other-details-step.js +++ b/app/components/forms/wizard/other-details-step.js @@ -1,7 +1,7 @@ import Component from '@ember/component'; import { computed } from '@ember/object'; import moment from 'moment'; -import { merge, orderBy, find } from 'lodash-es'; +import { orderBy, find } from 'lodash-es'; import { licenses } from 'open-event-frontend/utils/dictionary/licenses'; import { timezones } from 'open-event-frontend/utils/dictionary/date-time'; import FormMixin from 'open-event-frontend/mixins/form'; @@ -23,7 +23,6 @@ export default Component.extend(FormMixin, EventWizardMixin, { return orderBy(licenses, 'name'); }), - socialLinks: computed('data.event.socialLinks.@each.isDeleted', function() { return this.data.event.socialLinks.filterBy('isDeleted', false); }), @@ -31,30 +30,6 @@ export default Component.extend(FormMixin, EventWizardMixin, { isUserUnverified: computed('authManager.currentUser.isVerified', function() { return !this.authManager.currentUser.isVerified; }), - /** - * returns the validation rules for the social links. - */ - socialLinksValidationRules: computed('socialLinks', function() { - let validationRules = {}; - for (let i = 0; i < this.socialLinks.length; i++) { - validationRules = merge(validationRules, { - [this.socialLinks.get(i).identifier]: { - identifier : this.socialLinks.get(i).identifier, - optional : true, - rules : [ - { - type : 'regExp', - value : protocolLessValidUrlPattern, - prompt : this.l10n.t('Please enter a valid url') - } - ] - } - }); - } - - return validationRules; - }), - showDraftButton: computed('data.event.state', function() { return this.data.event.state !== 'published'; @@ -126,8 +101,6 @@ export default Component.extend(FormMixin, EventWizardMixin, { } } }; - // Merging the predetermined rules with the rules for social links. - validationRules.fields = merge(validationRules.fields, this.socialLinksValidationRules); return validationRules; }, diff --git a/app/components/widgets/forms/link-input.js b/app/components/widgets/forms/link-input.js index ba9b294b4ff..0d0f52014f0 100644 --- a/app/components/widgets/forms/link-input.js +++ b/app/components/widgets/forms/link-input.js @@ -45,6 +45,26 @@ export default class LinkInput extends Component { }); } + @observes('linkName') + linkNameObserver() { + const link = this.linkName; + const socialPlatforms = ['twitter', 'facebook', 'instagram', 'linkedin', 'youtube']; + + if (socialPlatforms.includes(link)) { + this.set('segmentedLink', { + protocol : `https://${link}.com/`, + address : '' + }); + } + + if (link === 'website') { + this.set('segmentedLink', { + protocol : 'https://', + address : '' + }); + } + } + didInsertElement() { super.didInsertElement(...arguments); if (this.segmentedLink) { diff --git a/app/templates/components/forms/wizard/other-details-step.hbs b/app/templates/components/forms/wizard/other-details-step.hbs index 64d4f23b56c..859c553918e 100644 --- a/app/templates/components/forms/wizard/other-details-step.hbs +++ b/app/templates/components/forms/wizard/other-details-step.hbs @@ -5,7 +5,7 @@ - +
+ {{#if this.fixedName}} + + {{else}} + +
Select
+ + +
+ {{/if}} +
-
- -
https://
- -