Show user's task on /attract
This commit is contained in:
@@ -2,18 +2,28 @@ import functools
|
|||||||
import logging
|
import logging
|
||||||
|
|
||||||
from flask import Blueprint, render_template
|
from flask import Blueprint, render_template
|
||||||
|
import flask_login
|
||||||
|
|
||||||
from pillar.api.utils import jsonify
|
from pillar.api.utils import jsonify
|
||||||
from pillar.web.system_util import pillar_api
|
from pillar.web.system_util import pillar_api
|
||||||
import pillarsdk
|
import pillarsdk
|
||||||
|
|
||||||
|
from attract import current_attract
|
||||||
|
|
||||||
blueprint = Blueprint('attract', __name__)
|
blueprint = Blueprint('attract', __name__)
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
@blueprint.route('/')
|
@blueprint.route('/')
|
||||||
def index():
|
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():
|
def error_project_not_setup_for_attract():
|
||||||
|
@@ -5,21 +5,12 @@
|
|||||||
#dashboard
|
#dashboard
|
||||||
.row
|
.row
|
||||||
.col-md-6
|
.col-md-6
|
||||||
h3 My Tasks
|
| {% if current_user.is_authenticated %}
|
||||||
a.pull-right
|
| {% from "attract/tasks/task_list_for_user.html" import task_list_for_user %}
|
||||||
small View All
|
| {{ task_list_for_user(tasks['_meta']['total'], tasks['_items']) }}
|
||||||
|
| {% else %}
|
||||||
#task-list.col-list
|
| {% include "attract/index_anon_left_column.html" %}
|
||||||
- for (var i = 0; i < 15; ++i) {
|
| {% endif %}
|
||||||
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
|
|
||||||
- }
|
|
||||||
|
|
||||||
.col-md-6
|
.col-md-6
|
||||||
h3 Latest Edit
|
h3 Latest Edit
|
||||||
img.img-responsive(src="//placehold.it/500x250")
|
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 page_title %}Tasks for you{% endblock %}
|
||||||
| {% block body %}
|
| {% block body %}
|
||||||
#col_main
|
#col_main
|
||||||
.col_header.task-list-header
|
| {% from "attract/tasks/task_list_for_user.html" import task_list_for_user %}
|
||||||
| Your tasks ({{ task_count }})
|
| {{ task_list_for_user(task_count, tasks) }}
|
||||||
|
|
||||||
#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 %}
|
|
||||||
|
|
||||||
.col-splitter
|
.col-splitter
|
||||||
|
|
||||||
#col_right
|
#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