Markup & style fixes for post list statuses

fixes #1703, fixes #1712

- featured star appears immediately for both draft and published items
- featured star is never red & alignment /style is updated
- improved markup and styling of statuses in general
- added to feature tests
This commit is contained in:
Hannah Wolfe 2013-12-18 15:23:35 +00:00
parent 574218130a
commit 05c603ee2c
5 changed files with 52 additions and 25 deletions

View File

@ -95,14 +95,22 @@
} }
} }
.featured .date { .featured .status {
@include icon($i-featured, 11px) { @include icon($i-featured, 11px) {
margin-right:12px; margin-right: 10px;
vertical-align: 0; vertical-align: 7%;
}; };
} }
ol { .status .draft {
color: $red;
}
.status .scheduled {
color: $orange;
}
ol {
list-style: none; list-style: none;
padding:0; padding:0;
margin:0; margin:0;

View File

@ -1677,12 +1677,4 @@ main {
background:$orange; background:$orange;
} }
} }
.status-draft {
color: $red;
}
.status-scheduled {
color: $orange;
}

View File

@ -1,16 +1,18 @@
<a class="permalink{{#if featured}} featured{{/if}}{{#if page}} page{{/if}}" href="#" title="Edit this post"> <a class="permalink{{#if featured}} featured{{/if}}{{#if page}} page{{/if}}" href="#" title="Edit this post">
<h3 class="entry-title">{{{title}}}</h3> <h3 class="entry-title">{{{title}}}</h3>
<section class="entry-meta"> <section class="entry-meta">
<span class="status">
{{#if published}} {{#if published}}
{{#if page}} {{#if page}}
<span class="page">Page</span> <span class="page">Page</span>
{{else}} {{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"}} Published {{date published_at timeago="True"}}
</time> </time>
{{/if}} {{/if}}
{{else}} {{else}}
<span class="status-draft">Draft</span> <span class="draft">Draft</span>
{{/if}} {{/if}}
</span>
</section> </section>
</a> </a>

View File

@ -138,7 +138,7 @@
initialize: function () { initialize: function () {
this.listenTo(Backbone, 'blog:activeItem', this.checkActive); 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); this.listenTo(this.model, 'destroy', this.removeItem);
}, },

View File

@ -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 // Create a sample post
casper.thenOpen(url + 'ghost/editor/', function testTitleAndUrl() { casper.thenOpen(url + 'ghost/editor/', function testTitleAndUrl() {
test.assertTitle('Ghost Admin', 'Ghost admin has no title'); test.assertTitle('Ghost Admin', 'Ghost admin has no title');
@ -80,9 +80,11 @@ CasperTest.begin("Posts can be marked as featured", 6, function suite(test) {
casper.thenClick('.js-publish-button'); casper.thenClick('.js-publish-button');
casper.waitForSelector('.notification-success', function () { casper.waitForSelector('.notification-success', function waitForSuccess() {
test.assert(true, 'got success notification'); test.assert(true, 'got success notification');
test.assertSelectorHasText('.notification-success', 'Your post has been saved as a draft.'); test.assertSelectorHasText('.notification-success', 'Your post has been saved as a draft.');
}, function onTimeout() {
test.assert(false, 'No success notification :(');
}); });
// Begin test // Begin test
@ -91,17 +93,40 @@ CasperTest.begin("Posts can be marked as featured", 6, function suite(test) {
}); });
// Mark as featured // Mark as featured
casper.waitForSelector('.unfeatured' , function() { casper.waitForSelector('.content-preview .unfeatured', function () {
this.click('.unfeatured'); 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 // Mark as not featured
casper.waitForSelector('.featured' , function() { casper.waitWhileSelector('.notification-success', function waitForNoSuccess() {
this.click('.featured'); 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.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:(');
}); });
}); });