diff options
author | Sebastin Santy <sebastinssanty@gmail.com> | 2017-06-10 05:18:53 +0200 |
---|---|---|
committer | Dylan William Hardison <dylan@hardison.net> | 2017-06-10 05:18:53 +0200 |
commit | 9243cbb3b6f014563d15c8b7ababdd55a722627a (patch) | |
tree | 40aa9450f816610d73c9254c74567bb390bad667 /extensions/BugModal/template | |
parent | b1abfe7caca072a36c312d6961ff9fbbfe306933 (diff) | |
download | bugzilla-9243cbb3b6f014563d15c8b7ababdd55a722627a.tar.gz bugzilla-9243cbb3b6f014563d15c8b7ababdd55a722627a.tar.xz |
Bug 1365342 - Extract the preview comment functionality and make it a reusable template
* Putting variables.none at the top
* Put the message at the top
* Remove header_done
* Add an #xhr-error to show bugzilla_ajax() errors
Diffstat (limited to 'extensions/BugModal/template')
-rw-r--r-- | extensions/BugModal/template/en/default/bug_modal/common_header.html.tmpl | 84 | ||||
-rw-r--r-- | extensions/BugModal/template/en/default/bug_modal/common_new_comment.html.tmpl | 55 |
2 files changed, 139 insertions, 0 deletions
diff --git a/extensions/BugModal/template/en/default/bug_modal/common_header.html.tmpl b/extensions/BugModal/template/en/default/bug_modal/common_header.html.tmpl new file mode 100644 index 000000000..3d71f1625 --- /dev/null +++ b/extensions/BugModal/template/en/default/bug_modal/common_header.html.tmpl @@ -0,0 +1,84 @@ +[%# This Source Code Form is subject to the terms of the Mozilla Public + # License, v. 2.0. If a copy of the MPL was not distributed with this + # file, You can obtain one at http://mozilla.org/MPL/2.0/. + # + # This Source Code Form is "Incompatible With Secondary Licenses", as + # defined by the Mozilla Public License, v. 2.0. + #%] + +[% + PROCESS global/variables.none.tmpl; + + title = title + + generate_api_token = 1; + + # these aren't always defined + UNLESS bodyclasses.defined; + bodyclasses = []; + END; + UNLESS javascript_urls.defined; + javascript_urls = []; + END; + UNLESS style_urls.defined; + style_urls = []; + END; + UNLESS jquery.defined; + jquery = []; + END; + + # right now we need yui for tracking flags and needinfo extensions + no_yui = 0; + + # add body classes for sec-groups, etc + bodyclasses.push("bug_modal"); + + # assets + javascript_urls.push( + "extensions/ProdCompSearch/web/js/prod_comp_search.js", + "extensions/BugModal/web/common_bug_modal.js", + "extensions/BugModal/web/comments.js", + "extensions/BugModal/web/dropdown.js", + "js/bugzilla-readable-status-min.js", + "js/field.js", + "js/comments.js", + "js/util.js" + ); + jquery.push( + "datetimepicker", + "contextMenu", + "visibility" + ); + style_urls.push( + "extensions/BugModal/web/common_bug_modal.css", + "extensions/BugModal/web/dropdown.css", + "skins/custom/bug_groups.css", + "js/jquery/plugins/datetimepicker/datetimepicker.css", + "js/jquery/plugins/contextMenu/contextMenu.css" + ); +%] + +[% javascript = BLOCK %] + + [%# expose useful data to js %] + + BUGZILLA.user = { + id: [% user.id FILTER none %], + login: '[% user.login FILTER js %]', + is_insider: [% user.is_insider ? "true" : "false" %], + is_timetracker: [% user.is_timetracker ? "true" : "false" %], + can_tag: [% user.can_tag_comments ? "true" : "false" %], + settings: { + quote_replies: '[% user.settings.quote_replies.value FILTER js %]', + zoom_textareas: [% user.settings.zoom_textareas.value == "on" ? "true" : "false" %], + remember_collapsed: [% user.settings.ui_remember_collapsed.value == "on" ? "true" : "false" %] + } + }; + + [% IF user.is_timetracker %] + BUGZILLA.remaining_time = [% bug.remaining_time FILTER js %]; // holds the original value + [% END %] + BUGZILLA.bug_secure = [% bug.groups_in.size ? 'true' : 'false' %]; +[% END %] + +[% Hook.process("end") %]
\ No newline at end of file diff --git a/extensions/BugModal/template/en/default/bug_modal/common_new_comment.html.tmpl b/extensions/BugModal/template/en/default/bug_modal/common_new_comment.html.tmpl new file mode 100644 index 000000000..2ba3948d1 --- /dev/null +++ b/extensions/BugModal/template/en/default/bug_modal/common_new_comment.html.tmpl @@ -0,0 +1,55 @@ +[%# This Source Code Form is subject to the terms of the Mozilla Public + # License, v. 2.0. If a copy of the MPL was not distributed with this + # file, You can obtain one at http://mozilla.org/MPL/2.0/. + # + # This Source Code Form is "Incompatible With Secondary Licenses", as + # defined by the Mozilla Public License, v. 2.0. + #%] + +[%# + # comment: comment object + # bug: bug object + #%] + +<div id="add-comment"> + + [% IF bug && !bug.check_can_change_field('longdesc', 0, 1) %] + <div id="new-comment-notice"> + You are not allowed to make an additional comment on this [% terms.bug %]. + </div> + [% RETURN %] + [% END %] + + [% IF bug && user.is_insider %] + <div id="add-comment-private" + title="Make comment visible only to members of the '[% Param('insidergroup') FILTER html %]' group" + > + <input type="checkbox" name="comment_is_private" id="add-comment-private-cb" + value="1" comment_id="[% comment.count FILTER none %]"> + <label for="add-comment-private-cb">Private</label> + </div> + [% END %] + + <ul id="comment-tabs" role="tablist"> + <li id="comment-edit-tab" data-focus="comment" role="tab" tabindex="0" aria-controls="comment-edit-tabpanel" aria-selected="true"> + Add Comment + </li> + [%~ ~%] + <li id="comment-preview-tab" role="tab" tabindex="-1" aria-controls="comment-preview-tabpanel" aria-selected="false"> + Preview + <img id="preview-throbber" src="extensions/BugModal/web/throbber.gif" width="16" height="11" style="display:none"> + </li> + </ul> + + <div id="comment-edit-tabpanel" class="comment-tabpanel" role="tabpanel" aria-labelledby="comment-edit-tab"> + <textarea rows="5" cols="80" name="comment" id="comment" aria-labelledby="comment-edit-tab"></textarea> + </div> + <div id="comment-preview-tabpanel" class="comment-tabpanel" role="tabpanel" aria-labelledby="comment-preview-tab" style="display:none"> + <pre id="comment-preview" class="comment-text"></pre> + </div> + + <div id="bugzilla-etiquette"> + <a href="page.cgi?id=etiquette.html" target="_blank" tabindex="-1"> + Comments Subject to Etiquette and Contributor Guidelines</a> + </div> +</div> |