Skip to content

Commit

Permalink
Merge pull request TryGhost#1704 from ErisDS/featured-star
Browse files Browse the repository at this point in the history
Markup & style fixes for post list statuses
  • Loading branch information
ErisDS committed Dec 21, 2013
2 parents b80054c + 05c603e commit 545f426
Show file tree
Hide file tree
Showing 5 changed files with 52 additions and 25 deletions.
16 changes: 12 additions & 4 deletions core/client/assets/sass/layouts/manage.scss
Original file line number Diff line number Diff line change
Expand Up @@ -95,14 +95,22 @@
}
}

.featured .date {
.featured .status {
@include icon($i-featured, 11px) {
margin-right:12px;
vertical-align: 0;
margin-right: 10px;
vertical-align: 7%;
};
}

ol {
.status .draft {
color: $red;
}
.status .scheduled {
color: $orange;
}


ol {
list-style: none;
padding:0;
margin:0;
Expand Down
10 changes: 1 addition & 9 deletions core/client/assets/sass/modules/global.scss
Original file line number Diff line number Diff line change
Expand Up @@ -1677,12 +1677,4 @@ main {
background:$orange;
}

}

.status-draft {
color: $red;
}
.status-scheduled {
color: $orange;
}

}
6 changes: 4 additions & 2 deletions core/client/tpl/list-item.hbs
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
<a class="permalink{{#if featured}} featured{{/if}}{{#if page}} page{{/if}}" href="#" title="Edit this post">
<h3 class="entry-title">{{{title}}}</h3>
<section class="entry-meta">
<span class="status">
{{#if published}}
{{#if page}}
<span class="page">Page</span>
{{else}}
<time datetime="{{date published_at format="YYYY-MM-DD hh:mm"}}" class="date">
<time datetime="{{date published_at format="YYYY-MM-DD hh:mm"}}" class="date published">
Published {{date published_at timeago="True"}}
</time>
{{/if}}
{{else}}
<span class="status-draft">Draft</span>
<span class="draft">Draft</span>
{{/if}}
</span>
</section>
</a>
2 changes: 1 addition & 1 deletion core/client/views/blog.js
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@

initialize: function () {
this.listenTo(Backbone, 'blog:activeItem', this.checkActive);
this.listenTo(this.model, 'change:page', this.render);
this.listenTo(this.model, 'change:page change:featured', this.render);
this.listenTo(this.model, 'destroy', this.removeItem);
},

Expand Down
43 changes: 34 additions & 9 deletions core/test/functional/admin/content_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ CasperTest.begin('Infinite scrolling', 1, function suite(test) {
});
});

CasperTest.begin("Posts can be marked as featured", 6, function suite(test) {
CasperTest.begin("Posts can be marked as featured", 12, function suite(test) {
// Create a sample post
casper.thenOpen(url + 'ghost/editor/', function testTitleAndUrl() {
test.assertTitle('Ghost Admin', 'Ghost admin has no title');
Expand All @@ -80,9 +80,11 @@ CasperTest.begin("Posts can be marked as featured", 6, function suite(test) {

casper.thenClick('.js-publish-button');

casper.waitForSelector('.notification-success', function () {
casper.waitForSelector('.notification-success', function waitForSuccess() {
test.assert(true, 'got success notification');
test.assertSelectorHasText('.notification-success', 'Your post has been saved as a draft.');
}, function onTimeout() {
test.assert(false, 'No success notification :(');
});

// Begin test
Expand All @@ -91,17 +93,40 @@ CasperTest.begin("Posts can be marked as featured", 6, function suite(test) {
});

// Mark as featured
casper.waitForSelector('.unfeatured' , function() {
this.click('.unfeatured');
casper.waitForSelector('.content-preview .unfeatured', function () {
this.click('.content-preview .unfeatured');
}, function onTimeOut() {
test.assert(false, 'The first post can\'t be marked as featured');
});

casper.waitForSelector('.notification-success', function waitForSuccess() {
test.assert(true, 'got success notification');
test.assertSelectorHasText('.notification-success', 'Post successfully marked as featured.');
}, function onTimeout() {
test.assert(false, 'No success notification :(');
});

casper.waitForSelector('.content-list-content li:first-child .featured', function () {
test.assertExists('.content-preview .featured');
test.assert(true, 'got a featured star');
this.click('.notification-success .close');
}, function onTimeout() {
test.assert(false, 'No featured star appeard in the left pane');
});

// Mark as not featured
casper.waitForSelector('.featured' , function() {
this.click('.featured');
casper.waitWhileSelector('.notification-success', function waitForNoSuccess() {
this.click('.content-preview .featured');
}, function onTimeout() {
test.assert(false, 'Success notification wont go away:(');
});

casper.waitForSelector('.notification-success', function () {
casper.waitForSelector('.notification-success', function waitForSuccess() {
test.assert(true, 'got success notification');
test.assertSelectorHasText('.notification-success', 'Post successfully marked as featured.');
test.assertSelectorHasText('.notification-success', 'Post successfully marked as not featured.');
test.assertDoesntExist('.content-preview .featured');
test.assertDoesntExist('.content-list-content li:first-child .featured');
}, function onTimeout() {
test.assert(false, 'Success notification wont go away:(');
});
});
});

0 comments on commit 545f426

Please sign in to comment.