Skip to content

Commit

Permalink
Merge pull request #411 from Cadasta/feature/css-locationdetails
Browse files Browse the repository at this point in the history
Location details right panel
  • Loading branch information
ian-ross authored Jul 12, 2016
2 parents 7e79bd3 + 1fd2503 commit 65d2820
Show file tree
Hide file tree
Showing 10 changed files with 191 additions and 43 deletions.
55 changes: 52 additions & 3 deletions cadasta/core/static/css/main.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion cadasta/core/static/css/main.css.map

Large diffs are not rendered by default.

41 changes: 37 additions & 4 deletions cadasta/core/static/css/main.scss
Original file line number Diff line number Diff line change
Expand Up @@ -668,15 +668,15 @@ header {
position: relative;
background: #fff;
margin: 0 auto;
padding: 30px;
padding: 24px;
overflow-x: hidden;
overflow-y: scroll;
-webkit-box-shadow: 0 0 6px rgba(0,0,0,.3);
-moz-box-shadow: 0 0 6px rgba(0,0,0,.3);
box-shadow: 0 0 6px rgba(0,0,0,.3);
z-index: 300;
.btn {
min-width: 120px;
min-width: 110px;
}
.more-menu {
width: auto !important;
Expand Down Expand Up @@ -725,7 +725,7 @@ header {
background: transparent;
padding: 20px 15px;
.btn {
min-width: 120px;
min-width: 110px;
margin-right: 20px;
margin-bottom: 10px;
&:last-child {
Expand All @@ -737,6 +737,16 @@ header {
.nav-tabs {
margin-bottom: 20px;
}
.detail .nav-tabs {
li > a {
font-size: 13px;
padding: 10px;
}
li.active > a, li.active > a:hover, li.active > a:focus {
border-color: $table-border-color;
border-bottom-color: transparent;
}
}
}

@media (max-width: $screen-sm-max) {
Expand Down Expand Up @@ -872,6 +882,18 @@ div.dataTables_wrapper div.dataTables_info /* showing number total */ {
max-width: 100px;
}

table.table-location { // location details in map area
border-top: none;
border-bottom: none;
tr:first-child td {
border-top: none;
}
label {
text-transform: uppercase;
font-size: 12px;
}
}

@media (max-width: $screen-sm-max) {
table {
overflow-x: auto;
Expand Down Expand Up @@ -1151,4 +1173,15 @@ ul.errorlist {
color: $alert-danger-text;
padding: 2px 8px;
}
}
}

/* =Map location details
-------------------------------------------------------------- */

.content-single .detail h2 span {
font-size: 14px;
color: #a6a7a8;
display: block;
text-transform: uppercase;
padding-bottom: 2px;
}
33 changes: 33 additions & 0 deletions cadasta/core/static/css/single.scss
Original file line number Diff line number Diff line change
Expand Up @@ -195,3 +195,36 @@
}
}

/* =Map location details in right column
-------------------------------------------------------------- */

.content-single .detail {
h2 {
margin-top: 10px;
span {
font-size: 11px;
color: $gray-medium;
display: block;
text-transform: uppercase;
padding-bottom: 2px;
}
}
.btn-group {
margin-bottom: 20px;
}
.btn-full .btn {
padding: 10px 12px;
}
}

#project-map {
h2 {
padding-bottom: 0;
}
.btn-wrap { // button
padding: 4px 4px 5px;
.btn-block {
margin: 0 auto;
}
}
}
2 changes: 1 addition & 1 deletion cadasta/templates/organization/project_dashboard.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<script>
function project_map_init(map, options) {
var trans = {
open: "{% trans 'Open Location' %}"
open: "{% trans 'Open location' %}"
};

{% if project.extent %}
Expand Down
2 changes: 1 addition & 1 deletion cadasta/templates/spatial/location_add.html
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
// TODO: It seems Leaflet has a bug with L.geoJson()
// not returning the correct bounds (see #377 for details)
var trans = {
open: "{% trans 'Open Location' %}"
open: "{% trans 'Open location' %}"
};

{% if object.extent %}
Expand Down
91 changes: 62 additions & 29 deletions cadasta/templates/spatial/location_detail.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
{% block location_panel %}

<div class="page-title">
<h2>Location</h2>
<h2><span>Location </span>{{ location.get_type_display }}</h2>
<div class="top-btn pull-right">
<!-- More options menu -->
<div class="dropdown pull-right btn-more">
Expand All @@ -30,51 +30,84 @@ <h2>Location</h2>
</ul>

<div class="tab-content">
<!-- Overview tab -->
<div role="tabpanel" class="tab-pane active" id="overview">
<table class="table table-striped">
<table class="table table-location">
<tbody>
<tr>
<td><strong>Type</strong></td>
<td>{{ location.get_type_display }}</td>
<td class="col-md-4"><label>Type</label></td>
<td class="col-md-8">{{ location.get_type_display }}</td>
</tr>
{% for attr in attributes %}
<tr>
<td><strong>{{ attr.0 }}</strong></td>
<td><label>{{ attr.0 }}</label></td>
<td>{{ attr.1 }}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
<!-- /overview tab -->

<!-- Relationship tab -->
<div role="tabpanel" class="tab-pane" id="relationships">
<table class="table table-hover datatable" data-paging-type="simple">
<thead>
<tr>
<th>{% trans "Relationship type" %}</th>
<th>{% trans "Party" %}</th>
</tr>
</thead>
<tbody>
{% for rel in relationships %}
<tr class="linked" onclick="window.document.location='{% url 'parties:relationship_detail' object.organization.slug object.slug rel.id %}';">
<td>{{ rel.tenure_type.label }}</td>
<td><a href="{% url 'parties:detail' object.organization.slug object.slug rel.party.id %}">{{ rel.party.name }}</a></td>
</tr>
{% endfor %}
</tbody>
</table>
<a href="{% url 'locations:relationship_add' object.organization.slug object.slug location.id %}" class="btn btn-primary btn-block">
{% trans "Add new relationship" %}
</a>
{% if has_relationships %}
<div class="pull-right">
<a href="{% url 'locations:relationship_add' object.organization.slug object.slug location.id %}" class="btn btn-primary btn-small">
<span class="glyphicon glyphicon-plus" aria-hidden="true"></span>
{% trans "Add relationship" %}
</a>
</div>
<table class="table table-hover datatable" data-paging-type="simple">
<thead>
<tr>
<th>{% trans "Relationship type" %}</th>
<th>{% trans "Party" %}</th>
</tr>
</thead>
<tbody>
{% for rel in relationships %}
<tr class="linked" onclick="window.document.location='{% url 'parties:relationship_detail' object.organization.slug object.slug rel.id %}';">
<td>{{ rel.tenure_type.label }}</td>
<td><a href="{% url 'parties:detail' object.organization.slug object.slug rel.party.id %}">{{ rel.party.name }}</a></td>
</tr>
{% endfor %}
</tbody>
</table>
{% else %}
<div>
<p>{% trans "This location does not have any relationships and is not connected to any parties. To add your first relationship, select the button below." %}</p>
<div class="btn-full">
<a href="{% url 'locations:relationship_add' object.organization.slug object.slug location.id %}" class="btn btn-primary">
<span class="glyphicon glyphicon-plus" aria-hidden="true"></span>
{% trans "Add relationship" %}
</a>
</div>
</div>
{% endif %}
</div>
<!-- /relationship tab -->

<!-- Resources tab -->
<div role="tabpanel" class="tab-pane" id="resources">
{% include 'resources/table_sm.html' with object_list=location.resources %}
<div class="btn-group btn-group-justified">
<a class="btn btn-primary" href="{% url 'locations:resource_add' object.organization.slug object.slug location.id %}">{% trans "Add from library" %}</a>
<a class="btn btn-primary" href="{% url 'locations:resource_new' object.organization.slug object.slug location.id %}">{% trans "Upload new resource" %}</a>
</div>
{% if has_resources %}
<div class="btn-group btn-group-justified">
<a class="btn btn-primary btn-sm" href="{% url 'locations:resource_add' object.organization.slug object.slug location.id %}">{% trans "Add from library" %}</a>
<a class="btn btn-primary btn-sm" href="{% url 'locations:resource_new' object.organization.slug object.slug location.id %}">{% trans "Upload new resource" %}</a>
</div>
{% include 'resources/table_sm.html' with object_list=location.resources %}
{% else %}
<div>
<p>{% trans "This location does not have any connected resources. To add a resource, selection from the options below." %}</p>
<div class="btn-full btn-group btn-group-justified">
<a class="btn btn-primary" href="{% url 'locations:resource_add' object.organization.slug object.slug location.id %}">{% trans "Add from library" %}</a>
<a class="btn btn-primary" href="{% url 'locations:resource_new' object.organization.slug object.slug location.id %}">{% trans "Upload new resource" %}</a>
</div>
</div>
{% endif %}
</div>
<!-- /resources tab -->

</div>

{% endblock %}
2 changes: 1 addition & 1 deletion cadasta/templates/spatial/location_edit.html
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
layer.bindPopup("<div class=\"text-wrap\">" +
"<h2><span>Location</span>" +
feature.properties.type + "</h2></div>" +
"<div class=\"btn-wrap\"><a href='" + feature.properties.url + "' class=\"btn btn-primary btn-sm btn-block\">{% trans 'Open Location' %}</a>" +
"<div class=\"btn-wrap\"><a href='" + feature.properties.url + "' class=\"btn btn-primary btn-sm btn-block\">{% trans 'Open location' %}</a>" +
"</div>");
}
});
Expand Down
2 changes: 1 addition & 1 deletion cadasta/templates/spatial/location_map.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
// TODO: It seems Leaflet has a bug with L.geoJson()
// not returning the correct bounds (see #377 for details)
var trans = {
open: "{% trans 'Open Location' %}"
open: "{% trans 'Open location' %}"
};

{% if object.extent %}
Expand Down
4 changes: 2 additions & 2 deletions cadasta/templates/spatial/location_wrapper.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<script>
function locations_map_init(map, options) {
var trans = {
open: "{% trans 'Open Location' %}"
open: "{% trans 'Open location' %}"
};

{% if object.extent %}
Expand All @@ -40,7 +40,7 @@
onEachFeature: function(feature, layer) {
layer.bindPopup("<div class=\"text-wrap\">" +
"<h2><span>Location</span>{{ location.get_type_display }}</h2></div>" +
"<div class=\"btn-wrap\"><a href='{% url 'locations:detail' object.organization.slug object.slug location.id %}' class=\"btn btn-primary btn-sm btn-block\">{% trans 'Open Location' %}</a>" +
"<div class=\"btn-wrap\"><a href='{% url 'locations:detail' object.organization.slug object.slug location.id %}' class=\"btn btn-primary btn-sm btn-block\">{% trans 'Open location' %}</a>" +
"</div>");
}
});
Expand Down

0 comments on commit 65d2820

Please sign in to comment.