make posts active when approving them

This commit is contained in:
Sacha Greif 2013-01-13 09:52:40 +09:00
parent 9edd21c3ab
commit 1c74af2344
4 changed files with 15 additions and 4 deletions

View file

@ -74,7 +74,7 @@ var newPostsHandle = postListSubscription(FIND_APPROVED, {sort: {sticky: -1, sub
var bestPostsHandle = postListSubscription(FIND_APPROVED, {sort: {sticky: -1, baseScore: -1}}, 10);
var pendingPostsHandle = postListSubscription(
{$or: [{status: STATUS_PENDING}, {status: STATUS_REJECTED}]},
{sort: {score: -1}},
{sort: {createdAt: -1}},
10
);

View file

@ -29,6 +29,12 @@
</div>
</div>
{{#if isAdmin}}
<div class="control-group post-form-sticky">
<label class="control-label">Inactive?</label>
<div class="controls">
{{inactive}}
</div>
</div>
<div class="control-group post-form-sticky">
<label class="control-label">Sticky?</label>
<div class="controls">

View file

@ -95,8 +95,13 @@ Template.post_edit.events = {
if(isAdmin(Meteor.user())){
if(status == STATUS_APPROVED){
// if post is approved, set submitted timestamp to current date or form field date
properties.submitted = (post.submitted == '') ? new Date().getTime() : parseInt(moment($('#submitted_date').val()+$('#submitted_time').val(), "MM/DD/YYYY HH:mm").valueOf());
if(post.submitted == ''){
// this is the first time we are approving the post
properties.submitted = new Date().getTime();
properties.inactive = false;
}else{
properties.submitted = parseInt(moment($('#submitted_date').val()+$('#submitted_time').val(), "MM/DD/YYYY HH:mm").valueOf());
}
}
adminProperties = {
sticky: !!$('#sticky').attr('checked'),

View file

@ -30,7 +30,7 @@
<div class="control-group">
<label class="control-label">Sticky?</label>
<div class="controls">
<input type="checkbox" name="sticky" id="sticky" {{#if sticky}}checked{{/if}} />
<input type="checkbox" name="sticky" id="sticky" />
</div>
</div>
<div class="control-group">