{% extends 'allura:templates/repo/repo_master.html' %}

{% block title %}
  {% if c.app.repo %}
    Repository: {{c.app.repo.name}}
  {% else %}
    Repository
  {% endif %}
{% endblock %}

{% block header %}{{c.app.config.options.mount_label}}
Merge Request #{{req.request_number}}: {{req.summary}} ({{req.status}})
{% endblock %}

{% block content %}

  {{ clone_info(c.app.repo) }}
  <p>
    <a href="{{req.creator_url}}">{{req.creator_name}}</a>
    would like you to merge {{ req.commits | count }} commits
    from <a href="{{req.downstream_url}}">{{req.downstream_url}}</a>
    to {{ req.target_branch }}
  </p>

  <div>{{g.markdown.convert(req.description)}}</div>

  {{ c.log_widget.display(value=req.commits) }}
  <div class="grid-19"><a href="#discussion_holder">Discuss</a></div>

  {% if h.has_access(c.app, 'write')() %}
     <div class="grid-19">To merge the commits, please execute the following commands in your working
       copy: </div>
     <div class="grid-19"><textarea
        style="width:80%; height:60px;"
        readonly
        >{{ c.app.repo.merge_command(req) | safe }}</textarea></div>
    {{ c.mr_dispose_form.display(action="save", value=dict(status=req.status)) }}
     <br style="clear:both">
  {% endif %}

{% endblock %}

{% block after_content %}
  <div id="discussion_holder">
    <h2>Discussion</h2>
    {% set thread=req.discussion_thread %}
    {{c.thread.display(
        value=thread,
        new_post_text="New Comment",
        page=page,
        limit=limit,
        count=count)}}
  </div>
{% endblock %}
