Skip to content

Commit

Permalink
Merge pull request #4057 from fossasia/development
Browse files Browse the repository at this point in the history
chore: Release v1.11
  • Loading branch information
iamareebjamal authored Feb 11, 2020
2 parents 0a82d66 + 747f7aa commit d767ad8
Show file tree
Hide file tree
Showing 23 changed files with 405 additions and 356 deletions.
23 changes: 23 additions & 0 deletions app/components/forms/wizard/basic-details-step.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { inject as service } from '@ember/service';
import EventWizardMixin from 'open-event-frontend/mixins/event-wizard';
import { protocolLessValidUrlPattern } from 'open-event-frontend/utils/validators';
import ENV from 'open-event-frontend/config/environment';
import $ from 'jquery';

export default Component.extend(FormMixin, EventWizardMixin, {

Expand Down Expand Up @@ -128,6 +129,12 @@ export default Component.extend(FormMixin, EventWizardMixin, {

// TODO: Removing the Event Time Validations due to the weird and buggy behaviour. Will be restored once a perfect solution is found. Please check issue: https://github.com/fossasia/open-event-frontend/issues/3667
getValidationRules() {
$.fn.form.settings.rules.checkMaxMinPrice = () => {
return $('.ui.form').form('get value', 'min_price') <= $('.ui.form').form('get value', 'max_price');
};
$.fn.form.settings.rules.checkMaxMinOrder = () => {
return $('.ui.form').form('get value', 'ticket_min_order') <= $('.ui.form').form('get value', 'ticket_max_order');
};

let validationRules = {
inline : true,
Expand Down Expand Up @@ -257,6 +264,10 @@ export default Component.extend(FormMixin, EventWizardMixin, {
{
type : 'number',
prompt : this.l10n.t('Invalid number')
},
{
type : 'checkMaxMinOrder',
prompt : this.l10n.t('Minimum order should not be greater than maximum')
}
]
},
Expand All @@ -274,6 +285,10 @@ export default Component.extend(FormMixin, EventWizardMixin, {
{
type : 'integer[1..]',
prompt : this.l10n.t('Maximum tickets per order should be greater than 0')
},
{
type : 'checkMaxMinOrder',
prompt : this.l10n.t('Maximum order should not be less than minimum')
}
]
},
Expand All @@ -287,6 +302,10 @@ export default Component.extend(FormMixin, EventWizardMixin, {
{
type : 'integer[1..]',
prompt : this.l10n.t('Minimum price needs to be greater than zero')
},
{
type : 'checkMaxMinPrice',
prompt : this.l10n.t('Minimum price should not be greater than maximum')
}
]
},
Expand All @@ -300,6 +319,10 @@ export default Component.extend(FormMixin, EventWizardMixin, {
{
type : 'integer[1..]',
prompt : this.l10n.t('Maximum price needs to be greater than zero')
},
{
type : 'checkMaxMinPrice',
prompt : this.l10n.t('Maximum price should not be less than minimum')
}
]
},
Expand Down
17 changes: 17 additions & 0 deletions app/components/public/side-menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,23 @@ export default Component.extend({
this.set('shouldShowCallforSpeakers',
speakersCall && speakersCall.announcement && (speakersCall.privacy === 'public'));
},
actions: {
scrollToTarget() {
document.querySelectorAll('.scroll').forEach(anchor => {
anchor.addEventListener('click', function(e) {
e.preventDefault();
document.querySelector(this.getAttribute('href')).scrollIntoView({
behavior: 'smooth'
});

document.querySelectorAll('.scroll').forEach(node => {
node.classList.remove('active');
});
e.target.classList.add('active');
});
});
}
},
isSchedulePublished: computed('event.schedulePublishedOn', function() {
return this.get('event.schedulePublishedOn') && this.get('event.schedulePublishedOn').toISOString() !== moment(0).toISOString();
})
Expand Down
4 changes: 2 additions & 2 deletions app/controllers/admin/users/view/events/list.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ export default class extends Controller.extend(EmberTableControllerMixin) {
return [
{
name : 'Name',
valuePath : 'id',
extraValuePaths : ['logoUrl', 'name', 'identifier', 'deletedAt'],
valuePath : 'name',
extraValuePaths : ['logoUrl', 'identifier', 'deletedAt'],
isSortable : true,
headerComponent : 'tables/headers/sort',
cellComponent : 'ui-table/cell/cell-event',
Expand Down
28 changes: 0 additions & 28 deletions app/controllers/events/view.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,6 @@ import { isEmpty } from '@ember/utils';
import { action } from '@ember/object';

export default class extends Controller {
@action
openDeleteEventModal() {
this.set('isEventDeleteModalOpen', true);
}

@action
togglePublishState() {
if (isEmpty(this.model.locationName)) {
Expand Down Expand Up @@ -46,29 +41,6 @@ export default class extends Controller {
});
}

@action
deleteEvent() {
this.set('isLoading', true);
this.model.destroyRecord()
.then(() => {
this.transitionToRoute('events');
this.notify.success(this.l10n.t('Event has been deleted successfully.'),
{
id: 'event_deleted_succ'
});
})
.catch(() => {
this.notify.error(this.l10n.t('An unexpected error has occurred.'),
{
id: 'event_deleted_error'
});
})
.finally(() => {
this.set('isLoading', false);
});
this.set('isEventDeleteModalOpen', false);
}

@action
copyEvent() {
this.set('isCopying', true);
Expand Down
28 changes: 28 additions & 0 deletions app/controllers/events/view/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,34 @@ import { action } from '@ember/object';

export default class extends Controller {

@action
openDeleteEventModal() {
this.set('isEventDeleteModalOpen', true);
}

@action
deleteEvent() {
this.set('isLoading', true);
this.model.event.destroyRecord()
.then(() => {
this.transitionToRoute('events');
this.notify.success(this.l10n.t('Event has been deleted successfully.'),
{
id: 'event_deleted_succ'
});
})
.catch(() => {
this.notify.error(this.l10n.t('An unexpected error has occurred.'),
{
id: 'event_deleted_error'
});
})
.finally(() => {
this.set('isLoading', false);
});
this.set('isEventDeleteModalOpen', false);
}

@action
openEventTransferModal(id, name) {
this.setProperties({
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/public/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ export default Controller.extend({
order.set('attendees', attendees);
await order.save()
.then(order => {
this.notify.success(this.l10n.t('Order details saved. Please fill further details within 10 minutes.'));
this.notify.success(this.l10n.t(`Order details saved. Please fill further details within ${this.settings.orderExpiryTime} minutes.`));
this.transitionToRoute('orders.new', order.identifier);
})
.catch(async e => {
Expand Down
3 changes: 0 additions & 3 deletions app/mixins/event-wizard.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,6 @@ export default Mixin.create(MutableArray, CustomFormMixin, {
if (event.name === undefined || event.name === '') {
errorObject.errors.push({ 'detail': 'Event name has not been provided' });
}
if (event.locationName === undefined || event.locationName === '') {
errorObject.errors.push({ 'detail': 'Location has not been provided' });
}
if (event.startsAtDate === undefined || event.endsAtDate === undefined) {
errorObject.errors.push({ 'detail': 'Dates have not been provided' });
}
Expand Down
8 changes: 7 additions & 1 deletion app/routes/public/role-invites.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
import Route from '@ember/routing/route';
import { inject as service } from '@ember/service';

export default Route.extend({
redirectionParams: null,
fastboot : service(),
redirectionParams : null,
async beforeModel(transition) {
// We don't want to process or transition in fastboot mode
// Since this is only an intermediate page
if (this.fastboot.isFastBoot) {return}
const { token } = transition.to.queryParams;
const originalEventId = transition.resolvedModels.public.originalId;
const payload = {
Expand Down Expand Up @@ -31,6 +36,7 @@ export default Route.extend({

},
afterModel() {
if (this.fastboot.isFastBoot) {return}
this.transitionTo('register', this.redirectionParams);
}
});
Loading

0 comments on commit d767ad8

Please sign in to comment.