mirror of
https://github.com/discourse/discourse.git
synced 2024-11-23 12:40:40 +08:00
UX: Display wiki icon on post edits indicator.
This commit is contained in:
parent
ed5fa20b0c
commit
17da0bd11f
|
@ -22,12 +22,22 @@ export default createWidget('post-edits-indicator', {
|
|||
},
|
||||
|
||||
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);
|
||||
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', {
|
||||
className: this.historyHeat(updatedAt),
|
||||
className,
|
||||
attributes: { title }
|
||||
}, contents);
|
||||
},
|
||||
|
|
|
@ -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', {
|
||||
tagName: 'div.post-info.via-email',
|
||||
|
||||
|
@ -185,10 +171,6 @@ createWidget('post-meta-data', {
|
|||
result.push(this.attach('post-edits-indicator', attrs));
|
||||
}
|
||||
|
||||
if (attrs.wiki) {
|
||||
result.push(this.attach('wiki-edit-button', attrs));
|
||||
}
|
||||
|
||||
if (attrs.multiSelect) {
|
||||
result.push(this.attach('select-post', attrs));
|
||||
}
|
||||
|
|
|
@ -80,15 +80,6 @@ body {
|
|||
.coldmap-low {
|
||||
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 {
|
||||
position: absolute;
|
||||
|
|
|
@ -220,16 +220,17 @@ aside.quote {
|
|||
}
|
||||
|
||||
.post-info {
|
||||
&.wiki, &.via-email, &.whisper {
|
||||
&.via-email, &.whisper {
|
||||
margin-right: 5px;
|
||||
i.fa {
|
||||
font-size: 1em;
|
||||
}
|
||||
}
|
||||
&.wiki {
|
||||
cursor: pointer;
|
||||
color: #408040;
|
||||
|
||||
.wiki {
|
||||
color: green !important;
|
||||
}
|
||||
|
||||
&.via-email {
|
||||
color: dark-light-choose(scale-color($primary, $lightness: 70%), scale-color($secondary, $lightness: 30%));
|
||||
}
|
||||
|
|
|
@ -155,10 +155,6 @@ nav.post-controls {
|
|||
box-shadow: none;
|
||||
}
|
||||
|
||||
&.wikied {
|
||||
color: green;
|
||||
}
|
||||
|
||||
&.bookmark {padding: 8px 11px; }
|
||||
|
||||
.read-icon {
|
||||
|
|
|
@ -76,7 +76,7 @@ button {
|
|||
margin:10px 0 10px 0;
|
||||
}
|
||||
&.has-like {color: $love;}
|
||||
&.wikied { color: green; }
|
||||
|
||||
.read-icon {
|
||||
&:before {
|
||||
font-family: "FontAwesome";
|
||||
|
|
|
@ -1700,6 +1700,7 @@ en:
|
|||
edit: "Editing {{link}} {{replyAvatar}} {{username}}"
|
||||
edit_reason: "Reason: "
|
||||
post_number: "post {{number}}"
|
||||
wiki_last_edited_on: "wiki last edited on"
|
||||
last_edited_on: "post last edited on"
|
||||
reply_as_new_topic: "Reply as linked Topic"
|
||||
continue_discussion: "Continuing the discussion from {{postLink}}:"
|
||||
|
@ -1752,9 +1753,6 @@ en:
|
|||
via_auto_generated_email: "this post arrived via an auto generated email"
|
||||
whisper: "this post is a private whisper for moderators"
|
||||
|
||||
wiki:
|
||||
about: "this post is a wiki"
|
||||
|
||||
archetypes:
|
||||
save: 'Save Options'
|
||||
|
||||
|
|
|
@ -17,15 +17,15 @@ widgetTest('basic elements', {
|
|||
});
|
||||
|
||||
widgetTest('wiki', {
|
||||
template: '{{mount-widget widget="post" args=args editPost="editPost"}}',
|
||||
template: '{{mount-widget widget="post" args=args showHistory="showHistory"}}',
|
||||
setup() {
|
||||
this.set('args', { wiki: true });
|
||||
this.on('editPost', () => this.editPostCalled = true);
|
||||
this.set('args', { wiki: true, version: 2, canViewEditHistory: true });
|
||||
this.on('showHistory', () => this.historyShown = true);
|
||||
},
|
||||
test(assert) {
|
||||
click('.post-info.wiki');
|
||||
click('.post-info .wiki');
|
||||
andThen(() => {
|
||||
assert.ok(this.editPostCalled, 'clicking the wiki icon edits the post');
|
||||
assert.ok(this.historyShown, 'clicking the wiki icon displays the post history');
|
||||
});
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue
Block a user