Skip to content

Commit

Permalink
UI: introduces "Export" modal/popup
Browse files Browse the repository at this point in the history
  • Loading branch information
pamfilos committed Sep 23, 2014
1 parent 6fd23c9 commit ef81a97
Show file tree
Hide file tree
Showing 9 changed files with 95 additions and 22 deletions.
12 changes: 9 additions & 3 deletions invenio_opendata/base/static/css/records.css
Original file line number Diff line number Diff line change
Expand Up @@ -327,14 +327,20 @@
font-weight: 600;
}
.rec_export .a {
background-color: #fff;
color: #606D75;
background-color: #428bca;
color: #fff;
font-weight: 600;
float: left;
padding: 5px 8px;
border-top-right-radius: 2px;
border-bottom-right-radius: 2px;
}

.rec_export .a a,
.rec_export .a a:hover,
.rec_export .a a:focus {
color: inherit;
text-decoration: inherit;
}
#record_content #record_content {
margin-left: -15px;
margin-right: -15px;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{% from "records/macros.html" import create_export_modal with context %}
<div class="row" style="margin: -25px -20px;">
<div class="rec_dedicated_top col-md-12">
<div class="row">
Expand All @@ -6,8 +7,8 @@
<div class="n"><div class="t col-md-2">DOI</div>{{ record['doi'] }}</div>
</div>
{% endif %}
<div class="rec_export col-md-12">
{{ format_record(recid, of='HDACT', ln=g.ln)|safe }}
<div class="col-md-12">
{{ create_export_modal("exportModal", record, ['__meta_metadata__', 'restriction']) }}
</div>
<div class="col-md-12 rec_parentcol">
<div class="n"><div class="t col-md-4">Parent Collection</div><a href="{{ url_for('collection/'+collection.name) }}">{{ collection.names[g.ln,'ln'] }}</a></div>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{% from "records/macros.html" import create_export_modal with context %}
<div class="row" style="margin: -25px -20px;">
<div class="rec_dedicated_top col-md-12">
<div class="row">
Expand All @@ -6,8 +7,8 @@
<div class="n"><div class="t col-md-2">DOI</div>{{ record['doi'] }}</div>
</div>
{% endif %}
<div class="rec_export col-md-12">
{{ format_record(recid, of='HDACT', ln=g.ln)|safe }}
<div class="col-md-12">
{{ create_export_modal("exportModal", record, ['__meta_metadata__', 'restriction']) }}
</div>
<div class="col-md-12 rec_parentcol">
<div class="n"><div class="t col-md-4">Parent Collection</div><a href="{{ url_for('collection/'+collection.name) }}">{{ collection.names[g.ln, 'ln'] }}</a></div>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{% from "records/macros.html" import create_export_modal with context %}
<div class="row" style="margin: -25px -20px;">
<div class="rec_dedicated_top col-md-12">
<div class="row">
Expand All @@ -6,9 +7,7 @@
<div class="n"><div class="t col-md-2">DOI</div>{{ record['doi'] }}</div>
</div>
{% endif %}
<div class="rec_export col-md-12">
{{ format_record(recid, of='HDACT', ln=g.ln)|safe }}
</div>
<div class="col-md-12 pull-left">{{ create_export_modal("exportModal", record, ['__meta_metadata__', 'restriction']) }}</div>
<div class="col-md-12 rec_parentcol">
<div class="n"><div class="t col-md-4">Parent Collection</div><a href="{{ url_for('collection/'+collection.name) }}">{{ collection.names[g.ln,'ln'] }}</a></div>
</div>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{% from "records/macros.html" import create_export_modal with context %}
<div class="rec_header">
<div class="row rec_details">
<div>
Expand All @@ -18,9 +19,7 @@
<div class="rec_thumb rec_parentcol">
<div class="n"><div class="t">Parent Collection</div><a href="{{ url_for('collection/'+collection.name) }}">{{ collection.names[g.ln,'ln'] }}</a></div>
</div>
<div class="rec_thumb rec_export">
{{ format_record(recid, of='HDACT', ln=g.ln)|safe }}
</div>
{{ create_export_modal("exportModal", record, ['__meta_metadata__', 'restriction']) }}
</div>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{% from "records/macros.html" import create_export_modal with context %}
<div class="rec_header">
<div class="row rec_details">
<div>
Expand All @@ -19,9 +20,7 @@
<div class="rec_thumb rec_parentcol">
<div class="n"><div class="t">Parent Collection</div><a href="{{ url_for('collection/'+collection.name) }}">{{ collection.names[g.ln,'ln'] }}</a></div>
</div>
<div class="rec_thumb rec_export">
{{ format_record(recid, of='HDACT', ln=g.ln)|safe }}
</div>
{{ create_export_modal("exportModal", record, ['__meta_metadata__', 'restriction']) }}
</div>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{% from "records/macros.html" import create_export_modal with context %}
<div class="rec_header">
<div class="row rec_details">
<div>
Expand All @@ -18,9 +19,7 @@
<div class="rec_thumb rec_parentcol">
<div class="n"><div class="t">Parent Collection</div><a href="{{ url_for('collection/'+collection.name) }}">{{ collection.names[g.ln,'ln'] }}</a></div>
</div>
<div class="rec_thumb rec_export">
{{ format_record(recid, of='HDACT', ln=g.ln)|safe }}
</div>
{{ create_export_modal("exportModal", record, ['__meta_metadata__', 'restriction']) }}
</div>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{% from "records/macros.html" import create_export_modal with context %}
<div class="rec_header">
<div class="row rec_details">
<div>
Expand All @@ -19,9 +20,7 @@
<div class="rec_thumb rec_parentcol">
<div class="n"><div class="t">Parent Collection</div><a href="{{ url_for('collection/'+collection.name) }}">{{ collection.names[g.ln,'ln'] }}</a></div>
</div>
<div class="rec_thumb rec_export">
{{ format_record(recid, of='HDACT', ln=g.ln)|safe }}
</div>
{{ create_export_modal("exportModal", record, ['__meta_metadata__', 'restriction']) }}
</div>
</div>
</div>
Expand Down
70 changes: 70 additions & 0 deletions invenio_opendata/base/templates/records/macros.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
{% macro list_record_attributes(record, exclude=[]) %}
<ul class="row">
{% for el in record|sort %}
<li class="col-md-12">
<ul class="col-md-12" style="padding-bottom: 5px;margin-bottom: 5px;border-bottom: 1px solid #d4d4d4;">
<kbd>{{el}}</kbd>:
{% if el in exclude %}
-<br>
{% elif record[el] is sequence and record[el] is not string %}
<br>
{% for i in record[el] %}
<li class="col-md-12">
<ul class="row">
{% if i is not string %}
<ul>
{% for f in i %}
<li class="col-md-12">
<b>{{f}}</b>:{{i[f]}}<br>
</li>
{% endfor %}
</ul>
{% else %}
<b>{{i}}</b>: {{record[el][i]}}<br>
{%endif%}
</ul>
</li>
{% endfor %}
{% else %}
{{record[el]}}<br>
{% endif %}
</ul>
</li>
{% endfor %}
</ul>
{% endmacro %}

{% macro create_export_modal(name, record, exclude=[]) %}
<style>.modal .modal-body .tab-pane{padding-top: 15px;}.modal{color:#666;}</style>
<div class="rec_thumb rec_export" style="float:left;">
<div class="t">Export</div>
<div class="a"><a href="#" data-toggle="modal" data-target="#{{name}}">here</a></div>
</div>
<div class="modal fade" id="{{name}}" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
<h4 class="modal-title" id="myModalLabel">{{record.get('title',{}).get('title','')}}</h4>
</div>
<div class="modal-body">
<ul class="nav nav-tabs" role="tablist">
<li class="active"><a href="#overview" role="tab" data-toggle="tab">Overview</a></li>
<li><a href="#bidtex" role="tab" data-toggle="tab">BibTex</a></li>
</ul>
<div class="tab-content">
<div class="tab-pane fade in active" id="overview">
{{ list_record_attributes(record, exclude ) }}
</div>
<div class="tab-pane fade" id="bidtex">
Upcoming Feature
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
{% endmacro %}

0 comments on commit ef81a97

Please sign in to comment.