Skip to content

Commit

Permalink
reverting news package to Vulcan example forum
Browse files Browse the repository at this point in the history
  • Loading branch information
lewi-g committed Sep 28, 2018
1 parent 9b721c3 commit 74031d0
Show file tree
Hide file tree
Showing 244 changed files with 4,377 additions and 5,330 deletions.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
If you want to learn how to customize Vulcan, we suggest checking out the [docs](http://docs.vulcanjs.org).

The first things you'll want to do are probably create a `settings.json` file to hold all your settings, and then taking a look at the sample custom package by uncommenting `customization-demo` in `.meteor/packages`.
The first things you'll want to do are probably create a `settings.json` file to hold all your settings, and then taking a look at the sample custom package by uncommenting `example-customization` in `.meteor/packages`.

Here are two tutorials to get further:
* [Understanding the Vulcan Framework](http://docs.vulcanjs.org/tutorial-framework.html )
Expand Down
5 changes: 5 additions & 0 deletions packages/example-forum/lib/assets/content/deploying.md
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).
9 changes: 9 additions & 0 deletions packages/example-forum/lib/assets/content/getting_help.md
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!
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
### Welcome to Vulcan!
### Welcome to Vulcan.js!

If you're reading this, it means you've successfully got Vulcan to run.
If you're reading this, it means you've successfully got Vulcan's Forum example project to run.

To make your first run a bit easier, we've taken the liberty of preloading your brand new app with a few posts that will walk you through your first steps with Vulcan.
To make your first run a bit easier, we've taken the liberty of preloading your brand new app with a few posts that will walk you through your first steps with the app.

### Creating An Account

The first thing you'll need to do is create your account. Since this will be the first ever account created in this app, it will automatically be assigned admin rights, and you'll then be able to access Vulcan's settings panel.
The first thing you'll need to do is create your account. Since this will be the first ever account created in this project, it will automatically be assigned admin rights, and you'll then be able to access Vulcan's settings panel.

Click the “Log In” link in the top menu and come back here once you're done!

Expand Down
File renamed without changes.
File renamed without changes
File renamed without changes
1 change: 1 addition & 0 deletions packages/example-forum/lib/client/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from '../modules/index.js';
12 changes: 12 additions & 0 deletions packages/example-forum/lib/components/admin/AdminUsersPosts.js
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;
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 });
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 packages/example-forum/lib/components/categories/CategoriesMenu.jsx
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] });
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] });
19 changes: 7 additions & 12 deletions ...b/components/comments/CommentsEditForm.js → .../components/comments/CommentsEditForm.jsx
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,17 +1,12 @@
import {
Components,
registerComponent,
getFragment,
withMessages
} from 'meteor/vulcan:core'
import React from 'react'
import PropTypes from 'prop-types'
import { Comments } from '../../modules/comments/index.js'
import { Components, registerComponent, getFragment, withMessages } from 'meteor/vulcan:core';
import React from 'react';
import PropTypes from 'prop-types';
import { Comments } from '../../modules/comments/index.js';

const CommentsEditForm = (props, context) => {
return (
<div className="comments-edit-form">
<Components.SmartForm
<Components.SmartForm
layout="elementOnly"
collection={Comments}
documentId={props.comment._id}
Expand All @@ -29,6 +24,6 @@ CommentsEditForm.propTypes = {
comment: PropTypes.object.isRequired,
successCallback: PropTypes.func,
cancelCallback: PropTypes.func
}
};

registerComponent('CommentsEditForm', CommentsEditForm, withMessages)
registerComponent({ name: 'CommentsEditForm', component: CommentsEditForm, hocs: [withMessages] });
Loading

0 comments on commit 74031d0

Please sign in to comment.