added 260907 version of worker toolkit
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
import Ember from 'ember';
|
||||
import HistoryTrackable from 'flaredown/mixins/history-trackable';
|
||||
import AuthenticatedRouteMixin from 'flaredown/mixins/authenticated-route-mixin';
|
||||
|
||||
const {
|
||||
get,
|
||||
Route,
|
||||
} = Ember;
|
||||
|
||||
export default Route.extend(HistoryTrackable, AuthenticatedRouteMixin, {
|
||||
model() {
|
||||
return get(this, 'session.currentUser').then(user => get(user, 'topicFollowing'));
|
||||
},
|
||||
});
|
||||
@@ -0,0 +1,77 @@
|
||||
import Ember from 'ember';
|
||||
import HistoryTrackable from 'flaredown/mixins/history-trackable';
|
||||
import ToggleHeaderLogo from 'flaredown/mixins/toggle-header-logo';
|
||||
import AddMetaTags from 'flaredown/mixins/add-meta-tags';
|
||||
|
||||
const {
|
||||
set,
|
||||
get,
|
||||
Route,
|
||||
RSVP: {
|
||||
hash,
|
||||
},
|
||||
} = Ember;
|
||||
|
||||
export default Route.extend(HistoryTrackable, ToggleHeaderLogo, AddMetaTags, {
|
||||
queryParams: {
|
||||
following: { refreshModel: true },
|
||||
query: { refreshModel: true }
|
||||
},
|
||||
|
||||
model(params) {
|
||||
set(this, 'query', params.query);
|
||||
const currentUser = get(this, 'session.currentUser');
|
||||
|
||||
return hash({
|
||||
posts: get(this, 'store').query('post', params).then(q => q.toArray()),
|
||||
topicFollowing: currentUser ? currentUser.then(user => get(user, 'topicFollowing')) : [],
|
||||
});
|
||||
},
|
||||
|
||||
setHeadTags: function() {
|
||||
const currentUrl = get(this, 'currentUrl');
|
||||
|
||||
const headTags = [
|
||||
{ type: 'meta',
|
||||
tagId: 'title',
|
||||
attrs: {
|
||||
property: 'og:title',
|
||||
content: 'Discussion',
|
||||
},
|
||||
},
|
||||
{ type: 'meta',
|
||||
tagId: 'description',
|
||||
attrs: {
|
||||
property: 'og:description',
|
||||
content: 'Discussion',
|
||||
},
|
||||
},
|
||||
{ type: 'meta',
|
||||
tagId: 'url',
|
||||
attrs: {
|
||||
property: 'og:url',
|
||||
content: currentUrl,
|
||||
},
|
||||
},
|
||||
|
||||
//Twitter meta tags
|
||||
{ type: 'meta',
|
||||
tagId: 'card',
|
||||
attrs: {
|
||||
name: 'twitter:card',
|
||||
content: 'summary',
|
||||
},
|
||||
},
|
||||
{
|
||||
type: 'meta',
|
||||
tagId: 'googleDesc',
|
||||
attrs: {
|
||||
name: 'description',
|
||||
content: 'Discussion',
|
||||
},
|
||||
},
|
||||
];
|
||||
|
||||
set(this, 'headTags', headTags);
|
||||
},
|
||||
});
|
||||
@@ -0,0 +1,26 @@
|
||||
import Ember from 'ember';
|
||||
import HistoryTrackable from 'flaredown/mixins/history-trackable';
|
||||
|
||||
const {
|
||||
get,
|
||||
Route,
|
||||
} = Ember;
|
||||
|
||||
export default Route.extend(HistoryTrackable, {
|
||||
model() {
|
||||
return get(this, 'store')
|
||||
.createRecord(
|
||||
'post',
|
||||
{
|
||||
tagIds: [],
|
||||
symptomIds: [],
|
||||
conditionIds: [],
|
||||
treatmentIds: [],
|
||||
}
|
||||
);
|
||||
},
|
||||
|
||||
historyEntry() {
|
||||
return null;
|
||||
},
|
||||
});
|
||||
@@ -0,0 +1,13 @@
|
||||
import Ember from 'ember';
|
||||
import PostableGetable from 'flaredown/mixins/postable-getable';
|
||||
import HistoryTrackable from 'flaredown/mixins/history-trackable';
|
||||
|
||||
const {
|
||||
Route,
|
||||
} = Ember;
|
||||
|
||||
export default Route.extend(PostableGetable, HistoryTrackable, {
|
||||
model() {
|
||||
return this.getPostables(1);
|
||||
},
|
||||
});
|
||||
@@ -0,0 +1,94 @@
|
||||
import Ember from 'ember';
|
||||
import HistoryTrackable from 'flaredown/mixins/history-trackable';
|
||||
import ToggleHeaderLogo from 'flaredown/mixins/toggle-header-logo';
|
||||
import AddMetaTags from 'flaredown/mixins/add-meta-tags';
|
||||
import UpdateNotifications from 'flaredown/mixins/update-notifications';
|
||||
|
||||
const {
|
||||
get,
|
||||
set,
|
||||
run: {
|
||||
schedule,
|
||||
},
|
||||
Route,
|
||||
} = Ember;
|
||||
|
||||
export default Route.extend(HistoryTrackable, ToggleHeaderLogo, AddMetaTags, UpdateNotifications, {
|
||||
updateNotifications: true,
|
||||
|
||||
afterModel() {
|
||||
const currentModel = this.modelFor(this.routeName);
|
||||
|
||||
schedule('afterRender', this, this.updatePostNotifications, currentModel);
|
||||
},
|
||||
|
||||
resetController(controller, isExiting) {
|
||||
if (isExiting) {
|
||||
set(controller, 'anchor', null);
|
||||
}
|
||||
},
|
||||
model(params) {
|
||||
return get(this, 'store').find('post', params.id);
|
||||
},
|
||||
|
||||
setupController(controller, model) {
|
||||
this._super(controller, model);
|
||||
|
||||
set(controller, 'newComment', get(this, 'store').createRecord('comment'));
|
||||
},
|
||||
|
||||
historyEntry(model) {
|
||||
let entry = this._super(...arguments);
|
||||
|
||||
entry.pushObject([get(model, 'id')]);
|
||||
|
||||
return entry;
|
||||
},
|
||||
|
||||
setHeadTags: function(model) {
|
||||
const currentUrl = get(this, 'currentUrl');
|
||||
|
||||
const headTags = [
|
||||
{ type: 'meta',
|
||||
tagId: 'title',
|
||||
attrs: {
|
||||
property: 'og:title',
|
||||
content: model.get('title'),
|
||||
},
|
||||
},
|
||||
{ type: 'meta',
|
||||
tagId: 'description',
|
||||
attrs: {
|
||||
property: 'og:description',
|
||||
content: model.get('body'),
|
||||
},
|
||||
},
|
||||
{ type: 'meta',
|
||||
tagId: 'url',
|
||||
attrs: {
|
||||
property: 'og:url',
|
||||
content: currentUrl,
|
||||
},
|
||||
},
|
||||
|
||||
//Twitter meta tags
|
||||
{ type: 'meta',
|
||||
tagId: 'card',
|
||||
attrs: {
|
||||
name: 'twitter:card',
|
||||
content: 'summary',
|
||||
},
|
||||
},
|
||||
{
|
||||
type: 'meta',
|
||||
tagId: 'googleDesc',
|
||||
attrs: {
|
||||
name: 'description',
|
||||
content: model.get('body'),
|
||||
},
|
||||
},
|
||||
];
|
||||
|
||||
set(this, 'headTags', headTags);
|
||||
},
|
||||
});
|
||||
@@ -0,0 +1,97 @@
|
||||
import Ember from 'ember';
|
||||
import HistoryTrackable from 'flaredown/mixins/history-trackable';
|
||||
import ToggleHeaderLogo from 'flaredown/mixins/toggle-header-logo';
|
||||
import AddMetaTags from 'flaredown/mixins/add-meta-tags';
|
||||
|
||||
const {
|
||||
get,
|
||||
set,
|
||||
inject: {
|
||||
service,
|
||||
},
|
||||
Route,
|
||||
getProperties,
|
||||
RSVP: {
|
||||
hash,
|
||||
},
|
||||
} = Ember;
|
||||
|
||||
const availableTypes = ['tag', 'symptom', 'condition', 'treatment'];
|
||||
|
||||
export default Route.extend(HistoryTrackable, ToggleHeaderLogo, AddMetaTags, {
|
||||
session: service(),
|
||||
|
||||
model(params) {
|
||||
const { id, type } = params;
|
||||
|
||||
if (!availableTypes.includes(type)) {
|
||||
return this.transitionTo('posts');
|
||||
}
|
||||
|
||||
const store = get(this, 'store');
|
||||
const currentUser = get(this, 'session.currentUser');
|
||||
|
||||
return hash({
|
||||
id,
|
||||
type,
|
||||
page: 1,
|
||||
posts: store.query('post', { id, type }).then(q => q.toArray()),
|
||||
topic: store.findRecord(type, id),
|
||||
topicFollowing: currentUser ? currentUser.then(user => get(user, 'topicFollowing')) : [],
|
||||
});
|
||||
},
|
||||
|
||||
historyEntry(model) {
|
||||
const { id, type } = getProperties(model, 'id', 'type');
|
||||
|
||||
return this._super(...arguments).pushObjects([type, id]);
|
||||
},
|
||||
|
||||
setHeadTags: function(model) {
|
||||
const currentUrl = get(this, 'currentUrl');
|
||||
|
||||
const headTags = [
|
||||
{ type: 'meta',
|
||||
tagId: 'title',
|
||||
attrs: {
|
||||
property: 'og:title',
|
||||
content: 'Topic',
|
||||
},
|
||||
},
|
||||
{ type: 'meta',
|
||||
tagId: 'description',
|
||||
attrs: {
|
||||
property: 'og:description',
|
||||
content: get(model, 'topic.name'),
|
||||
},
|
||||
},
|
||||
{ type: 'meta',
|
||||
tagId: 'url',
|
||||
attrs: {
|
||||
property: 'og:url',
|
||||
content: currentUrl,
|
||||
},
|
||||
},
|
||||
|
||||
//Twitter meta tags
|
||||
{ type: 'meta',
|
||||
tagId: 'card',
|
||||
attrs: {
|
||||
name: 'twitter:card',
|
||||
content: 'summary',
|
||||
},
|
||||
},
|
||||
{
|
||||
type: 'meta',
|
||||
tagId: 'googleDesc',
|
||||
attrs: {
|
||||
name: 'description',
|
||||
content: get(model, 'topic.name'),
|
||||
},
|
||||
},
|
||||
];
|
||||
|
||||
set(this, 'headTags', headTags);
|
||||
},
|
||||
|
||||
});
|
||||
Reference in New Issue
Block a user