Better UI for toggling worktime-only status

hinted-selects
Vitaliy Filippov 2014-09-10 15:29:27 +04:00
parent 723ddea69b
commit f75546693d
5 changed files with 17 additions and 30 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 625 B

View File

@ -32,11 +32,8 @@ function showhide_comment(comment_id, show)
{
var link = document.getElementById('comment_link_' + comment_id);
var comment = document.getElementById('comment_text_' + comment_id);
var unmark = document.getElementById('unmark_wtonly_' + comment_id);
link.innerHTML = show ? "[-]" : "[+]";
link.title = (show ? "Collapse" : "Expand")+" the comment.";
if (unmark)
unmark.style.display = show ? '' : 'none';
if (show)
removeClass(comment, 'collapsed');
else
@ -65,18 +62,13 @@ function showhide_comment_preview(comment_id)
return false;
}
// Mark comment as worktime-only or normal
function toggle_wtonly(id, initial_wtonly, img)
function edit_wtonly(l, id)
{
var f = document.getElementById((initial_wtonly ? 'cmt_normal_' : 'cmt_worktime_') + id);
var mark = f.value == '1';
f.value = mark ? '' : '1';
mark = initial_wtonly ? mark : !mark;
img.src = 'images/clock' + (mark ? '' : 'x') + '.gif';
img.alt = mark ?
'Comment is marked worktime-only. Click to mark it as normal, then click Save Changes' :
'Comment is marked as normal. Click to mark it as worktime-only, then click Save Changes';
img.title = img.alt;
l.style.display = 'none';
var e = document.getElementById('wtonly_' + id);
e.name = e.id;
e.style.display = '';
e.focus();
}
// This way, we are sure that browsers which do not support JS

View File

@ -496,9 +496,9 @@ if ($ARGS->{id})
# Same with worktime-only
foreach (keys %$ARGS)
{
if (/^cmt_(normal|worktime)_(\d+)$/ && $ARGS->{$_})
if (/^wtonly_(\d+)$/)
{
$first_bug->set_comment_worktimeonly($2, $1 eq 'worktime');
$first_bug->set_comment_worktimeonly($1, $ARGS->{$_});
}
}
}

View File

@ -11,6 +11,7 @@
.bz_comment_actions, .bz_comment_number, .bz_private_checkbox { float: right; }
.bz_comment_worktime { font-weight: bold; margin-left: 1em; }
.cmt_wtonly { font-size: 80%; vertical-align: middle; }
.bz_comment_unmark_wtonly { margin-left: 1em; }
.bz_private_checkbox input { margin: 0; vertical-align: middle; }
.bz_comment_user_images img { vertical-align: bottom; }

View File

@ -92,21 +92,15 @@
<span class="bz_comment_actions" id="comment_act_[% comment.id %]">
[% IF wt_btn %]
[% IF wt_only %]
<img src="images/clock.gif" width="16" height="16"
alt="Comment is marked as worktime-only. Click to mark it as normal, then click Save Changes"
title="Comment is marked as worktime-only. Click to mark it as normal, then click Save Changes"
<img src="images/clock[% IF !wt_only %]g[% END %].gif" width="16" height="16"
alt="[% wt_only ? 'Comment is worktime-only' : 'Comment is not worktime-only' %]"
title="[% wt_only ? 'Comment is worktime-only' : 'Comment is not worktime-only' %]"
style="cursor: pointer; vertical-align: middle"
onclick="toggle_wtonly([% comment.id %],1,this)" />
<input type="hidden" id="cmt_normal_[% comment.id %]" name="cmt_normal_[% comment.id %]" value="" />
[% ELSIF comment.type == constants.CMT_NORMAL %]
<img src="images/clockx.gif" width="16" height="16"
alt="Comment is marked as normal. Click to mark it as worktime-only, then click Save Changes"
title="Comment is marked as normal. Click to mark it as worktime-only, then click Save Changes"
style="cursor: pointer; vertical-align: middle"
onclick="toggle_wtonly([% comment.id %],0,this)" />
<input type="hidden" id="cmt_worktime_[% comment.id %]" name="cmt_worktime_[% comment.id %]" value="" />
[% END %]
onclick="edit_wtonly(this, [% comment.id %])" />
<select class="cmt_wtonly" id="wtonly_[% comment.id %]" style="display: none">
<option value="0">normal</option>
<option value="1"[% " selected" IF wt_only %]>worktime-only</option>
</select>
[% END %]
</span>