Fix #549 - Deauthorize OAuth applications
[mediagoblin.git] / mediagoblin / templates / mediagoblin / edit / metadata.html
CommitLineData
fffc5dcf 1{#
2# GNU MediaGoblin -- federated, autonomous media hosting
3# Copyright (C) 2011, 2012 MediaGoblin contributors. See AUTHORS.
4#
5# This program is free software: you can redistribute it and/or modify
6# it under the terms of the GNU Affero General Public License as published by
7# the Free Software Foundation, either version 3 of the License, or
8# (at your option) any later version.
9#
10# This program is distributed in the hope that it will be useful,
11# but WITHOUT ANY WARRANTY; without even the implied warranty of
12# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13# GNU Affero General Public License for more details.
14#
15# You should have received a copy of the GNU Affero General Public License
16# along with this program. If not, see <http://www.gnu.org/licenses/>.
17#}
18{%- extends "mediagoblin/base.html" %}
19{% import "/mediagoblin/utils/wtforms.html" as wtforms_util %}
e80596c8 20{% block mediagoblin_head %}
21 <script>
22 function add_new_row(table_id, row_number, input_prefix) {
23 new_row = $('<tr>').append(
24 $('<td>').attr(
25 'class','form_field_input').append(
26 $('<input>').attr('name',
27 input_prefix + row_number + "-identifier").attr('id',
28 input_prefix + row_number + "-identifier")
29 )
30 ).append(
31 $('<td>').attr(
32 'class','form_field_input').append(
33 $('<input>').attr('name',
34 input_prefix + row_number + "-value").attr('id',
35 input_prefix + row_number + "-value")
36 )
37 );
38 $(table_id).append(new_row);
39 }
40 function clear_empty_rows(list_id) {
41 $('table'+list_id+' tr').each(function(row){
42 id_input = $(this).find('td').find('input');
43 value_input = $(this).find('td').next().find('input');
9919fb08 44 if ((value_input.attr('value') == "") &&
e80596c8 45 (id_input.attr('value') == "")) {
46 $(this).remove();
47 }
48 })
49 }
fffc5dcf 50
e80596c8 51 $(document).ready(function(){
e80596c8 52 var metadata_lines = {{ form.media_metadata | length }};
53 $("#add_new_metadata_row").click(function(){
9919fb08 54 add_new_row("#metadata_list",
e80596c8 55 metadata_lines,
56 'media_metadata-');
57 metadata_lines += 1;
58 })
0e69d932 59
e80596c8 60 $("#clear_empty_rows").click(function(){
e80596c8 61 clear_empty_rows("#metadata_list");
62 })
63 })
64 </script>
65{% endblock %}
fffc5dcf 66{% block mediagoblin_content %}
e80596c8 67 <h2>{% trans media_name=media.title -%}
68 Metadata for "{{ media_name }}"{% endtrans %}</h2>
69 <form action="" method="POST" id="metadata_form">
e80596c8 70
71<!-- This table holds all the information about the media entry's metadata -->
0d6550fb 72 <h3>{% trans %}MetaData{% endtrans %}</h3>
e80596c8 73 <table class="metadata_editor" id="metadata_list" >
494bce47 74 {{ wtforms_util.render_fieldlist_as_table_rows(form.media_metadata) }}
e80596c8 75 </table>
76
77<!-- These are the buttons you use to control the form -->
78 <table class="metadata_editor" id="buttons_bottom">
79 <tr>
80 <td><input type=button value="{% trans %}Add new Row{% endtrans %}"
81 class="button_action" id="add_new_metadata_row" />
82 </td>
9919fb08 83 <td><input type=submit value="{% trans %}Update Metadata{% endtrans %}"
e80596c8 84 class="button_action_highlight" /></td>
85 </tr>
86 <tr>
87 <td><input type=button value="{% trans %}Clear empty Rows{% endtrans %}"
88 class="button_action" id="clear_empty_rows" /></td>
89 </tr>
90 </table>
91 {{ csrf_token }}
92 </form>
9919fb08 93
fffc5dcf 94{% endblock mediagoblin_content %}