-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #940 from akvo/933_add_update
[#933] Add an update page
- Loading branch information
Showing
9 changed files
with
289 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
{% extends "base.html" %} | ||
|
||
{% load i18n markup_tags rsr_utils bootstrap3 %} | ||
|
||
{% block title %}{{project.title}}{% endblock %} | ||
|
||
{% block head_js %} | ||
<script> | ||
$(document).ready(function() { | ||
$( "#id_latitude").val(0); | ||
$( "#id_longitude").val(0); | ||
if (navigator.geolocation) { | ||
navigator.geolocation.getCurrentPosition(storePosition); | ||
} | ||
function storePosition(position) { | ||
$( "#id_latitude").val(position.coords.latitude); | ||
$( "#id_longitude").val(position.coords.longitude); | ||
} | ||
}); | ||
</script> | ||
{% endblock %} | ||
|
||
{% block maincontent %} | ||
<article class="touch-navbar"> | ||
{% include "partials/project_header.html" %} | ||
|
||
<div class="container"> | ||
<div class="row"> | ||
<div class="col-md-12"> | ||
<h1>{% if edit_mode %}{% trans 'Edit an update' %}{% else %}{% trans 'Add an update' %}{% endif %}</h1> | ||
{% if edit_mode %} | ||
<p class="small">You posted this update at {{ update.time_gmt|date:"H:i T"}}. You have until {{ update.expires_at|date:"H:i T" }} to save your edits.</p> | ||
{% endif %} | ||
</div> | ||
</div> | ||
<div class="row"> | ||
<div class="col-lg-7 col-md-7 col-sm-12 col-xs-12" id="update"> | ||
{% if update and update.photo and edit_mode %} | ||
<p>{% img update 400 300 update.title %}</p> | ||
{% endif %} | ||
<form method="post" action="" id="updateForm" enctype="multipart/form-data"> | ||
{% csrf_token %} | ||
{% for field in updateform %} | ||
{% bootstrap_field field %} | ||
{% endfor %} | ||
{% buttons %} | ||
<button type="submit" class="btn btn-primary"> | ||
{% if edit_mode %}{% trans 'Edit update' %}{% else %}{% trans 'Add update' %}{% endif %} | ||
</button> | ||
{% endbuttons %} | ||
</form> | ||
</div> | ||
{% if updates %} | ||
<div class="col-lg-5 col-md-5 hidden-sm hidden-xs"> | ||
<h2>Previous updates of this project</h2> | ||
{% for u in updates %} | ||
{% if update and not u.id = update.id %} | ||
<div class="row"> | ||
<div class="col-lg-5 col-md-5 thumbImg"> | ||
<a href="{% url 'update-main' u.project.id u.id %}"> | ||
{% img u 160 160 u.title %} | ||
</a> | ||
</div> | ||
<div class="col-lg-7 col-md-7"> | ||
<h4><a href="{% url 'update-main' u.project.id u.id %}">{{u.title}}</a></h4> | ||
<p class="small"> | ||
<span class="glyphicon glyphicon-user"></span> {{u.user.first_name}} {{u.user.last_name}}<br> | ||
{% if u.primary_location.country %} | ||
<span class="glyphicon glyphicon-map-marker"></span> {{u.primary_location.country}}, {{u.primary_location.country.continent}} <br> | ||
{% endif %} | ||
<span class="glyphicon glyphicon-calendar"></span> {{u.created_at|date:"d-M-Y"}}<br> | ||
</p> | ||
</div> | ||
</div> | ||
<br> | ||
{% endif %} | ||
{% endfor %} | ||
</div> | ||
{% endif %} | ||
</div> | ||
</div> | ||
</article> | ||
|
||
{% endblock %} |
Oops, something went wrong.