Changed URL to /attract/<project_url>/tasks/...

The overall tasks index is still /attract/tasks though.
This commit is contained in:
2016-09-21 10:49:34 +02:00
parent 7b72289ddd
commit 486f947a90
4 changed files with 14 additions and 8 deletions

View File

@@ -54,7 +54,11 @@ class AttractExtension(PillarExtension):
from . import modules, tasks
return [modules.blueprint, tasks.blueprint]
return [
modules.blueprint,
tasks.blueprint,
tasks.perproject_blueprint,
]
@property
def template_path(self):

View File

@@ -11,6 +11,8 @@ from .node_types.task import node_type_task
from . import current_task_manager
blueprint = Blueprint('attract.tasks', __name__, url_prefix='/tasks')
perproject_blueprint = Blueprint('attract.tasks.perproject', __name__,
url_prefix='/<project_url>/tasks')
log = logging.getLogger(__name__)
@@ -19,7 +21,7 @@ def index():
return render_template('attract/tasks/index.html')
@blueprint.route('/<project_url>/')
@perproject_blueprint.route('/')
@attract_project_view()
def for_project(project):
api = pillar_api()
@@ -35,7 +37,7 @@ def for_project(project):
project=project)
@blueprint.route('/<project_url>/<task_id>')
@perproject_blueprint.route('/<task_id>')
@attract_project_view(extension_props=True)
def view_embed_task(project, attract_props, task_id):
api = pillar_api()
@@ -51,7 +53,7 @@ def view_embed_task(project, attract_props, task_id):
attract_props=attract_props.to_dict())
@blueprint.route('/<project_url>/<task_id>', methods=['POST'])
@perproject_blueprint.route('/<task_id>', methods=['POST'])
@attract_project_view()
def save(project, task_id):
log.info('Saving task %s', task_id)
@@ -63,8 +65,8 @@ def save(project, task_id):
# TODO: remove GET method once Pablo has made a proper button to call this URL with a POST.
@blueprint.route('/<project_url>/create', methods=['POST', 'GET'])
@blueprint.route('/<project_url>/create/<task_type>', methods=['POST', 'GET'])
@perproject_blueprint.route('/create', methods=['POST', 'GET'])
@perproject_blueprint.route('/create/<task_type>', methods=['POST', 'GET'])
@attract_project_view()
def create_task(project, task_type=None):
task = current_task_manager.create_task(project, task_type=task_type)