Merge pull request #4656 from tgxworld/dont_display_an_extra_button_for_wiki_post

UX: Display wiki icon on post edits indicator.
This commit is contained in:
Guo Xiang Tan 2017-01-17 06:34:43 +08:00 committed by GitHub
commit c76ee788a7
8 changed files with 25 additions and 47 deletions

View File

@ -22,12 +22,22 @@ export default createWidget('post-edits-indicator', {
}, },
html(attrs) { html(attrs) {
const contents = [attrs.version - 1, ' ', iconNode('pencil')]; let icon = 'pencil';
let titleKey = 'post.last_edited_on';
const updatedAt = new Date(attrs.updated_at); const updatedAt = new Date(attrs.updated_at);
let className = this.historyHeat(updatedAt);
const title = `${I18n.t('post.last_edited_on')} ${longDate(updatedAt)}`; if (attrs.wiki) {
icon = 'pencil-square-o';
titleKey = 'post.wiki_last_edited_on';
className = `${className} wiki`;
}
const contents = [attrs.version - 1, ' ', iconNode(icon)];
const title = `${I18n.t(titleKey)} ${longDate(updatedAt)}`;
return h('a', { return h('a', {
className: this.historyHeat(updatedAt), className,
attributes: { title } attributes: { title }
}, contents); }, contents);
}, },

View File

@ -110,20 +110,6 @@ createWidget('post-avatar', {
} }
}); });
createWidget('wiki-edit-button', {
tagName: 'div.post-info.wiki',
title: 'post.wiki.about',
html() {
return iconNode('pencil-square-o');
},
click() {
this.sendWidgetAction('editPost');
}
});
createWidget('post-email-indicator', { createWidget('post-email-indicator', {
tagName: 'div.post-info.via-email', tagName: 'div.post-info.via-email',
@ -185,10 +171,6 @@ createWidget('post-meta-data', {
result.push(this.attach('post-edits-indicator', attrs)); result.push(this.attach('post-edits-indicator', attrs));
} }
if (attrs.wiki) {
result.push(this.attach('wiki-edit-button', attrs));
}
if (attrs.multiSelect) { if (attrs.multiSelect) {
result.push(this.attach('select-post', attrs)); result.push(this.attach('select-post', attrs));
} }

View File

@ -80,15 +80,6 @@ body {
.coldmap-low { .coldmap-low {
color: dark-light-choose(scale-color($primary, $lightness: 50%), scale-color($secondary, $lightness: 50%)) !important; color: dark-light-choose(scale-color($primary, $lightness: 50%), scale-color($secondary, $lightness: 50%)) !important;
} }
.heatmap-high {
color: #fe7a15 !important;
}
.heatmap-med {
color: #cf7721 !important;
}
.heatmap-low {
color: #9b764f !important;
}
#loading-message { #loading-message {
position: absolute; position: absolute;

View File

@ -220,16 +220,17 @@ aside.quote {
} }
.post-info { .post-info {
&.wiki, &.via-email, &.whisper { &.via-email, &.whisper {
margin-right: 5px; margin-right: 5px;
i.fa { i.fa {
font-size: 1em; font-size: 1em;
} }
} }
&.wiki {
cursor: pointer; .wiki {
color: #408040; color: green !important;
} }
&.via-email { &.via-email {
color: dark-light-choose(scale-color($primary, $lightness: 70%), scale-color($secondary, $lightness: 30%)); color: dark-light-choose(scale-color($primary, $lightness: 70%), scale-color($secondary, $lightness: 30%));
} }

View File

@ -155,10 +155,6 @@ nav.post-controls {
box-shadow: none; box-shadow: none;
} }
&.wikied {
color: green;
}
&.bookmark {padding: 8px 11px; } &.bookmark {padding: 8px 11px; }
.read-icon { .read-icon {

View File

@ -76,7 +76,7 @@ button {
margin:10px 0 10px 0; margin:10px 0 10px 0;
} }
&.has-like {color: $love;} &.has-like {color: $love;}
&.wikied { color: green; }
.read-icon { .read-icon {
&:before { &:before {
font-family: "FontAwesome"; font-family: "FontAwesome";

View File

@ -1700,6 +1700,7 @@ en:
edit: "Editing {{link}} {{replyAvatar}} {{username}}" edit: "Editing {{link}} {{replyAvatar}} {{username}}"
edit_reason: "Reason: " edit_reason: "Reason: "
post_number: "post {{number}}" post_number: "post {{number}}"
wiki_last_edited_on: "wiki last edited on"
last_edited_on: "post last edited on" last_edited_on: "post last edited on"
reply_as_new_topic: "Reply as linked Topic" reply_as_new_topic: "Reply as linked Topic"
continue_discussion: "Continuing the discussion from {{postLink}}:" continue_discussion: "Continuing the discussion from {{postLink}}:"
@ -1752,9 +1753,6 @@ en:
via_auto_generated_email: "this post arrived via an auto generated email" via_auto_generated_email: "this post arrived via an auto generated email"
whisper: "this post is a private whisper for moderators" whisper: "this post is a private whisper for moderators"
wiki:
about: "this post is a wiki"
archetypes: archetypes:
save: 'Save Options' save: 'Save Options'

View File

@ -17,15 +17,15 @@ widgetTest('basic elements', {
}); });
widgetTest('wiki', { widgetTest('wiki', {
template: '{{mount-widget widget="post" args=args editPost="editPost"}}', template: '{{mount-widget widget="post" args=args showHistory="showHistory"}}',
setup() { setup() {
this.set('args', { wiki: true }); this.set('args', { wiki: true, version: 2, canViewEditHistory: true });
this.on('editPost', () => this.editPostCalled = true); this.on('showHistory', () => this.historyShown = true);
}, },
test(assert) { test(assert) {
click('.post-info.wiki'); click('.post-info .wiki');
andThen(() => { andThen(() => {
assert.ok(this.editPostCalled, 'clicking the wiki icon edits the post'); assert.ok(this.historyShown, 'clicking the wiki icon displays the post history');
}); });
} }
}); });