Skip to content

Commit 6f08830

Browse files
committed
Bug 1181596 - Modal UI doesn't honor the "where to put the additional comment textarea" preference
1 parent 99331e9 commit 6f08830

File tree

3 files changed

+64
-32
lines changed

3 files changed

+64
-32
lines changed

extensions/BugModal/template/en/default/bug_modal/edit.html.tmpl

Lines changed: 55 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1017,7 +1017,11 @@
10171017
[% IF user.id %]
10181018
<div id="top-actions">
10191019
<button type="button" id="attachments-add-btn" class="minor">Attach File</button>
1020-
<button type="button" class="comment-btn minor">Add Comment</button>
1020+
[% IF user.settings.comment_box_position.value == 'after_comments' %]
1021+
<button type="button" id="add-comment-btn" class="minor">Add Comment &darr;</button>
1022+
[% ELSE %]
1023+
<button type="button" id="bottom-btn" class="minor">Bottom &darr;</button>
1024+
[% END %]
10211025
[%+ Hook.process('top_actions') %]
10221026
<button type="submit" class="save-btn major" id="top-save-btn" style="display:none">Save Changes</button>
10231027
</div>
@@ -1028,49 +1032,69 @@
10281032
[%# === comments === %]
10291033

10301034
[%
1035+
IF user.settings.comment_box_position.value == 'before_comments';
1036+
INCLUDE new_comment;
1037+
END;
10311038
INCLUDE bug_modal/activity_stream.html.tmpl stream=bug.activity_stream;
1032-
IF user.id;
1033-
INCLUDE bug_modal/new_comment.html.tmpl;
1034-
ELSE;
1035-
%]
1036-
<div id="new-comment-notice">
1037-
You need to <a href="show_bug.cgi?id=[% bug.bug_id FILTER none %]&amp;GoAheadAndLogIn=1">log in</a>
1038-
before you can comment on or make changes to this [% terms.bug %].
1039-
</div>
1040-
[%
1039+
IF user.settings.comment_box_position.value == 'after_comments';
1040+
INCLUDE new_comment;
10411041
END;
10421042
%]
10431043

10441044
[%# === bottom actions === %]
10451045

1046-
[% IF user.id %]
1047-
<div id="bottom-actions">
1048-
<button type="submit" class="save-btn major" id="bottom-save-btn">Save Changes</button>
1049-
[%
1050-
IF bug.resolution == "";
1051-
seen_header = 0;
1052-
FOREACH resolution IN ["FIXED", "INVALID", "DUPLICATE"];
1053-
NEXT UNLESS bug.choices.resolution.only("name", resolution).size;
1054-
IF NOT seen_header;
1055-
seen_header = 1;
1056-
" Resolve as ";
1057-
END;
1058-
%] <button type="button" class="minor resolution-btn">[% resolution FILTER html %]</button> [%
1059-
END;
1060-
ELSIF bug.choices.bug_status.only("name", "REOPENED").size;
1061-
%] <button type="button" class="minor status-btn" data-status="REOPENED">REOPEN</button> [%
1062-
END;
1063-
%]
1064-
<div id="bottom-right-actions">
1065-
<button type="button" id="top-btn" class="minor">Top &uarr;</button>
1046+
<div id="bottom-actions">
1047+
<div id="bottom-right-actions">
1048+
<button type="button" id="top-btn" class="minor">Top &uarr;</button>
1049+
[% IF user.id %]
10661050
<button type="button" id="new-bug-btn" class="minor">New [% terms.Bug %] &#9662;</button>
1067-
</div>
1051+
[% END %]
10681052
</div>
1053+
</div>
1054+
1055+
[% IF user.id %]
10691056
</form>
10701057
[% END %]
10711058

10721059
[%# === blocks === %]
10731060

1061+
[% BLOCK new_comment %]
1062+
[%# === new comment === %]
1063+
[%
1064+
IF user.id;
1065+
INCLUDE bug_modal/new_comment.html.tmpl;
1066+
ELSE;
1067+
%]
1068+
<div id="new-comment-notice">
1069+
You need to <a href="show_bug.cgi?id=[% bug.bug_id FILTER none %]&amp;GoAheadAndLogIn=1">log in</a>
1070+
before you can comment on or make changes to this [% terms.bug %].
1071+
</div>
1072+
[%
1073+
END;
1074+
%]
1075+
[%# === comment actions === %]
1076+
[% IF user.id %]
1077+
<div id="new-comment-actions">
1078+
<button type="submit" class="save-btn major" id="bottom-save-btn">Save Changes</button>
1079+
[%
1080+
IF bug.resolution == "";
1081+
seen_header = 0;
1082+
FOREACH resolution IN ["FIXED", "INVALID", "DUPLICATE"];
1083+
NEXT UNLESS bug.choices.resolution.only("name", resolution).size;
1084+
IF NOT seen_header;
1085+
seen_header = 1;
1086+
" Resolve as ";
1087+
END;
1088+
%] <button type="button" class="minor resolution-btn">[% resolution FILTER html %]</button> [%
1089+
END;
1090+
ELSIF bug.choices.bug_status.only("name", "REOPENED").size;
1091+
%] <button type="button" class="minor status-btn" data-status="REOPENED">REOPEN</button> [%
1092+
END;
1093+
%]
1094+
</div>
1095+
[% END %]
1096+
[% END %]
1097+
10741098
[% BLOCK fields_lhs %]
10751099
<div class="fields-lhs">[% content FILTER none %]</div>
10761100
[% END %]

extensions/BugModal/web/bug_modal.css

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -343,6 +343,7 @@ input[type="number"] {
343343
}
344344

345345
#bottom-actions {
346+
margin-top: 8px;
346347
margin-bottom: 50px;
347348
max-width: 1024px;
348349
}

extensions/BugModal/web/bug_modal.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,13 @@ $(function() {
106106
$.scrollTo($('body'));
107107
});
108108

109+
// bottom btn
110+
$('#bottom-btn')
111+
.click(function(event) {
112+
event.preventDefault();
113+
$.scrollTo($('#bottom-actions'));
114+
});
115+
109116
// use non-native tooltips for relative times and bug summaries
110117
$('.rel-time, .rel-time-title, .bz_bug_link, .tt').tooltip({
111118
position: { my: "left top+8", at: "left bottom", collision: "flipfit" },
@@ -306,7 +313,7 @@ $(function() {
306313
});
307314

308315
// add comment menuitem, scroll the textarea into view
309-
$('#action-add-comment')
316+
$('#action-add-comment, #add-comment-btn')
310317
.click(function(event) {
311318
event.preventDefault();
312319
// focus first to grow the textarea, so we scroll to the correct location

0 commit comments

Comments
 (0)