Show user's task on /attract
This commit is contained in:
@@ -2,18 +2,28 @@ import functools
|
||||
import logging
|
||||
|
||||
from flask import Blueprint, render_template
|
||||
import flask_login
|
||||
|
||||
from pillar.api.utils import jsonify
|
||||
from pillar.web.system_util import pillar_api
|
||||
import pillarsdk
|
||||
|
||||
from attract import current_attract
|
||||
|
||||
blueprint = Blueprint('attract', __name__)
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@blueprint.route('/')
|
||||
def index():
|
||||
return render_template('attract/index.html')
|
||||
user = flask_login.current_user
|
||||
if user.is_authenticated:
|
||||
tasks = current_attract.task_manager.tasks_for_user(user.objectid)
|
||||
else:
|
||||
tasks = None
|
||||
|
||||
return render_template('attract/index.html',
|
||||
tasks=tasks)
|
||||
|
||||
|
||||
def error_project_not_setup_for_attract():
|
||||
|
@@ -5,21 +5,12 @@
|
||||
#dashboard
|
||||
.row
|
||||
.col-md-6
|
||||
h3 My Tasks
|
||||
a.pull-right
|
||||
small View All
|
||||
|
||||
#task-list.col-list
|
||||
- for (var i = 0; i < 15; ++i) {
|
||||
a.col-list-item.task-list-item(
|
||||
id="task-(TASK_ID)",
|
||||
class="status-review task-link",
|
||||
href="#")
|
||||
span.status-indicator
|
||||
span.name Task Name
|
||||
span.type type
|
||||
- }
|
||||
|
||||
| {% if current_user.is_authenticated %}
|
||||
| {% from "attract/tasks/task_list_for_user.html" import task_list_for_user %}
|
||||
| {{ task_list_for_user(tasks['_meta']['total'], tasks['_items']) }}
|
||||
| {% else %}
|
||||
| {% include "attract/index_anon_left_column.html" %}
|
||||
| {% endif %}
|
||||
.col-md-6
|
||||
h3 Latest Edit
|
||||
img.img-responsive(src="//placehold.it/500x250")
|
||||
|
3
src/templates/attract/index_anon_left_column.jade
Normal file
3
src/templates/attract/index_anon_left_column.jade
Normal file
@@ -0,0 +1,3 @@
|
||||
h3 Welcome to Attract
|
||||
|
||||
p This is the left column. It contains left-handed things.
|
@@ -3,21 +3,8 @@
|
||||
| {% block page_title %}Tasks for you{% endblock %}
|
||||
| {% block body %}
|
||||
#col_main
|
||||
.col_header.task-list-header
|
||||
| Your tasks ({{ task_count }})
|
||||
|
||||
#task-list.col-list
|
||||
| {% for task in tasks %}
|
||||
//- NOTE: this is tightly linked to the JS in tasks.js, function task_add()
|
||||
a.col-list-item.task-list-item(
|
||||
class="status-{{ task.properties.status }} task-link",
|
||||
title="In project '{{ task._project_info.name }}'",
|
||||
href="{{ url_for('attract.tasks.perproject.view_task', project_url=task._project_info.url, task_id=task._id) }}")
|
||||
span.status-indicator
|
||||
span.name {{ task.name }}
|
||||
span.type {{ task.properties.task_type }}
|
||||
| {% endfor %}
|
||||
|
||||
| {% from "attract/tasks/task_list_for_user.html" import task_list_for_user %}
|
||||
| {{ task_list_for_user(task_count, tasks) }}
|
||||
.col-splitter
|
||||
|
||||
#col_right
|
||||
|
19
src/templates/attract/tasks/task_list_for_user.jade
Normal file
19
src/templates/attract/tasks/task_list_for_user.jade
Normal file
@@ -0,0 +1,19 @@
|
||||
| {% macro task_list_for_user(task_count, tasks, include_shotname=True) -%}
|
||||
.col_header.task-list-header
|
||||
| Your tasks ({{ task_count }})
|
||||
|
||||
#task-list.col-list
|
||||
| {% for task in tasks %}
|
||||
//- NOTE: this is tightly linked to the JS in tasks.js, function task_add()
|
||||
a.col-list-item.task-list-item(
|
||||
class="status-{{ task.properties.status }} task-link",
|
||||
title="In project '{{ task._project_info.name }}'",
|
||||
href="{{ url_for('attract.tasks.perproject.view_task', project_url=task._project_info.url, task_id=task._id) }}")
|
||||
span.status-indicator
|
||||
span.name {{ task.name }}
|
||||
| {% if include_shotname and task._parent_info %}
|
||||
span.shotname {{ task._parent_info.name }}
|
||||
| {% endif %}
|
||||
span.type {{ task.properties.task_type }}
|
||||
| {% endfor %}
|
||||
| {%- endmacro %}
|
Reference in New Issue
Block a user