* Now is more DRY, the JS code and the HTML code are in one place * It works even without JS Signed-off-by: volpino <fox91@anche.no>
		
			
				
	
	
		
			90 lines
		
	
	
		
			2.6 KiB
		
	
	
	
		
			HTML
		
	
	
	
	
	
			
		
		
	
	
			90 lines
		
	
	
		
			2.6 KiB
		
	
	
	
		
			HTML
		
	
	
	
	
	
{% extends "euscan/_datatable.html" %}
 | 
						|
 | 
						|
{% load url from future %}
 | 
						|
{% load sub %}
 | 
						|
{% load euscan_accounts_helpers %}
 | 
						|
 | 
						|
{% block meta %}
 | 
						|
{{ block.super }}
 | 
						|
<link rel="alternate" type="application/atom+xml" title="{{ package }} Feed"
 | 
						|
      href="{% url "package_feed" package.category package.name %}" />
 | 
						|
{% endblock %}
 | 
						|
 | 
						|
{% block menu_feed %}
 | 
						|
{{ block.super }}
 | 
						|
<li>
 | 
						|
  <img src="{{ STATIC_URL }}/img/feed.png" alt="feed" />
 | 
						|
  <a title="{{ package }} Feed" href="{% url "package_feed" package.category package.name %}">
 | 
						|
    {{ package|truncatechars:15 }}
 | 
						|
  </a>
 | 
						|
</li>
 | 
						|
{% endblock %}
 | 
						|
 | 
						|
{% block title %}
 | 
						|
{{ block.super }} - {{ package.category }}/{{ package.name }}
 | 
						|
{% endblock %}
 | 
						|
 | 
						|
{% block content %}
 | 
						|
 | 
						|
<div class="refresh-alert alert {% if not refresh_pos %}hide{% endif %}">
 | 
						|
  <p>A refresh request is in progress, please wait...</p>
 | 
						|
  <p>Queue position: <span id="refresh-pos">{{ refresh_pos }}</span></p>
 | 
						|
</div>
 | 
						|
 | 
						|
<h2>
 | 
						|
  {{ package.category }}/{{ package.name }}
 | 
						|
 | 
						|
  {% if user.is_authenticated %}
 | 
						|
    <div class="pull-right">
 | 
						|
      <form class="refresh-form inline"
 | 
						|
            method="POST"
 | 
						|
            action="{% url "refresh_package" package.category package.name %}">
 | 
						|
        <button class="btn refresh-button {% if refresh_requested %}hide{% endif %}" type="submit">
 | 
						|
          <img src="{{ STATIC_URL}}/img/refresh-active.png" alt="Refresh" />
 | 
						|
        </button>
 | 
						|
        <input type="hidden" name="nojs" value="true" />
 | 
						|
      </form>
 | 
						|
      <button class="btn refresh-button-disabled disabled {% if not refresh_requested %}hide{% endif %}">
 | 
						|
        <img src="{{ STATIC_URL}}/img/refresh-inactive.png" alt="Refresh" />
 | 
						|
      </button>
 | 
						|
 | 
						|
      {% favourite_buttons "package" package.category package.name %}
 | 
						|
    </div>
 | 
						|
  {% endif %}
 | 
						|
</h2>
 | 
						|
 | 
						|
{% include "euscan/_package_details.html" %}
 | 
						|
 | 
						|
<hr/>
 | 
						|
 | 
						|
{% if user.is_authenticated %}
 | 
						|
    <a class="pull-right" href="{% url "problem" package.category package.name %}">
 | 
						|
      <span class="btn bug-button">
 | 
						|
        <img src="{{ STATIC_URL}}/img/bug.png" alt="Report problems" >
 | 
						|
      </span>
 | 
						|
    </a>
 | 
						|
{% endif %}
 | 
						|
 | 
						|
<script type="text/javascript">
 | 
						|
  $(document).ready(function () {
 | 
						|
    $(".refresh-form").submit(function(e) {
 | 
						|
      var url = $(this).attr("action");
 | 
						|
 | 
						|
      e.preventDefault();
 | 
						|
      e.stopPropagation();
 | 
						|
 | 
						|
      $.post(url, function(data) {
 | 
						|
        $(".refresh-button").addClass("hide");
 | 
						|
        $(".refresh-button-disabled").removeClass("hide");
 | 
						|
        $("#refresh-pos").text(data.position);
 | 
						|
        $(".refresh-alert").show("slow");
 | 
						|
      });
 | 
						|
      return false;
 | 
						|
    });
 | 
						|
  });
 | 
						|
</script>
 | 
						|
 | 
						|
<script src="{{ STATIC_URL }}js/favourite.js" type="text/javascript"></script>
 | 
						|
 | 
						|
{% endblock %}
 |