Skip to content

Commit

Permalink
[#933] Merged 'feature/rsr_v3' into branch
Browse files Browse the repository at this point in the history
  • Loading branch information
KasperBrandt committed Dec 1, 2014
2 parents 1e6ad94 + 86fb2d0 commit 237f99f
Show file tree
Hide file tree
Showing 13 changed files with 747 additions and 101 deletions.
5 changes: 3 additions & 2 deletions akvo/rsr/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,9 @@ class OrganisationAdmin(TimestampsAdminDisplayMixin, ObjectPermissionsModelAdmin
# If the fieldsets are changed, the template may need fixing too
fieldsets = (
(_(u'General information'), {'fields': ('name', 'long_name', 'partner_types', 'organisation_type',
'new_organisation_type', 'logo', 'url', 'iati_org_id', 'language',
'content_owner', 'allow_edit',)}),
'new_organisation_type', 'logo', 'url', 'facebook', 'twitter',
'linkedin', 'iati_org_id', 'language', 'content_owner',
'allow_edit',)}),
(_(u'Contact information'), {'fields': ('phone', 'mobile', 'fax', 'contact_person', 'contact_email', ), }),
(_(u'About the organisation'), {'fields': ('description', 'notes',)}),
)
Expand Down
5 changes: 0 additions & 5 deletions akvo/rsr/migrations/0071_permissions.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,11 +204,6 @@ def backwards(self, orm):
'project': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'goals'", 'to': "orm['rsr.Project']"}),
'text': ('akvo.rsr.fields.ValidXMLCharField', [], {'max_length': '100', 'blank': 'True'})
},
'rsr.group': {
'Meta': {'object_name': 'Group'},
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'})
},
'rsr.indicator': {
'Meta': {'object_name': 'Indicator'},
'ascending': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}),
Expand Down

Large diffs are not rendered by default.

12 changes: 12 additions & 0 deletions akvo/rsr/models/organisation.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,18 @@ def image_path(instance, file_name):
blank=True,
help_text=_(u'Enter the full address of your web site, beginning with http://.'),
)
facebook = models.URLField(
blank=True,
help_text=_(u'Enter the full address of your Facebook page, beginning with http://.'),
)
twitter = models.URLField(
blank=True,
help_text=_(u'Enter the full address of your Twitter feed, beginning with http://.'),
)
linkedin = models.URLField(
blank=True,
help_text=_(u'Enter the full address of your LinkedIn page, beginning with http://.'),
)
phone = ValidXMLCharField(_(u'phone'), blank=True, max_length=20, help_text=_(u'(20 characters).'))
mobile = ValidXMLCharField(_(u'mobile'), blank=True, max_length=20, help_text=_(u'(20 characters).'))
fax = ValidXMLCharField(_(u'fax'), blank=True, max_length=20, help_text=_(u'(20 characters).'))
Expand Down
5 changes: 5 additions & 0 deletions akvo/rsr/models/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -465,6 +465,11 @@ def latest_update_fields(self):
latest_update_id=Max('project_updates__id'), latest_update_date=Max('project_updates__created_at')
)

def all_updates(self):
"return ProjectUpdates for self, newest first"
from .project_update import ProjectUpdate
return ProjectUpdate.objects.filter(project__in=self)

#the following 6 methods return organisation querysets!
def _partners(self, partner_type=None):
orgs = Organisation.objects.filter(partnerships__project__in=self)
Expand Down
7 changes: 7 additions & 0 deletions akvo/rsr/static/rsr/v3/css/src/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,13 @@ header {
text-transform: uppercase;
font-size: 0.875em; }

#draft {
background: #E04F46;
color: #fff;
padding: 10px;
text-align: center;
margin-bottom: 20px; }

#gallery {
height: 300px;
background: #ccc; }
Expand Down
7 changes: 7 additions & 0 deletions akvo/rsr/static/rsr/v3/css/src/main.scss
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,13 @@ header {
text-transform: uppercase;
font-size: 0.875em;
}
#draft {
background: #E04F46;
color: #fff;
padding: 10px;
text-align: center;
margin-bottom: 20px;
}
#gallery {
height: 300px;
background: #ccc;
Expand Down
5 changes: 5 additions & 0 deletions akvo/rsr/views/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,11 @@ def directory(request):

def main(request, project_id):
project = get_object_or_404(Project, pk=project_id)

# Non-editors are not allowed to view unpublished projects
if not project.is_published() and not request.user.has_perm('rsr.change_project', project):
raise PermissionDenied

carousel_data = _get_carousel_data(project)
updates = project.project_updates.all().order_by('-created_at')
accordion_data = _get_accordion_data(project)
Expand Down
4 changes: 2 additions & 2 deletions akvo/templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@

{# React #}
<script src="http://fb.me/react-0.10.0.js"></script>

{# Fonts #}
<link href="//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet">
<link href='//fonts.googleapis.com/css?family=Open+Sans:400,300,600,700,400italic,600italic,300italic|Montserrat:400,700|Raleway:400,500,600,700|Dancing+Script:400,700' rel='stylesheet' type='text/css'>
<link href="//fonts.googleapis.com/css?family=Open+Sans:400,300,600,700,400italic,600italic,300italic%7CMontserrat:400,700%7CRaleway:400,500,600,700%7CDancing+Script:400,700" rel="stylesheet" type="text/css">


{% compressed_css 'rsr_v3_style' %}
Expand Down
53 changes: 36 additions & 17 deletions akvo/templates/organisation_directory.html
Original file line number Diff line number Diff line change
Expand Up @@ -60,23 +60,42 @@
</div>

<section class="main-list organisations">
<ul class="container">
{% for o in page %}
<li class="row">
<div class="col-sm-3 col-md-2 col-xs-4 col-lg-2 thumbImg">
<a href="{% url 'organisation-main' o.id %}">
{# <img src="http://placehold.it/400x300"> #}
{% img o 250 250 o.title %}
</a>
</div>
<h1><a href="{% url 'organisation-main' o.id %}">{{o.name}}</a></h1>
<p>
<span class="glyphicon glyphicon-globe"></span> {{o.primary_location.country}}, {{o.primary_location.country.continent}}<br>
<span class="glyphicon glyphicon-tag"></span> {{o.get_new_organisation_type_display}}<br>
<span class="glyphicon glyphicon-folder-open"></span> {{o.published_projects.count}} {% trans "projects" %}
</p>
</li>
{% endfor %}
<ul class="container">
{% for o in page %}
<li class="row">
<div class="col-lg-2 col-sm-3 col-xs-5 thumbImg">
<a href="{% url 'organisation-main' o.id %}">
{% img o 200 200 o.title %}
</a>
</div>
<div class="col-lg-4 col-sm-3 col-xs-7">
<h1><a href="{% url 'organisation-main' o.id %}">{{o.name}}</a></h1>
<p class="small">
{% if o.iati_org_id %}{{o.iati_org_id}}<br>{% endif %}
<span class="glyphicon glyphicon-tag"></span> {{o.get_new_organisation_type_display}}<br>
{% if o.primary_location.country %}<span class="glyphicon glyphicon-globe"></span> {{o.primary_location.country}}, {{o.primary_location.country.continent}}{% endif %}
</p>
</div>
<div class="col-sm-3 hidden-xs hidden-sm">
<h4 class="detailedInfo">{% trans "Additional Information" %}</h4>
<p class="small">
<span class="glyphicon glyphicon-folder-open"></span> {{o.published_projects.count}} {% trans "projects" %}<br>
<span class="glyphicon glyphicon-user"></span> {{o.all_users.count}} {% trans "users" %}<br>
<span class="glyphicon glyphicon-list"></span> {{o.all_projects.all_updates.count}} {% trans "updates" %}
</p>
</div>
{% if o.facebook or o.twitter or o.linkedin %}
<div class="col-md-3 hidden-xs hidden-sm">
<h4 class="detailedInfo">{% trans "Social Media" %}</h4>
<p class="small">
{% if o.facebook %}<img src="http://www.lindersoft.com/images/Common/files/social-icon-sm-facebook.png"> <a href="{{o.facebook}}">Facebook</a><br>{% endif %}
{% if o.twitter %}<img src="http://www.cyfe.com/images/icon-twitter.png"> <a href="{{o.twitter}}">Twitter</a><br>{% endif %}
{% if o.linkedin %}<img src="http://www.bvgh.org/Portals/_default/Skins/_common/images/Linked-In-icon.png"> <a href="{{o.linkedin}}">LinkedIn</a>{% endif %}
</p>
</div>
{% endif %}
</li>
{% endfor %}
</ul>
</section>
</div>
Expand Down
85 changes: 35 additions & 50 deletions akvo/templates/project_directory.html
Original file line number Diff line number Diff line change
Expand Up @@ -273,58 +273,43 @@
{% for p in page %}
<li class="row">
<div class="col-lg-2 col-sm-3 col-xs-5 thumbImg">
{% comment %}
<a href="{% url 'project-main' p.id %}">
{# <img src="http://placehold.it/200x200" alt="{{p.title}}"> #}
{# <img src="/media/{{p.current_image}}" alt="{{p.title}}" /> #}
{% thumbnail p.current_image 200x200 upscale autocrop sharpen as project_image %}
{# <img src="{{project_image}}" alt="{{p.title" />
{% include "partials/img.html" with img=p.current_image size=200x200 title=p.title %}
{% img p 200 200 p.title %}
</a>
{# include "partials/img.html" with img=p.current_image size=200x200 title=p.title #}
{% img p 200 200 p.title %}
<img src="/media/{{p.current_image}}" alt="" />
{% thumbnail p.current_image "200x200" crop="center" as im %}
<img src="{{ im.url }}" width="{{img.width}}" height="{{im.height}}" />
{% endthumbnail %}
{% endcomment %}
<a href="{% url 'project-main' p.id %}">
{% img p 200 200 p.title %}
</a>
</div>
<div class="col-lg-4 col-sm-3 col-xs-7">
<h1><a href="{% url 'project-main' p.id %}">{{p.title}}</a></h1>
<p>{{p.subtitle}}</p>
<p><span class="glyphicon glyphicon-globe"></span> {{p.primary_location.country}}, {{p.primary_location.country.continent}}</p>
<p><span class="glyphicon glyphicon-folder-close"></span> <a href="{% url 'organisation-main' p.partners.all.0.id %}">{{p.partners.all.0}}</a> <a href="#" class="small">+{{p.partners.count|add:"-1"}} more</a></p>
</div>
<div class="col-sm-3 hidden-xs hidden-sm">
<h4 class="detailedInfo">{% trans "Focus Areas" %}</h4>
<p>
{% for area in p.focus_areas %}
<a href="#">{{area.name}}</a><br/>
{% endfor %}
</p>
<h4 class="detailedInfo">{% trans "Sectors" %}</h4>
<p>?</p>
<h4 class="detailedInfo">{% trans "Status" %}</h4>
<p>{{p.get_status_display}}</p>
</div>
<div class="col-md-3 hidden-xs hidden-sm">
<h4 class="detailedInfo">{% trans "Finance" %}</h4>
{% include "partials/project_budget.html" with project=p %}
</div>
<div class="col-xs-7 col-xs-offset-5 col-sm-6 col-sm-offset-0 visible-xs-block visible-sm">
<p class="small">
<span class="detailedInfo">{% trans "Focus Areas" %}</span>
{% for area in p.focus_areas %}<a href="#">{{area.name}}</a> {% endfor %}<br>
<span class="detailedInfo">{% trans "Sectors" %}</span> ? <a href="#" class="small">+4 more</a><br>
<span class="detailedInfo">{% trans "Status" %}</span> {{p.get_status_display}}<br>
<span class="detailedInfo">{% trans "Finance" %}</span>
{% widthratio p.funds p.budget 100 %}% {% trans "of" %} {{p.get_currency_display}}{{p.budget|floatformat|intcomma}}
</p>
</div>
</li>
</div>
<div class="col-lg-4 col-sm-3 col-xs-7">
<h1><a href="{% url 'project-main' p.id %}">{{p.title}}</a></h1>
<p>{{p.subtitle}}</p>
<p><span class="glyphicon glyphicon-globe"></span> {{p.primary_location.country}}, {{p.primary_location.country.continent}}</p>
<p><span class="glyphicon glyphicon-folder-close"></span> <a href="{% url 'organisation-main' p.partners.all.0.id %}">{{p.partners.all.0}}</a> <a href="#" class="small">+{{p.partners.count|add:"-1"}} more</a></p>
</div>
<div class="col-sm-3 hidden-xs hidden-sm">
<h4 class="detailedInfo">{% trans "Focus Areas" %}</h4>
<p>
{% for area in p.focus_areas %}
<a href="#">{{area.name}}</a><br/>
{% endfor %}
</p>
<h4 class="detailedInfo">{% trans "Sectors" %}</h4>
<p>?</p>
<h4 class="detailedInfo">{% trans "Status" %}</h4>
<p>{{p.get_status_display}}</p>
</div>
<div class="col-md-3 hidden-xs hidden-sm">
<h4 class="detailedInfo">{% trans "Finance" %}</h4>
{% include "partials/project_budget.html" with project=p %}
</div>
<div class="col-xs-7 col-xs-offset-5 col-sm-6 col-sm-offset-0 visible-xs-block visible-sm">
<p class="small">
<span class="detailedInfo">{% trans "Focus Areas" %}</span>
{% for area in p.focus_areas %}<a href="#">{{area.name}}</a> {% endfor %}<br>
<span class="detailedInfo">{% trans "Sectors" %}</span> ? <a href="#" class="small">+4 more</a><br>
<span class="detailedInfo">{% trans "Status" %}</span> {{p.get_status_display}}<br>
<span class="detailedInfo">{% trans "Finance" %}</span>
{% widthratio p.funds p.budget 100 %}% {% trans "of" %} {{p.get_currency_display}}{{p.budget|floatformat|intcomma}}
</p>
</div>
</li>
{% endfor %}
</ul>
</section>
Expand Down
3 changes: 3 additions & 0 deletions akvo/templates/project_main.html
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@
{% include "partials/project_header.html" %}

<div class="container">
{% if not project.is_published %}
<div id="draft" class="row">This is a draft view of the project. It can only be seen by Administrators and Project editors.</div>
{% endif %}
<div class="row">
<div class="col-sm-8">
<div id="carousel"></div>
Expand Down
57 changes: 32 additions & 25 deletions akvo/templates/update_directory.html
Original file line number Diff line number Diff line change
Expand Up @@ -61,31 +61,38 @@
</div>

<section class="main-list updates">
<ul class="container">
{% for u in page %}
<li class="row updateAsset">
<div class="col-sm-3 col-md-2 col-xs-4 col-lg-2 thumbImg">
<a href="{% url 'update-main' u.project.id u.id %}">
{% img u 220 220 u.title %}
</a>
</div>
<div class="col-sm-4 col-xs-8 col-md-5 col-lg-5">
<h1><a href="{% url 'update-main' u.project.id u.id %}">{{u.title}}</a></h1>
<p class="small"><span class="glyphicon glyphicon-folder-close"></span>
<a href="{% url 'project-main' u.project.pk %}">{{u.project.title}}</a><br>
<span class="glyphicon glyphicon-user"></span> {% trans "Person" %} (Partner)<br>
<span class="glyphicon glyphicon-map-marker"></span> {% trans "Location" %}
{{u.primary_location.country.continent}}, {{u.primary_location.country}} <br>
{{u.created_at|date:"d-M-Y"}}</p>
</div>
<div class="excerpt small col-sm-5 col-xs-12 col-md-5 col-lg-5 hidden-xs">
{% autoescape off %}
{{ u.text|force_escape|urlize|apply_markup:"markdown" }}
{% endautoescape %}
</div>
</li>
{% endfor %}
</ul>
<ul class="container">
{% for u in page %}
<li class="row updateAsset">
<div class="col-sm-3 col-md-2 col-xs-4 col-lg-2 thumbImg">
<a href="{% url 'update-main' u.project.id u.id %}">
{% img u 220 220 u.title %}
</a>
</div>
<div class="col-sm-4 col-xs-8 col-md-5 col-lg-5">
<h1><a href="{% url 'update-main' u.project.id u.id %}">{{u.title}}</a></h1>
<p class="small"><span class="glyphicon glyphicon-folder-close"></span> <a href="{% url 'project-main' u.project.pk %}">{{u.project.title}}</a><br>
<span class="glyphicon glyphicon-user"></span> {{u.user.first_name}} {{u.user.last_name}}
{% if u.user.approved_organisations %}
{% with org=u.user.approved_organisations.0 %}
(<a href="{% url 'organisation-main' org.pk %}">{{org.long_name}}</a>)
{% endwith %}
{% endif %}
<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"}}
</p>
</div>
<div class="excerpt small col-sm-5 col-xs-12 col-md-5 col-lg-5 hidden-xs">
{% autoescape off %}
{{ u.text|force_escape|urlize|apply_markup:"markdown" }}
{% endautoescape %}
</div>
</li>
{% endfor %}
</ul>
</section>

<div class="container-fluid">
Expand Down

0 comments on commit 237f99f

Please sign in to comment.