| |
@@ -38,13 +38,31 @@
|
| |
{% if type == 'edit' %}
|
| |
{{ render_bootstrap_field(form.status, field_description="bug status") }}
|
| |
{% endif %}
|
| |
+ {% if types %}
|
| |
+ <fieldset class="form-group ">
|
| |
+ <strong><label for="status">Type</label></strong>
|
| |
+ <select class="form-control c-select" id="type" name="type">
|
| |
+ {% for type in types %}
|
| |
+ <option selected value="{{ type }}">{{ type }}</option>
|
| |
+ {% endfor %}
|
| |
+ </select>
|
| |
+ <div>
|
| |
+ <small class="text-muted">Ticket type</small>
|
| |
+ </div>
|
| |
+ </fieldset>
|
| |
+ {% endif %}
|
| |
{{ render_bootstrap_field(form.private, field_description="Do you want to keep the issue private?") }}
|
| |
<fieldset class="form-group">
|
| |
<label for="issue_content"><strong>Description</strong></label>
|
| |
- <small class="text-muted pull-xs-right"><span class="btn btn-sm btn-secondary inactive" aria-pressed="false" id="previewinmarkdown">Preview</span></small>
|
| |
+ <small class="text-muted pull-xs-right">
|
| |
+ <span class="btn btn-sm btn-secondary inactive"
|
| |
+ aria-pressed="false" id="previewinmarkdown">Preview</span>
|
| |
+ </small>
|
| |
<textarea class="form-control" rows="8" id="issue_content" name="issue_content"
|
| |
placeholder="Describe your issue">
|
| |
- {%- if issue %}{{ issue.content }}{% endif -%}
|
| |
+ {%- if issue %}{{ issue.content }}{%
|
| |
+ elif default %}{{ default }}{%
|
| |
+ endif -%}
|
| |
</textarea>
|
| |
<div>
|
| |
|
| |
@@ -63,7 +81,6 @@
|
| |
</fieldset>
|
| |
Attach file <input id="file-picker" type="file" name="filestream" accept="image/*" multiple>
|
| |
|
| |
-
|
| |
<p class="buttons indent">
|
| |
{% if not type or type == 'new' %}
|
| |
<input type="submit" class="btn btn-primary" value="Create">
|
| |
@@ -72,24 +89,26 @@
|
| |
{% endif %}
|
| |
<input type="button" value="Cancel" class="btn btn-secondary" onclick="history.back();">
|
| |
{{ form.csrf_token }}
|
| |
+ <a href="http://daringfireball.net/projects/markdown/syntax"
|
| |
+ target="_blank">Markdown Syntax</a>
|
| |
</p>
|
| |
</form>
|
| |
</div>
|
| |
</div>
|
| |
|
| |
- {% if authenticated and repo_admin and type and type == 'edit' %}
|
| |
- <form method="post" class="pull-xs-right" action="{{ url_for('.delete_issue',
|
| |
- username=username, repo=repo.name, issueid=issueid) }}">
|
| |
- <button class="btn btn-danger" type="submit"
|
| |
- onclick="return confirm('Are you sure to delete this ticket? \nThis is final and cannot be un-done.');"
|
| |
- title="Delete this ticket">
|
| |
- <span class="icon icon-trash blue"></span>
|
| |
- Delete issue
|
| |
- </button>
|
| |
- {{ form.csrf_token }}
|
| |
- </form>
|
| |
- {% endif %}
|
| |
-
|
| |
+ {% if authenticated and repo_admin and type and type == 'edit' %}
|
| |
+ <form method="post" class="pull-xs-right" action="{{
|
| |
+ url_for('.delete_issue',
|
| |
+ username=username, repo=repo.name, issueid=issueid) }}">
|
| |
+ <button class="btn btn-danger" type="submit"
|
| |
+ onclick="return confirm('Are you sure to delete this ticket? \nThis is final and cannot be un-done.');"
|
| |
+ title="Delete this ticket">
|
| |
+ <span class="icon icon-trash blue"></span>
|
| |
+ Delete issue
|
| |
+ </button>
|
| |
+ {{ form.csrf_token }}
|
| |
+ </form>
|
| |
+ {% endif %}
|
| |
|
| |
</div>
|
| |
</div>
|
| |
@@ -131,43 +150,71 @@
|
| |
var json_url = '{{ url_for("static", filename="emoji/emoji_strategy.json") }}';
|
| |
emoji_complete(json_url, folder);
|
| |
|
| |
+ $("#type").on("change", function() {
|
| |
+ if ( !confirm('Do you want to load the new template?')){
|
| |
+ return false;
|
| |
+ }
|
| |
+
|
| |
+ var _type = $("#type").val();
|
| |
+ var _url = "{{
|
| |
+ url_for('internal_ns.get_ticket_template',
|
| |
+ username=repo.username if repo.is_fork else None,
|
| |
+ repo=repo.name) }}";
|
| |
+ _url += '?template=' + _type;
|
| |
+ $.ajax({
|
| |
+ url: _url ,
|
| |
+ type: 'POST',
|
| |
+ data: {
|
| |
+ csrf_token: "{{ form.csrf_token.current_token }}",
|
| |
+ },
|
| |
+ dataType: 'json',
|
| |
+ success: function(res) {
|
| |
+ $("#issue_content").val(res.message);
|
| |
+ },
|
| |
+ error: function(res) {
|
| |
+ alert('Unable to get this template');
|
| |
+ }
|
| |
+ });
|
| |
+ });
|
| |
+
|
| |
});
|
| |
+
|
| |
{% endif %}
|
| |
|
| |
$(function() {
|
| |
$( "#preview" ).hide();
|
| |
$( "#previewinmarkdown" ).click(
|
| |
function(event, ui) {
|
| |
- if ($( "#previewinmarkdown" ).hasClass("inactive")){
|
| |
- var _text = $( "#issue_content" ).val();
|
| |
- var _url = "{{ url_for('markdown_preview') }}";
|
| |
- $.ajax({
|
| |
- url: _url ,
|
| |
- type: 'POST',
|
| |
- data: {
|
| |
- content: _text,
|
| |
- csrf_token: "{{ form.csrf_token.current_token }}",
|
| |
- },
|
| |
- dataType: 'html',
|
| |
- success: function(res) {
|
| |
- var preview = emojione.toImage(res);
|
| |
- $( "#preview" ).html(preview);
|
| |
- $( "#previewinmarkdown" ).removeClass("inactive");
|
| |
- $( "#previewinmarkdown" ).addClass("active");
|
| |
- $( "#issue_content" ).hide();
|
| |
- $( "#preview" ).show();
|
| |
- },
|
| |
- error: function() {
|
| |
- alert('Unable to generate preview!'+error);
|
| |
- }
|
| |
- });
|
| |
- return false;
|
| |
- } else if ($( "#previewinmarkdown" ).hasClass("active")){
|
| |
- $( "#previewinmarkdown" ).addClass("inactive");
|
| |
- $( "#previewinmarkdown" ).removeClass("active");
|
| |
- $( "#issue_content" ).show();
|
| |
- $( "#preview" ).hide();
|
| |
+ if ($( "#previewinmarkdown" ).hasClass("inactive")){
|
| |
+ var _text = $( "#issue_content" ).val();
|
| |
+ var _url = "{{ url_for('markdown_preview') }}";
|
| |
+ $.ajax({
|
| |
+ url: _url ,
|
| |
+ type: 'POST',
|
| |
+ data: {
|
| |
+ content: _text,
|
| |
+ csrf_token: "{{ form.csrf_token.current_token }}",
|
| |
+ },
|
| |
+ dataType: 'html',
|
| |
+ success: function(res) {
|
| |
+ var preview = emojione.toImage(res);
|
| |
+ $( "#preview" ).html(preview);
|
| |
+ $( "#previewinmarkdown" ).removeClass("inactive");
|
| |
+ $( "#previewinmarkdown" ).addClass("active");
|
| |
+ $( "#issue_content" ).hide();
|
| |
+ $( "#preview" ).show();
|
| |
+ },
|
| |
+ error: function() {
|
| |
+ alert('Unable to generate preview!'+error);
|
| |
}
|
| |
+ });
|
| |
+ return false;
|
| |
+ } else if ($( "#previewinmarkdown" ).hasClass("active")){
|
| |
+ $( "#previewinmarkdown" ).addClass("inactive");
|
| |
+ $( "#previewinmarkdown" ).removeClass("active");
|
| |
+ $( "#issue_content" ).show();
|
| |
+ $( "#preview" ).hide();
|
| |
+ }
|
| |
}
|
| |
);
|
| |
});
|
| |