<commit_before><!--
  ~ Copyright (c) 2014 Hewlett-Packard Development Company, L.P.
  ~
  ~ Licensed under the Apache License, Version 2.0 (the "License"); you may
  ~ not use this file except in compliance with the License. You may obtain
  ~ a copy of the License at
  ~
  ~         http://www.apache.org/licenses/LICENSE-2.0
  ~
  ~ Unless required by applicable law or agreed to in writing, software
  ~ distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
  ~ WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
  ~ License for the specific language governing permissions and limitations
  ~ under the License.
  -->

<div class="container" ng-controller="StoryDetailController">
    <div class="row">
        <div class="col-xs-12">
            <div ng-include
                 src="'/inline/story_detail.html'"
                 ng-hide="showEditForm">
            </div>
            <div ng-include
                 src="'/inline/story_detail_form.html'"
                 ng-show="showEditForm">
            </div>
            <div ng-include src="'/inline/task_list.html'"></div>
            <hr/>
            <div ng-include src="'/inline/discussion.html'"></div>
        </div>
    </div>
</div>


<!-- Template for the header and description -->
<script type="text/ng-template" id="/inline/story_detail.html">
    <h1>

        <span ng-show="story.title">
            {{story.title}}
        </span>
        <em ng-hide="story.title" class="text-muted">
            No title
        </em>
        <small ng-show="isLoggedIn">
            <a href="" ng-click="toggleEditMode()" >
                <i class="fa fa-pencil"></i>
            </a>
        </small>
    </h1>
    <p><strong>Author:</strong>
        <em ng-show="!story.creator_id" class="text-muted">
            None
        </em>
        <span ng-show="story.creator_id && !creator.$resolved">
            <i class="fa fa-refresh fa-spin"></i>
        </span>
        <span ng-show="creator.full_name">
            {{creator.full_name}}
        </span>
        <br/>
        <strong>Last updated:</strong>
        <span time-moment eventdate="story.created_at"  ng-if="!story.updated_at"></span>
        <span time-moment eventdate="story.updated_at" ng-if="story.updated_at"></span>
        <em ng-hide="story.updated_at || story.created_at" class="text-muted">
            Never
        </em>
    </p>
    <p>
        <span ng-show="story.description"
              class="honor-carriage-return">{{story.description}}
        </span>
        <em ng-hide="story.description" class="text-muted">
            No description provided
        </em>
    </p>
</script>


<!-- Template for the header and description -->
<script type="text/ng-template" id="/inline/story_detail_form.html">
    <form name="storyForm">
        <div class="form-group">
            <textarea type="text"
                      class="form-control context-edit h1"
                      ng-model="story.title"
                      required
                      ng-disabled="isUpdating"
                      placeholder="Story Title">
            </textarea>
        </div>
        <div class="form-group">
            <textarea placeholder="Enter a story description here"
                      class="form-control context-edit"
                      msd-elastic
                      rows="3"
                      required
                      ng-disabled="isUpdating"
                      ng-model="story.description">
            </textarea>
        </div>

        <div class="clearfix">
            <div class="pull-right">
                <div class="btn" ng-show="isUpdating">
                    <i class="fa fa-spinner fa-lg fa-spin"></i>
                </div>
                <button type="button"
                        class="btn btn-primary"
                        ng-click="update()"
                        ng-disabled="!storyForm.$valid">
                    Save
                </button>
                <button type="button"
                        class="btn btn-default"
                        ng-click="cancel()">
                    Cancel
                </button>
            </div>
            <button type="button"
                    class="btn btn-link"
                    ng-click="remove()">
                Remove this story
            </button>
        </div>
    </form>
</script>


<!-- Template for the task list -->
<script type="text/ng-template" id="/inline/task_list.html">
    <table class="table table-striped"
           ng-controller="StoryTaskListController">
        <thead>
        <tr>
            <td colspan="3"><strong>Tasks</strong></td>
            <td colspan="3" class="text-right">
                <small>
                    <a href=""
                       ng-click="showAddTaskForm = !showAddTaskForm"
                       ng-show="isLoggedIn">
                        <i class="fa fa-plus" ng-if="!showAddTaskForm"></i>
                        <i class="fa fa-minus" ng-if="showAddTaskForm"></i>
                        Add task
                    </a>
                </small>
            </td>
        </tr>
        </thead>
        <tbody>
        <tr ng-repeat="task in tasks"
            ng-include
            src="'/inline/task_list_item.html'"
            ng-controller="StoryTaskListItemController">
        </tr>
        <tr ng-show="tasks.length == 0 && !showAddTaskForm">
            <td colspan="6">
                <p class="text-muted text-center">
                    <em>This story has no tasks.</em>
                </p>
            </td>
        </tr>
        </tbody>
        <tfoot ng-show="showAddTaskForm">
        <tr>
            <td></td>
            <td colspan="3">
                <task-edit-form
                        task="newTask"
                        button-label="Add Task"
                        on-button-click="addTask()"
                        />
            </td>
            <td colspan="2"></td>
        </tr>
        </tfoot>

    </table>
</script>


<!-- Template for the task list -->
<script type="text/ng-template" id="/inline/discussion.html">
    <div ng-controller="StoryDiscussionController">
        <h4>Events timeline
            <a href ng-click="updateFilter()"><i class="fa fa-gear"></i></a>
        </h4>
        <div class="discussion">
            <div class="alert alert-warning"
                 ng-show="comments.length == 0">
                The discussion hasn't started yet
            </div>
            <div ng-repeat="event in events"
                 ng-controller="StoryDiscussionItemController">
                <timeline-event tl_event={{event}} />
            </div>

            <form class="discussion-comment-form comment"
                  id="commentForm"
                  name="commentForm"
                  ng-show="isLoggedIn">
                <div class="form-group">
                    <textarea id="comment"
                              placeholder="Enter your comment here"
                              class="form-control"
                              msd-elastic
                              rows="3"
                              required
                              ng-disabled="isSavingComment"
                              ng-shift-enter="addComment()"
                              ng-model="newComment.content">
                    </textarea>
                </div>
                <div class="form-group clearfix">
                    <button type="button"
                            class="btn btn-primary pull-right"
                            ng-click="addComment()"
                            ng-disabled="!commentForm.$valid || isSavingComment">
                        Comment
                    </button>
                </div>
            </form>
        </div>
    </div>
</script>

<!-- Template for an item in the task list -->
<script type="text/ng-template" id="/inline/task_list_item.html">
    <td ng-show="isLoggedIn">
        <a href=""
           ng-click="showTaskEditForm = true"
           ng-hide="showTaskEditForm">
            <i class="fa fa-caret-right fa-lg"></i>
        </a>
        <a href=""
           ng-click="showTaskEditForm = false"
           ng-show="showTaskEditForm">
            <i class="fa fa-caret-down fa-lg"></i>
        </a>
    </td>
    <td ng-hide="showTaskEditForm">
        <a href=""
           ng-show="isLoggedIn"
           ng-click="showTaskEditForm = true">
            {{task.title}}
        </a>
        <span ng-hide="isLoggedIn">
            {{task.title}}
        </span>
    </td>
    <td ng-hide="showTaskEditForm">
        <a href=""
           ng-click="showTaskEditForm = true"
           ng-show="isLoggedIn">
            <span ng-show="project">
                {{project.name}}
            </span>
            <em class="text-muted" ng-hide="project">
                Project not found
            </em>
        </a>
        <span ng-hide="isLoggedIn">
            <span ng-show="project">
                {{project.name}}
            </span>
            <em class="text-muted" ng-hide="project">
                Project not found
            </em>
        </span>
    </td>
    <td ng-hide="showTaskEditForm">
        <span ng-show="assignee">
            {{assignee.full_name}}
        </span>
        <em class="text-muted" ng-hide="assignee">
            Not assigned
        </em>
    </td>
    <td ng-show="showTaskEditForm"
        colspan="3">
        <task-edit-form
                task="task"
                on-button-click="updateTask()"
                button-label="Update"
                />
    </td>
    <td class="text-right">
        <task-priority-dropdown
                editable="{{isLoggedIn}}"
                on-change="updatePriority(priority)"
                priority="{{task.priority}}"
                />
    </td>
    <td class="text-right">
        <task-status-dropdown
                editable="{{isLoggedIn}}"
                on-change="updateStatus(status)"
                status="{{task.status}}"
                />
    </td>
    <td class="text-right">
        <a ng-show="isLoggedIn"
           ng-click="removeTask()">
            <i class="fa fa-times fa-lg"></i>
        </a>
    </td>
</script>

<!-- Template for story metadata -->
<script type="text/ng-template" id="/inline/metadata.html">

</script>
<commit_msg>Only show remove story button for admin users<commit_after><!--
  ~ Copyright (c) 2014 Hewlett-Packard Development Company, L.P.
  ~
  ~ Licensed under the Apache License, Version 2.0 (the "License"); you may
  ~ not use this file except in compliance with the License. You may obtain
  ~ a copy of the License at
  ~
  ~         http://www.apache.org/licenses/LICENSE-2.0
  ~
  ~ Unless required by applicable law or agreed to in writing, software
  ~ distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
  ~ WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
  ~ License for the specific language governing permissions and limitations
  ~ under the License.
  -->

<div class="container" ng-controller="StoryDetailController">
    <div class="row">
        <div class="col-xs-12">
            <div ng-include
                 src="'/inline/story_detail.html'"
                 ng-hide="showEditForm">
            </div>
            <div ng-include
                 src="'/inline/story_detail_form.html'"
                 ng-show="showEditForm">
            </div>
            <div ng-include src="'/inline/task_list.html'"></div>
            <hr/>
            <div ng-include src="'/inline/discussion.html'"></div>
        </div>
    </div>
</div>


<!-- Template for the header and description -->
<script type="text/ng-template" id="/inline/story_detail.html">
    <h1>

        <span ng-show="story.title">
            {{story.title}}
        </span>
        <em ng-hide="story.title" class="text-muted">
            No title
        </em>
        <small ng-show="isLoggedIn">
            <a href="" ng-click="toggleEditMode()" >
                <i class="fa fa-pencil"></i>
            </a>
        </small>
    </h1>
    <p><strong>Author:</strong>
        <em ng-show="!story.creator_id" class="text-muted">
            None
        </em>
        <span ng-show="story.creator_id && !creator.$resolved">
            <i class="fa fa-refresh fa-spin"></i>
        </span>
        <span ng-show="creator.full_name">
            {{creator.full_name}}
        </span>
        <br/>
        <strong>Last updated:</strong>
        <span time-moment eventdate="story.created_at"  ng-if="!story.updated_at"></span>
        <span time-moment eventdate="story.updated_at" ng-if="story.updated_at"></span>
        <em ng-hide="story.updated_at || story.created_at" class="text-muted">
            Never
        </em>
    </p>
    <p>
        <span ng-show="story.description"
              class="honor-carriage-return">{{story.description}}
        </span>
        <em ng-hide="story.description" class="text-muted">
            No description provided
        </em>
    </p>
</script>


<!-- Template for the header and description -->
<script type="text/ng-template" id="/inline/story_detail_form.html">
    <form name="storyForm">
        <div class="form-group">
            <textarea type="text"
                      class="form-control context-edit h1"
                      ng-model="story.title"
                      required
                      ng-disabled="isUpdating"
                      placeholder="Story Title">
            </textarea>
        </div>
        <div class="form-group">
            <textarea placeholder="Enter a story description here"
                      class="form-control context-edit"
                      msd-elastic
                      rows="3"
                      required
                      ng-disabled="isUpdating"
                      ng-model="story.description">
            </textarea>
        </div>

        <div class="clearfix">
            <div class="pull-right">
                <div class="btn" ng-show="isUpdating">
                    <i class="fa fa-spinner fa-lg fa-spin"></i>
                </div>
                <button type="button"
                        class="btn btn-primary"
                        ng-click="update()"
                        ng-disabled="!storyForm.$valid">
                    Save
                </button>
                <button type="button"
                        class="btn btn-default"
                        ng-click="cancel()">
                    Cancel
                </button>
            </div>
            <button type="button"
                    class="btn btn-link"
                    ng-click="remove()" permission="is_superuser">
                Remove this story
            </button>
        </div>
    </form>
</script>


<!-- Template for the task list -->
<script type="text/ng-template" id="/inline/task_list.html">
    <table class="table table-striped"
           ng-controller="StoryTaskListController">
        <thead>
        <tr>
            <td colspan="3"><strong>Tasks</strong></td>
            <td colspan="3" class="text-right">
                <small>
                    <a href=""
                       ng-click="showAddTaskForm = !showAddTaskForm"
                       ng-show="isLoggedIn">
                        <i class="fa fa-plus" ng-if="!showAddTaskForm"></i>
                        <i class="fa fa-minus" ng-if="showAddTaskForm"></i>
                        Add task
                    </a>
                </small>
            </td>
        </tr>
        </thead>
        <tbody>
        <tr ng-repeat="task in tasks"
            ng-include
            src="'/inline/task_list_item.html'"
            ng-controller="StoryTaskListItemController">
        </tr>
        <tr ng-show="tasks.length == 0 && !showAddTaskForm">
            <td colspan="6">
                <p class="text-muted text-center">
                    <em>This story has no tasks.</em>
                </p>
            </td>
        </tr>
        </tbody>
        <tfoot ng-show="showAddTaskForm">
        <tr>
            <td></td>
            <td colspan="3">
                <task-edit-form
                        task="newTask"
                        button-label="Add Task"
                        on-button-click="addTask()"
                        />
            </td>
            <td colspan="2"></td>
        </tr>
        </tfoot>

    </table>
</script>


<!-- Template for the task list -->
<script type="text/ng-template" id="/inline/discussion.html">
    <div ng-controller="StoryDiscussionController">
        <h4>Events timeline
            <a href ng-click="updateFilter()"><i class="fa fa-gear"></i></a>
        </h4>
        <div class="discussion">
            <div class="alert alert-warning"
                 ng-show="comments.length == 0">
                The discussion hasn't started yet
            </div>
            <div ng-repeat="event in events"
                 ng-controller="StoryDiscussionItemController">
                <timeline-event tl_event={{event}} />
            </div>

            <form class="discussion-comment-form comment"
                  id="commentForm"
                  name="commentForm"
                  ng-show="isLoggedIn">
                <div class="form-group">
                    <textarea id="comment"
                              placeholder="Enter your comment here"
                              class="form-control"
                              msd-elastic
                              rows="3"
                              required
                              ng-disabled="isSavingComment"
                              ng-shift-enter="addComment()"
                              ng-model="newComment.content">
                    </textarea>
                </div>
                <div class="form-group clearfix">
                    <button type="button"
                            class="btn btn-primary pull-right"
                            ng-click="addComment()"
                            ng-disabled="!commentForm.$valid || isSavingComment">
                        Comment
                    </button>
                </div>
            </form>
        </div>
    </div>
</script>

<!-- Template for an item in the task list -->
<script type="text/ng-template" id="/inline/task_list_item.html">
    <td ng-show="isLoggedIn">
        <a href=""
           ng-click="showTaskEditForm = true"
           ng-hide="showTaskEditForm">
            <i class="fa fa-caret-right fa-lg"></i>
        </a>
        <a href=""
           ng-click="showTaskEditForm = false"
           ng-show="showTaskEditForm">
            <i class="fa fa-caret-down fa-lg"></i>
        </a>
    </td>
    <td ng-hide="showTaskEditForm">
        <a href=""
           ng-show="isLoggedIn"
           ng-click="showTaskEditForm = true">
            {{task.title}}
        </a>
        <span ng-hide="isLoggedIn">
            {{task.title}}
        </span>
    </td>
    <td ng-hide="showTaskEditForm">
        <a href=""
           ng-click="showTaskEditForm = true"
           ng-show="isLoggedIn">
            <span ng-show="project">
                {{project.name}}
            </span>
            <em class="text-muted" ng-hide="project">
                Project not found
            </em>
        </a>
        <span ng-hide="isLoggedIn">
            <span ng-show="project">
                {{project.name}}
            </span>
            <em class="text-muted" ng-hide="project">
                Project not found
            </em>
        </span>
    </td>
    <td ng-hide="showTaskEditForm">
        <span ng-show="assignee">
            {{assignee.full_name}}
        </span>
        <em class="text-muted" ng-hide="assignee">
            Not assigned
        </em>
    </td>
    <td ng-show="showTaskEditForm"
        colspan="3">
        <task-edit-form
                task="task"
                on-button-click="updateTask()"
                button-label="Update"
                />
    </td>
    <td class="text-right">
        <task-priority-dropdown
                editable="{{isLoggedIn}}"
                on-change="updatePriority(priority)"
                priority="{{task.priority}}"
                />
    </td>
    <td class="text-right">
        <task-status-dropdown
                editable="{{isLoggedIn}}"
                on-change="updateStatus(status)"
                status="{{task.status}}"
                />
    </td>
    <td class="text-right">
        <a ng-show="isLoggedIn"
           ng-click="removeTask()">
            <i class="fa fa-times fa-lg"></i>
        </a>
    </td>
</script>

<!-- Template for story metadata -->
<script type="text/ng-template" id="/inline/metadata.html">

</script>

{'fraction_non_alphanumeric': 0.1402929350947731, 'fraction_numerical': 0.0023932605782117557, 'mean_word_length': 1.3557334536024355, 'pattern_counts': {'":': 0, '<': 435, '<?xml version=': 0, '>': 435, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2998968', 'n_tokens_mistral': 5841, 'n_tokens_neox': 5562, 'n_words': 1166}