mirror of
https://github.com/vale981/Vulcan
synced 2025-03-06 01:51:40 -05:00
working on component replacement system
This commit is contained in:
parent
fe02270bad
commit
f2dbc3970f
34 changed files with 541 additions and 179 deletions
|
@ -184,5 +184,6 @@
|
|||
"Telescope": true,
|
||||
"templates": true,
|
||||
"themeSettings": true
|
||||
}
|
||||
},
|
||||
"esnext": true
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
# 'meteor add' and 'meteor remove' will edit this file for you,
|
||||
# but you can also edit it by hand.
|
||||
|
||||
|
||||
############ Telescope Core ############
|
||||
|
||||
telescope:core
|
||||
|
@ -29,7 +30,9 @@ telescope:core
|
|||
# telescope:releases
|
||||
# telescope:rss
|
||||
# telescope:scoring
|
||||
# telescope:search
|
||||
|
||||
telescope:search
|
||||
|
||||
# telescope:share
|
||||
# telescope:singleday
|
||||
# telescope:sitemap
|
||||
|
@ -44,3 +47,9 @@ telescope:core
|
|||
############ Your Custom Packages ############
|
||||
|
||||
# my-custom-package
|
||||
|
||||
base-components
|
||||
|
||||
# telescope:forms
|
||||
|
||||
# theme-test
|
||||
|
|
|
@ -1 +1 @@
|
|||
METEOR@1.2.1
|
||||
METEOR@1.3-modules-beta.7
|
147
.meteor/versions
147
.meteor/versions
|
@ -1,105 +1,116 @@
|
|||
accounts-base@1.2.2
|
||||
accounts-base@1.2.3-modules.7
|
||||
accounts-facebook@1.0.6
|
||||
accounts-oauth@1.1.8
|
||||
accounts-password@1.1.4
|
||||
accounts-oauth@1.1.9-modules.7
|
||||
accounts-password@1.1.5-modules.7
|
||||
accounts-twitter@1.0.6
|
||||
accounts-ui@1.1.6
|
||||
accounts-ui-unstyled@1.1.8
|
||||
accounts-ui-unstyled@1.1.9-modules.7
|
||||
aldeed:simple-schema@1.5.3
|
||||
allow-deny@1.0.1-modules.7
|
||||
arillo:flow-router-helpers@0.5.1
|
||||
autoupdate@1.2.4
|
||||
babel-compiler@5.8.24_1
|
||||
babel-runtime@0.1.4
|
||||
base64@1.0.4
|
||||
binary-heap@1.0.4
|
||||
blaze@2.1.3
|
||||
autoupdate@1.2.5-modules.7
|
||||
babel-compiler@6.4.0-modules.7
|
||||
babel-runtime@0.1.5-modules.7
|
||||
base-components@0.25.7
|
||||
base64@1.0.5-modules.7
|
||||
binary-heap@1.0.5-modules.7
|
||||
blaze@2.1.4-modules.7
|
||||
blaze-html-templates@1.0.1
|
||||
blaze-tools@1.0.4
|
||||
boilerplate-generator@1.0.4
|
||||
caching-compiler@1.0.0
|
||||
caching-html-compiler@1.0.2
|
||||
callback-hook@1.0.4
|
||||
check@1.1.0
|
||||
coffeescript@1.0.11
|
||||
blaze-tools@1.0.5-modules.7
|
||||
boilerplate-generator@1.0.5-modules.7
|
||||
caching-compiler@1.0.1-modules.7
|
||||
caching-html-compiler@1.0.3-modules.7
|
||||
callback-hook@1.0.5-modules.7
|
||||
check@1.1.1-modules.7
|
||||
coffeescript@1.0.12-modules.7
|
||||
cosmos:browserify@0.9.3
|
||||
dburles:mongo-collection-instances@0.3.4
|
||||
ddp@1.2.2
|
||||
ddp-client@1.2.1
|
||||
ddp-client@1.2.2-modules.7
|
||||
ddp-common@1.2.2
|
||||
ddp-rate-limiter@1.0.0
|
||||
ddp-server@1.2.2
|
||||
ddp-rate-limiter@1.0.1-modules.7
|
||||
ddp-server@1.2.3-modules.7
|
||||
deps@1.0.9
|
||||
diff-sequence@1.0.1
|
||||
ecmascript@0.1.6
|
||||
ecmascript-runtime@0.2.6
|
||||
ejson@1.0.7
|
||||
email@1.0.8
|
||||
facebook@1.2.2
|
||||
fastclick@1.0.7
|
||||
geojson-utils@1.0.4
|
||||
hot-code-push@1.0.0
|
||||
html-tools@1.0.5
|
||||
htmljs@1.0.5
|
||||
http@1.1.1
|
||||
diff-sequence@1.0.2-modules.7
|
||||
ecmascript@0.4.0-modules.7
|
||||
ecmascript-runtime@0.2.7-modules.7
|
||||
ejson@1.0.8-modules.7
|
||||
email@1.0.9-modules.7
|
||||
facebook@1.2.3-modules.7
|
||||
fastclick@1.0.8-modules.7
|
||||
geojson-utils@1.0.5-modules.7
|
||||
hot-code-push@1.0.1-modules.7
|
||||
html-tools@1.0.6-modules.7
|
||||
htmljs@1.0.6-modules.7
|
||||
http@1.1.2-modules.7
|
||||
id-map@1.0.4
|
||||
jquery@1.11.4
|
||||
jsx@0.2.3
|
||||
jquery@1.11.5-modules.7
|
||||
jsx@0.2.4
|
||||
kadira:flow-router@2.10.1
|
||||
kadira:react-layout@1.5.3
|
||||
lai:collection-extensions@0.1.4
|
||||
launch-screen@1.0.4
|
||||
less@2.5.1
|
||||
launch-screen@1.0.5-modules.7
|
||||
less@2.5.2-modules.7
|
||||
livedata@1.0.15
|
||||
localstorage@1.0.5
|
||||
logging@1.0.8
|
||||
localstorage@1.0.6-modules.7
|
||||
logging@1.0.9-modules.7
|
||||
mdg:validation-error@0.2.0
|
||||
meteor@1.1.10
|
||||
meteor@1.1.11-modules.7
|
||||
meteor-base@1.0.1
|
||||
meteor-env-dev@0.0.1-modules.7
|
||||
meteor-env-prod@0.0.1-modules.7
|
||||
meteor-platform@1.2.3
|
||||
minifiers@1.1.7
|
||||
minimongo@1.0.10
|
||||
meteorhacks:meteorx@1.0.2
|
||||
meteorhacks:unblock@1.1.0
|
||||
minifiers-js@1.1.8-modules.7
|
||||
minimongo@1.0.11-modules.7
|
||||
mobile-status-bar@1.0.6
|
||||
mongo@1.1.3
|
||||
modules@0.5.0-modules.7
|
||||
modules-runtime@0.5.0-modules.7
|
||||
momentjs:moment@2.11.2
|
||||
mongo@1.1.4-modules.7
|
||||
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
|
||||
npm-mongo@1.4.40-modules.7
|
||||
oauth@1.1.7-modules.7
|
||||
oauth1@1.1.6-modules.7
|
||||
oauth2@1.1.6-modules.7
|
||||
observe-sequence@1.0.8-modules.7
|
||||
ordered-dict@1.0.4
|
||||
promise@0.5.1
|
||||
random@1.0.5
|
||||
rate-limit@1.0.0
|
||||
react@0.14.3
|
||||
react-meteor-data@0.2.4
|
||||
promise@0.5.2-modules.7
|
||||
random@1.0.6-modules.7
|
||||
rate-limit@1.0.1-modules.7
|
||||
react@0.14.3_1
|
||||
react-meteor-data@0.2.5
|
||||
react-runtime@0.14.4
|
||||
react-runtime-dev@0.14.4
|
||||
react-runtime-prod@0.14.4
|
||||
reactive-dict@1.1.3
|
||||
reactive-dict@1.1.4-modules.7
|
||||
reactive-var@1.0.6
|
||||
reload@1.1.4
|
||||
reload@1.1.5-modules.7
|
||||
retry@1.0.4
|
||||
routepolicy@1.0.6
|
||||
service-configuration@1.0.5
|
||||
session@1.1.1
|
||||
routepolicy@1.0.7-modules.7
|
||||
service-configuration@1.0.6-modules.7
|
||||
session@1.1.2-modules.7
|
||||
sha@1.0.4
|
||||
spacebars@1.0.7
|
||||
spacebars-compiler@1.0.7
|
||||
srp@1.0.4
|
||||
spacebars@1.0.8-modules.7
|
||||
spacebars-compiler@1.0.8-modules.7
|
||||
srp@1.0.5-modules.7
|
||||
standard-app-packages@1.0.6
|
||||
telescope:core@0.25.7
|
||||
telescope:lib@0.25.7
|
||||
telescope:posts@0.25.7
|
||||
templating@1.1.5
|
||||
templating-tools@1.0.0
|
||||
telescope:search@0.25.7
|
||||
templating@1.1.6-modules.7
|
||||
templating-tools@1.0.1-modules.7
|
||||
tmeasday:publish-counts@0.7.3
|
||||
tracker@1.0.9
|
||||
twitter@1.1.5
|
||||
tracker@1.0.10-modules.7
|
||||
twitter@1.1.6-modules.7
|
||||
ui@1.0.8
|
||||
underscore@1.0.4
|
||||
url@1.0.5
|
||||
underscore@1.0.5-modules.7
|
||||
url@1.0.6-modules.7
|
||||
utilities:smartquery@0.1.5
|
||||
webapp@1.2.3
|
||||
webapp-hashing@1.0.5
|
||||
webapp@1.2.4-modules.7
|
||||
webapp-hashing@1.0.6-modules.7
|
||||
zimme:active-route@2.3.2
|
||||
|
|
11
packages/base-components/lib/posts/Post.jsx
Normal file
11
packages/base-components/lib/posts/Post.jsx
Normal file
|
@ -0,0 +1,11 @@
|
|||
const Post = (props) => {
|
||||
return (
|
||||
<div className="post">
|
||||
<h3>{props.title}</h3>
|
||||
<p>{moment(props.postedAt).fromNow()}</p>
|
||||
<p>{props.body}</p>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
module.exports = Post;
|
3
packages/base-components/lib/posts/list/LoadMore.jsx
Normal file
3
packages/base-components/lib/posts/list/LoadMore.jsx
Normal file
|
@ -0,0 +1,3 @@
|
|||
const LoadMore = props => <a href="#" className="load-more" onClick={props.loadMore}>Load More ({props.count}/{props.totalCount})</a>
|
||||
|
||||
module.exports = LoadMore;
|
3
packages/base-components/lib/posts/list/NoMorePosts.jsx
Normal file
3
packages/base-components/lib/posts/list/NoMorePosts.jsx
Normal file
|
@ -0,0 +1,3 @@
|
|||
const NoMorePosts = props => <p>No more posts.</p>
|
||||
|
||||
module.exports = NoMorePosts;
|
3
packages/base-components/lib/posts/list/NoPosts.jsx
Normal file
3
packages/base-components/lib/posts/list/NoPosts.jsx
Normal file
|
@ -0,0 +1,3 @@
|
|||
const NoPosts = props => <p>No posts to display.</p>
|
||||
|
||||
module.exports = NoPosts;
|
12
packages/base-components/lib/posts/list/PostItem.jsx
Normal file
12
packages/base-components/lib/posts/list/PostItem.jsx
Normal file
|
@ -0,0 +1,12 @@
|
|||
const PostItem = props => {
|
||||
return (
|
||||
<div className="post">
|
||||
<h3><a href={FlowRouter.path("post", props)}>{props.title}</a></h3>
|
||||
<p>{props.url}</p>
|
||||
</div>
|
||||
)
|
||||
};
|
||||
|
||||
// export default PostItem;
|
||||
|
||||
module.exports = PostItem;
|
32
packages/base-components/lib/posts/list/PostList.jsx
Normal file
32
packages/base-components/lib/posts/list/PostList.jsx
Normal file
|
@ -0,0 +1,32 @@
|
|||
const PostList = props => {
|
||||
|
||||
const PostItem = Telescope.getComponent("PostItem");
|
||||
const LoadMore = Telescope.getComponent("LoadMore");
|
||||
const PostsLoading = Telescope.getComponent("PostsLoading");
|
||||
const NoPosts = Telescope.getComponent("NoPosts");
|
||||
const NoMorePosts = Telescope.getComponent("NoMorePosts");
|
||||
|
||||
if (!!props.posts.length) {
|
||||
return (
|
||||
<div className="postList">
|
||||
{props.posts.map(post => <PostItem {...post} key={post._id}/>)}
|
||||
{props.hasMore ? (props.ready ? <LoadMore {...props}/> : <PostsLoading/>) : <NoMorePosts/>}
|
||||
</div>
|
||||
)
|
||||
} else if (!props.ready) {
|
||||
return (
|
||||
<div className="postList">
|
||||
<PostsLoading/>
|
||||
</div>
|
||||
)
|
||||
} else {
|
||||
return (
|
||||
<div className="postList">
|
||||
<NoPosts/>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
module.exports = PostList;
|
3
packages/base-components/lib/posts/list/PostsLoading.jsx
Normal file
3
packages/base-components/lib/posts/list/PostsLoading.jsx
Normal file
|
@ -0,0 +1,3 @@
|
|||
const PostsLoading = props => <p>Loading…</p>
|
||||
|
||||
module.exports = PostsLoading;
|
9
packages/base-components/lib/require.js
Normal file
9
packages/base-components/lib/require.js
Normal file
|
@ -0,0 +1,9 @@
|
|||
console.log("base-components")
|
||||
|
||||
Telescope.registerComponent("LoadMore", require('./posts/list/LoadMore.jsx'));
|
||||
Telescope.registerComponent("NoMorePosts", require('./posts/list/NoMorePosts.jsx'));
|
||||
Telescope.registerComponent("NoPosts", require('./posts/list/NoPosts.jsx'));
|
||||
Telescope.registerComponent("PostItem", require('./posts/list/PostItem.jsx'));
|
||||
Telescope.registerComponent("PostsLoading", require('./posts/list/PostsLoading.jsx'));
|
||||
Telescope.registerComponent("PostList", require('./posts/list/PostList.jsx'));
|
||||
Telescope.registerComponent("Post", require('./posts/Post.jsx'));
|
27
packages/base-components/package.js
Normal file
27
packages/base-components/package.js
Normal file
|
@ -0,0 +1,27 @@
|
|||
Package.describe({
|
||||
name: "base-components",
|
||||
summary: "Telescope components package",
|
||||
version: "0.25.7",
|
||||
git: "https://github.com/TelescopeJS/telescope.git"
|
||||
});
|
||||
|
||||
Package.onUse(function (api) {
|
||||
|
||||
api.versionsFrom(['METEOR@1.0']);
|
||||
|
||||
api.use([
|
||||
'telescope:lib@0.25.7',
|
||||
'telescope:posts@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/require.js'
|
||||
], ['client', 'server']);
|
||||
|
||||
|
||||
|
||||
});
|
|
@ -1,34 +1,37 @@
|
|||
App = React.createClass({
|
||||
|
||||
// mixins: [ReactMeteorData],
|
||||
mixins: [ReactMeteorData],
|
||||
|
||||
// getMeteorData() {
|
||||
getMeteorData() {
|
||||
|
||||
// var data = {
|
||||
// ready: true
|
||||
// };
|
||||
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'),
|
||||
// ];
|
||||
var handles = Telescope.subscriptions.map((sub) => Meteor.subscribe(sub.name, sub.arguments));
|
||||
|
||||
// if(_.every(handles, handle => {return handle.ready();})) {
|
||||
// Session.set("book", Products.findOne({key: BOOK_KEY}));
|
||||
// data.ready = true;
|
||||
// }
|
||||
if(!!handles.length && _.every(handles, handle => handle.ready())) {
|
||||
data.ready = true;
|
||||
}
|
||||
|
||||
// return data;
|
||||
// },
|
||||
return data;
|
||||
},
|
||||
|
||||
|
||||
render() {
|
||||
return this.props.content;
|
||||
if (this.data.ready) {
|
||||
|
||||
return (
|
||||
<div>
|
||||
<a href={FlowRouter.path("newPost")}>New Post</a>
|
||||
<hr/>
|
||||
{this.props.content}
|
||||
</div>
|
||||
)
|
||||
} else {
|
||||
return <p>Loading App…</p>
|
||||
}
|
||||
|
||||
// return this.data.ready ? this.props.content : <Loading/>;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,15 +1,4 @@
|
|||
// note: this is shared between client/server in order to enable fast-render to auto-detect subscriptions
|
||||
|
||||
Telescope.subscriptions.preload('settings');
|
||||
Telescope.subscriptions.preload('currentUser');
|
||||
|
||||
FlowRouter.subscriptions = function() {
|
||||
var flow = this;
|
||||
Telescope.subscriptions.forEach(function (sub) {
|
||||
if (typeof sub === 'object'){
|
||||
flow.register(sub.subName, Meteor.subscribe(sub.subName, sub.subArguments));
|
||||
}else{
|
||||
flow.register(sub, Meteor.subscribe(sub));
|
||||
}
|
||||
});
|
||||
};
|
||||
Telescope.subscriptions.preload('currentUser');
|
16
packages/telescope-forms/lib/components/NewPost.jsx
Normal file
16
packages/telescope-forms/lib/components/NewPost.jsx
Normal file
|
@ -0,0 +1,16 @@
|
|||
class NewPost extends React.Component {
|
||||
render() {
|
||||
return (
|
||||
<div>
|
||||
<h1>Create a post</h1>
|
||||
<MRF.Form
|
||||
collection={Posts}
|
||||
type="insert"
|
||||
ref="form"
|
||||
onSuccess={(docId) => FlowRouter.go('posts.update', { postId: docId })}
|
||||
/>
|
||||
<RaisedButton label="Create" onTouchTap={() => this.refs.form.submit()}/>
|
||||
</div>
|
||||
);
|
||||
},
|
||||
};
|
7
packages/telescope-forms/lib/routes.jsx
Normal file
7
packages/telescope-forms/lib/routes.jsx
Normal file
|
@ -0,0 +1,7 @@
|
|||
FlowRouter.route('/post/new', {
|
||||
name: 'newPost',
|
||||
action: function (params, queryParams) {
|
||||
ReactLayout.render(AppContainer, {content: <NewPost {...params} />})
|
||||
// mount(App, {content: <PostListContainer {...queryParams}/>});
|
||||
}
|
||||
});
|
30
packages/telescope-forms/package.js
Normal file
30
packages/telescope-forms/package.js
Normal file
|
@ -0,0 +1,30 @@
|
|||
Package.describe({
|
||||
name: "telescope:forms",
|
||||
summary: "Telescope Forms package",
|
||||
version: "0.25.7",
|
||||
git: "https://github.com/TelescopeJS/telescope.git"
|
||||
});
|
||||
|
||||
Package.onUse(function (api) {
|
||||
|
||||
api.versionsFrom(['METEOR@1.0']);
|
||||
|
||||
api.use([
|
||||
'telescope:lib@0.25.7'
|
||||
]);
|
||||
|
||||
api.addFiles([
|
||||
// 'package-tap.i18n',
|
||||
'lib/components/NewPost.jsx'
|
||||
], ['client', 'server']);
|
||||
|
||||
api.addFiles([
|
||||
], ['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"]);
|
||||
|
||||
});
|
9
packages/telescope-lib/lib/components.js
Normal file
9
packages/telescope-lib/lib/components.js
Normal file
|
@ -0,0 +1,9 @@
|
|||
Telescope.components = {};
|
||||
|
||||
Telescope.registerComponent = (name, component) => {
|
||||
Telescope.components[name] = component;
|
||||
};
|
||||
|
||||
Telescope.getComponent = (name) => {
|
||||
return Telescope.components[name];
|
||||
};
|
|
@ -2,19 +2,4 @@
|
|||
* Telescope configuration namespace
|
||||
* @namespace Telescope.config
|
||||
*/
|
||||
Telescope.config = {};
|
||||
|
||||
/**
|
||||
* Subscriptions namespace
|
||||
* @namespace Telescope.subscriptions
|
||||
*/
|
||||
Telescope.subscriptions = [];
|
||||
|
||||
/**
|
||||
* Add a subscription to be preloaded
|
||||
* @param {string} subscription - The name of the subscription
|
||||
*/
|
||||
Telescope.subscriptions.preload = function (subscription) {
|
||||
Telescope.subscriptions.push(subscription);
|
||||
};
|
||||
|
||||
Telescope.config = {};
|
13
packages/telescope-lib/lib/subscriptions.js
Normal file
13
packages/telescope-lib/lib/subscriptions.js
Normal file
|
@ -0,0 +1,13 @@
|
|||
/**
|
||||
* Subscriptions namespace
|
||||
* @namespace Telescope.subscriptions
|
||||
*/
|
||||
Telescope.subscriptions = [];
|
||||
|
||||
/**
|
||||
* Add a subscription to be preloaded
|
||||
* @param {string} subscription - The name of the subscription
|
||||
*/
|
||||
Telescope.subscriptions.preload = function (subscription, args) {
|
||||
Telescope.subscriptions.push({name: subscription, arguments: args});
|
||||
};
|
|
@ -27,6 +27,10 @@ Package.onUse(function (api) {
|
|||
'http',
|
||||
'email',
|
||||
'aldeed:simple-schema@1.5.3',
|
||||
|
||||
// 'nicolaslopezj:mrf@0.1.1',
|
||||
// 'nicolaslopezj:mrf-material-ui@0.1.1',
|
||||
|
||||
// 'aldeed:collection2@2.8.0',
|
||||
// 'aldeed:http@0.2.2',
|
||||
// 'aldeed:autoform@5.8.1',
|
||||
|
@ -45,7 +49,7 @@ Package.onUse(function (api) {
|
|||
// 'useraccounts:unstyled@1.13.1',
|
||||
// 'useraccounts:flow-routing@1.13.1',
|
||||
// 'aramk:tinycolor@1.1.0_1',
|
||||
// 'momentjs:moment@2.11.2',
|
||||
'momentjs:moment@2.11.2',
|
||||
// 'sacha:spin@2.3.1',
|
||||
// 'aslagle:reactive-table@0.8.24',
|
||||
// 'utilities:avatar@0.9.2',
|
||||
|
@ -59,19 +63,20 @@ Package.onUse(function (api) {
|
|||
// 'chuangbo:cookie@1.1.0',
|
||||
// 'ongoworks:speakingurl@6.0.0',
|
||||
// 'okgrow:router-autoscroll@0.1.6',
|
||||
// 'tmeasday:publish-counts@0.7.3',
|
||||
'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',
|
||||
'meteorhacks:unblock@1.1.0',
|
||||
'kadira:flow-router@2.10.1',
|
||||
'arillo:flow-router-helpers@0.5.0',
|
||||
'utilities:smartquery@0.1.5',
|
||||
'kadira:react-layout@1.5.3',
|
||||
'ecmascript@0.1.6',
|
||||
'react',
|
||||
'jsx'
|
||||
'react@0.14.3_1',
|
||||
'jsx',
|
||||
'modules'
|
||||
];
|
||||
|
||||
api.use(packages);
|
||||
|
@ -79,16 +84,18 @@ Package.onUse(function (api) {
|
|||
api.imply(packages);
|
||||
|
||||
api.addFiles([
|
||||
'containers/AppContainer.jsx'
|
||||
// 'lib/core.js',
|
||||
// 'lib/utils.js',
|
||||
// 'lib/callbacks.js',
|
||||
'containers/AppContainer.jsx',
|
||||
'lib/core.js',
|
||||
'lib/utils.js',
|
||||
'lib/callbacks.js',
|
||||
'lib/components.js',
|
||||
'lib/subscriptions.js',
|
||||
// 'lib/collections.js',
|
||||
// 'lib/modules.js',
|
||||
// 'lib/config.js',
|
||||
// 'lib/templates.js',
|
||||
// 'lib/deep.js',
|
||||
// 'lib/deep_extend.js',
|
||||
'lib/deep.js',
|
||||
'lib/deep_extend.js',
|
||||
// 'lib/autolink.js',
|
||||
// 'lib/themes.js',
|
||||
// 'lib/menus.js',
|
||||
|
|
|
@ -1,7 +0,0 @@
|
|||
PostList = props => {
|
||||
return (
|
||||
<div className="postList">
|
||||
{props.posts.map(post => <h3 key={post.title}>{post.title}</h3>)}
|
||||
</div>
|
||||
)
|
||||
};
|
32
packages/telescope-posts/lib/containers/PostContainer.jsx
Normal file
32
packages/telescope-posts/lib/containers/PostContainer.jsx
Normal file
|
@ -0,0 +1,32 @@
|
|||
// import React from 'react';
|
||||
|
||||
const Post = Telescope.getComponent("Post");
|
||||
|
||||
PostContainer = React.createClass({
|
||||
|
||||
// propTypes: {
|
||||
|
||||
// },
|
||||
|
||||
mixins: [ReactMeteorData],
|
||||
|
||||
getMeteorData() {
|
||||
|
||||
const subscription = Meteor.subscribe('singlePost', this.props._id);
|
||||
|
||||
return {
|
||||
post: Posts.findOne(this.props._id)
|
||||
};
|
||||
},
|
||||
|
||||
render() {
|
||||
if (this.data.post) {
|
||||
return (
|
||||
<Post {...this.data.post} />
|
||||
)
|
||||
} else {
|
||||
return <p>Loading…</p>
|
||||
}
|
||||
}
|
||||
|
||||
});
|
|
@ -1,30 +1,102 @@
|
|||
// import {composeWithTracker} from 'react-komposer';
|
||||
|
||||
// const composer = (props, onData) => {
|
||||
|
||||
// console.log(props)
|
||||
|
||||
// var terms = props;
|
||||
// // const terms = {...props, limit: this.state.limit};
|
||||
// const parameters = Posts.parameters.get(terms);
|
||||
// const find = parameters.find;
|
||||
// const options = parameters.options;
|
||||
// // options.limit = this.state.limit;
|
||||
|
||||
|
||||
// Meteor.subscribe('postList', terms, () => {
|
||||
// console.log(find, options)
|
||||
// const posts = Posts.find(find, options).fetch();
|
||||
// console.log(Posts.find().count())
|
||||
// console.log(posts)
|
||||
// onData(null, {posts});
|
||||
// });
|
||||
|
||||
// // support latency compensation
|
||||
// // we don't need to invalidate tracker because of the
|
||||
// // data fetching from the cache.
|
||||
// // const postFromCache = Tracker.nonreactive(() => {
|
||||
// // return Posts.find(find, options);
|
||||
// // });
|
||||
|
||||
// // if (postFromCache) {
|
||||
// // onData(null, {post: postFromCache});
|
||||
// // } else {
|
||||
// // onData();
|
||||
// // }
|
||||
// };
|
||||
|
||||
// PostListContainer = composeWithTracker(composer)(PostList);
|
||||
|
||||
|
||||
|
||||
|
||||
// import React from 'react';
|
||||
|
||||
// const PostList = Telescope.getComponent("PostList");
|
||||
console.log("// PostListContainer")
|
||||
PostListContainer = React.createClass({
|
||||
|
||||
// propTypes: {
|
||||
|
||||
// },
|
||||
|
||||
getInitialState() {
|
||||
|
||||
return {
|
||||
limit: 5
|
||||
};
|
||||
|
||||
},
|
||||
|
||||
mixins: [ReactMeteorData],
|
||||
|
||||
getMeteorData() {
|
||||
var cursor = Posts.find({}, {limit: 10});
|
||||
var sm = SmartQuery.create("posts", cursor);
|
||||
const terms = {...this.props, limit: this.state.limit};
|
||||
const parameters = Posts.parameters.get(terms);
|
||||
const find = parameters.find;
|
||||
const options = parameters.options;
|
||||
options.limit = this.state.limit;
|
||||
|
||||
// var cursor = Posts.find(find, options);
|
||||
// var sm = SmartQuery.create("posts", cursor);
|
||||
|
||||
// console.log(terms)
|
||||
|
||||
const subscription = Meteor.subscribe('postList', terms);
|
||||
|
||||
const totalCount = Counts.get("postList");
|
||||
|
||||
const cursor = Posts.find(find, options);
|
||||
|
||||
return {
|
||||
posts: sm.cursor.fetch()
|
||||
}
|
||||
// return {
|
||||
// posts: [
|
||||
// {title: "foo"},
|
||||
// {title: "bar"}
|
||||
// ]
|
||||
// };
|
||||
posts: cursor.fetch(),
|
||||
ready: subscription.ready(),
|
||||
count: cursor.count(),
|
||||
totalCount: totalCount,
|
||||
hasMore: cursor.count() < totalCount
|
||||
};
|
||||
},
|
||||
|
||||
loadMore(event) {
|
||||
event.preventDefault();
|
||||
this.setState({
|
||||
limit: this.state.limit+5
|
||||
});
|
||||
},
|
||||
|
||||
render() {
|
||||
const PostList = Telescope.getComponent("PostList");
|
||||
return (
|
||||
<PostList {...this.data}/>
|
||||
<PostList {...this.data} loadMore={this.loadMore}/>
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
@ -4,4 +4,12 @@ FlowRouter.route('/', {
|
|||
ReactLayout.render(AppContainer, {content: <PostListContainer {...queryParams} />})
|
||||
// mount(App, {content: <PostListContainer {...queryParams}/>});
|
||||
}
|
||||
});
|
||||
|
||||
FlowRouter.route('/post/:_id', {
|
||||
name: 'post',
|
||||
action: function (params, queryParams) {
|
||||
ReactLayout.render(AppContainer, {content: <PostContainer {...params} />})
|
||||
// mount(App, {content: <PostListContainer {...queryParams}/>});
|
||||
}
|
||||
});
|
|
@ -5,4 +5,21 @@ SmartQuery.addRule(Posts, {
|
|||
// fields: function () {
|
||||
// return ["_id", "title", "body"];
|
||||
// }
|
||||
});
|
||||
|
||||
|
||||
Meteor.publish('postList', function(terms) {
|
||||
|
||||
var parameters = Posts.parameters.get(terms),
|
||||
posts = Posts.find(parameters.find, parameters.options);
|
||||
|
||||
Counts.publish(this, "postList", Posts.find(parameters.find, parameters.options));
|
||||
|
||||
return posts;
|
||||
});
|
||||
|
||||
Meteor.publish('singlePost', function(postId) {
|
||||
|
||||
return Posts.find(postId);
|
||||
|
||||
});
|
|
@ -123,3 +123,13 @@ Posts.views.add("userDownvotedPosts", function (terms) {
|
|||
options: {limit: 5, sort: {postedAt: -1}}
|
||||
};
|
||||
});
|
||||
|
||||
|
||||
Posts.views.add("test", function (terms) {
|
||||
return {
|
||||
find: {
|
||||
title: {$regex: "newsletter", $options: 'i'}
|
||||
},
|
||||
options: {sort: {sticky: -1, baseScore: -1}}
|
||||
};
|
||||
});
|
|
@ -5,6 +5,10 @@ Package.describe({
|
|||
git: "https://github.com/TelescopeJS/telescope-posts.git"
|
||||
});
|
||||
|
||||
// Npm.depends({
|
||||
// 'react-komposer': '1.3.1'
|
||||
// });
|
||||
|
||||
Package.onUse(function (api) {
|
||||
|
||||
api.versionsFrom(['METEOR@1.0']);
|
||||
|
@ -15,21 +19,28 @@ Package.onUse(function (api) {
|
|||
// 'telescope:settings@0.25.7',
|
||||
// 'telescope:users@0.25.7',
|
||||
// 'telescope:comments@0.25.7'
|
||||
// 'base-components'
|
||||
]);
|
||||
|
||||
api.addFiles([
|
||||
'lib/namespace.js',
|
||||
// 'lib/config.js',
|
||||
'lib/config.js',
|
||||
// 'lib/posts.js',
|
||||
// 'lib/parameters.js',
|
||||
// 'lib/views.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/containers/PostContainer.jsx',
|
||||
// 'lib/components/PostList.jsx',
|
||||
// 'lib/components/Post.jsx',
|
||||
// 'lib/components/LoadMore.jsx',
|
||||
// 'lib/components/PostsLoading.jsx',
|
||||
// 'lib/components/NoPosts.jsx',
|
||||
// 'lib/components/NoMorePosts.jsx',
|
||||
'lib/routes.jsx'
|
||||
], ['client', 'server']);
|
||||
|
||||
|
@ -93,7 +104,9 @@ Package.onUse(function (api) {
|
|||
api.export([
|
||||
'Posts',
|
||||
'PostListContainer',
|
||||
'PostList'
|
||||
'PostContainer',
|
||||
'PostList',
|
||||
'Post'
|
||||
]);
|
||||
|
||||
});
|
||||
|
|
|
@ -12,24 +12,24 @@ Package.onUse(function (api) {
|
|||
api.use(['telescope:core@0.25.7']);
|
||||
|
||||
api.addFiles([
|
||||
'lib/search.js',
|
||||
// 'lib/search.js',
|
||||
'lib/parameters.js',
|
||||
'package-tap.i18n'
|
||||
// 'package-tap.i18n'
|
||||
], ['client', 'server']);
|
||||
|
||||
api.addFiles([
|
||||
'lib/client/templates/search.html',
|
||||
'lib/client/templates/search.js',
|
||||
'lib/client/stylesheets/search.scss'
|
||||
// 'lib/client/templates/search.html',
|
||||
// 'lib/client/templates/search.js',
|
||||
// 'lib/client/stylesheets/search.scss'
|
||||
], ['client']);
|
||||
|
||||
api.addFiles([
|
||||
], ['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"]);
|
||||
|
||||
});
|
||||
|
|
|
@ -12,15 +12,15 @@ Package.onUse(function(api) {
|
|||
|
||||
api.use([
|
||||
'telescope:lib@0.25.7',
|
||||
'telescope:i18n@0.25.7',
|
||||
'hausor:autoform-bs-minicolors@1.0.0'
|
||||
// 'telescope:i18n@0.25.7',
|
||||
// 'hausor:autoform-bs-minicolors@1.0.0'
|
||||
]);
|
||||
|
||||
api.addFiles([
|
||||
'lib/settings.js',
|
||||
'lib/routes.js',
|
||||
'lib/menus.js',
|
||||
'package-tap.i18n'
|
||||
// 'lib/settings.js',
|
||||
// 'lib/routes.js',
|
||||
// 'lib/menus.js',
|
||||
// 'package-tap.i18n'
|
||||
], both);
|
||||
|
||||
api.addFiles([
|
||||
|
@ -28,17 +28,17 @@ Package.onUse(function(api) {
|
|||
], 'server');
|
||||
|
||||
api.addFiles([
|
||||
'lib/client/language_changer.js',
|
||||
'lib/client/helpers.js',
|
||||
'lib/client/templates/settings.html',
|
||||
'lib/client/templates/settings.js'
|
||||
// 'lib/client/language_changer.js',
|
||||
// 'lib/client/helpers.js',
|
||||
// 'lib/client/templates/settings.html',
|
||||
// 'lib/client/templates/settings.js'
|
||||
], 'client');
|
||||
|
||||
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('Settings', both);
|
||||
});
|
||||
|
|
12
packages/theme-test/PostItem2.jsx
Normal file
12
packages/theme-test/PostItem2.jsx
Normal file
|
@ -0,0 +1,12 @@
|
|||
const PostItem2 = props => {
|
||||
return (
|
||||
<div className="post">
|
||||
<h3><a href={FlowRouter.path("post", props)}>xyz/{props.title}</a></h3>
|
||||
<p>{props.url}</p>
|
||||
</div>
|
||||
)
|
||||
};
|
||||
|
||||
// export default PostItem;
|
||||
|
||||
module.exports = PostItem2;
|
20
packages/theme-test/package.js
Normal file
20
packages/theme-test/package.js
Normal file
|
@ -0,0 +1,20 @@
|
|||
Package.describe({
|
||||
name: "theme-test",
|
||||
summary: "Telescope components package",
|
||||
version: "0.25.7",
|
||||
git: "https://github.com/TelescopeJS/telescope.git"
|
||||
});
|
||||
|
||||
Package.onUse(function (api) {
|
||||
|
||||
api.versionsFrom(['METEOR@1.0']);
|
||||
|
||||
api.use([
|
||||
'telescope:lib@0.25.7'
|
||||
]);
|
||||
|
||||
api.addFiles([
|
||||
'require.js',
|
||||
], ['client', 'server']);
|
||||
|
||||
});
|
2
packages/theme-test/require.js
Normal file
2
packages/theme-test/require.js
Normal file
|
@ -0,0 +1,2 @@
|
|||
console.log('foo')
|
||||
Telescope.registerComponent("PostItem", require('./PostItem2.jsx'));
|
Loading…
Add table
Reference in a new issue