-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
reverting news package to Vulcan example forum
- Loading branch information
Showing
244 changed files
with
4,377 additions
and
5,330 deletions.
There are no files selected for viewing
0
packages/news/README.md → packages/example-forum/README.md
100644 → 100755
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
...es/news/lib/assets/content/customizing.md → ...e-forum/lib/assets/content/customizing.md
100644 → 100755
This file contains 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
This file contains 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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
Once you've played around with Vulcan, you might want to deploy your app for the whole world to see. | ||
|
||
We recommend using [Meteor Up](http://meteor-up.com/) to deploy to a [Digital Ocean](http://digitalocean.com) server, along with [Compose](http://compose.io) to host your database. Another good solution is [Galaxy](http://galaxy.meteor.com/). | ||
|
||
Learn more in the [Vulcan docs](http://docs.vulcanjs.org/deployment.html). |
This file contains 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 |
---|---|---|
@@ -0,0 +1,9 @@ | ||
### Slack Chatroom | ||
|
||
If you have a question, the best place to ask is the [Slack chatroom](http://slack.vulcanjs.org) to get help. Or you can also drop to just say hello! | ||
|
||
### GitHub Issues | ||
|
||
If you've found a bug in this codebase, then please [leave an issue on GitHub](https://github.com/VulcanJS/Vulcan-Starter/issues/). | ||
|
||
If on the other hand the issue is with Vulcan in general, [leave an issue on the Vulcan core repo](https://github.com/VulcanJS/Vulcan/issues/). If you're not sure which to use, feel free to drop by the Slack chatroom to ask! |
8 changes: 4 additions & 4 deletions
8
...ews/lib/assets/content/read_this_first.md → ...rum/lib/assets/content/read_this_first.md
100644 → 100755
This file contains 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
File renamed without changes.
File renamed without changes
File renamed without changes
This file contains 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 |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from '../modules/index.js'; |
12 changes: 12 additions & 0 deletions
12
packages/example-forum/lib/components/admin/AdminUsersPosts.js
This file contains 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 |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import React from 'react'; | ||
import { Posts } from '../../modules/posts/index.js'; | ||
import { Link } from 'react-router'; | ||
|
||
const AdminUsersPosts = ({ document: user }) => | ||
<ul> | ||
{user.posts && user.posts.map(post => | ||
<li key={post._id}><Link to={Posts.getLink(post)}>{post.title}</Link></li> | ||
)} | ||
</ul> | ||
|
||
export default AdminUsersPosts; |
30 changes: 30 additions & 0 deletions
30
packages/example-forum/lib/components/categories/CategoriesDashboard.jsx
This file contains 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 |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/* | ||
Show a dashboard of all categories | ||
http://docs.vulcanjs.org/core-components.html#Datatable | ||
*/ | ||
|
||
import React from 'react'; | ||
import { Components, registerComponent } from 'meteor/vulcan:core'; | ||
import { FormattedMessage } from 'meteor/vulcan:i18n'; | ||
|
||
import { Categories } from '../../modules/categories'; | ||
|
||
const CategoriesDashboard = () => | ||
|
||
<div className="categories-dashboard"> | ||
|
||
<h3><FormattedMessage id='categories'/></h3> | ||
|
||
<Components.Datatable | ||
collection={Categories} | ||
columns={['name', 'description', 'order', 'slug']} | ||
showEdit={true} | ||
showNew={true} | ||
/> | ||
|
||
</div> | ||
|
||
registerComponent({ name: 'CategoriesDashboard', component: CategoriesDashboard }); |
43 changes: 43 additions & 0 deletions
43
packages/example-forum/lib/components/categories/CategoriesEditForm.jsx
This file contains 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 |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import { intlShape } from 'meteor/vulcan:i18n'; | ||
import { Components, registerComponent, getFragment, withMessages } from 'meteor/vulcan:core'; | ||
import { Categories } from '../../modules/categories/index.js'; | ||
|
||
const CategoriesEditForm = (props, context) => { | ||
|
||
return ( | ||
<div className="categories-edit-form"> | ||
<div className="categories-edit-form-admin"> | ||
<div className="categories-edit-form-id">ID: {props.category._id}</div> | ||
</div> | ||
<Components.SmartForm | ||
collection={Categories} | ||
documentId={props.category._id} | ||
mutationFragment={getFragment('CategoriesList')} | ||
successCallback={category => { | ||
props.closeModal(); | ||
props.flash({ id: 'categories.edit_success', properties: { name: category.name }, type: 'success'}); | ||
}} | ||
removeSuccessCallback={({ documentId, documentTitle }) => { | ||
props.closeModal(); | ||
props.flash({ id: 'categories.delete_success', properties: {name: documentTitle }, type: 'success'}); | ||
// context.events.track("category deleted", {_id: documentId}); | ||
}} | ||
showRemove={true} | ||
/> | ||
</div> | ||
); | ||
}; | ||
|
||
CategoriesEditForm.propTypes = { | ||
category: PropTypes.object.isRequired, | ||
closeModal: PropTypes.func, | ||
flash: PropTypes.func, | ||
}; | ||
|
||
CategoriesEditForm.contextTypes = { | ||
intl: intlShape, | ||
}; | ||
|
||
registerComponent({ name: 'CategoriesEditForm', component: CategoriesEditForm, hocs: [withMessages] }); |
129 changes: 129 additions & 0 deletions
129
packages/example-forum/lib/components/categories/CategoriesMenu.jsx
This file contains 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 |
---|---|---|
@@ -0,0 +1,129 @@ | ||
import { Components, registerComponent, withList, Utils, withCurrentUser } from 'meteor/vulcan:core'; | ||
import React, { PureComponent } from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import { FormattedMessage } from 'meteor/vulcan:i18n'; | ||
import { withRouter } from 'react-router'; | ||
import { Categories } from '../../modules/categories/index.js'; | ||
import { withApollo } from 'react-apollo'; | ||
|
||
/* | ||
Category menu item | ||
*/ | ||
const CategoryMenuItem = ({ category, active, expanded }) => <span className={`category-menu-item ${active ? 'category-menu-item-active' : ''}`}>{category.name}</span>; | ||
|
||
class CategoriesMenu extends PureComponent { | ||
|
||
/* | ||
Menu item for the "All Categories" link | ||
*/ | ||
getResetCategoriesItem = () => { | ||
|
||
const resetCategoriesQuery = _.clone(this.props.router.location.query); | ||
delete resetCategoriesQuery.cat; | ||
|
||
const menuItem = { | ||
to: { pathname: Utils.getRoutePath('posts.list'), query: resetCategoriesQuery }, | ||
itemProps: { | ||
eventKey: 0, | ||
className: 'category-menu-item category-menu-item-all dropdown-item', | ||
}, | ||
component: <FormattedMessage id="categories.all" />, | ||
}; | ||
|
||
return menuItem; | ||
} | ||
|
||
/* | ||
Menu items for categoeries | ||
*/ | ||
getCategoriesItems = () => { | ||
const categories = this.props.results || []; | ||
|
||
// check if a category is currently active in the route | ||
const currentCategorySlug = this.props.router.location.query && this.props.router.location.query.cat; | ||
const currentCategory = Categories.findOneInStore(this.props.client.store, { slug: currentCategorySlug }); | ||
const parentCategories = Categories.getParents(currentCategory, this.props.client.store); | ||
|
||
// decorate categories with active and expanded properties | ||
const categoriesClone = categories.map((category, index) => { | ||
|
||
const query = _.clone(this.props.router.location.query); | ||
query.cat = category.slug; | ||
|
||
const active = currentCategory && category.slug === currentCategory.slug; | ||
const expanded = parentCategories && _.contains(_.pluck(parentCategories, 'slug'), category.slug); | ||
|
||
return { | ||
to: { pathname: Utils.getRoutePath('posts.list'), query }, | ||
component: <CategoryMenuItem/>, | ||
itemProps: { | ||
active, | ||
className: 'dropdown-item', | ||
}, | ||
componentProps: { // will be passed to component defined above | ||
_id: category._id, | ||
parentId: category.parentId, | ||
category, | ||
index, | ||
currentUser: this.props.currentUser, | ||
active, | ||
expanded, | ||
} | ||
}; | ||
}); | ||
|
||
// add `childrenItems` on each item in categoriesClone | ||
const nestedCategories = Utils.unflatten(categoriesClone, { idProperty: 'componentProps._id', parentIdProperty: 'componentProps.parentId', childrenProperty: 'childrenItems' }); | ||
|
||
return nestedCategories; | ||
} | ||
|
||
/* | ||
Get all menu items | ||
*/ | ||
getMenuItems = () => { | ||
const menuItems = [this.getResetCategoriesItem(), ...this.getCategoriesItems()]; | ||
return menuItems; | ||
}; | ||
|
||
render() { | ||
|
||
return ( | ||
<div> | ||
{this.props.loading ? ( | ||
<Components.Loading /> | ||
) : ( | ||
<Components.Dropdown | ||
variant="default" | ||
className="categories-list btn-secondary" | ||
labelId={'categories'} | ||
id="categories-dropdown" | ||
menuItems={this.getMenuItems()} | ||
/> | ||
)} | ||
</div> | ||
); | ||
} | ||
} | ||
|
||
CategoriesMenu.propTypes = { | ||
results: PropTypes.array, | ||
}; | ||
|
||
const options = { | ||
collection: Categories, | ||
queryName: 'categoriesListQuery', | ||
fragmentName: 'CategoriesList', | ||
limit: 0, | ||
pollInterval: 0, | ||
}; | ||
|
||
registerComponent({ name: 'CategoriesMenu', component: CategoriesMenu, hocs: [withRouter, withApollo, [withList, options], withCurrentUser] }); |
34 changes: 34 additions & 0 deletions
34
packages/example-forum/lib/components/categories/CategoriesNewForm.jsx
This file contains 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 |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import { intlShape } from 'meteor/vulcan:i18n'; | ||
import { Components, registerComponent, getFragment, withMessages } from 'meteor/vulcan:core'; | ||
import { Categories } from '../../modules/categories/index.js'; | ||
|
||
const CategoriesNewForm = (props, context) => { | ||
|
||
return ( | ||
<div className="categories-new-form"> | ||
<Components.SmartForm | ||
collection={Categories} | ||
mutationFragment={getFragment('CategoriesList')} | ||
successCallback={category => { | ||
props.closeModal(); | ||
props.flash({id: 'categories.new_success', properties: {name: category.name}, type: "success"}); | ||
}} | ||
/> | ||
</div> | ||
) | ||
} | ||
|
||
CategoriesNewForm.displayName = "CategoriesNewForm"; | ||
|
||
CategoriesNewForm.propTypes = { | ||
closeCallback: PropTypes.func, | ||
flash: PropTypes.func, | ||
}; | ||
|
||
CategoriesNewForm.contextTypes = { | ||
intl: intlShape, | ||
}; | ||
|
||
registerComponent({ name: 'CategoriesNewForm', component: CategoriesNewForm, hocs: [withMessages] }); |
This file contains 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
Oops, something went wrong.