Parent: [ddf08c] (diff)

Child: [9ea466] (diff)

Download this file

index.html    130 lines (121 with data), 5.2 kB

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
{#-
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-#}
{% extends 'forgeshorturl:templates/master.html' %}
{% set can_update = c.user and h.has_access(c.app, 'update') %}
{% block extra_js %}
{{ super() }}
{{ c.update_short_url_lightbox.display(content='''
<div>
<h1>Update Short URL</h1>
<form method="post" action="" id="update-short-url-form">
<input type="hidden" name="update" value="update">
<input type="hidden" name="short_url">
<label class="grid-13">Short name</label>
<div class="grid-13"><input type="text" name="short_url_display" style="width: 250px" disabled="disabled"></div>
<label class="grid-13">Full URL</label>
<div class="grid-13"><input type="text" name="full_url" style="width: 250px"></div>
<label class="grid-13">Description</label>
<div class="grid-13"><textarea name="description" style="width: 250px; height: 100px"></textarea></div>
<div class="grid-13"><input type="checkbox" name="private" id="update-checkbox-private"><label for="update-checkbox-private">Private</label></div>
<div class="grid-13">&nbsp;</div>
<hr>
<div class="grid-13"><div class="grid-13">&nbsp;</div>
<input type="submit" value="Save">
<a href="#" class="close">Cancel</a>
</div>
</form>
</div>
''') }}
{% endblock %}
{% block content %}
<table>
<thead>
<tr>
<th>Private</th>
<th>Create user</th>
<th>Short URL</th>
<th>Full URL</th>
<th>Description</th>
<th>Created</th>
<th>Last updated</th>
{% if can_update %}<th></th>{% endif %}
</tr>
</thead>
{% for su in short_urls %}
<tr>
{%if su.private %}
<td><small>yes</small></td>
{% else %}
<td><small>no</small></td>
{% endif %}
<td><small>{{ su.user.username }}</small></td>
<td><small><a href="{{ c.app.url+su.short_name }}">{{ request.scheme+'://'+request.host+su.url()}}</a></small></td>
<td><small>{{ su.full_url|urlize(20) }}</small></td>
<td><small>{{ su.description }}</small></td>
<td><small>{{ lib.abbr_date(su.created) }}</small></td>
<td><small>{{ lib.abbr_date(su.last_updated) }}</small></td>
{% if can_update %}
<td>
<small>
<a class="update-url" id="update-url-{{su.short_name}}" href="{{c.project.url()}}admin/{{c.app.config.options.mount_point}}/add/">
Update
</a>
<script>
$(function() {
var upform = $('#update-short-url-form');
$('#update-url-{{su.short_name}}').click(function() {
upform.attr('action', this.href);
upform.find('input[name="short_url"]').val('{{ su.short_name }}');
upform.find('input[name="short_url_display"]').val('{{ su.short_name }}');
upform.find('input[name="full_url"]').val('{{ su.full_url }}');
upform.find('textarea[name="description"]').val('{{su.description|replace("\n", "\\n")|replace("\r", "\\r")}}');
if ('{{ su.private }}' == 'True') {
$('#update-checkbox-private').attr('checked', 'checked');
} else {
$('#update-checkbox-private').removeAttr('checked');
}
return false;
});
});
</script>
<br>
<a id="remove-url-{{su.short_name}}" href="{{c.project.url()}}admin/{{c.app.config.options.mount_point}}/remove">
Remove
</a>
<script>
$(function() {
var cval = $.cookie('_session_id');
$('#remove-url-{{su.short_name}}').click(function() {
if (confirm('Remove URL {{su.short_name}}?')) {
var row = $(this).parents('tr');
var data = {_session_id: cval, shorturl: '{{ su.short_name }}'};
$.post(this.href, data, function(data, status, xhr) {
if (data.status == 'ok') row.remove();
});
}
return false;
});
});
</script>
</small>
</td>
{% endif %} {# can_update #}
</tr>
{% endfor %}
</table>
{{ c.page_list.display(limit=limit, count=count, page=pagenum) }}
{% endblock %}