Remove avatar, name, timestamp and interactions from publisher preview

This doesn't add any value in the post preview:
* Avatar is already at the left-hand side of the publisher
* Timestamp is always "less than a minute ago"
* Interactions are disabled in the preview anyway

We don't display these things in the comment preview either, they only
need space and don't add any value to the preview.
This commit is contained in:
Benjamin Neff 2017-08-14 02:00:28 +02:00
parent 9adcca2679
commit dd6cbbbb8e
No known key found for this signature in database
GPG key ID: 971464C3F1A90194
5 changed files with 46 additions and 74 deletions

View file

@ -5,7 +5,6 @@ app.views.PreviewPost = app.views.Post.extend({
className: "stream-element loaded",
subviews: {
".feedback": "feedbackView",
".post-content": "postContentView",
".oembed": "oEmbedView",
".opengraph": "openGraphView",
@ -13,12 +12,6 @@ app.views.PreviewPost = app.views.Post.extend({
".status-message-location": "postLocationStreamView"
},
tooltipSelector: [
".timeago",
".delete",
".permalink"
].join(", "),
initialize: function() {
this.model.set("preview", true);
this.oEmbedView = new app.views.OEmbed({model: this.model});
@ -26,10 +19,6 @@ app.views.PreviewPost = app.views.Post.extend({
this.pollView = new app.views.Poll({model: this.model});
},
feedbackView: function() {
return new app.views.Feedback({model: this.model});
},
postContentView: function() {
return new app.views.StatusMessage({model: this.model});
},

View file

@ -197,10 +197,16 @@
border: 0;
}
.md-preview {
// This rule is required until we switch to the newer release of bootstrap-markdown with
// the following commit in:
// https://github.com/toopay/bootstrap-markdown/commit/14a21c3837140144b27efc19c795d1a37fad70fb
.md-preview { min-height: 90px; }
min-height: 90px;
.stream-element .post-content .markdown-content {
padding-top: 0;
}
}
}
.publisher-textarea-wrapper {

View file

@ -13,29 +13,17 @@
</span>
{{#if preview}}
<span>{{t "stream.like"}}</span>
{{else}}
<a href="#" class="like" rel='nofollow'>
<a href="#" class="like" rel='nofollow'>
{{~#if userLike~}}
{{~t "stream.unlike"~}}
{{~else~}}
{{~t "stream.like"~}}
{{~/if~}}
</a>
{{/if}}
</a>
·
{{#if preview}}
<span>{{t "stream.reshare"}}</span>
·
{{else if userCanReshare}}
{{#if userCanReshare}}
<a href="#" class="reshare" rel='nofollow'>{{t "stream.reshare"}}</a>
·
{{/if}}
{{#if preview}}
<span>{{t "stream.comment"}}</span>
{{else}}
<a href="#" class="focus_comment_textarea" rel="nofollow">{{t "stream.comment"}}</a>
{{/if}}
<a href="#" class="focus_comment_textarea" rel="nofollow">{{t "stream.comment"}}</a>

View file

@ -1,11 +1,15 @@
<div class="media {{#if showPost}} {{#if nsfw}} shield-off {{/if}} {{else}} shield-active {{/if}}">
{{#unless preview}}
{{#with author}}
<a href="/people/{{guid}}" class="img {{{hovercardable this}}}">
{{{personImage this}}}
</a>
{{/with}}
{{/unless}}
<div class="bd">
{{#unless preview}}
{{#if loggedIn}}
<div class="post-controls"></div>
{{/if}}
@ -17,9 +21,6 @@
<span class="details gray">
-
{{#if preview}}
<time class="timeago" data-original-title="{{{localTime created_at}}}" datetime="{{created_at}}" />
{{else}}
<a href="/posts/{{id}}">
<time class="timeago" data-original-title="{{{localTime created_at}}}" datetime="{{created_at}}" />
</a>
@ -27,16 +28,18 @@
<a href="/posts/{{guid}}" class="permalink" title="{{t "stream.permalink"}}">
<i class="entypo-link"></i>
</a>
{{/if}}
</span>
</div>
{{/unless}}
<div class="post-content"> </div>
<div class="status-message-location nsfw-hidden"> </div>
{{#unless preview}}
<div class="feedback nsfw-hidden"> </div>
<div class="likes nsfw-hidden"> </div>
<div class="reshares nsfw-hidden"> </div>
<div class="comments nsfw-hidden"> </div>
{{/unless}}
</div>
</div>

View file

@ -36,12 +36,6 @@ describe("app.views.PreviewPost", function() {
});
describe("render", function() {
it("calls feedbackView", function() {
spyOn(app.views.PreviewPost.prototype, "feedbackView");
this.view.render();
expect(app.views.PreviewPost.prototype.feedbackView).toHaveBeenCalled();
});
it("calls postContentView", function() {
spyOn(app.views.PreviewPost.prototype, "postContentView");
this.view.render();
@ -55,14 +49,6 @@ describe("app.views.PreviewPost", function() {
});
});
describe("feedbackView", function() {
it("calls app.views.Feedback.initialise", function() {
spyOn(app.views.Feedback.prototype, "initialize");
this.view.feedbackView();
expect(app.views.Feedback.prototype.initialize).toHaveBeenCalledWith({model: this.model});
});
});
describe("postContentView", function() {
it("calls app.views.Feedback.initialise", function() {
spyOn(app.views.StatusMessage.prototype, "initialize");