-
Notifications
You must be signed in to change notification settings - Fork 1.8k
feat: Introducing Ember Tables in Admin/Messages #3340
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
Merged
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
83d8284
Introducing Ember Tables in Admin/Messages
kushthedude 4cc2890
Final Changes
kushthedude 60610c0
Merge branch 'development' into table
kushthedude b58c166
Making cell options correct
kushthedude ac210a3
Merge branch 'development' into table
kushthedude 6e176a3
Merge branch 'development' into table
kushthedude 0372b0a
Merge branch 'development' into table
kushthedude f47b512
Merge branch 'development' into table
kushthedude 628831d
Removing one extraValue
kushthedude c734708
Removing one extraValue
kushthedude e343b58
Merge branch 'development' into table
kushthedude 968b6b1
Merge branch 'development' into table
kushthedude 267ab5e
Merge branch 'development' into table
kushthedude File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,66 @@ | ||
import Controller from '@ember/controller'; | ||
import { computed } from '@ember/object'; | ||
import EmberTableControllerMixin from 'open-event-frontend/mixins/ember-table-controller'; | ||
|
||
export default Controller.extend({ | ||
columns: [ | ||
export default class extends Controller.extend(EmberTableControllerMixin) { | ||
per_page = 100; | ||
|
||
sort_by = 'time'; | ||
|
||
sort_dir = 'ASC'; | ||
|
||
@computed() | ||
get columns() { | ||
return [ | ||
{ | ||
propertyName : 'recipient', | ||
title : 'Recipients' | ||
name : 'Recipients', | ||
valuePath : 'recipient', | ||
headerComponent : 'tables/headers/sort', | ||
isSortable : true | ||
}, | ||
{ | ||
propertyName : 'action', | ||
title : 'Trigger' | ||
name : 'Trigger', | ||
valuePath : 'action' | ||
}, | ||
{ | ||
subject : 'emailSubject', | ||
message : 'emailMessage', | ||
title : 'Email Message', | ||
template : 'components/ui-table/cell/cell-title-message' | ||
name : 'Email Message', | ||
valuePath : 'emailMessage', | ||
|
||
cellComponent : 'ui-table/cell/cell-title-message', | ||
extraValuePaths : ['emailSubject'], | ||
options : { | ||
subject : 'emailSubject', | ||
message : 'emailMessage' | ||
} | ||
}, | ||
{ | ||
subject : 'notificationTitle', | ||
message : 'notificationMessage', | ||
title : 'Notification Message', | ||
template : 'components/ui-table/cell/cell-title-message' | ||
name : 'Notification Message', | ||
valuePath : 'notificationMessage', | ||
cellComponent : 'ui-table/cell/cell-title-message', | ||
extraValuePaths : ['notificationTitle'], | ||
options : { | ||
subject : 'notificationTitle', | ||
message : 'notificationMessage' | ||
} | ||
}, | ||
{ | ||
title : 'Options', | ||
template : 'components/ui-table/cell/admin/messages/cell-options' | ||
name : 'Options', | ||
valuePath : 'option', | ||
extraValuePaths : ['mailStatus', 'notificationStatus', 'userControlStatus'], | ||
cellComponent : 'ui-table/cell/admin/messages/cell-options' | ||
}, | ||
{ | ||
propertyName : 'sentAt', | ||
title : 'Time/Date sent out', | ||
template : 'components/ui-table/cell/cell-simple-date', | ||
dateFormat : 'MMMM DD, YYYY - HH:mm A' | ||
name : 'Time/Date Sent Out', | ||
valuePath : 'sentAt', | ||
headerComponent : 'tables/headers/sort', | ||
isSortable : true, | ||
cellComponent : 'ui-table/cell/cell-simple-date', | ||
options : { | ||
dateFormat: 'MMMM DD, YYYY - HH:mm A' | ||
} | ||
} | ||
] | ||
}); | ||
|
||
]; | ||
} | ||
} | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,18 @@ | ||
import Route from '@ember/routing/route'; | ||
import EmberTableRouteMixin from 'open-event-frontend/mixins/ember-table-route'; | ||
|
||
export default Route.extend({ | ||
model() { | ||
return this.modelFor('admin.messages'); | ||
export default class extends Route.extend(EmberTableRouteMixin) { | ||
|
||
async model(params) { | ||
const searchField = 'recipient'; | ||
let filterOptions = this.applySearchFilters([], params, searchField); | ||
let queryString = { | ||
filter : filterOptions, | ||
'page[size]' : params.per_page || 100, | ||
'page[number' : params.page || 1 | ||
}; | ||
queryString = this.applySortFilters(queryString, params); | ||
return this.asArray(this.modelFor('admin.messages', queryString)); | ||
} | ||
}); | ||
|
||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,16 @@ | ||
<div class="sixteen wide column"> | ||
{{events/events-table columns=columns data=model | ||
useNumericPagination=true | ||
showGlobalFilter=true | ||
showPageSize=true | ||
{{tables/default columns=columns | ||
rows=model.data | ||
currentPage=page | ||
pageSize=per_page | ||
searchQuery=search | ||
sortBy=sort_by | ||
sortDir=sort_dir | ||
metaData=model.meta | ||
filterOptions=filterOptions | ||
widthConstraint="eq-container" | ||
resizeMode="fluid" | ||
fillMode="equal-column" | ||
|
||
}} | ||
</div> |
6 changes: 3 additions & 3 deletions
6
app/templates/components/ui-table/cell/admin/messages/cell-options.hbs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,12 @@ | ||
<div class='ui checkbox'> | ||
{{input type='checkbox' name='mail_status' checked=record.mailStatus}} | ||
{{input type='checkbox' name='mail_status' checked=extraRecords.mailStatus}} | ||
<label>Mail</label> | ||
</div> | ||
<div class='ui checkbox'> | ||
{{input type='checkbox' name='notification_status' checked=record.notificationStatus}} | ||
{{input type='checkbox' name='notification_status' checked=extraRecords.notificationStatus}} | ||
<label>Notification</label> | ||
</div> | ||
<div class='ui checkbox'> | ||
{{input type='checkbox' name='user_control_status' checked=record.userControlStatus}} | ||
{{input type='checkbox' name='user_control_status' checked=extraRecords.userControlStatus}} | ||
<label>User Control</label> | ||
</div> |
22 changes: 11 additions & 11 deletions
22
app/templates/components/ui-table/cell/cell-title-message.hbs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.