diff options
author | tilly-Q <nattilypigeonfowl@gmail.com> | 2014-04-21 15:42:57 -0400 |
---|---|---|
committer | tilly-Q <nattilypigeonfowl@gmail.com> | 2014-04-21 15:42:57 -0400 |
commit | 8ccd560ca2c480bb55f8caf1ddc035731eee11ca (patch) | |
tree | 40272e307461c034db38d6d1888b6b0a2a9fc0b7 /mediagoblin/templates | |
parent | 7ff99dabfbb3e854afe2aba17a79a0aee9062e44 (diff) | |
download | mediagoblin-8ccd560ca2c480bb55f8caf1ddc035731eee11ca.tar.lz mediagoblin-8ccd560ca2c480bb55f8caf1ddc035731eee11ca.tar.xz mediagoblin-8ccd560ca2c480bb55f8caf1ddc035731eee11ca.zip |
Created the basic structure of the metadata display table in rdfa lite
Diffstat (limited to 'mediagoblin/templates')
-rw-r--r-- | mediagoblin/templates/mediagoblin/user_pages/media.html | 2 | ||||
-rw-r--r-- | mediagoblin/templates/mediagoblin/utils/metadata_table.html | 37 |
2 files changed, 39 insertions, 0 deletions
diff --git a/mediagoblin/templates/mediagoblin/user_pages/media.html b/mediagoblin/templates/mediagoblin/user_pages/media.html index e01cce5c..22971fec 100644 --- a/mediagoblin/templates/mediagoblin/user_pages/media.html +++ b/mediagoblin/templates/mediagoblin/user_pages/media.html @@ -18,6 +18,7 @@ {%- extends "mediagoblin/base.html" %} {% import "/mediagoblin/utils/wtforms.html" as wtforms_util %} +{% import "/mediagoblin/utils/metadata_table.html" as metadata_util %} {% from "mediagoblin/utils/pagination.html" import render_pagination %} {% block title %}{{ media.title }} — {{ super() }}{% endblock %} @@ -231,6 +232,7 @@ {% template_hook("media_sideinfo") %} {% block mediagoblin_sidebar %} + {{ metadata_util.render_table(request, media, rdfa_to_readable) }} {% endblock %} </div><!--end media_sidebar--> diff --git a/mediagoblin/templates/mediagoblin/utils/metadata_table.html b/mediagoblin/templates/mediagoblin/utils/metadata_table.html new file mode 100644 index 00000000..38b580d5 --- /dev/null +++ b/mediagoblin/templates/mediagoblin/utils/metadata_table.html @@ -0,0 +1,37 @@ +{# +# GNU MediaGoblin -- federated, autonomous media hosting +# Copyright (C) 2011, 2012 MediaGoblin contributors. See AUTHORS. +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. +#} + +{%- macro render_table(request, media_entry, format_predicate) %} + {%- set metadata=media_entry.media_metadata %} + {%- set metadata_context=metadata['@context'] %} + {%- if metadata %} + <table prefix="{%- for prefix in metadata_context -%} + {{ prefix }} {{ metadata_context[prefix] }} + {%- endfor %}"> + {%- for key, value in metadata.iteritems() if not key=='@context' %} + <tr> + <td>{{ format_predicate(key) }}</td> + {% if value -%} + <td property="{{ key }}">{{ value }}</td> + {%- else -%} + <td></td> + {%- endif -%} + {%- endfor %} + </table> + {% endif %} +{%- endmacro %} |