Skip to content

Commit

Permalink
Add a project browser blueprint
Browse files Browse the repository at this point in the history
References #4.
  • Loading branch information
othieno committed Aug 5, 2016
1 parent f865f54 commit a5c0696
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 0 deletions.
13 changes: 13 additions & 0 deletions geotagx/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ def setup(self):

setup_survey(app)
setup_sourcerer(app)
setup_project_browser(app)


def setup_default_configuration(app, default_configuration):
Expand Down Expand Up @@ -106,3 +107,15 @@ def setup_sourcerer(app, url_prefix="/sourcerer"):
from view.sourcerer import blueprint

app.register_blueprint(blueprint, url_prefix=url_prefix)


def setup_project_browser(app, url_prefix="/browse"):
"""Sets up the project browser blueprint.
Args:
app (werkzeug.local.LocalProxy): The current application's instance.
url_prefix (str): The blueprint's URL prefix.
"""
from view.project_browser import blueprint

app.register_blueprint(blueprint, url_prefix=url_prefix)
40 changes: 40 additions & 0 deletions geotagx/view/project_browser.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# -*- coding: utf-8 -*-
#
# This module is part of the GeoTag-X PyBossa plugin. It contains a Flask Blueprint
# implementation that offers an alternative approach to browsing PyBossa projects.
#
# Author: Jeremy Othieno ([email protected])
#
# Copyright (c) 2016 UNITAR/UNOSAT
#
# The MIT License (MIT)
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
# DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
# OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
# OR OTHER DEALINGS IN THE SOFTWARE.
from flask import Blueprint, render_template

blueprint = Blueprint("geotagx-project-browser", __name__)


@blueprint.route("/")
def index():
"""Renders the project browser's index page.
Returns:
unicode: The page's rendered HTML.
"""
return render_template("projects/browse.html")

0 comments on commit a5c0696

Please sign in to comment.