Skip to content

Commit

Permalink
[feature] add gallery template
Browse files Browse the repository at this point in the history
- allow for users to view images they have edited
  • Loading branch information
collinmutembei committed Mar 29, 2016
1 parent 5288080 commit 2c1209e
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 10 deletions.
6 changes: 3 additions & 3 deletions app/templates/dashboard.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
{% endif %}
</a>
<ul class="dropdown-menu">
<li><a href="#" class="dec small">Gallery</a></li>
<li><a href="/gallery" class="dec small" target="_self">Gallery</a></li>
<li class="divider"></li>
<li><a href="/accounts/logout/" class="dec small">Logout</a></li>
</ul>
Expand Down Expand Up @@ -108,7 +108,7 @@
</div>
</div>
</div>
<footer class="footer-custom">
<!-- <footer class="footer-custom">
<div class="container">
<div class="footer-left">
<h2>PHEDIT</h2>
Expand All @@ -118,5 +118,5 @@ <h2>PHEDIT</h2>
<a href="//github.com/andela-cmutembei/IV"><i class="fa fa-github"></i></a>
</div>
</div>
</footer>
</footer> -->
{% endblock %}
16 changes: 16 additions & 0 deletions app/templates/gallery.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{% extends "index.html" %}

{% block content %}

{% verbatim %}
<div class="container">
<div class="row">
<h1 class="gallery">Gallery</h1>
<div class="row" ng-repeat="image in gallery | orderBy: '-created_at'">
<div class="col-lg-3 col-sm-4 col-xs-6"><a title="{{image.id}}" href="#"><img class="thumbnail img-responsive" ng-src="{{image.phedited_image}}" alt="{{image.id}}"></a></div>
</div>
</div>
</div>
{% endverbatim %}

{% endblock %}
9 changes: 9 additions & 0 deletions app/templates/static/scripts/controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,4 +99,13 @@ angular.module('pheditApp').controller('MyCtrl', ['$scope', 'Upload', 'MainServi
$scope.loading = false;
});

MainService.image_effects.get_effects().
$promise.
then(function(result){
$scope.gallery = result
}).
catch(function(response){
console.log("failed to fetch images");
});

}]);
10 changes: 4 additions & 6 deletions app/templates/static/styles/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -601,12 +601,6 @@ input[type=checkbox] {
margin-right: 2px;
}

/*.logout-btn {
border: 1px solid #292c2f;;
margin-right: 10px;
margin-top: 22px;
color: #000;
}*/

.clearcanvas .btn {
height: 36px;
Expand Down Expand Up @@ -634,3 +628,7 @@ input[type=checkbox] {
from { transform: scale(1) rotate(0deg);}
to { transform: scale(1) rotate(360deg);}
}

.gallery {
color: #000;
}
3 changes: 2 additions & 1 deletion app/urls.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
from django.conf.urls import url
from app.views import landing, dashboard
from app.views import landing, dashboard, gallery

urlpatterns = [
url(r'^$', landing),
url(r'^app/', dashboard),
url(r'^gallery/', gallery),
]
8 changes: 8 additions & 0 deletions app/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,11 @@ def dashboard(request):
if request.user.is_authenticated():
return render(request, 'dashboard.html')
return HttpResponseRedirect("/")


def gallery(request):
"""renders the gallery for all images
"""
if request.user.is_authenticated():
return render(request, 'gallery.html')
return HttpResponseRedirect("/")

0 comments on commit 2c1209e

Please sign in to comment.