Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: redesigns sessions page and add lock/unlock column #2964

Merged
merged 3 commits into from May 23, 2019
Merged
Changes from 1 commit
Commits
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.

Always

Just for now

@@ -0,0 +1,4 @@
import Component from '@ember/component';

export default Component.extend({
});
@@ -0,0 +1,4 @@
import Component from '@ember/component';

export default Component.extend({
});
@@ -8,8 +8,9 @@ export default Controller.extend({
template : 'components/ui-table/cell/events/view/sessions/cell-session-state'
},
{
propertyName : 'title',
title : 'Title'
title : 'Title',
disableSorting : true,
template : 'components/ui-table/cell/events/view/sessions/cell-session-title'
},
{
propertyName : 'speakers',
@@ -18,9 +19,12 @@ export default Controller.extend({
disableSorting : true
},
{
propertyName : 'shortAbstract',
title : 'Short Abstract',
disableSorting : true
propertyName : 'track.name',
title : 'Track'
},
{
propertyName : 'sessionType.name',
title : 'Type'
},
{
propertyName : 'submittedAt',
@@ -41,13 +45,14 @@ export default Controller.extend({
disableSorting : true
},
{
template : 'components/ui-table/cell/cell-simple-buttons',
template : 'components/ui-table/cell/events/view/sessions/cell-buttons',
title : 'Actions',
disableSorting : true,
disableFiltering : true
},
{
template : 'components/ui-table/cell/events/view/sessions/cell-buttons',
title : 'Actions',
template : 'components/ui-table/cell/events/view/sessions/cell-lock-session',
title : 'Lock Session',
disableSorting : true,
disableFiltering : true
}
@@ -72,6 +77,36 @@ export default Controller.extend({
viewSession(id) {
this.transitionToRoute('events.view.sessions.edit', id);
},
lockSession(session) {
session.set('isLocked', true);
this.set('isLoading', true);

This comment has been minimized.

Copy link
@uds5501

uds5501 May 22, 2019

Contributor

Everything looks good, but just had a question, wouldn't it be nice if the session.set('isLocked', true) be executed when isLoading is true? (I think it's just code design, won't affect the functionality, of course)

This comment has been minimized.

Copy link
@shreyanshdwivedi

shreyanshdwivedi May 22, 2019

Author Member

@uds5501 I did this intentionally. I had a number of references where values were set before setting isLoading to true. As we know that isLoading is basically for loading status if a task takes time so it is added just before the time-taking task. However, if you want you can refer to login-form or register-form where similar implementations were carried out.

This comment has been minimized.

Copy link
@uds5501

uds5501 May 22, 2019

Contributor

Understood!

session.save()
.then(() => {
this.notify.success(this.get('l10n').t('Session has been locked successfully.'));
this.send('refreshRoute');
})
.catch(() => {
this.notify.error(this.get('l10n').t('An unexpected error has occurred.'));

This comment has been minimized.

Copy link
@ritikamotwani

ritikamotwani May 23, 2019

Contributor

Use this.notify....this.l10n

})
.finally(() => {
this.set('isLoading', false);
});
},
unlockSession(session) {
session.set('isLocked', false);
this.set('isLoading', true);
session.save()
.then(() => {
this.notify.success(this.get('l10n').t('Session has been unlocked successfully.'));
this.send('refreshRoute');
})
.catch(() => {
this.notify.error(this.get('l10n').t('An unexpected error has occurred.'));
})
.finally(() => {
this.set('isLoading', false);
});
},
acceptProposal(session, sendEmail) {
session.set('sendEmail', sendEmail);
session.set('state', 'accepted');
@@ -23,7 +23,8 @@ export default ModelBase.extend({
signupUrl : attr('string'),
sendEmail : attr('boolean'),

isMailSent: attr('boolean', { defaultValue: false }),
isLocked : attr('boolean', { defaultValue: false }),
isMailSent : attr('boolean', { defaultValue: false }),

createdAt : attr('string'),
deletedAt : attr('string'),
@@ -0,0 +1,9 @@
{{#if record.isLocked}}
{{#ui-popup content=(t 'Unlock Session') class='ui basic button' click=(action unlockSession record) position='left center'}}
<i class="lock icon"></i>
{{/ui-popup}}
{{else}}
{{#ui-popup content=(t 'Lock Session') class='ui basic button' click=(action lockSession record) position='left center'}}
<i class="unlock icon"></i>
{{/ui-popup}}
{{/if}}
@@ -0,0 +1,15 @@
{{record.title}}

This comment has been minimized.

Copy link
@ritikamotwani

ritikamotwani May 23, 2019

Contributor

Also there's no point of using a property name if you are using record.title simply to get the title.
May be you can use (get record column.propertyName) for it.

<div class="hidden ui divider"></div>
<div class="ui horizontal compact basic buttons">
{{#ui-popup content=(t 'View Session') class="{{if device.isMobile 'medium' 'huge'}} ui icon button" click=(action viewSession record.id) position='left center'}}
<i class="unhide icon"></i>
{{/ui-popup}}
{{#if (not record.isLocked)}}
{{#ui-popup content=(t 'Edit Session') class="{{if device.isMobile 'medium' 'huge'}} ui icon button" click=(action editSession record.id record.event.id) position='left center'}}
<i class="edit icon"></i>
{{/ui-popup}}
{{/if}}
{{#ui-popup content=(t 'Delete Session') click=(action (confirm (t 'Are you sure you would like to delete this Session?') (action deleteSession record))) class="{{if device.isMobile 'medium' 'huge'}} ui icon button" position='left center'}}
<i class="trash outline icon"></i>
{{/ui-popup}}
</div>
@@ -9,6 +9,8 @@
useNumericPagination=true
showGlobalFilter=true
showPageSize=true
lockSession=(action 'lockSession')
unlockSession=(action 'unlockSession')
deleteSession=(action 'deleteSession')
editSession=(action 'editSession')
viewSession=(action 'viewSession')
@@ -1,11 +1,13 @@
<div class="ui container">
<div class="ui row">
{{#link-to 'events.view.sessions.edit' model.event.id model.id}}
<button class="ui blue button {{if device.isMobile 'fluid' 'right floated'}}">{{t 'Edit Session Proposal'}}</button>
{{#if device.isMobile}}
<div class="ui hidden fitted divider"></div>
{{/if}}
{{/link-to}}
{{#if (not model.isLocked)}}
{{#link-to 'events.view.sessions.edit' model.event.id model.id}}
<button class="ui blue button {{if device.isMobile 'fluid' 'right floated'}}">{{t 'Edit Session Proposal'}}</button>
{{#if device.isMobile}}
<div class="ui hidden fitted divider"></div>
{{/if}}
{{/link-to}}
{{/if}}
{{#each model.speakers as |speaker|}}
{{#if (eq speaker.email authManager.currentUser.email)}}
{{#link-to 'events.view.speakers.edit' model.event.id speaker.id}}
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.