Skip to content

Commit

Permalink
templates: fix formatting using record
Browse files Browse the repository at this point in the history
* Ammends record templates to follow new data model.

Signed-off-by: Jiri Kuncar <[email protected]>
  • Loading branch information
jirikuncar committed Jul 3, 2015
1 parent f810507 commit 24740b1
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 9 deletions.
4 changes: 4 additions & 0 deletions invenio_records/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,10 @@ def get_record(cls, recid, *args, **kwargs):
record = cls(obj.json, model=obj)
return record

def dumps(self, **kwargs):
# FIXME add keywords filtering
return dict(self)


# Functional interface
create_record = Record.create
Expand Down
2 changes: 1 addition & 1 deletion invenio_records/templates/records/base_base.html
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

{% block metaheader %}
{% if recid != -1 and config.CFG_WEBSEARCH_DETAILED_META_FORMAT %}
{# format_record(recid, of=config.CFG_WEBSEARCH_DETAILED_META_FORMAT, ln = g.ln)|safe #}
{# format_record(record, of=config.CFG_WEBSEARCH_DETAILED_META_FORMAT, ln = g.ln)|safe #}
{% endif %}
{% endblock metaheader %}

Expand Down
2 changes: 1 addition & 1 deletion invenio_records/templates/records/comments_base.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,5 @@
{% extends "records/base.html" %}

{% block record_content %}
{{ format_record(recid, of='hd')|safe }}
{{ format_record(record, of='hd')|safe }}
{% endblock %}
4 changes: 2 additions & 2 deletions invenio_records/templates/records/files_base.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@

{% block record_content %}
<div class="page-header">
{{ format_record(recid, 'hs', ln=g.ln)|safe }}
{{ format_record(record, 'hs', ln=g.ln)|safe }}
</div>

{{ format_record(recid, 'HDFILE', ln=g.ln)|safe }}
{{ format_record(record, 'HDFILE', ln=g.ln)|safe }}

{% from 'cloudconnector/files.html' import upload_files with context %}

Expand Down
6 changes: 3 additions & 3 deletions invenio_records/templates/records/metadata_base.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
{%- endif -%}

{% block record_content %}
{{ format_record(recid, of=of, ln=g.ln)|safe }}
{{ format_record(record, of=of, ln=g.ln)|safe }}

<hr/>

Expand All @@ -31,7 +31,7 @@
<div class="well">
<div class="row">
<div style="text-align: center;" class="col-md-3">
{# format_record(recid, of='HDFILE', ln=g.ln)|safe #}
{# format_record(record, of='HDFILE', ln=g.ln)|safe #}
</div>
<div style="text-align: center;" class="col-md-5">
{%- if config.CFG_WEBCOMMENT_ALLOW_REVIEWS -%}
Expand All @@ -40,7 +40,7 @@
&nbsp;
</div>
<div class="col-md-3">
{# format_record(recid, of='HDACT', ln=g.ln)|safe #}
{# format_record(record, of='HDACT', ln=g.ln)|safe #}
</div>
</div>
</div>
Expand Down
4 changes: 2 additions & 2 deletions invenio_records/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,10 @@ def decorated(recid, *args, **kwargs):
title = record.get(cfg.get('RECORDS_BREADCRUMB_TITLE_KEY'), '')
tabs = []

def _format_record(recid, of='hd', user_info=current_user, *args,
def _format_record(record, of='hd', user_info=current_user, *args,
**kwargs):
from invenio.modules.formatter import format_record
return format_record(recid, of, user_info=user_info, *args,
return format_record(record, of, user_info=user_info, *args,
**kwargs)

@register_template_context_processor
Expand Down

0 comments on commit 24740b1

Please sign in to comment.