From 24740b10e2b3aa95ff1fefc290160a33e67ade52 Mon Sep 17 00:00:00 2001 From: Jiri Kuncar Date: Wed, 1 Jul 2015 13:43:19 +0200 Subject: [PATCH] templates: fix formatting using record * Ammends record templates to follow new data model. Signed-off-by: Jiri Kuncar --- invenio_records/api.py | 4 ++++ invenio_records/templates/records/base_base.html | 2 +- invenio_records/templates/records/comments_base.html | 2 +- invenio_records/templates/records/files_base.html | 4 ++-- invenio_records/templates/records/metadata_base.html | 6 +++--- invenio_records/views.py | 4 ++-- 6 files changed, 13 insertions(+), 9 deletions(-) diff --git a/invenio_records/api.py b/invenio_records/api.py index a96cfbf6..248cf959 100644 --- a/invenio_records/api.py +++ b/invenio_records/api.py @@ -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 diff --git a/invenio_records/templates/records/base_base.html b/invenio_records/templates/records/base_base.html index 1e1851e3..5317f09f 100644 --- a/invenio_records/templates/records/base_base.html +++ b/invenio_records/templates/records/base_base.html @@ -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 %} diff --git a/invenio_records/templates/records/comments_base.html b/invenio_records/templates/records/comments_base.html index 45dc879f..3c692cb9 100644 --- a/invenio_records/templates/records/comments_base.html +++ b/invenio_records/templates/records/comments_base.html @@ -19,5 +19,5 @@ {% extends "records/base.html" %} {% block record_content %} - {{ format_record(recid, of='hd')|safe }} + {{ format_record(record, of='hd')|safe }} {% endblock %} diff --git a/invenio_records/templates/records/files_base.html b/invenio_records/templates/records/files_base.html index aee2248b..f7e56008 100644 --- a/invenio_records/templates/records/files_base.html +++ b/invenio_records/templates/records/files_base.html @@ -22,10 +22,10 @@ {% block record_content %} - {{ 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 %} diff --git a/invenio_records/templates/records/metadata_base.html b/invenio_records/templates/records/metadata_base.html index c3a5848b..ead1f0ff 100644 --- a/invenio_records/templates/records/metadata_base.html +++ b/invenio_records/templates/records/metadata_base.html @@ -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 }}
@@ -31,7 +31,7 @@
- {# format_record(recid, of='HDFILE', ln=g.ln)|safe #} + {# format_record(record, of='HDFILE', ln=g.ln)|safe #}
{%- if config.CFG_WEBCOMMENT_ALLOW_REVIEWS -%} @@ -40,7 +40,7 @@  
- {# format_record(recid, of='HDACT', ln=g.ln)|safe #} + {# format_record(record, of='HDACT', ln=g.ln)|safe #}
diff --git a/invenio_records/views.py b/invenio_records/views.py index c9fc3259..06c687a3 100644 --- a/invenio_records/views.py +++ b/invenio_records/views.py @@ -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