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

Integrate sessions API at event/sessions route #651

Merged
merged 1 commit into from Aug 11, 2017
Jump to file or symbol
Failed to load files and symbols.
+195 −132
Diff settings

Always

Just for now

@@ -0,0 +1,6 @@
import Ember from 'ember';
const { Component } = Ember;
export default Component.extend({
});
@@ -0,0 +1,6 @@
import Ember from 'ember';
const { Component } = Ember;
export default Component.extend({
});
@@ -0,0 +1,6 @@
import Ember from 'ember';
const { Component } = Ember;
export default Component.extend({
});
@@ -0,0 +1,53 @@
import Ember from 'ember';
const { Controller } = Ember;
export default Controller.extend({
columns: [
{
propertyName : 'state',
title : 'State',
disableSorting : true,
template : 'components/ui-table/cell/events/view/sessions/cell-session-state'
},
{
propertyName : 'title',
title : 'Title'
},
{
propertyName : 'speakers',
template : 'components/ui-table/cell/cell-speakers',
title : 'Speakers',
disableSorting : true
},
{
propertyName : 'shortAbstract',
title : 'Short Abstract',
disableSorting : true
},
{
propertyName : 'submitted-at',
template : 'components/ui-table/cell/cell-simple-date',
title : 'Submission Date'
},
{
propertyName : 'last-modified',
title : 'Last Modified'
},
{
propertyName : 'is-mail-sent',
title : 'Email Sent',
template : 'components/ui-table/cell/events/view/sessions/cell-is-mail-sent',
disableSorting : true
},
{
template : 'components/ui-table/cell/cell-simple-buttons',
disableSorting : true,
disableFiltering : true
},
{
template : 'components/ui-table/cell/events/view/sessions/cell-buttons',
disableSorting : true,
disableFiltering : true
}
]
});
@@ -4,26 +4,8 @@ const { Route } = Ember;
export default Route.extend({
templateName: 'events/view/sessions/list',
model() {
return [{
title : 'Test Session 1',
speakers : [{ name: 'speaker 1', id: 1, organization: 'fossasia' }, { name: 'speaker 2', id: 1, organization: 'fossasia' }],
track : 'sample track',
shortAbstract : 'Lorem Ipsum is simply dummy text of the printing and typesetting industry.',
submissionDate : new Date(),
lastModified : new Date(),
emailSent : 'No',
state : 'confirmed'
},
{
title : 'Test Session 2',
speakers : [{ name: 'speaker 3', id: 1, organization: 'fossasia' }, { name: 'speaker 4', id: 1, organization: 'fossasia' }],
track : 'sample track',
shortAbstract : 'Lorem Ipsum is simply dummy text of the printing and typesetting industry.',
submissionDate : new Date(),
lastModified : new Date(),
emailSent : 'Yes',
state : 'confirmed'
}];
beforeModel() {
this._super(...arguments);
this.transitionTo('events.view.sessions.list', 'all');
}
});
@@ -7,35 +7,58 @@ export default Route.extend({
switch (this.get('params.session_status')) {
case 'pending':
return this.l10n.t('Pending');
case 'accepted':
return this.l10n.t('Accepted');
case 'confirmed':
return this.l10n.t('Confirmed');
case 'accepted':
return this.l10n.t('Accepted');
case 'rejected':
return this.l10n.t('Rejected');
default:
return this.l10n.t('Session');
}
},
model(params) {
this.set('params', params);
return [{
title : 'Test Session 1',
speakers : [{ name: 'speaker 1', id: 1, organization: 'fossasia' }, { name: 'speaker 2', id: 1, organization: 'fossasia' }],
track : 'sample track',
shortAbstract : 'Lorem Ipsum is simply dummy text of the printing and typesetting industry.',
submittedAt : new Date(),
modifiedAt : new Date(),
emailSent : 'No',
state : 'confirmed'
},
{
title : 'Test Session 2',
speakers : [{ name: 'speaker 3', id: 1, organization: 'fossasia' }, { name: 'speaker 4', id: 1, organization: 'fossasia' }],
track : 'sample track',
shortAbstract : 'Lorem Ipsum is simply dummy text of the printing and typesetting industry.',
submittedAt : new Date(),
modifiedAt : new Date(),
emailSent : 'Yes',
state : 'confirmed'
}];
let filterOptions = [];
if (params.session_status === 'pending') {
filterOptions = [
{
name : 'state',
op : 'eq',
val : 'pending'
}
];
} else if (params.session_status === 'accepted') {
filterOptions = [
{
name : 'state',
op : 'eq',
val : 'accepted'
}
];
} else if (params.session_status === 'rejected') {
filterOptions = [
{
name : 'state',
op : 'eq',
val : 'rejected'
}
];
} else if (params.session_status === 'confirmed') {
filterOptions = [
{
name : 'state',
op : 'eq',
val : 'confirmed'
}
];
} else {
filterOptions = [];
}
return this.modelFor('events.view').query('sessions', {
include : 'event,speakers',
filter : filterOptions,
'page[size]' : 10
});
}
});
@@ -0,0 +1,16 @@
<div class="ui vertical compact basic buttons">
{{#ui-dropdown class='ui icon bottom right pointing dropdown button'}}
<i class="green checkmark icon"></i>
<div class="menu">
<div class="item">{{t 'With email'}}</div>
<div class="item">{{t 'Without email'}}</div>
</div>
{{/ui-dropdown}}
{{#ui-dropdown class='ui icon bottom right pointing dropdown button'}}
<i class="red remove icon"></i>
<div class="menu">
<div class="item">{{t 'With email'}}</div>
<div class="item">{{t 'Without email'}}</div>
</div>
{{/ui-dropdown}}
</div>
@@ -0,0 +1,7 @@
<span>
{{#if record.isMailSent}}
{{t 'Yes'}}
{{else}}
{{t 'No'}}
{{/if}}
</span>
@@ -0,0 +1,11 @@
<span>
{{#if (eq record.state "accepted")}}

This comment has been minimized.

@geekyd

geekyd Aug 10, 2017

Member

@harshitagupta30 Please use yellow colour for confirmed & pending.

<div class="ui green label">{{t 'Accepted'}}</div>
{{else if (eq record.state "confirmed")}}
<div class="ui yellow label">{{t 'Confirmed'}}</div>
{{else if (eq record.state "pending")}}
<div class="ui yellow label">{{t 'Pending'}}</div>
{{else}}
<div class="ui red label">{{t 'Rejected'}}</div>
{{/if}}
</span>
@@ -2,7 +2,7 @@
<div class="row">
<div class="eight wide column">
{{#tabbed-navigation isNonPointing=true}}
{{#link-to 'events.view.sessions.index' class='item'}}
{{#link-to 'events.view.sessions.list' 'all' class='item'}}
{{t 'All'}}
{{/link-to}}
{{#link-to 'events.view.sessions.list' 'pending' class='item'}}
@@ -1,90 +1,7 @@
<div class="sixteen wide column">
<table class="ui tablet stackable very basic table">
<thead>
<tr>
<th>{{t 'State'}}</th>
<th>{{t 'Title'}}</th>
<th>{{t 'Speakers'}}</th>
<th>{{t 'Track'}}</th>
<th>{{t 'Short Abstract'}}</th>
<th>{{t 'Submission Date'}}</th>
<th>{{t 'Last Modified'}}</th>
<th>{{t 'Email Sent'}}</th>
<th></th>
<th></th>
</tr>
</thead>
<tbody>
{{#each model as |session|}}
<tr>
<td>
{{#if (eq session.state "confirmed")}}
<div class="ui green label">{{t 'Confirmed'}}</div>
{{else}}
<div class="ui red label">{{t 'Not Confirmed'}}</div>
{{/if}}
</td>
<td>
{{session.title}}
</td>
<td>
<div class="ui ordered list">
{{#each session.speakers as |speaker|}}
<div class="item">{{speaker.name}}</div>
{{/each}}
</div>
</td>
<td>
{{session.track}}
</td>
<td>
{{session.shortAbstract}}
</td>
<td>
{{moment-format session.submittedAt 'dddd, DD MMMM YYYY'}}
</td>
<td>
{{moment-format session.modifiedAt 'dddd, DD MMMM YYYY'}}
</td>
<td>
{{session.emailSent}}
</td>
<td>
<div class="ui vertical compact basic buttons">
{{#ui-popup content=(t 'View') class='ui icon button' position='left center'}}
<i class="unhide icon"></i>
{{/ui-popup}}
{{#ui-popup content=(t 'Edit') class='ui icon button' position='left center'}}
<i class="edit icon"></i>
{{/ui-popup}}
{{#ui-popup content=(t 'Delete') class='ui icon button' position='left center'}}
<i class="trash outline icon"></i>
{{/ui-popup}}
{{#ui-popup content=(t 'Browse edit history') class='ui icon button' position='left center'}}
<i class="history icon"></i>
{{/ui-popup}}
</div>
</td>
<td>
<div class="ui vertical compact basic buttons">
{{#ui-dropdown class='ui icon bottom right pointing dropdown button'}}
<i class="green checkmark icon"></i>
<div class="menu">
<div class="item">{{t 'With email'}}</div>
<div class="item">{{t 'Without email'}}</div>
</div>
{{/ui-dropdown}}
{{#ui-dropdown class='ui icon bottom right pointing dropdown button'}}
<i class="red remove icon"></i>
<div class="menu">
<div class="item">{{t 'With email'}}</div>
<div class="item">{{t 'Without email'}}</div>
</div>
{{/ui-dropdown}}
</div>
</td>
</tr>
{{/each}}
</tbody>
</table>
{{events/events-table columns=columns data=model
useNumericPagination=true
showGlobalFilter=true
showPageSize=true
}}
</div>
@@ -0,0 +1,12 @@
import { test } from 'ember-qunit';
import moduleForComponent from 'open-event-frontend/tests/helpers/component-helper';
import hbs from 'htmlbars-inline-precompile';
moduleForComponent('ui-table/cell/events/views/sessions/cell-buttons', 'Integration | Component | ui table/cell/events/views/sessions/cell buttons');
test('it renders', function(assert) {
this.render(hbs`{{ui-table/cell/events/views/sessions/cell-buttons}}`);
assert.ok(this.$().html().trim().includes(''));
});
@@ -0,0 +1,12 @@
import { test } from 'ember-qunit';
import moduleForComponent from 'open-event-frontend/tests/helpers/component-helper';
import hbs from 'htmlbars-inline-precompile';
moduleForComponent('ui-table/cell/events/views/sessions/cell-is-mail-sent', 'Integration | Component | ui table/cell/events/views/sessions/cell is mail sent');
test('it renders', function(assert) {
this.render(hbs`{{ui-table/cell/events/views/sessions/cell-is-mail-sent}}`);
assert.ok(this.$().html().trim().includes(''));
});
@@ -0,0 +1,12 @@
import { test } from 'ember-qunit';
import moduleForComponent from 'open-event-frontend/tests/helpers/component-helper';
import hbs from 'htmlbars-inline-precompile';
moduleForComponent('ui-table/cell/events/views/sessions/cell-session-state', 'Integration | Component | ui table/cell/events/views/sessions/cell session state');
test('it renders', function(assert) {
this.render(hbs`{{ui-table/cell/events/views/sessions/cell-session-state}}`);
assert.ok(this.$().html().trim().includes(''));
});
ProTip! Use n and p to navigate between commits in a pull request.