Commit dc58db24 by Őry Máté

one: remove hard coded urls

parent 678568a1
......@@ -401,7 +401,7 @@ class Instance(models.Model):
@models.permalink
def get_absolute_url(self):
return ('vm_show', None, {'iid':self.id})
return ('one.views.vm_show', None, {'iid':self.id})
def get_port(self, use_ipv6=False):
"""Get public port number for default access method."""
......
<!DOCTYPE html>
{% load i18n %}
{% load staticfiles %}
{% get_current_language as lang %}
<html lang="{{lang}}">
<head>
<title>{% block title %}IK Cloud{% endblock %}</title>
<link href="https://fonts.googleapis.com/css?family=Titillium+Web&amp;subset=latin,latin-ext" rel="stylesheet" type="text/css">
<link rel="icon" type="image/png" href="/static/favicon.png" />
<link rel="stylesheet/less" href="/static/style/style.less" />
<link rel="icon" type="image/png" href="{% static "favicon.png" %}" />
<link rel="stylesheet/less" href="{% static "style/style.less" %}" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<script src="/static/script/jquery.min.js"></script>
<script src="{% static "script/jquery.min.js" %}"></script>
<script type="text/javascript" src="{% url django.views.i18n.javascript_catalog %}"></script>
<script type="text/javascript">
window.localStorage.removeItem('https://cloud.ik.bme.hu/static/style/style.less:timestamp');
var current_user={{user.id}};
</script>
<script src="/static/script/less.min.js"></script>
<script src="/static/script/knockout.min.js"></script>
<script type="text/javascript" src="/static/script/util.js"></script>
<script type="text/javascript" src="/static/script/cloud.js"></script>
<script src="{% static "script/less.min.js" %}"></script>
<script src="{% static "script/knockout.min.js" %}"></script>
<script type="text/javascript" src="{% static "script/util.js" %}"></script>
<script type="text/javascript" src="{% static "script/cloud.js" %}"></script>
{{ form.media }}
{% block js %}{% endblock %}
</head>
......@@ -27,24 +28,24 @@
<div id="loginblock"><p>
{% if user.is_authenticated %}
{% trans "Logged in:" %} {{ user.username }}.
<a href="/logout/">{% trans "Logout" %}</a>.
<a href="{% url logout %}">{% trans "Logout" %}</a>.
{% if user.is_staff %}
<a href="/admin/">{% trans "Admin" %}</a>.
<a href="{% url admin:index %}">{% trans "Admin" %}</a>.
{% endif %}
{% else %}
<a href="/login/">{% trans "Login" %}</a>.
<a href="{% url login %}">{% trans "Login" %}</a>.
{% endif %}
{% if lang == 'hu' %}
<a href="/language/en/">In English</a>.
<a href="{% url school.views.language "en" %}">In English</a>.
{% else %}
<a href="/language/hu/">Magyarul</a>.
<a href="{% url school.views.language "hu" %}">Magyarul</a>.
{% endif %}
</p>
</div>
{% endblock %}
{% block header %}
{% block header_title %}
<h1><a href="/">IK Cloud</a></h1>
<h1><a href="{% url one.views.index %}">IK Cloud</a></h1>
{% endblock %}
{% endblock %}
</div>
......
{% extends "box/base/box.html" %}
{% load i18n %}
{% load l10n %}
{% load staticfiles %}
{% get_current_language as LANGUAGE_CODE %}
{% block title %}
......@@ -9,7 +10,7 @@
{% block boxhelp %}
<div class="boxhelp">
<div class="icon">
<img src="/static/icons/information-frame.png" alt="{% trans "Help" %}" />
<img src="{% static "icons/information-frame.png" %}" alt="{% trans "Help" %}" />
</div>
<div class="boxhelp-box">
<p>{% blocktrans %}This is your global data store.{% endblocktrans %}</p>
......@@ -100,7 +101,7 @@
</div>
<div class="details">
<div class="container">
<form style="padding-bottom: 10px" action="/key/add/" method="POST">
<form style="padding-bottom: 10px" action="{% url one.views.key_add %}" method="POST">
{% csrf_token %}
<textarea style="margin-bottom: 5px" name="key" placeholder="{% trans "Public key in OpenSSH format" %}"></textarea><br />
<input type="submit" style="margin-left: 10px;" value="{% trans "Save" %}" />
......@@ -139,7 +140,7 @@
<p id="upload-error-unknown" style="display: none"></p>
</div>
<div style="display: none" class="upload-zone" id="old-upload-form">
<form action="/" method="POST" data-bind="attr: {action: uploadURL}" enctype="multipart/form-data">
<form action="{% url one.views.home %}" method="POST" data-bind="attr: {action: uploadURL}" enctype="multipart/form-data">
<input type="file" name="data" />
<input type="submit" value="Feltöltés" />
</form>
......
{% extends "box/base/entry.html" %}
{% load i18n %}
{% load staticfiles %}
{% get_current_language as LANGUAGE_CODE %}
{% block summary %}
......@@ -8,13 +9,13 @@
<div class="info" data-bind="text: size"></div>
<div class="actions">
<a href="#" data-bind="click: $parent.rename, clickBubble: false">
<img src="/static/icons/pencil.png" alt="{% trans "rename" %}" />
<img src="{% static "icons/pencil.png" %}" alt="{% trans "rename" %}" />
</a>
<a href="#" data-bind="click: $parent.delete, clickBubble: false">
<img src="/static/icons/minus-circle.png" alt="{% trans "remove" %}" />
<img src="{% static "icons/minus-circle.png" %}" alt="{% trans "remove" %}" />
</a>
<a href="#" data-bind="click: $parent.download, clickBubble: false">
<img src="/static/icons/download-cloud.png" alt="{% trans "download" %}" />
<img src="{% static "icons/download-cloud.png" %}" alt="{% trans "download" %}" />
</a>
</div>
<div class="clear"></div>
......
{% extends "box/base/entry.html" %}
{% load i18n %}
{% load staticfiles %}
{% get_current_language as LANGUAGE_CODE %}
{% block content %}
......@@ -15,7 +16,7 @@
</div>
<div class="actions">
<a href="#" class="remove delete-key" data-id="{{key.id}}">
<img src="/static/icons/minus-circle.png" alt="{% trans 'Remove' %}" />
<img src="{% static "icons/minus-circle.png" %}" alt="{% trans 'Remove' %}" />
</a>
</div>
<div class="clear"></div>
......
{% extends "box/base/box.html" %}
{% load i18n %}
{% load l10n %}
{% load staticfiles %}
{% get_current_language as LANGUAGE_CODE %}
{% block title %}
......@@ -10,7 +11,7 @@
{% block boxhelp %}
<div class="boxhelp">
<div class="icon">
<img src="/static/icons/information-frame.png" alt="{% trans "Help" %}" />
<img src="{% static "icons/information-frame.png" %}" alt="{% trans "Help" %}" />
</div>
<div class="boxhelp-box">
<p>{% blocktrans %}This is the list of your own templates.{% endblocktrans %}</p>
......@@ -53,17 +54,17 @@
<div class="summary public-template">
<div class="name">
{{t.name}}
<img src="/static/icons/lock-small.png" alt="{% trans "locked" %}"
<img src="{% static "icons/lock-small.png" %}" alt="{% trans "locked" %}"
title="{% trans "This is a shared template." %}" />
</div>
<div class="status">{{t.state}}</div>
<div class="actions">
{% if t.state == 'READY' %}
<a href="#" class="try-template-button" data-id="{{t.id}}" title="{% trans "Try" %}">
<img src="/static/icons/control.png" alt="{% trans "Start" %}"/>
<img src="{% static "icons/control.png" %}" alt="{% trans "Start" %}"/>
</a>
<a href="#" class="template-share" data-id="{{t.id}}" data-gid="{{group.id}}" title="{% trans "Share" %}">
<img src="/static/icons/user-share.png" alt="{% trans "Share" %}" />
<img src="{% static "icons/user-share.png" %}" alt="{% trans "Share" %}" />
</a>
{% endif %}
</div>
......@@ -75,11 +76,11 @@
<div class="quota">
<div class="used" style="width: {{ i.get_instance_pc|unlocalize }}%"></div>
</div>
<form action="/vm/unshare/{{i.id}}/" method="post">
<form action="{% url one.views.vm_unshare i.id %}" method="post">
<span title="{{i.name}}">{{i.name|truncatechars:20}}</span>
({{i.get_running}}/{{i.instance_limit}}) {{i.type}}
<a href="#" class="edit" data-id="{{i.id}}">
<img src="/static/icons/pencil.png" alt="{% trans "Edit" %}" title="{% trans "Edit" %}" />
<img src="{% static "icons/pencil.png" %}" alt="{% trans "Edit" %}" title="{% trans "Edit" %}" />
</a>
{% csrf_token %}
<input type="submit" class="template-unshare" value="{% trans "Delete" %}" style="float: right"/>
......
{% extends "box/base/summary.html" %}
{% load i18n %}
{% load l10n %}
{% load staticfiles %}
{% get_current_language as LANGUAGE_CODE %}
{% block content %}
......@@ -13,11 +14,11 @@
<div class="quota">
<div class="used" style="width: {{ i.get_instance_pc|unlocalize }}%"></div>
</div>
<form action="/vm/unshare/{{i.id}}/" method="post">
<form action="{% url one.views.vm_unshare i.id %}" method="post">
<span title="{{i.name}}">{{i.name|truncatechars:20}}</span>
({{i.get_running}}/{{i.instance_limit}}) {{i.type}}
<a href="#" class="edit" data-id="{{i.id}}">
<img src="/static/icons/pencil.png" alt="{% trans "Edit" %}" title="{% trans "Edit" %}" />
<img src="{% static "icons/pencil.png" %}" alt="{% trans "Edit" %}" title="{% trans "Edit" %}" />
</a>
{% csrf_token %}
<input class="template-unshare" type="submit" value="{% trans "Delete" %}" style="float: right"/>
......@@ -48,19 +49,19 @@
{% block actions %}
{% if t.state == 'READY' %}
<a href="#" class="try-template" data-id="{{t.id}}" title="{% trans "Try" %}">
<img src="/static/icons/control.png" alt="{% trans "Start" %}"/>
<img src="{% static "icons/control.png" %}" alt="{% trans "Start" %}"/>
</a>
<!--<a href="#" title="{% trans "Edit" %}">
<img src="/static/icons/pencil.png" alt="{% trans "Edit" %}" />
<img src="{% static "icons/pencil.png" %}" alt="{% trans "Edit" %}" />
</a>-->
<a href="#" class="template-share" data-id="{{t.id}}" data-gid="{{group.id}}" title="{% trans "Share" %}">
<img src="/static/icons/user-share.png" alt="{% trans "Share" %}" />
<img src="{% static "icons/user-share.png" %}" alt="{% trans "Share" %}" />
</a>
{% endif %}
<a href="#" class="delete-template" data-id="{{ t.id }}" data-name="{{ t.name }}" title="{% trans "Remove" %}">
<img src="/static/icons/minus-circle.png" alt="{% trans "Remove" %}" />
<img src="{% static "icons/minus-circle.png" %}" alt="{% trans "Remove" %}" />
</a>
<!--<a href="#" class="edit-template" data-id="{{ t.id }}" title="{% trans "Edit" %}">
<img src="/static/icons/pencil.png" alt="{% trans "Edit" %}" />
<img src="{% static "icons/pencil.png" %}" alt="{% trans "Edit" %}" />
</a>-->
{% endblock actions %}
{% extends "box/base/box.html" %}
{% load i18n %}
{% load l10n %}
{% load staticfiles %}
{% get_current_language as LANGUAGE_CODE %}
{% block title %}
......@@ -10,7 +11,7 @@
{% block boxhelp %}
<div class="boxhelp">
<div class="icon">
<img src="/static/icons/information-frame.png" alt="{% trans "Help" %}" />
<img src="{% static "icons/information-frame.png" %}" alt="{% trans "Help" %}" />
</div>
<div class="boxhelp-box">
<p>{% blocktrans %}This is the list of your running virtual machines.{% endblocktrans %}</p>
......@@ -103,7 +104,7 @@
<li>
&nbsp;
<span class="value">
<form method="POST" action="/vm/new/s{{s.pk}}/">
<form method="POST" action="{% url one.views.vm_new share=s.id %}">
{% csrf_token %}
<input {% if s.running_shared >= s.per_user_limit or s.get_running >= s.instance_limit%}disabled="disabled" value="{% trans "Quota reached" %}" {%else%}value="{% trans "Launch" %}"{% endif %} type="submit" />
</form>
......
{% extends "box/base/entry.html" %}
{% load i18n %}
{% load staticfiles %}
{% get_current_language as LANGUAGE_CODE %}
{% block content %}
......@@ -57,7 +58,7 @@
{% trans "time of suspend"|capfirst %}:
<span class="value"> <abbr title="{{vm.time_of_suspend}}">{{vm.time_of_suspend|timeuntil}}</abbr>
<a href="#" class="renew-vm renew-suspend-vm" data-id="{{ vm.id }}" title="{% trans "Renew suspend time" %}">
<img src="/static/icons/control-double.png" alt="{% trans "Renew suspend time" %}" />
<img src="{% static "icons/control-double.png" %}" alt="{% trans "Renew suspend time" %}" />
</a>
</span>
</li>
......@@ -67,7 +68,7 @@
{% trans "time of delete"|capfirst %}:
<span class="value"> <abbr title="{{vm.time_of_delete}}">{{vm.time_of_delete|timeuntil}}</abbr>
<a href="#" class="renew-vm renew-delete-vm" data-id="{{ vm.id }}" title="{% trans "Renew deletion time" %}">
<img src="/static/icons/control-double.png" alt="{% trans "Renew deletion time" %}" />
<img src="{% static "icons/control-double.png" %}" alt="{% trans "Renew deletion time" %}" />
</a>
</span>
</li>
......@@ -75,7 +76,7 @@
<li>
&nbsp;
<span class="value">
<a href="/vm/show/{{vm.id}}/" title="{{vm.name}}">{% trans "More details" %}</a>
<a href="{{ vm.get_absolute_url }}" title="{{vm.name}}">{% trans "More details" %}</a>
</span>
</li>
</ul>
......
{% extends "box/base/summary.html" %}
{% load staticfiles %}
{% load i18n %}
{% get_current_language as LANGUAGE_CODE %}
......@@ -12,7 +13,7 @@
<div class="name {% if vm.state == 'ACTIVE' %}vm-on{% else %}vm-off{% endif %}">
<span id="vm-{{vm.id}}-name">{{vm.name|truncatechars:20}}</span>
<small id="vm-{{vm.id}}-name-details" class="details">
(<a href="/vm/show/{{vm.id}}/" title="{{vm.name}}">{% trans "More details" %}</a>)
(<a href="{{ vm.get_absolute_url }}" title="{{vm.name}}">{% trans "More details" %}</a>)
</small>
</div>
{% endblock %}
......@@ -23,42 +24,42 @@
{% block actions %}
<a href="#" class="rename-vm" data-name="{{ vm.name }}" data-id="{{ vm.id }}" title="{% trans "Edit name" %}">
<img src="/static/icons/pencil.png" alt="{% trans "Edit name" %}" />
<img src="{% static "icons/pencil.png" %}" alt="{% trans "Edit name" %}" />
</a>
{% if vm.waiting %}
<a href="#">
<img src="/static/image/load.gif" />
<img src="{% static "image/load.gif" %}" />
</a>
{% elif vm.state == 'ACTIVE' %}
<a href="{{vm.get_connect_uri}}" data-id="{{ vm.id }}" class="connect-vm" title="{% trans "Connect" %}">
<img src="/static/icons/plug.png" alt="{% trans "Connect" %}" />
<img src="{% static "icons/plug.png" %}" alt="{% trans "Connect" %}" />
</a>
<a href="#" class="stop-vm" data-name="{{ vm.name }}" data-id="{{ vm.id }}" title="{% trans "Pause" %}">
<img src="/static/icons/control-pause.png" alt="{% trans "Pause" %}" />
<img src="{% static "icons/control-pause.png" %}" alt="{% trans "Pause" %}" />
</a>
<a href="#" class="delete-vm" data-name="{{ vm.name }}" data-id="{{ vm.id }}" title="{% trans "Delete" %}">
<img src="/static/icons/minus-circle.png" alt="{% trans "Delete" %}" />
<img src="{% static "icons/minus-circle.png" %}" alt="{% trans "Delete" %}" />
</a>
<a href="#" class="restart-vm" data-name="{{ vm.name }}" data-id="{{ vm.id }}" title="{% trans "Restart" %}">
<img src="/static/icons/arrow-circle-double.png" alt="↺" />
<img src="{% static "icons/arrow-circle-double.png" %}" alt="↺" />
</a>
{% elif vm.state == 'PENDING' %}
<a href="#">
<img src="/static/image/load.gif" />
<img src="{% static "image/load.gif" %}" />
</a>
<a style="float: right" href="#" class="delete-vm" data-name="{{ vm.name }}" data-id="{{ vm.id }}" title="{% trans "Delete" %}">
<img src="/static/icons/minus-circle.png" alt="{% trans "Delete" %}" />
<img src="{% static "icons/minus-circle.png" %}" alt="{% trans "Delete" %}" />
</a>
{% elif vm.state == 'STOPPED' %}
<a href="#" class="resume-vm" data-name="{{ vm.name }}" data-id="{{ vm.id }}" title="{% trans "Resume" %}">
<img src="/static/icons/control.png" alt="{% trans "Resume" %}" />
<img src="{% static "icons/control.png" %}" alt="{% trans "Resume" %}" />
</a>
<a href="#" class="delete-vm" data-name="{{ vm.name }}" data-id="{{ vm.id }}" title="{% trans "Delete" %}">
<img src="/static/icons/minus-circle.png" alt="{% trans "Delete" %}" />
<img src="{% static "icons/minus-circle.png" %}" alt="{% trans "Delete" %}" />
</a>
{% elif vm.state == 'FAILED' %}
<a href="#" class="delete-vm" data-name="{{ vm.name }}" data-id="{{ vm.id }}" title="{% trans "Delete" %}">
<img src="/static/icons/minus-circle.png" alt="{% trans "Delete" %}" />
<img src="{% static "icons/minus-circle.png" %}" alt="{% trans "Delete" %}" />
</a>
{% endif %}
{% endblock actions %}
{% load i18n %}
{% get_current_language as LANGUAGE_CODE %}
<form action="/ajax/shareEdit/{{share.id}}/" method="post" id="template-wizard">
<form action="{% url one.views.ajax_share_edit_wizard share.id %}" method="post" id="template-wizard">
{% csrf_token %}
<div id="new-share" class="wizard">
<h2>
......
{% extends "base.html" %}
{% load i18n %}
{% load staticfiles %}
{% get_current_language as LANGUAGE_CODE %}
{% block js %}
<script type="text/javascript" src="/static/script/store.js"></script>
<script type="text/javascript" src="{% static "script/store.js" %}"></script>
{% endblock %}
{% block content %}
<div class="boxes">
......
{% load i18n %}
{% get_current_language as LANGUAGE_CODE %}
<form action="/ajax/share/{{base.id}}/" method="post" id="template-wizard">
<form action="{% url one.views.ajax_share_wizard id=base.id %}" method="post" id="template-wizard">
{% csrf_token %}
<div id="new-share" class="wizard">
<h2>
......
{% load i18n %}
{% load staticfiles %}
{% get_current_language as LANGUAGE_CODE %}
<form action="/ajax/templateWizard" method="post" id="template-wizard">
<form action="{% url one.views.ajax_template_wizard %}" method="post" id="template-wizard">
{% csrf_token %}
<div id="new-template-step-1" class="wizard">
<div class="progress">
......@@ -28,7 +29,7 @@
<input type="radio" name="base" value="{{m.id}}" />
{{m.name}}
{% if m.public %}
<img src="/static/icons/lock-small.png" alt="{% trans "locked" %}"
<img src="{% static "icons/lock-small.png" %}" alt="{% trans "locked" %}"
title="{% trans "This is a shared template." %}" />
{% endif %}
</label>
......@@ -56,7 +57,7 @@
else {
$.ajax({
'type': 'POST',
'url': '/ajax/templateWizard',
'url': '{% url one.views.ajax_template_wizard %}',
'data': $('#template-wizard').serialize(),
'success': function(data) {
$('#modal-container').html(data);
......
{% load i18n %}
{% load staticfiles %}
{% get_current_language as LANGUAGE_CODE %}
<form action="/vm/new/{{base.id}}/" method="post" id="template-wizard">
<form action="{% url one.views.vm_new base.id %}" method="post" id="template-wizard">
{% csrf_token %}
<div id="new-template-step-2" class="wizard">
<div class="progress">
......@@ -75,7 +76,7 @@
var s = $(self).val();
$.ajax({
'type': 'GET',
'url': '{% one.views.ajax_template_name_unique %}?name=' + s,
'url': '{% url one.views.ajax_template_name_unique %}?name=' + s,
'success': function(data, b, c) {
if (s != $("#new-template-name").val()) {
return true;
......@@ -99,7 +100,7 @@
e.preventDefault();
$.ajax({
'type': 'GET',
'url': '{% one.views.ajax_template_name_unique %}?name=' + $("#new-template-name").val(),
'url': '{% url one.views.ajax_template_name_unique %}?name=' + $("#new-template-name").val(),
'success': function(data, b, c) {
if (data == "True") {
$("#template-wizard").unbind('submit').submit()
......
{% extends "base.html" %}
{% load i18n %}
{% load staticfiles %}
{% block js %}
<script type="text/javascript">
......@@ -8,14 +9,14 @@
$.ajax({
type: 'GET',
dataType: 'json',
url: '/ajax/vm/status/{{ id }}',
url: '{% url one.views.vm_ajax_instance_status id %}',
success: function(data){
if( !data.booting && data.state == 'ACTIVE'){
if (!data.booting && data.state == 'ACTIVE'){
window.location.reload();
}
}
})
},2000);
}, 1000);
{% endif %}
</script>
{% endblock %}
......@@ -61,13 +62,13 @@
<div class="content">
{% if state == "PENDING" or state == "ACTIVE" and booting %}
<p style="font-size:25px; line-height:2em;text-align:center;">
<img src="/static/image/load.gif" />
<img src="{% static "image/load.gif" %}" />
{% trans "Starting..." %}
</p>
{% elif state == "ACTIVE" and not booting %}
<p id="connect" style="display:block; font-size:25px; line-height:2em;text-align:center;">
<a href="{{uri}}" class="button" onclick="return connectbutton();">
<img src="/static/image/load.gif" id="connecting" style="display:none;" />
<img src="{% static "image/load.gif" %}" id="connecting" style="display:none;" />
{% trans "Running" %}
</a>
</p>
......@@ -91,7 +92,7 @@
<h2>
<div class="boxhelp">
<div class="icon">
<img src="/static/icons/information-frame.png" alt="{% trans "Help" %}" />
<img src="{% static "icons/information-frame.png" %}" alt="{% trans "Help" %}" />
</div>
<div class="boxhelp-box">
<p>{% blocktrans %}This is a list about the network ports
......@@ -107,7 +108,7 @@
</div>
{% trans "Port administration" %}</h2>
<div class="content">
<form action="{% url vm_port_add i.id %}" method="post">
<form action="{% url one.views.vm_port_add i.id %}" method="post">
{% csrf_token %}
<table>
<tr>
......@@ -121,7 +122,7 @@
<td>{{port.public}}</td>
{% if i.template.network.nat %}<td>{{port.private}}</td>{%endif%}
<td>
<a href="/vm/port_del/{{i.id}}/{{port.proto}}/{{port.public}}/">{% trans "Delete" %}</a>
<a href="{% url one.views.vm_port_del i.id port.proto port.public %}">{% trans "Delete" %}</a>
</td>
</tr>
{% endfor %}
......
{% load i18n %}
{% load staticfiles %}
{% get_current_language as LANGUAGE_CODE %}
<div class="content">
<table>
......@@ -8,7 +9,7 @@
<div class="boxhelp">
<div class="icon">
<img src="/static/icons/information-frame.png" alt="{% trans "Help" %}" />
<img src="{% static "icons/information-frame.png" %}" alt="{% trans "Help" %}" />
</div>
<div class="boxhelp-box">
{% if i.template.os_type == 'linux' %}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment