Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions app/components/public/add-to-calender.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import Component from '@ember/component';
import { computed } from '@ember/object';
import moment from 'moment';
export default Component.extend({
Copy link
Member

Choose a reason for hiding this comment

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

Use glimmer component

classNames: ['ui', 'basic', 'segment'],

calender: computed(function() {
const params = this.get('event');
const startparams = params.startsAt;
const endparams = params.endsAt;
const starttime = moment(startparams).tz('Asia/Kolkata').utc().format('YYYYMMDD[T]HHmmSS[Z]');
Copy link
Member

Choose a reason for hiding this comment

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

The site doesn't only work for India

Copy link
Contributor

Choose a reason for hiding this comment

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

const timezone=params.timezone get the timezone and use it.

const endtime = moment(endparams).tz('Asia/Kolkata').utc().format('YYYYMMDD[T]HHmmSS[Z]');
return `https://calendar.google.com/calendar/u/0/r/eventedit?dates=${starttime}/${endtime}&text=${params.name}&location=${this.get('eventlocation')}&sf=true`;
})

});
6 changes: 6 additions & 0 deletions app/templates/components/public/add-to-calender.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<div class="ui list">
<div class="content">
<li>{{header-date @event.startsAt}} To {{header-date @event.endsAt}}</li>
Copy link
Contributor

Choose a reason for hiding this comment

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

use general date helper and format it. And also I don't think it is needed here.

Copy link
Contributor Author

@akash2408 akash2408 Oct 27, 2020

Choose a reason for hiding this comment

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

i use it to give a similar format like given in the photo in the issue and i think its looking fine

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

your format is not similar to this -
https://user-images.githubusercontent.com/1583873/93197307-c05ab780-f74b-11ea-8527-4cb703d739d9.png
previously it was same u told me to use general date helper instead of header date
isn't?

Copy link
Contributor

Choose a reason for hiding this comment

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

it's wasn't same previously too, look closely

Copy link
Contributor Author

Choose a reason for hiding this comment

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

can i make a new helper for the same format?

<a href={{this.calender}}>Add To Calender</a>
Copy link
Contributor

Choose a reason for hiding this comment

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

Add to Google calendar, or add a google calendar icon.

</div>
</div>
3 changes: 2 additions & 1 deletion app/templates/public.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,8 @@
{{/each}}
</div>
{{/if}}
<Public::SocialLinks @externalUrl={{this.model.externalEventUrl}} @socialLinks={{this.model.socialLinks}} />
<Public::AddToCalender @event={{this.model}} @eventlocation={{this.headerLocation}}/>
<Public::SocialLinks @externalUrl={{this.model.externalEventUrl}} @socialLinks={{this.model.socialLinks}}/>
{{/if}}
</div>
</div>
Expand Down
26 changes: 26 additions & 0 deletions tests/integration/components/public/add-to-calender-test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import { module, test } from 'qunit';
import { setupRenderingTest } from 'ember-qunit';
import { render } from '@ember/test-helpers';
import hbs from 'htmlbars-inline-precompile';

module('Integration | Component | public/add-to-calender', function(hooks) {
setupRenderingTest(hooks);

test('it renders', async function(assert) {
// Set any properties with this.set('myProperty', 'value');
// Handle any actions with this.set('myAction', function(val) { ... });

await render(hbs`{{public/add-to-calender}}`);

assert.equal(this.element.textContent.trim(), '');

// Template block usage:
await render(hbs`
{{#public/add-to-calender}}
template block text
{{/public/add-to-calender}}
`);

assert.equal(this.element.textContent.trim(), 'template block text');
});
});