message_edit: Modify css for hover over 'Copy' button.

Replace background-image of copy button with an image
and change color on hover.
This commit is contained in:
Raghav Jajodia 2017-03-26 15:45:50 +05:30 committed by Tim Abbott
parent fd5ad3658d
commit 2bb632824e
6 changed files with 15 additions and 11 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 519 B

After

Width:  |  Height:  |  Size: 531 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 519 B

View File

@ -201,11 +201,10 @@ function edit_message(row, raw_content) {
var message_edit_countdown_timer = row.find('.message_edit_countdown_timer');
var copy_message = row.find('.copy_message');
initClipboard(copy_message[0]);
if (editability === editability_types.NO) {
message_edit_content.prop("readonly", "readonly");
message_edit_topic.prop("readonly", "readonly");
initClipboard(copy_message[0]);
} else if (editability === editability_types.NO_LONGER) {
// You can currently only reach this state in non-streams. If that
// changes (e.g. if we stop allowing topics to be modified forever
@ -213,10 +212,12 @@ function edit_message(row, raw_content) {
// row.find('input.message_edit_topic') as well.
message_edit_content.prop("readonly", "readonly");
message_edit_countdown_timer.text(i18n.t("View source"));
initClipboard(copy_message[0]);
} else if (editability === editability_types.TOPIC_ONLY) {
message_edit_content.prop("readonly", "readonly");
// Hint why you can edit the topic but not the message content
message_edit_countdown_timer.text(i18n.t("Topic editing only"));
initClipboard(copy_message[0]);
} else if (editability === editability_types.FULL) {
copy_message.remove();
composebox_typeahead.initialize_compose_typeahead("#message_edit_content", {emoji: true, stream: true});

View File

@ -222,12 +222,14 @@ $(function () {
$(this).closest(".message_row").find(".copy_message").hide();
});
$("body").on("mouseover", ".copy_message", function () {
$("body").on("mouseenter", ".copy_message", function () {
$(this).find('img#clipboard_image').attr("src", "/static/images/clippy_hover.svg");
$(this).show();
$(this).tooltip('show');
});
$("body").on("mouseout", ".copy_message", function () {
$("body").on("mouseleave", ".copy_message", function () {
$(this).find('img#clipboard_image').attr("src", "/static/images/clippy.svg");
$(this).tooltip('hide');
});

View File

@ -282,15 +282,11 @@ li,
.copy_message,
.copy_message:focus {
background-image: url('/static/images/clippy.svg');
background-size: contain;
background-repeat: no-repeat;
background-color: white;
background-position: center;
height: 20px;
width: 15px;
padding: 5px 10px;
border-radius: 2px;
border: none;
position: relative;
top: 32px;
left: -5px;
@ -298,8 +294,12 @@ li,
display: block;
}
.copy_message:hover {
background-color: #dadada;
#clipboard_image {
height: inherit;
width: inherit;
max-width: inherit;
margin-top: inherit;
margin-left: -7px;
}
.btn-large {

View File

@ -17,6 +17,7 @@
<div class="control-group no-margin">
<div class="controls edit-controls">
<button class="btn pull-right copy_message" data-toggle="tooltip" title="{{t "Copy and close" }}" data-clipboard-target="#message_edit_content">
<img src="/static/images/clippy.svg" id="clipboard_image" />
</button>
<label class="edit-control-label" for="message_edit_topic">{{t "Content" }}</label>
<textarea class="message_edit_content" id="message_edit_content">{{content}}</textarea>