Blame pagure/templates/new_issue.html

Pierre-Yves Chibon 508fa0
{% extends "repo_master.html" %}
Ryan Lerch f6b451
{% from "_formhelper.html" import render_bootstrap_field %}
Ryan Lerch 441f54
Pierre-Yves Chibon b2cfe2
{% block title %}{% if not type or type == 'new'
Pierre-Yves Chibon b2cfe2
    %}New issue{% elif type and type == 'edit'
Pierre-Yves Chibon ff8880
    %}Edit issue #{{ issueid }} {% endif %} - {{
Pierre-Yves Chibon ff8880
    repo.namespace + '/' if repo.namespace }}{{ repo.name }}{% endblock %}
Ryan Lerch f4adb4
{% set tag = "home" %}
Pierre-Yves Chibon 508fa0
Clement Verna 817f05
{% block header %}
Shengjing Zhu 2295bf
Clement Verna 817f05
  rel="stylesheet" />
Shengjing Zhu 2295bf
Abhijeet Kasurde 299ee2
  rel="stylesheet" />
Pierre-Yves Chibon 9ee3a0
Pierre-Yves Chibon 9ee3a0
  rel="stylesheet" />
Clement Verna 817f05
{% endblock %}
Clement Verna 817f05
Pierre-Yves Chibon 508fa0
Pierre-Yves Chibon 508fa0
{% block repo %}
Pierre-Yves Chibon 9ee3a0
  {% if not type or type == 'new' %}
Pierre-Yves Chibon b130e5
  
Pierre-Yves Chibon 9ee3a0
        repo=repo.name,
Pierre-Yves Chibon 9ee3a0
        username=username,
Pierre-Yves Chibon 9ee3a0
        namespace=repo.namespace)
Pierre-Yves Chibon 9ee3a0
    }}" method="post" enctype="multipart/form-data">
Pierre-Yves Chibon 9ee3a0
Pierre-Yves Chibon 9ee3a0
  {% elif type and type == 'edit' %}
Pierre-Yves Chibon b130e5
  
Pierre-Yves Chibon 9ee3a0
        repo=repo.name,
Pierre-Yves Chibon 9ee3a0
        username=username,
Pierre-Yves Chibon 9ee3a0
        namespace=repo.namespace,
Pierre-Yves Chibon 9ee3a0
        issueid=issueid) }}" method="post"
Pierre-Yves Chibon 9ee3a0
        enctype="multipart/form-data">
Pierre-Yves Chibon 9ee3a0
  {% endif %}
Ryan Lerch 7230c1
  {{form.csrf_token}}
Ryan Lerch eef090
  
Ryan Lerch 7230c1
  {% if (g.repo_user and not type) or (g.repo_user and type == 'new') %}
Ryan Lerch 7230c1
  
Ryan Lerch 7230c1
    

New Issue

Ryan Lerch 7230c1
  
Pierre-Yves Chibon 9ee3a0
  
Ryan Lerch 7230c1
  {% else %}
Ryan Lerch 7230c1
  
Ryan Lerch 7230c1
      {% if not type or type == 'new' %}
Ryan Lerch 7230c1
      

New Issue

Ryan Lerch 7230c1
      {% elif type and type == 'edit' %}
Ryan Lerch 7230c1
      

Edit Issue

Ryan Lerch 7230c1
      {% endif %}
Ryan Lerch 7230c1
  {% endif %}
Ryan Lerch 7230c1
    
farhaanbukhsh c74b66
        {% if type == 'edit' %}
Ryan Lerch 7230c1
          {{ form.status(class_="hidden") }}
Ryan Lerch 7230c1
          
Ryan Lerch 7230c1
            

Ryan Lerch 7230c1
            

#{{issue.id}}

farhaanbukhsh c74b66
        {% endif %}
Ryan Lerch 7230c1
        {{ form.title(class_="form-control", placeholder="Issue Title", required="required")|safe }}
Ryan Lerch 7230c1
        {% if form.title.errors %}
Ryan Lerch 7230c1
        
Ryan Lerch 7230c1
          <small></small>
Ryan Lerch 7230c1
          {% for error in form.title.errors %}
Ryan Lerch 7230c1
            {{ error }} 
Ryan Lerch 7230c1
          {% endfor %}
Ryan Lerch 7230c1
          
Ryan Lerch 7230c1
        
Ryan Lerch 7230c1
        {% endif %}
Ryan Lerch 7230c1
        {% if type == 'edit' %}
Pierre-Yves Chibon 324a0b
          
Pierre-Yves Chibon 324a0b
        {% endif %}
Ryan Lerch 441f54
Ryan Lerch 7230c1
        
Ryan Lerch 7230c1
            
Ryan Lerch 7230c1
              
Ryan Lerch 7230c1
                
Ryan Lerch 7230c1
                
Ryan Lerch 7230c1
                
Ryan Lerch 7230c1
                    {% if types %}
Ryan Lerch 7230c1
                    {% if (types | length == 1 and not default) or (types | length > 1)%}
Ryan Lerch 7230c1
                    
Ryan Lerch 7230c1
                        <button aria-expanded="false" class="btn btn-outline-secondary border-0 dropdown-toggle qr-btn" data-toggle="dropdown" title="Issue Templates" type="button"></button>
Ryan Lerch 7230c1
                           
Ryan Lerch 7230c1
                        
Ryan Lerch 7230c1
                        
Ryan Lerch 7230c1
                            
Ryan Lerch 7230c1
                            {% for type in types %}
Ryan Lerch 7230c1
                            {{type}}
Ryan Lerch 7230c1
                          {% endfor %}
Ryan Lerch 7230c1
                          
Ryan Lerch 7230c1
                        
Ryan Lerch 7230c1
                      
Ryan Lerch 7230c1
                      {% else %}
Ryan Lerch 7230c1
                        {% set notemplates = True %}
Ryan Lerch 7230c1
                      {% endif %}
Ryan Lerch 7230c1
                      {% else %}
Ryan Lerch 7230c1
                        {% set notemplates = True %}
Ryan Lerch 7230c1
                      {% endif %}
Ryan Lerch 7230c1
                        
    Ryan Lerch 7230c1
                              
  • Ryan Lerch 7230c1
                                Preview
    Ryan Lerch 7230c1
                              
    Ryan Lerch 7230c1
                              
  • Ryan Lerch 7230c1
                                Edit
    Ryan Lerch 7230c1
                              
    Ryan Lerch 7230c1
                            
    Ryan Lerch 441f54
    Ryan Lerch 7230c1
                      
    Ryan Lerch 7230c1
                  
    Ryan Lerch 7230c1
                
    Ryan Lerch 7230c1
                
    Ryan Lerch 7230c1
                          
    Ryan Lerch 7230c1
                          placeholder="Enter your comment here" tabindex=1 required>
    Ryan Lerch 7230c1
                          {%- if issue %}{{ issue.content }}{%
    Ryan Lerch 7230c1
                            elif form.issue_content.data %}{{ form.issue_content.data }}{%
    Ryan Lerch 7230c1
                            elif default %}{{ default }}{%
    Ryan Lerch 7230c1
                        endif -%}
    Ryan Lerch 7230c1
                        
    Ryan Lerch 7230c1
                        {% if form.issue_content.errors %}
    Ryan Lerch 7230c1
                        
    Ryan Lerch 7230c1
                          <small></small>
    Ryan Lerch 7230c1
                          {% for error in form.issue_content.errors %}
    Ryan Lerch 7230c1
                            {{ error }} 
    Ryan Lerch 7230c1
                          {% endfor %}
    Ryan Lerch 7230c1
                          
    Ryan Lerch 7230c1
                        
    Ryan Lerch 7230c1
                        {% endif %}
    Ryan Lerch 7230c1
                          
    Ryan Lerch 7230c1
                          
    Ryan Lerch 7230c1
                          
    Ryan Lerch 7230c1
                              <label class="custom-file comment-upload-browse font-size-09"></label>
    Ryan Lerch 7230c1
                                  <input accept="image/*" class="custom-file-input" id="file-picker" multiple="" name="file" tabindex="3" type="file">
    Ryan Lerch 7230c1
                                  
    Ryan Lerch 7230c1
                                    Browse to attach images or drag them into the comment field
    Ryan Lerch 7230c1
                                  
    Ryan Lerch 7230c1
                              
    Ryan Lerch 7230c1
                              
    Ryan Lerch 7230c1
                                
    0%
    Ryan Lerch 7230c1
                              
    Ryan Lerch 7230c1
                          
    Ryan Lerch 7230c1
                  
    Ryan Lerch 7230c1
                  
    Ryan Lerch 7230c1
                    
    Ryan Lerch 7230c1
                      <small>Comments use </small>
    Ryan Lerch 7230c1
                         target="_blank" rel="noopener noreferrer" class="notblue">Markdown Syntax
    Ryan Lerch 7230c1
                      
    Ryan Lerch 7230c1
                              {{ form.private(class_="form-check-input") }}
    Ryan Lerch 7230c1
                              <label class="form-check-label pl-2" for="private">Private</label>
    Ryan Lerch 7230c1
                      
    Ryan Lerch 7230c1
                      
    Ryan Lerch 7230c1
                        
    Ryan Lerch 7230c1
                          {% if not type or type == 'new' %}
    Ryan Lerch 7230c1
                          <input class="btn btn-primary" type="submit" value="Create Issue">
    Ryan Lerch 7230c1
                          {% elif type and type == 'edit' %}
    Ryan Lerch 7230c1
                          <input class="btn btn-primary" type="submit" value="Update Issue #{{issue.id}}">
    Ryan Lerch 7230c1
                          {% endif %}
    Ryan Lerch 7230c1
                        
    Ryan Lerch 7230c1
                      
    Ryan Lerch 7230c1
                    
    Ryan Lerch 7230c1
                  
    Ryan Lerch 7230c1
            
    Pierre-Yves Chibon b306a0
          
    Pierre-Yves Chibon 9ee3a0
      
    Pierre-Yves Chibon 9ee3a0
    Pierre-Yves Chibon 9ee3a0
      {% if g.repo_user and not type or type == 'new' %}
    Pierre-Yves Chibon 9ee3a0
      
    Ryan Lerch 7230c1
        
    Ryan Lerch 7230c1
            
    Ryan Lerch 7230c1
              
    Metadata
    Ryan Lerch 7230c1
            
    Ryan Lerch 7230c1
    Ryan Lerch 7230c1
            <fieldset class="form-group"></fieldset>
    Ryan Lerch 7230c1
                <label class="mb-1 pl-1 text-semimuted">  Assignee</label>
    Ryan Lerch 7230c1
                
    Ryan Lerch 7230c1
                  placeholder="username"
    Ryan Lerch 7230c1
                  value="{{ request.form.assignee or '' }}" />
    Ryan Lerch 7230c1
            
    Pierre-Yves Chibon 9ee3a0
    Pierre-Yves Chibon 9ee3a0
            <fieldset class="form-group"></fieldset>
    Ryan Lerch 7230c1
               <label class="mb-1 pl-1 text-semimuted">  Tags</label>
    Pierre-Yves Chibon 9ee3a0
               
    Pierre-Yves Chibon 9ee3a0
                  placeholder="tag1, tag2" name="tag"
    Pierre-Yves Chibon 9ee3a0
                  title="comma separated list of tags"
    Pierre-Yves Chibon 9ee3a0
                  value="{{ request.form.tags or '' }}" />
    Pierre-Yves Chibon 9ee3a0
            
    Pierre-Yves Chibon 9ee3a0
    Ryan Lerch 7230c1
            {% if repo.priorities %}
    Pierre-Yves Chibon 9ee3a0
            <fieldset class="form-group"></fieldset>
    Ryan Lerch 7230c1
                <label class="mb-1 pl-1 text-semimuted">  Priority</label>
    Ryan Lerch 7230c1
                {{form.priority}}
    Ryan Lerch 7230c1
             
    Ryan Lerch 7230c1
            {% endif %}
    Pierre-Yves Chibon 9ee3a0
    Ryan Lerch 7230c1
            {% if repo.milestones %}
    Ryan Lerch 7230c1
            <fieldset class="form-group"></fieldset>
    Ryan Lerch 7230c1
                <label class="mb-1 pl-1 text-semimuted">  Milestone</label>
    Ryan Lerch 7230c1
                {{form.milestone}}
    Ryan Lerch 7230c1
             
    Ryan Lerch 7230c1
            {% endif %}
    Pierre-Yves Chibon 9ee3a0
        
    Pierre-Yves Chibon 9ee3a0
      
    Pierre-Yves Chibon 9ee3a0
      {% endif %}
    Ryan Lerch eef090
      
    Pierre-Yves Chibon 9ee3a0
      
    Pierre-Yves Chibon 508fa0
    {% endblock %}
    Pierre-Yves Chibon b306a0
    Pierre-Yves Chibon b306a0
    {% block jscripts %}
    Pierre-Yves Chibon b306a0
    {{ super() }}
    Clement Verna 817f05
    Shengjing Zhu 2295bf
        src="{{ url_for('static', filename='vendor/jquery.textcomplete/jquery.textcomplete.min.js') }}">
    Clement Verna 817f05
    Clement Verna 817f05
    Shengjing Zhu 2295bf
        src="{{ url_for('static', filename='vendor/emojione/emojione.min.js') }}">
    Clement Verna 817f05
    Ryan Lerch 4a7143
    Ryan Lerch 4a7143
        src="{{ url_for('static', filename='emoji/emojicomplete.js') }}">
    Ryan Lerch 4a7143
    Abhijeet Kasurde 299ee2
    Shengjing Zhu 2295bf
        src="{{ url_for('static', filename='vendor/jquery.caret/jquery.caret.min.js') }}">
    Abhijeet Kasurde 299ee2
    Abhijeet Kasurde 299ee2
    Shengjing Zhu 2295bf
        src="{{ url_for('static', filename='vendor/jquery.atwho/jquery.atwho.min.js') }}">
    Abhijeet Kasurde 299ee2
    Pierre-Yves Chibon 9ee3a0
    Pierre-Yves Chibon 9ee3a0
        src="{{ url_for('static', filename='vendor/selectize/selectize.min.js') }}">
    Pierre-Yves Chibon 9ee3a0
    Abhijeet Kasurde 299ee2
    Pierre-Yves Chibon b306a0
    <script type="text/javascript"></script>
    Pierre-Yves Chibon b130e5
    {% if g.authenticated and form %}
    Pierre-Yves Chibon 334310
    $(document).ready(function() {
    Pierre-Yves Chibon 334310
      // Set up the handler for the file input box.
    Pierre-Yves Chibon c3cda1
      $("#file-picker").on("change", function(evt) {
    Pierre-Yves Chibon c3cda1
        var files = evt.target.files;
    Pierre-Yves Chibon 334310
        //doUpload("{{ form.csrf_token.current_token }}", this.files);
    Ryan Lerch 441f54
        var _txt = $("#issue_content").val();
    Pierre-Yves Chibon 334310
        if (_txt) {
    Pierre-Yves Chibon 334310
          _txt += '\n';
    Pierre-Yves Chibon 334310
        }
    Pierre-Yves Chibon c3cda1
        $("#issue_content").val(_txt + '\n'.repeat(files.length));
    Pierre-Yves Chibon 334310
      });
    Clement Verna 817f05
    Abhijeet Kasurde 299ee2
      // List username in @ drop-down
    Abhijeet Kasurde 299ee2
      $.get("{{ url_for('api_ns.api_users') }}", {
    Abhijeet Kasurde 299ee2
        pattern: '*'
    Abhijeet Kasurde 299ee2
      }).done(function(resp) {
    Abhijeet Kasurde 299ee2
        var userConfig = {
    Abhijeet Kasurde 299ee2
          at: '@',
    Abhijeet Kasurde 299ee2
          data: resp['mention'],
    Abhijeet Kasurde 299ee2
          insertTpl: '@${username}',
    Abhijeet Kasurde 299ee2
          displayTpl: "
  • ${username} <small>${name}</small>
  • ",
    Abhijeet Kasurde 299ee2
          searchKey: "username"
    Abhijeet Kasurde 299ee2
        }
    Abhijeet Kasurde 299ee2
        $("#issue_content").atwho(userConfig);
    Abhijeet Kasurde 299ee2
      });
    Abhijeet Kasurde 299ee2
    Clement Verna 817f05
      var emojiStrategy;
    Clement Verna 817f05
      $.getJSON(
    Shengjing Zhu 2295bf
        '{{ url_for("static", filename="vendor/emojione/emoji_strategy.json") }}',
    Clement Verna 817f05
        function( data ) {
    Clement Verna 817f05
          emojiStrategy =  data;
    Clement Verna 817f05
        }
    Clement Verna 817f05
      );
    Clement Verna 817f05
    Clement Verna 817f05
      var folder = '{{url_for("static", filename="emoji/png/") }}';
    Shengjing Zhu 2295bf
      var json_url = '{{ url_for("static", filename="vendor/emojione/emoji_strategy.json") }}';
    Clement Verna 817f05
      emoji_complete(json_url, folder);
    Clement Verna 817f05
    Ryan Lerch 7230c1
      $(".issue-template").on("click", function() {
    Pierre-Yves Chibon 79367e
        if ( !confirm('Do you want to load the new template?')){
    Pierre-Yves Chibon 79367e
          return false;
    Pierre-Yves Chibon 79367e
        }
    Pierre-Yves Chibon 79367e
    Pierre-Yves Chibon 79367e
        var _type = $("#type").val();
    Pierre-Yves Chibon 79367e
        var _url = "{{
    Pierre-Yves Chibon 79367e
          url_for('internal_ns.get_ticket_template',
    Pierre-Yves Chibon 08a80b
                  repo=repo.name,
    Pierre-Yves Chibon 79367e
                  username=repo.username if repo.is_fork else None,
    Pierre-Yves Chibon 08a80b
                  namespace=repo.namespace) }}";
    Pierre-Yves Chibon 79367e
        _url += '?template=' + _type;
    Pierre-Yves Chibon 79367e
        $.ajax({
    Pierre-Yves Chibon 79367e
          url: _url ,
    Pierre-Yves Chibon 79367e
          type: 'POST',
    Pierre-Yves Chibon 79367e
          data: {
    Pierre-Yves Chibon bf0132
            csrf_token: "{{ g.confirmationform.csrf_token.current_token }}",
    Pierre-Yves Chibon 79367e
          },
    Pierre-Yves Chibon 79367e
          dataType: 'json',
    Pierre-Yves Chibon 79367e
          success: function(res) {
    Pierre-Yves Chibon 79367e
            $("#issue_content").val(res.message);
    Pierre-Yves Chibon 79367e
          },
    Pierre-Yves Chibon 79367e
          error: function(res) {
    Pierre-Yves Chibon 79367e
            alert('Unable to get this template');
    Pierre-Yves Chibon 79367e
          }
    Pierre-Yves Chibon 79367e
        });
    Pierre-Yves Chibon 79367e
      });
    Pierre-Yves Chibon 79367e
    Pierre-Yves Chibon 9ee3a0
      {% if g.repo_user %}
    Pierre-Yves Chibon 9ee3a0
      var available_tags = [];
    Pierre-Yves Chibon 9ee3a0
      {% for tog in tag_list %}
    Pierre-Yves Chibon 9ee3a0
        available_tags.push("{{ tog.tag }}");
    Pierre-Yves Chibon 9ee3a0
      {% endfor %}
    Pierre-Yves Chibon 9ee3a0
      var items = available_tags.map(function(x) { return { item: x }; });
    Pierre-Yves Chibon 9ee3a0
    Pierre-Yves Chibon 9ee3a0
      $('#tag').selectize({
    Pierre-Yves Chibon 9ee3a0
        delimiter: ',',
    Pierre-Yves Chibon 9ee3a0
        options: items,
    Pierre-Yves Chibon 9ee3a0
        persist: false,
    Pierre-Yves Chibon 9ee3a0
        create: false,
    Pierre-Yves Chibon 9ee3a0
        labelField: "item",
    Pierre-Yves Chibon 9ee3a0
        valueField: "item",
    Pierre-Yves Chibon 9ee3a0
        searchField: ["item"],
    Pierre-Yves Chibon 9ee3a0
      });
    Pierre-Yves Chibon 9ee3a0
    Ryan Lerch eef090
      $("#priority").selectize({
    Ryan Lerch eef090
        create: true
    Ryan Lerch eef090
        });
    Ryan Lerch eef090
      $("#milestone").selectize();
    Pierre-Yves Chibon 9ee3a0
      {% endif %}
    Pierre-Yves Chibon 9ee3a0
    Pierre-Yves Chibon 334310
    });
    Pierre-Yves Chibon 6c8ca2
    Pierre-Yves Chibon 334310
    {% endif %}
    Pierre-Yves Chibon 334310
    Pierre-Yves Chibon b306a0
    $(function() {
    Ryan Lerch 581a9c
      $( "#preview" ).hide();
    Ryan Lerch 7230c1
    Ryan Lerch f6b451
      $( "#previewinmarkdown" ).click(
    Pierre-Yves Chibon b306a0
        function(event, ui) {
    Pierre-Yves Chibon 6c8ca2
            var _text = $( "#issue_content" ).val();
    Pierre-Yves Chibon b130e5
            var _url = "{{ url_for('ui_ns.markdown_preview',
    Pierre-Yves Chibon 08a80b
                            repo=repo.name,
    Pierre-Yves Chibon 0adca7
                            user=repo.user.user if repo.is_fork,
    Pierre-Yves Chibon 08a80b
                            namespace=repo.namespace) | safe}}";
    Pierre-Yves Chibon 6c8ca2
            $.ajax({
    Pierre-Yves Chibon 6c8ca2
              url: _url ,
    Pierre-Yves Chibon 6c8ca2
              type: 'POST',
    Pierre-Yves Chibon 6c8ca2
              data: {
    Pierre-Yves Chibon 6c8ca2
                content: _text,
    Pierre-Yves Chibon bf0132
                csrf_token: "{{ g.confirmationform.csrf_token.current_token }}",
    Pierre-Yves Chibon 6c8ca2
              },
    Pierre-Yves Chibon 6c8ca2
              dataType: 'html',
    Pierre-Yves Chibon 6c8ca2
              success: function(res) {
    Pierre-Yves Chibon 6c8ca2
                var preview = emojione.toImage(res);
    Pierre-Yves Chibon 6c8ca2
                $( "#preview" ).html(preview);
    Ryan Lerch 7230c1
                $( "#previewinmarkdown" ).toggleClass("active");
    Ryan Lerch 7230c1
                $( "#editinmarkdown" ).toggleClass("active");
    Pierre-Yves Chibon 6c8ca2
                $( "#issue_content" ).hide();
    Pierre-Yves Chibon 6c8ca2
                $( "#preview" ).show();
    Pierre-Yves Chibon 6c8ca2
              },
    Pierre-Yves Chibon 6c8ca2
              error: function() {
    Pierre-Yves Chibon 6c8ca2
                alert('Unable to generate preview!'+error);
    Ryan Lerch 441f54
              }
    Pierre-Yves Chibon 6c8ca2
            });
    Pierre-Yves Chibon 6c8ca2
            return false;
    Ryan Lerch 7230c1
        }
    Ryan Lerch 7230c1
      );
    Ryan Lerch 7230c1
    Ryan Lerch 7230c1
      $( "#editinmarkdown" ).click(
    Ryan Lerch 7230c1
        function(event, ui) {
    Ryan Lerch 7230c1
          $( "#editinmarkdown" ).toggleClass("active");
    Ryan Lerch 7230c1
          $( "#previewinmarkdown" ).toggleClass("active");
    Ryan Lerch 7230c1
          $( "#issue_content" ).show();
    Ryan Lerch 7230c1
          $( "#preview" ).hide();
    Pierre-Yves Chibon b306a0
        }
    Pierre-Yves Chibon b306a0
      );
    Pierre-Yves Chibon b306a0
    });
    Pierre-Yves Chibon b306a0
    Pierre-Yves Chibon b306a0
    {% endblock %}