summaryrefslogtreecommitdiffstats
path: root/extensions/UserStory/template/en/default/hook/bug/comments-comment_banner.html.tmpl
blob: e276e312733aef6e900a59f91ead2743a6e439e2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
[%# 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.
  #%]

[% RETURN UNLESS bug.user_story_visible.0 %]
[% RETURN IF user.id == 0 && bug.cf_user_story == "" %]
[% can_edit_story = bug.check_can_change_field('cf_user_story', 0, 1) %]

<div class="user_story">
  <script type="text/javascript">
    function userStoryComment() {
        var commenttext = "(Commenting on User Story)\n";
        var text_elem = document.getElementById('user_story');
        var commenttext = commenttext + wrapReplyText(text_elem.value);
        var textarea = document.getElementById('comment');
        if (textarea.value != commenttext) {
            textarea.value += commenttext;
        }
        textarea.focus();
    }
  </script>
  <div id="user_story_header">
    <b>User Story</b>
    [% IF can_edit_story %]
      <span id="user_story_edit">
        (<a href="javascript:void(0)" id="user_story_edit_action" >edit</a>)
      </span>
    [% END %]
    [% IF user.id
          && bug.cf_user_story != ""
          && bug.check_can_change_field('longdesc', 0, 1) %]
      <span id="user_story_comment">
        [<a class="bz_reply_link" href="#user_story_comment"
           onclick="userStoryComment(); return false;"
         >comment</a>]
      </span>
    [% END %]
  </div>

  [% IF bug.cf_user_story != "" %]
    <div id="user_story_readonly" class="bz_comment">
      <pre id="user-story" class="bz_comment_text">
        [%- bug.cf_user_story FILTER quoteUrls(bug) -%]
      </pre>
    </div>
  [% ELSE %]
    <br id="user_story_readonly">
  [% END %]

  [% IF can_edit_story %]
    <div id="user_story_edit_container" class="bz_default_hidden">
      [% INCLUDE global/textarea.html.tmpl
                name    = 'cf_user_story'
                id      = 'user_story'
                minrows = 10
                maxrows = 10
                cols    = constants.COMMENT_COLS
                defaultcontent = bug.cf_user_story %]
    </div>
    <script type="text/javascript">
      YAHOO.util.Event.addListener('user_story_edit_action', 'click', function() {
        YAHOO.util.Dom.addClass('user_story_edit', 'bz_default_hidden');
        YAHOO.util.Dom.addClass('user_story_readonly', 'bz_default_hidden');
        YAHOO.util.Dom.removeClass('user_story_edit_container', 'bz_default_hidden');
        YAHOO.util.Dom.get('user_story').focus();
      });
    </script>
  [% END %]
</div>