using React and simplifying the app down to a list of post titles

This commit is contained in:
Sacha Greif 2016-02-14 12:27:20 +09:00
parent 85e9d00088
commit fe02270bad
16 changed files with 441 additions and 389 deletions

44
.eslintrc Normal file
View file

@ -0,0 +1,44 @@
/* Galaxy's Javascript linting configuration (Meteor)
*
* Documentation on rules can be found at:
* http://eslint.org/docs/rules/ <- Optionally append the rulename
*
* Ensure changes are kept in sync with the base linting configuration.
*/
{
"extends": ".eslintrc-meteor",
"env": {
/* Allows global vars from the Meteor environment to pass and enables certain rules */
"meteor": true
},
"rules": {
/* ---------------- Rules relaxed for Meteor's sake --------------------- */
/* allows use of var (remove when we are ready to switch to ES6) */
"no-var": 0,
/* allows anonymous functions */
"func-names": 0,
/* allows var = function() delcarations */
"func-style": 0,
/* relaxes max-len to 100 chars per line */
"max-len": [2, 100, 2],
/* relaxes requirement to put all vars at the top of the scope */
"vars-on-top": 0,
/* relaxes dangling commas enforcement */
"comma-dangle": 0,
/* allows certain non-constructor functions to start with a capital letter, */
"new-cap": [2, { "capIsNewExceptions": [
"Match", "Any", "Object", "ObjectIncluding", "OneOf", "Optional", "Where"
]}],
/* ---------------------------------------------------------------------- */
}
}

View file

@ -11,35 +11,35 @@ telescope:core
# Note: all following packages depend on telescope:core; Additional internal dependencies are mentioned
telescope:migrations
telescope:api
telescope:daily # singleday
telescope:datetimepicker
telescope:debug
telescope:email
telescope:embedly
telescope:getting-started
telescope:invites
telescope:kadira
telescope:newsletter
telescope:notifications
telescope:pages
telescope:post-by-feed
telescope:prerender
telescope:releases
telescope:rss
telescope:scoring
telescope:search
telescope:share
# telescope:migrations
# telescope:api
# telescope:daily # singleday
# telescope:datetimepicker
# telescope:debug
# telescope:email
# telescope:embedly
# telescope:getting-started
# telescope:invites
# telescope:kadira
# telescope:newsletter
# telescope:notifications
# telescope:pages
# telescope:post-by-feed
# telescope:prerender
# telescope:releases
# telescope:rss
# telescope:scoring
# telescope:search
# telescope:share
# telescope:singleday
# telescope:sitemap
telescope:spiderable
telescope:subscribe-to-posts # notifications
telescope:tagline-banner
telescope:tags
telescope:theme-base
telescope:theme-hubble
telescope:update-prompt
# telescope:spiderable
# telescope:subscribe-to-posts # notifications
# telescope:tagline-banner
# telescope:tags
# telescope:theme-base
# telescope:theme-hubble
# telescope:update-prompt
############ Your Custom Packages ############

View file

@ -5,18 +5,8 @@ accounts-password@1.1.4
accounts-twitter@1.0.6
accounts-ui@1.1.6
accounts-ui-unstyled@1.1.8
aldeed:autoform@5.8.1
aldeed:collection2@2.8.0
aldeed:collection2-core@1.0.0
aldeed:http@0.2.2
aldeed:schema-deny@1.0.1
aldeed:schema-index@1.0.1
aldeed:simple-schema@1.5.3
aldeed:template-extension@4.0.0
anti:i18n@0.4.3
aramk:tinycolor@1.1.0_1
arillo:flow-router-helpers@0.5.0
aslagle:reactive-table@0.8.24
arillo:flow-router-helpers@0.5.1
autoupdate@1.2.4
babel-compiler@5.8.24_1
babel-runtime@0.1.4
@ -29,16 +19,10 @@ boilerplate-generator@1.0.4
caching-compiler@1.0.0
caching-html-compiler@1.0.2
callback-hook@1.0.4
ccan:cssreset@1.0.0
cfs:http-methods@0.0.30
check@1.1.0
chuangbo:cookie@1.1.0
chuangbo:marked@0.3.5_1
cmather:handlebars-server@2.0.0
coffeescript@1.0.11
cosmos:browserify@0.9.2
dburles:collection-helpers@1.0.4
dburles:spacebars-tohtml@1.0.1
cosmos:browserify@0.9.3
dburles:mongo-collection-instances@0.3.4
ddp@1.2.2
ddp-client@1.2.1
ddp-common@1.2.2
@ -46,148 +30,76 @@ ddp-rate-limiter@1.0.0
ddp-server@1.2.2
deps@1.0.9
diff-sequence@1.0.1
djedi:sanitize-html@1.11.2
ecmascript@0.1.6
ecmascript-runtime@0.2.6
ejson@1.0.7
email@1.0.8
es5-shim@4.1.14
facebook@1.2.2
fastclick@1.0.7
fortawesome:fontawesome@4.5.0
fourseven:scss@3.4.1
geojson-utils@1.0.4
handlebars@1.0.4
hausor:autoform-bs-minicolors@1.0.0
hot-code-push@1.0.0
html-tools@1.0.5
htmljs@1.0.5
http@1.1.1
id-map@1.0.4
idorecall:email-normalize@1.0.0
jparker:crypto-core@0.1.0
jparker:crypto-md5@0.1.1
jparker:gravatar@0.4.1
jquery@1.11.4
kadira:blaze-layout@2.3.0
kadira:debug@2.2.4
kadira:dochead@1.4.0
jsx@0.2.3
kadira:flow-router@2.10.1
kestanous:herald@1.3.0
kestanous:herald-email@0.5.0
kadira:react-layout@1.5.3
lai:collection-extensions@0.1.4
launch-screen@1.0.4
less@2.5.1
livedata@1.0.15
localstorage@1.0.5
logging@1.0.8
matb33:collection-hooks@0.8.1
mdg:validation-error@0.2.0
meteor@1.1.10
meteor-base@1.0.1
meteor-platform@1.2.3
meteorhacks:fast-render@2.11.0
meteorhacks:inject-data@1.4.1
meteorhacks:inject-initial@1.0.2
meteorhacks:kadira@2.24.1
meteorhacks:meteorx@1.4.1
meteorhacks:picker@1.0.3
meteorhacks:subs-manager@1.6.3
meteorhacks:unblock@1.1.0
meteorspark:util@0.2.0
minifiers@1.1.7
minimongo@1.0.10
miro:mailchimp@1.1.0
mobile-status-bar@1.0.6
momentjs:moment@2.11.2
mongo@1.1.3
mongo-id@1.0.1
mongo-livedata@1.0.9
npm-bcrypt@0.7.8_2
npm-mongo@1.4.39_1
oauth@1.1.6
oauth1@1.1.5
oauth2@1.1.5
observe-sequence@1.0.7
okgrow:router-autoscroll@0.1.6
ongoworks:speakingurl@6.0.0
ordered-dict@1.0.4
package-version-parser@3.0.4
percolatestudio:synced-cron@1.1.0
promise@0.5.1
raix:eventemitter@0.1.3
random@1.0.5
rate-limit@1.0.0
react@0.14.3
react-meteor-data@0.2.4
react-runtime@0.14.4
react-runtime-dev@0.14.4
react-runtime-prod@0.14.4
reactive-dict@1.1.3
reactive-var@1.0.6
reload@1.1.4
retry@1.0.4
routepolicy@1.0.6
sacha:juice@0.1.4
sacha:spin@2.3.1
sanjo:meteor-files-helpers@1.2.0_1
sanjo:meteor-version@1.0.0
seba:minifiers-autoprefixer@0.0.1
service-configuration@1.0.5
session@1.1.1
sha@1.0.4
softwarerero:accounts-t9n@1.1.7
spacebars@1.0.7
spacebars-compiler@1.0.7
spiderable@1.0.9
srp@1.0.4
standard-app-packages@1.0.6
tap:i18n@1.7.0
telescope:api@0.25.7
telescope:comments@0.25.7
telescope:core@0.25.7
telescope:daily@0.25.7
telescope:datetimepicker@0.25.7
telescope:debug@0.25.7
telescope:email@0.25.7
telescope:embedly@0.25.7
telescope:events@0.25.7
telescope:getting-started@0.25.7
telescope:i18n@0.25.7
telescope:invites@0.25.7
telescope:kadira@0.25.7
telescope:lib@0.25.7
telescope:messages@0.25.7
telescope:migrations@0.25.7
telescope:newsletter@0.25.7
telescope:notifications@0.25.7
telescope:pages@0.25.7
telescope:post-by-feed@0.25.7
telescope:posts@0.25.7
telescope:prerender@0.25.7
telescope:releases@0.25.7
telescope:rss@0.25.7
telescope:scoring@0.25.7
telescope:search@0.25.7
telescope:settings@0.25.7
telescope:share@0.25.7
telescope:spiderable@0.25.7
telescope:subscribe-to-posts@0.25.7
telescope:tagline-banner@0.25.7
telescope:tags@0.25.7
telescope:theme-base@0.25.7
telescope:theme-hubble@0.25.7
telescope:update-prompt@0.25.7
telescope:users@0.25.7
templating@1.1.5
templating-tools@1.0.0
tmeasday:publish-counts@0.7.3
tracker@1.0.9
tsega:bootstrap3-datetimepicker@4.17.37_1
twitter@1.1.5
ui@1.0.8
underscore@1.0.4
url@1.0.5
useraccounts:core@1.13.1
useraccounts:flow-routing@1.13.1
useraccounts:unstyled@1.13.1
utilities:avatar@0.9.2
utilities:menu@0.1.7
utilities:onsubscribed@0.1.2
utilities:smartquery@0.1.5
webapp@1.2.3
webapp-hashing@1.0.5
zimme:active-route@2.3.2

View file

@ -0,0 +1,35 @@
App = React.createClass({
// mixins: [ReactMeteorData],
// getMeteorData() {
// var data = {
// ready: true
// };
// var handles = [
// Meteor.subscribe('site', SITE_KEY),
// Meteor.subscribe('toc'),
// Meteor.subscribe('chapters', BOOK_KEY),
// Meteor.subscribe('interviews', BOOK_KEY),
// Meteor.subscribe('videos', BOOK_KEY),
// Meteor.subscribe('thisUser'),
// Meteor.subscribe('pages'),
// ];
// if(_.every(handles, handle => {return handle.ready();})) {
// Session.set("book", Products.findOne({key: BOOK_KEY}));
// data.ready = true;
// }
// return data;
// },
render() {
return this.props.content;
// return this.data.ready ? this.props.content : <Loading/>;
}
});

View file

@ -11,12 +11,12 @@ Package.onUse(function(api) {
var packages = [
'telescope:lib@0.25.7', // no dependencies
'telescope:messages@0.25.7', // lib
'telescope:i18n@0.25.7', // lib
'telescope:events@0.25.7', // lib, i18n
'telescope:settings@0.25.7', // lib, i18n
'telescope:users@0.25.7', // lib, i18n, settings
'telescope:comments@0.25.7', // lib, i18n, settings, users
// 'telescope:messages@0.25.7', // lib
// 'telescope:i18n@0.25.7', // lib
// 'telescope:events@0.25.7', // lib, i18n
// 'telescope:settings@0.25.7', // lib, i18n
// 'telescope:users@0.25.7', // lib, i18n, settings
// 'telescope:comments@0.25.7', // lib, i18n, settings, users
'telescope:posts@0.25.7' // lib, i18n, settings, users, comments
];
@ -25,66 +25,67 @@ Package.onUse(function(api) {
api.imply(packages);
api.addFiles([
'lib/modules.js',
'lib/vote.js',
'lib/subscriptions.js',
'lib/callbacks.js'
// 'lib/modules.js',
// 'lib/vote.js',
// 'lib/subscriptions.js',
// 'lib/callbacks.js'
], ['client', 'server']);
api.addFiles([
'lib/client/handlebars.js',
'lib/client/main.html',
'lib/client/main.js',
'lib/client/scripts/jquery.quickfit.js',
'lib/client/templates/modules/modules.html',
'lib/client/templates/modules/modules.js',
'lib/client/templates/admin/admin_menu.html',
'lib/client/templates/admin/admin_menu.js',
'lib/client/templates/admin/admin_wrapper.html',
'lib/client/templates/common/css.html',
'lib/client/templates/common/css.js',
'lib/client/templates/common/footer_code.html',
'lib/client/templates/common/footer_code.js',
'lib/client/templates/common/loader.html',
'lib/client/templates/common/checker.html',
'lib/client/templates/common/checker.js',
'lib/client/templates/common/layout.html',
'lib/client/templates/common/layout.js',
'lib/client/templates/errors/already_logged_in.html',
'lib/client/templates/errors/loading.html',
'lib/client/templates/errors/loading.js',
'lib/client/templates/errors/no_account.html',
'lib/client/templates/errors/no_account.js',
'lib/client/templates/errors/no_invite.html',
'lib/client/templates/errors/no_invite.js',
'lib/client/templates/errors/no_rights.html',
'lib/client/templates/errors/no_rights.js',
'lib/client/templates/errors/not_found.html',
'lib/client/templates/forms/urlCustomType.html',
'lib/client/templates/forms/urlCustomType.js',
'lib/client/templates/nav/logo.html',
'lib/client/templates/nav/logo.js',
'lib/client/templates/nav/mobile_nav.html',
'lib/client/templates/nav/mobile_nav.js',
'lib/client/templates/nav/header.html',
'lib/client/templates/nav/header.js',
'lib/client/templates/nav/submit_button.html'
'lib/components/App.jsx',
// 'lib/client/handlebars.js',
// 'lib/client/main.html',
// 'lib/client/main.js',
// 'lib/client/scripts/jquery.quickfit.js',
// 'lib/client/templates/modules/modules.html',
// 'lib/client/templates/modules/modules.js',
// 'lib/client/templates/admin/admin_menu.html',
// 'lib/client/templates/admin/admin_menu.js',
// 'lib/client/templates/admin/admin_wrapper.html',
// 'lib/client/templates/common/css.html',
// 'lib/client/templates/common/css.js',
// 'lib/client/templates/common/footer_code.html',
// 'lib/client/templates/common/footer_code.js',
// 'lib/client/templates/common/loader.html',
// 'lib/client/templates/common/checker.html',
// 'lib/client/templates/common/checker.js',
// 'lib/client/templates/common/layout.html',
// 'lib/client/templates/common/layout.js',
// 'lib/client/templates/errors/already_logged_in.html',
// 'lib/client/templates/errors/loading.html',
// 'lib/client/templates/errors/loading.js',
// 'lib/client/templates/errors/no_account.html',
// 'lib/client/templates/errors/no_account.js',
// 'lib/client/templates/errors/no_invite.html',
// 'lib/client/templates/errors/no_invite.js',
// 'lib/client/templates/errors/no_rights.html',
// 'lib/client/templates/errors/no_rights.js',
// 'lib/client/templates/errors/not_found.html',
// 'lib/client/templates/forms/urlCustomType.html',
// 'lib/client/templates/forms/urlCustomType.js',
// 'lib/client/templates/nav/logo.html',
// 'lib/client/templates/nav/logo.js',
// 'lib/client/templates/nav/mobile_nav.html',
// 'lib/client/templates/nav/mobile_nav.js',
// 'lib/client/templates/nav/header.html',
// 'lib/client/templates/nav/header.js',
// 'lib/client/templates/nav/submit_button.html'
], 'client');
api.addAssets([
'public/img/loading.svg',
// 'public/img/loading.svg',
], 'client');
api.addFiles([
'lib/server/start.js',
'lib/server/fastrender.js',
'lib/server/routes.js'
// 'lib/server/start.js',
// 'lib/server/fastrender.js',
// 'lib/server/routes.js'
], ['server']);
var languages = ["ar", "bg", "cs", "da", "de", "el", "en", "es", "et", "fr", "hu", "id", "it", "ja", "kk", "ko", "nl", "pl", "pt-BR", "ro", "ru", "sl", "sv", "th", "tr", "vi", "zh-CN"];
var languagesPaths = languages.map(function (language) {
return "i18n/"+language+".i18n.json";
});
api.addFiles(languagesPaths, ["client", "server"]);
// var languages = ["ar", "bg", "cs", "da", "de", "el", "en", "es", "et", "fr", "hu", "id", "it", "ja", "kk", "ko", "nl", "pl", "pt-BR", "ro", "ru", "sl", "sv", "th", "tr", "vi", "zh-CN"];
// var languagesPaths = languages.map(function (language) {
// return "i18n/"+language+".i18n.json";
// });
// api.addFiles(languagesPaths, ["client", "server"]);
});

View file

@ -0,0 +1,35 @@
AppContainer = React.createClass({
// mixins: [ReactMeteorData],
// getMeteorData() {
// var data = {
// ready: true
// };
// var handles = [
// Meteor.subscribe('site', SITE_KEY),
// Meteor.subscribe('toc'),
// Meteor.subscribe('chapters', BOOK_KEY),
// Meteor.subscribe('interviews', BOOK_KEY),
// Meteor.subscribe('videos', BOOK_KEY),
// Meteor.subscribe('thisUser'),
// Meteor.subscribe('pages'),
// ];
// if(_.every(handles, handle => {return handle.ready();})) {
// Session.set("book", Products.findOne({key: BOOK_KEY}));
// data.ready = true;
// }
// return data;
// },
render() {
return this.props.content;
// return this.data.ready ? this.props.content : <Loading/>;
}
});

View file

@ -16,7 +16,6 @@ Package.onUse(function (api) {
'jquery',
'session',
'tracker',
// 'standard-minifiers@1.0.1',
'service-configuration',
'accounts-ui',
'accounts-base',
@ -24,52 +23,55 @@ Package.onUse(function (api) {
'accounts-twitter',
'accounts-facebook',
'check',
// 'audit-argument-checks',
'reactive-var',
'http',
'email',
'ecmascript@0.1.6',
'aldeed:simple-schema@1.5.3',
'aldeed:collection2@2.8.0',
'aldeed:http@0.2.2',
'aldeed:autoform@5.8.1',
'aldeed:template-extension@4.0.0',
'tap:i18n@1.7.0',
'fourseven:scss@3.4.1',
// 'aldeed:collection2@2.8.0',
// 'aldeed:http@0.2.2',
// 'aldeed:autoform@5.8.1',
// 'aldeed:template-extension@4.0.0',
// 'tap:i18n@1.7.0',
// 'fourseven:scss@3.4.1',
// 'kadira:blaze-layout@2.3.0',
// 'meteorhacks:picker@1.0.3',
// 'kadira:dochead@1.4.0',
// 'dburles:collection-helpers@1.0.4',
// 'matb33:collection-hooks@0.8.1',
// 'chuangbo:marked@0.3.5_1',
// 'meteorhacks:fast-render@2.11.0',
// 'meteorhacks:subs-manager@1.6.3',
// 'percolatestudio:synced-cron@1.1.0',
// 'useraccounts:unstyled@1.13.1',
// 'useraccounts:flow-routing@1.13.1',
// 'aramk:tinycolor@1.1.0_1',
// 'momentjs:moment@2.11.2',
// 'sacha:spin@2.3.1',
// 'aslagle:reactive-table@0.8.24',
// 'utilities:avatar@0.9.2',
// 'fortawesome:fontawesome@4.5.0',
// 'ccan:cssreset@1.0.0',
// 'djedi:sanitize-html@1.11.2',
// 'dburles:collection-helpers@1.0.4',
// 'jparker:gravatar@0.4.1',
// 'sanjo:meteor-files-helpers@1.2.0_1',
// 'cmather:handlebars-server@2.0.0',
// 'chuangbo:cookie@1.1.0',
// 'ongoworks:speakingurl@6.0.0',
// 'okgrow:router-autoscroll@0.1.6',
// 'tmeasday:publish-counts@0.7.3',
// 'utilities:onsubscribed@0.1.2',
// 'utilities:menu@0.1.6',
// 'seba:minifiers-autoprefixer@0.0.1',
// 'dburles:spacebars-tohtml@1.0.1',
// 'meteorhacks:unblock@1.1.0',
'kadira:flow-router@2.10.1',
'kadira:blaze-layout@2.3.0',
'arillo:flow-router-helpers@0.5.0',
'meteorhacks:picker@1.0.3',
'kadira:dochead@1.4.0',
'dburles:collection-helpers@1.0.4',
'matb33:collection-hooks@0.8.1',
'chuangbo:marked@0.3.5_1',
'meteorhacks:fast-render@2.11.0',
'meteorhacks:subs-manager@1.6.3',
'percolatestudio:synced-cron@1.1.0',
'useraccounts:unstyled@1.13.1',
'useraccounts:flow-routing@1.13.1',
'aramk:tinycolor@1.1.0_1',
'momentjs:moment@2.11.2',
'sacha:spin@2.3.1',
'aslagle:reactive-table@0.8.24',
'utilities:avatar@0.9.2',
'fortawesome:fontawesome@4.5.0',
'ccan:cssreset@1.0.0',
'djedi:sanitize-html@1.11.2',
'dburles:collection-helpers@1.0.4',
'jparker:gravatar@0.4.1',
'sanjo:meteor-files-helpers@1.2.0_1',
'cmather:handlebars-server@2.0.0',
'chuangbo:cookie@1.1.0',
'ongoworks:speakingurl@6.0.0',
'okgrow:router-autoscroll@0.1.6',
'tmeasday:publish-counts@0.7.3',
'utilities:onsubscribed@0.1.2',
'utilities:menu@0.1.6',
'seba:minifiers-autoprefixer@0.0.1',
'dburles:spacebars-tohtml@1.0.1',
'meteorhacks:unblock@1.1.0'
'utilities:smartquery@0.1.5',
'kadira:react-layout@1.5.3',
'ecmascript@0.1.6',
'react',
'jsx'
];
api.use(packages);
@ -77,39 +79,41 @@ Package.onUse(function (api) {
api.imply(packages);
api.addFiles([
'lib/core.js',
'lib/utils.js',
'lib/callbacks.js',
'lib/collections.js',
'lib/modules.js',
'lib/config.js',
'lib/templates.js',
'lib/deep.js',
'lib/deep_extend.js',
'lib/autolink.js',
'lib/themes.js',
'lib/menus.js',
'lib/seo.js',
'lib/base.js',
'lib/colors.js',
'lib/icons.js',
'lib/router.js',
'lib/custom_template_prefix.js'
'containers/AppContainer.jsx'
// 'lib/core.js',
// 'lib/utils.js',
// 'lib/callbacks.js',
// 'lib/collections.js',
// 'lib/modules.js',
// 'lib/config.js',
// 'lib/templates.js',
// 'lib/deep.js',
// 'lib/deep_extend.js',
// 'lib/autolink.js',
// 'lib/themes.js',
// 'lib/menus.js',
// 'lib/seo.js',
// 'lib/base.js',
// 'lib/colors.js',
// 'lib/icons.js',
// 'lib/router.js',
// 'lib/custom_template_prefix.js'
], ['client', 'server']);
api.addFiles([
'lib/client/jquery.exists.js',
'lib/client/template_replacement.js'
// 'lib/client/jquery.exists.js',
// 'lib/client/template_replacement.js'
], ['client']);
api.export([
'Telescope',
'_',
// '_',
'getTemplate',
'templates',
// 'getTemplate',
// 'templates',
'themeSettings'
// 'themeSettings',
'AppContainer'
]);
});

View file

@ -1,7 +1,7 @@
Package.describe({
name: "telescope:newsletter",
summary: "Telescope email newsletter package",
version: "0.25.7",
version: "0.25.7_1",
git: "https://github.com/TelescopeJS/telescope-newsletter.git"
});

View file

@ -0,0 +1,7 @@
PostList = props => {
return (
<div className="postList">
{props.posts.map(post => <h3 key={post.title}>{post.title}</h3>)}
</div>
)
};

View file

@ -0,0 +1,33 @@
// import React from 'react';
PostListContainer = React.createClass({
// propTypes: {
// },
mixins: [ReactMeteorData],
getMeteorData() {
var cursor = Posts.find({}, {limit: 10});
var sm = SmartQuery.create("posts", cursor);
return {
posts: sm.cursor.fetch()
}
// return {
// posts: [
// {title: "foo"},
// {title: "bar"}
// ]
// };
},
render() {
return (
<PostList {...this.data}/>
)
}
});
// export default PostListContainer;

View file

@ -26,7 +26,7 @@ Posts.schema = new SimpleSchema({
editableBy: ["admin"],
autoform: {
group: 'admin',
type: "bootstrap-datetimepicker"
// type: "bootstrap-datetimepicker"
}
},
/**
@ -38,7 +38,7 @@ Posts.schema = new SimpleSchema({
max: 500,
editableBy: ["member", "admin"],
autoform: {
type: "bootstrap-url",
// type: "bootstrap-url",
order: 10
}
},
@ -246,18 +246,12 @@ Posts.schema = new SimpleSchema({
});
// schema transforms
Meteor.startup(function(){
// needs to happen after every fields were added
Posts.internationalize();
});
// Meteor.startup(function(){
// // needs to happen after every fields were added
// Posts.internationalize();
// });
/**
* Attach schema to Posts collection
*/
Posts.attachSchema(Posts.schema);
Posts.allow({
update: _.partial(Telescope.allowCheck, Posts),
remove: _.partial(Telescope.allowCheck, Posts)
});

View file

@ -1,33 +1,33 @@
FlowRouter.route('/', {
name: "postsDefault",
action: function(params, queryParams) {
BlazeLayout.render("layout", {main: "main_posts_list"});
}
});
// FlowRouter.route('/', {
// name: "postsDefault",
// action: function(params, queryParams) {
// BlazeLayout.render("layout", {main: "main_posts_list"});
// }
// });
FlowRouter.route('/posts/:_id/edit', {
name: "postEdit",
action: function(params, queryParams) {
BlazeLayout.render("layout", {main: "post_edit"});
}
});
// FlowRouter.route('/posts/:_id/edit', {
// name: "postEdit",
// action: function(params, queryParams) {
// BlazeLayout.render("layout", {main: "post_edit"});
// }
// });
FlowRouter.route('/posts/:_id/:slug?', {
name: "postPage",
action: function(params, queryParams) {
trackRouteEntry(params._id);
BlazeLayout.render("layout", {main: "post_page"});
}
});
// FlowRouter.route('/posts/:_id/:slug?', {
// name: "postPage",
// action: function(params, queryParams) {
// trackRouteEntry(params._id);
// BlazeLayout.render("layout", {main: "post_page"});
// }
// });
var trackRouteEntry = function (postId) {
var sessionId = Meteor.default_connection && Meteor.default_connection._lastSessionId ? Meteor.default_connection._lastSessionId : null;
Meteor.call('increasePostViews', postId, sessionId);
}
// var trackRouteEntry = function (postId) {
// var sessionId = Meteor.default_connection && Meteor.default_connection._lastSessionId ? Meteor.default_connection._lastSessionId : null;
// Meteor.call('increasePostViews', postId, sessionId);
// }
FlowRouter.route('/submit', {
name: "postSubmit",
action: function(params, queryParams) {
BlazeLayout.render("layout", {main: "post_submit"});
}
});
// FlowRouter.route('/submit', {
// name: "postSubmit",
// action: function(params, queryParams) {
// BlazeLayout.render("layout", {main: "post_submit"});
// }
// });

View file

@ -0,0 +1,7 @@
FlowRouter.route('/', {
name: 'postList',
action: function (params, queryParams) {
ReactLayout.render(AppContainer, {content: <PostListContainer {...queryParams} />})
// mount(App, {content: <PostListContainer {...queryParams}/>});
}
});

View file

@ -0,0 +1,8 @@
SmartQuery.addRule(Posts, {
filter: function (document) {
return true;
}
// fields: function () {
// return ["_id", "title", "body"];
// }
});

View file

@ -1,34 +0,0 @@
// Posts.addStateTransition("status", [
// {
// name: "approve",
// from: "*",
// to: Posts.config.STATUS_APPROVED,
// callback: function (oldPost, newPost) {
// Telescope.callbacks.runAsync("postApproveAsync", newPost, oldPost);
// }
// },
// {
// name: "unapprove",
// from: Posts.config.STATUS_APPROVED,
// to: "*",
// callback: function (oldPost, newPost) {
// Telescope.callbacks.runAsync("postUnapproveAsync", newPost, oldPost);
// }
// },
// {
// name: "makePending",
// from: "*",
// to: Posts.config.STATUS_PENDING,
// callback: function (oldPost, newPost) {
// Telescope.callbacks.runAsync("postMakePendingAsync", newPost, oldPost);
// }
// },
// {
// name: "reject",
// from: "*",
// to: Posts.config.STATUS_REJECTED,
// callback: function (oldPost, newPost) {
// Telescope.callbacks.runAsync("postRejectAsync", newPost, oldPost);
// }
// }
// ]);

View file

@ -11,83 +11,89 @@ Package.onUse(function (api) {
api.use([
'telescope:lib@0.25.7',
'telescope:i18n@0.25.7',
'telescope:settings@0.25.7',
'telescope:users@0.25.7',
'telescope:comments@0.25.7'
// 'telescope:i18n@0.25.7',
// 'telescope:settings@0.25.7',
// 'telescope:users@0.25.7',
// 'telescope:comments@0.25.7'
]);
api.addFiles([
'lib/namespace.js',
'lib/config.js',
'lib/posts.js',
'lib/parameters.js',
'lib/views.js',
'lib/helpers.js',
'lib/modules.js',
'lib/callbacks.js',
'lib/methods.js',
'lib/transitions.js',
'lib/menus.js',
'lib/routes.js'
// 'lib/config.js',
// 'lib/posts.js',
// 'lib/parameters.js',
// 'lib/views.js',
// 'lib/helpers.js',
// 'lib/modules.js',
// 'lib/callbacks.js',
// 'lib/methods.js',
// 'lib/menus.js',
'lib/containers/PostListContainer.jsx',
'lib/components/PostList.jsx',
'lib/routes.jsx'
], ['client', 'server']);
api.addFiles([
'lib/client/templates/after_post_item.html',
'lib/client/templates/before_post_item.html',
'lib/client/templates/modules/post_actions.html',
'lib/client/templates/modules/post_actions.js',
'lib/client/templates/modules/post_admin.html',
'lib/client/templates/modules/post_admin.js',
'lib/client/templates/modules/post_author.html',
'lib/client/templates/modules/post_author.js',
'lib/client/templates/modules/post_avatars.html',
'lib/client/templates/modules/post_avatars.js',
'lib/client/templates/modules/post_comments_link.html',
'lib/client/templates/modules/post_content.html',
'lib/client/templates/modules/post_content.js',
'lib/client/templates/modules/post_discuss.html',
'lib/client/templates/modules/post_domain.html',
'lib/client/templates/modules/post_domain.js',
'lib/client/templates/modules/post_info.html',
'lib/client/templates/modules/post_info.js',
'lib/client/templates/modules/post_rank.html',
'lib/client/templates/modules/post_rank.js',
'lib/client/templates/modules/post_title.html',
'lib/client/templates/modules/post_vote.html',
'lib/client/templates/modules/post_vote.js',
'lib/client/templates/post_body.html',
'lib/client/templates/post_edit.html',
'lib/client/templates/post_edit.js',
'lib/client/templates/post_item.html',
'lib/client/templates/post_item.js',
'lib/client/templates/post_page.html',
'lib/client/templates/post_page.js',
'lib/client/templates/post_submit.html',
'lib/client/templates/post_submit.js',
'lib/client/templates/views_menu.html',
'lib/client/templates/views_menu.js',
'lib/client/templates/main_posts_list.html',
'lib/client/templates/main_posts_list.js',
'lib/client/templates/posts_list/posts_list.html',
'lib/client/templates/posts_list/posts_list.js',
'lib/client/templates/posts_list/posts_list_compact.html',
'lib/client/templates/posts_list/posts_list_compact.js',
'lib/client/templates/posts_list/posts_list_controller.html',
'lib/client/templates/posts_list/posts_list_controller.js'
// 'lib/client/templates/after_post_item.html',
// 'lib/client/templates/before_post_item.html',
// 'lib/client/templates/modules/post_actions.html',
// 'lib/client/templates/modules/post_actions.js',
// 'lib/client/templates/modules/post_admin.html',
// 'lib/client/templates/modules/post_admin.js',
// 'lib/client/templates/modules/post_author.html',
// 'lib/client/templates/modules/post_author.js',
// 'lib/client/templates/modules/post_avatars.html',
// 'lib/client/templates/modules/post_avatars.js',
// 'lib/client/templates/modules/post_comments_link.html',
// 'lib/client/templates/modules/post_content.html',
// 'lib/client/templates/modules/post_content.js',
// 'lib/client/templates/modules/post_discuss.html',
// 'lib/client/templates/modules/post_domain.html',
// 'lib/client/templates/modules/post_domain.js',
// 'lib/client/templates/modules/post_info.html',
// 'lib/client/templates/modules/post_info.js',
// 'lib/client/templates/modules/post_rank.html',
// 'lib/client/templates/modules/post_rank.js',
// 'lib/client/templates/modules/post_title.html',
// 'lib/client/templates/modules/post_vote.html',
// 'lib/client/templates/modules/post_vote.js',
// 'lib/client/templates/post_body.html',
// 'lib/client/templates/post_edit.html',
// 'lib/client/templates/post_edit.js',
// 'lib/client/templates/post_item.html',
// 'lib/client/templates/post_item.js',
// 'lib/client/templates/post_page.html',
// 'lib/client/templates/post_page.js',
// 'lib/client/templates/post_submit.html',
// 'lib/client/templates/post_submit.js',
// 'lib/client/templates/views_menu.html',
// 'lib/client/templates/views_menu.js',
// 'lib/client/templates/main_posts_list.html',
// 'lib/client/templates/main_posts_list.js',
// 'lib/client/templates/posts_list/posts_list.html',
// 'lib/client/templates/posts_list/posts_list.js',
// 'lib/client/templates/posts_list/posts_list_compact.html',
// 'lib/client/templates/posts_list/posts_list_compact.js',
// 'lib/client/templates/posts_list/posts_list_controller.html',
// 'lib/client/templates/posts_list/posts_list_controller.js'
], ['client']);
api.addFiles([
'lib/server/publications.js',
'lib/server/fastrender.js'
// 'lib/server/publications.js',
// 'lib/server/fastrender.js'
'lib/server/rules.js'
], ['server']);
var languages = ["ar", "bg", "cs", "da", "de", "el", "en", "es", "et", "fr", "hu", "id", "it", "ja", "kk", "ko", "nl", "pl", "pt-BR", "ro", "ru", "sl", "sv", "th", "tr", "vi", "zh-CN"];
var languagesPaths = languages.map(function (language) {
return "i18n/"+language+".i18n.json";
});
api.addFiles(languagesPaths, ["client", "server"]);
// var languages = ["ar", "bg", "cs", "da", "de", "el", "en", "es", "et", "fr", "hu", "id", "it", "ja", "kk", "ko", "nl", "pl", "pt-BR", "ro", "ru", "sl", "sv", "th", "tr", "vi", "zh-CN"];
// var languagesPaths = languages.map(function (language) {
// return "i18n/"+language+".i18n.json";
// });
// api.addFiles(languagesPaths, ["client", "server"]);
api.export('Posts');
api.export([
'Posts',
'PostListContainer',
'PostList'
]);
});