Skip to content
This repository has been archived by the owner on Aug 13, 2018. It is now read-only.

Commit

Permalink
Merge branch 'devel' of https://github.com/TelescopeJS/Telescope into…
Browse files Browse the repository at this point in the history
… tests
  • Loading branch information
anthonymayer committed Jan 18, 2015
2 parents bbaa413 + ff1d92f commit e3ef359
Show file tree
Hide file tree
Showing 105 changed files with 1,104 additions and 1,131 deletions.
4 changes: 2 additions & 2 deletions .editorconfig
Expand Up @@ -2,7 +2,7 @@

root = true

[*.js]
[*.{js,html}]

charset = utf-8
end_of_line = lf
Expand All @@ -17,4 +17,4 @@ trim_trailing_whitespace = true

[*.md]

trim_trailing_whitespace = false
trim_trailing_whitespace = false
1 change: 0 additions & 1 deletion .meteor/packages
Expand Up @@ -32,7 +32,6 @@ aldeed:simple-schema

mrt:jquery-hotkeys
mrt:cookies
mrt:mailchimp

ccan:cssreset # CSS reset (Must come before any other css)
cmather:handlebars-server
Expand Down
2 changes: 1 addition & 1 deletion .meteor/versions
Expand Up @@ -72,13 +72,13 @@ meteorhacks:npm@1.2.2
meteorhacks:subs-manager@1.2.2
minifiers@1.1.3
minimongo@1.0.6
miro:mailchimp@1.0.2
mobile-status-bar@1.0.2
momentjs:moment@2.8.4
mongo@1.0.11
mongo-livedata@1.0.7
mrt:cookies@0.3.0
mrt:jquery-hotkeys@0.0.1
mrt:mailchimp@0.4.0
mrt:moment@2.8.1
npm-bcrypt@0.7.7
npm-container@1.0.0
Expand Down
12 changes: 12 additions & 0 deletions History.md
@@ -1,3 +1,15 @@
## v0.13.0 “ComponentScope”

* Tweaked comments layout in Hubbble theme.
* Added Bulgarian translation (thanks @toome123!).
* Cleaned up permission functions (thanks @anthonymayer!).
* Various fixes (thanks @comerc and @Kikobeats!).
* Stopped synced-cron message logging.
* Limit all posts lists to 200 posts.
* Refactored posts lists to use the template-level subscription pattern when appropriate.
* Refactored `single day` and `daily` packages.
* Footer field now accepts Markdown instead of HTML.

## v0.12.0 “DummyScope”

**Important: existing newsletters and feeds need to be manually enabled in the Settings panel**
Expand Down
1 change: 0 additions & 1 deletion README.md
Expand Up @@ -5,7 +5,6 @@ Telescope is an open-source, real-time social news site built with [Meteor](http
Note that Telescope is distributed under the [MIT License](http://opensource.org/licenses/MIT)

### We Need Your Help!
[![Gitter](https://badges.gitter.im/Join Chat.svg)](https://gitter.im/TelescopeJS/Telescope?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)

A lot of work has already gone into Telescope, but it needs that final push to reach its full potential.

Expand Down
21 changes: 5 additions & 16 deletions client/helpers/handlebars.js
Expand Up @@ -23,19 +23,13 @@ UI.registerHelper('isLoggedIn', function() {
return !!Meteor.user();
});
UI.registerHelper('canView', function() {
return canView(Meteor.user());
return can.view(Meteor.user());
});
UI.registerHelper('canPost', function() {
return canPost(Meteor.user());
return can.post(Meteor.user());
});
UI.registerHelper('canComment', function() {
return canComment(Meteor.user());
});
UI.registerHelper('canUpvote', function(collection) {
return canUpvote(Meteor.user(), collection);
});
UI.registerHelper('canDownvote', function(collection) {
return canDownvote(Meteor.user(), collection);
return can.comment(Meteor.user());
});
UI.registerHelper('isAdmin', function(showError) {
if(isAdmin(Meteor.user())){
Expand All @@ -46,13 +40,8 @@ UI.registerHelper('isAdmin', function(showError) {
return false;
}
});
UI.registerHelper('canEdit', function(collectionName, item, action) {
var action = (typeof action !== 'string') ? null : action;
var collection = (typeof collectionName !== 'string') ? Posts : eval(collectionName);
// console.log(item);
// var itemId = (collectionName==="Posts") ? Session.get('selectedPostId') : Session.get('selectedCommentId');
// var item=collection.findOne(itemId);
return item && canEdit(Meteor.user(), item, action);
UI.registerHelper('canEdit', function(item) {
return can.edit(Meteor.user(), item, false);
});

UI.registerHelper('log', function(context){
Expand Down
9 changes: 3 additions & 6 deletions client/views/admin/settings_form.js
Expand Up @@ -8,18 +8,15 @@ AutoForm.hooks({
}
},

onSuccess: function(operation, result, template) {
onSuccess: function(operation, result, template) {
template.$('button[type=submit]').removeClass('loading');
},

onError: function(operation, result, template) {
template.$('button[type=submit]').removeClass('loading');
}

}
});

AutoForm.hooks({
},
insertSettingsForm: {

before: {
Expand All @@ -29,7 +26,7 @@ AutoForm.hooks({
}
},

onSuccess: function(operation, result, template) {
onSuccess: function(operation, result, template) {
template.$('button[type=submit]').removeClass('loading');
},

Expand Down
2 changes: 2 additions & 0 deletions client/views/comments/comment_form.html
Expand Up @@ -10,5 +10,7 @@
</div>
</form>
</div>
{{else}}
<p>{{reason}}</p>
{{/if}}
</template>
10 changes: 5 additions & 5 deletions client/views/comments/comment_form.js
@@ -1,6 +1,6 @@
Template[getTemplate('comment_form')].helpers({
canComment: function(){
return canComment(Meteor.user());
reason: function () {
return !!Meteor.user() ? i18n.t('sorry_you_do_not_have_the_rights_to_comments'): i18n.t('please_log_in_to_comment');
}
});

Expand All @@ -22,14 +22,14 @@ Template[getTemplate('comment_form')].events({
// $submitButton.addClass('loading');

$commentForm.val('');

var post = postObject;

comment = {
postId: post._id,
body: body
}

// child comment
if (getCurrentTemplate() == 'comment_reply') {
comment.parentCommentId = this.comment._id;
Expand All @@ -45,6 +45,6 @@ Template[getTemplate('comment_form')].events({
trackEvent("newComment", newComment);
}
});

}
});
32 changes: 15 additions & 17 deletions client/views/comments/comment_item.html
Expand Up @@ -15,25 +15,23 @@
<span>{{_ "downvote"}}</span>
</a>
</div>
<div class="user-avatar">{{> avatar userId=userId shape="circle"}}</div>
<div class="comment-main">
<div class="comment-meta">
<a class="comment-username" href="{{profileUrl}}">{{authorName}}</a>
<span class="comment-time">{{timeAgo ago}},</span>
<span class="points">{{upvotes}}</span> <span class="unit">points </span>
<a href="{{pathFor route='comment_reply' _id=_id}}" class="comment-permalink icon-link goto-comment">{{_ "link"}}</a>
{{#if can_edit}}
| <a class="edit-link" href="{{pathFor route='comment_edit' _id=_id}}">{{_ "edit"}}</a>
{{/if}}
{{#if isAdmin}}
| <span>{{full_date}}</span>
{{/if}}
</div>
<div class="comment-text markdown">{{{htmlBody}}}</div>
{{#if getSetting "nestedComments" true}}
<a href="{{pathFor route='comment_reply' _id=_id}}" class="comment-reply goto-comment">{{_ "reply"}}</a>
<div class="comment-meta">
<div class="user-avatar">{{> avatar userId=userId shape="circle"}}</div>
<a class="comment-username" href="{{profileUrl}}">{{authorName}}</a>
<span class="comment-time">{{timeAgo ago}},</span>
<span class="points">{{upvotes}}</span> <span class="unit">points </span>
<a href="{{pathFor route='comment_reply' _id=_id}}" class="comment-permalink icon-link goto-comment">{{_ "link"}}</a>
{{#if canEdit this}}
| <a class="edit-link" href="{{pathFor route='comment_edit' _id=_id}}">{{_ "edit"}}</a>
{{/if}}
{{#if isAdmin}}
| <span>{{full_date}}</span>
{{/if}}
</div>
<div class="comment-main">
<div class="comment-text markdown">{{{htmlBody}}}</div>
<a href="{{pathFor route='comment_reply' _id=_id}}" class="comment-reply goto-comment">{{_ "reply"}}</a>
</div>
</div>
{{/if}}
{{#if showChildComments}}
Expand Down
6 changes: 0 additions & 6 deletions client/views/comments/comment_item.js
Expand Up @@ -79,12 +79,6 @@ Template[getTemplate('comment_item')].helpers({
authorName: function(){
return getAuthorName(this);
},
can_edit: function(){
if(this.userId && Meteor.userId())
return isAdmin(Meteor.user()) || (Meteor.userId() === this.userId);
else
return false;
},
showChildComments: function(){
// TODO: fix this
// return Session.get('showChildComments');
Expand Down
4 changes: 2 additions & 2 deletions client/views/common/css.html
Expand Up @@ -26,8 +26,8 @@
color: {{getSetting "headerTextColor"}};
}
.logo-image a{
height:{{getSetting "logoHeight"}}px;
width:{{getSetting "logoWidth"}}px;
max-height:{{getSetting "logoHeight"}}px;
max-width:{{getSetting "logoWidth"}}px;
}
</style>
</template>
2 changes: 1 addition & 1 deletion client/views/common/footer.html
@@ -1,7 +1,7 @@
<template name="footer">
{{#if footerCode}}
<div class="footer grid {{footerClass}}">
{{{footerCode}}}
{{#markdown}}{{footerCode}}{{/markdown}}
</div>
{{/if}}
{{#each footerModules}}
Expand Down
2 changes: 1 addition & 1 deletion client/views/forms/quickFormTelescope.html
Expand Up @@ -36,7 +36,7 @@ <h3 class="fieldset-heading">{{fieldsetName}}</h3>
{{#if showField}}
<div class="form-group {{#if afFieldIsInvalid name=this.atts.name}}has-error{{/if}}">
<label class="control-label">
{{_ this.atts.name}}
{{_ label}}
{{#if fieldIsPrivate}}
<span class="private-field" title="{{_ 'Private'}}">(p)</span>
{{/if}}
Expand Down
13 changes: 13 additions & 0 deletions client/views/forms/quickFormTelescope.js
Expand Up @@ -133,6 +133,19 @@ Template["afFormGroup_telescope"].helpers({
},
afFieldInstructions: function () {
return this.afFieldInputAtts.instructions;
},
label: function () {

var name = this.atts.name;
var label = name; // default to field name

// ugly hack to figure out if schema is Post (the only one that's modifiable right now)
if (getCurrentTemplate().indexOf("post") !== -1 && !!postSchemaObject[name].label) {
var label = postSchemaObject[name].label;
}

return i18n.t(label);

}
});

Expand Down
9 changes: 0 additions & 9 deletions client/views/nav/mobile_nav.js
Expand Up @@ -7,15 +7,6 @@ Template[getTemplate('mobile_nav')].helpers({
},
getTemplate: function () {
return getTemplate(this).template;
},
canPost: function(){
return canPost(Meteor.user());
},
requirePostsApproval: function(){
return getSetting('requirePostsApproval');
},
userMenu: function () {
return getTemplate('userMenu');
}
});

Expand Down
2 changes: 1 addition & 1 deletion client/views/posts/modules/post_info.html
Expand Up @@ -3,7 +3,7 @@
<span class="points">{{baseScore}}</span>
<span class="unit">{{pointsUnitDisplayText}}</span>
{{#if postedAt}}<span class="post-time">{{timeAgo postedAt}}</span>{{/if}}
{{#if can_edit}}
{{#if canEdit this}}
| <a href="{{pathFor route='post_edit' _id=_id}}" class="edit-link goto-edit">{{_ "edit"}}</a>
{{/if}}
</div>
Expand Down
3 changes: 0 additions & 3 deletions client/views/posts/modules/post_info.js
Expand Up @@ -2,9 +2,6 @@ Template[getTemplate('postInfo')].helpers({
pointsUnitDisplayText: function(){
return this.upvotes == 1 ? i18n.t('point') : i18n.t('points');
},
can_edit: function(){
return canEdit(Meteor.user(), this);
},
getTemplate: function() {
return getTemplate("postAuthor");
}
Expand Down
3 changes: 3 additions & 0 deletions client/views/posts/modules/post_rank.html
@@ -0,0 +1,3 @@
<template name="postRank">
<div class="post-rank-inner"><span>{{oneBasedRank}}</span></div>
</template>
6 changes: 6 additions & 0 deletions client/views/posts/modules/post_rank.js
@@ -0,0 +1,6 @@
Template[getTemplate('postRank')].helpers({
oneBasedRank: function(){
if(typeof this.rank !== 'undefined')
return this.rank + 1;
}
});
4 changes: 0 additions & 4 deletions client/views/posts/modules/post_upvote.js
Expand Up @@ -3,10 +3,6 @@ Template[getTemplate('postUpvote')].helpers({
var user = Meteor.user();
if(!user) return false;
return _.include(this.upvoters, user._id);
},
oneBasedRank: function(){
if(typeof this.rank !== 'undefined')
return this.rank + 1;
}
});

Expand Down
@@ -1,13 +1,13 @@
<template name="posts_list">
{{> UI.dynamic template=postsListIncoming data=incoming}}
<div class="posts-wrapper grid grid-module">
{{> UI.dynamic template=postsListIncoming data=incoming}}
<div class="posts list">
{{#each posts}}
{{#each postsCursor}}
{{> UI.dynamic template=before_post_item}}
{{> UI.dynamic template=post_item}}
{{> UI.dynamic template=after_post_item}}
{{/each}}
</div>
{{> UI.dynamic template=postsLoadMore}}
</div>
{{> UI.dynamic template=postsLoadMore}}
</template>
@@ -1,3 +1,7 @@
Template[getTemplate('posts_list')].created = function() {
Session.set('listPopulatedAt', new Date());
};

Template[getTemplate('posts_list')].helpers({
description: function () {
var controller = Iron.controller();
Expand All @@ -13,14 +17,15 @@ Template[getTemplate('posts_list')].helpers({
after_post_item: function () {
return getTemplate('after_post_item');
},
posts : function () {
if(this.postsList){ // XXX
this.postsList.rewind();
var posts = this.postsList.map(function (post, index, cursor) {
postsCursor : function () {
if (this.postsCursor) { // not sure why this should ever be undefined, but it can apparently
var posts = this.postsCursor.map(function (post, index, cursor) {
post.rank = index;
return post;
});
return posts;
} else {
console.log('postsCursor not defined')
}
},
postsLoadMore: function () {
Expand All @@ -29,8 +34,4 @@ Template[getTemplate('posts_list')].helpers({
postsListIncoming: function () {
return getTemplate('postsListIncoming');
}
});

Template[getTemplate('posts_list')].created = function() {
Session.set('listPopulatedAt', new Date());
};
});

0 comments on commit e3ef359

Please sign in to comment.