Tasks Index for a Project
Work in progress
This commit is contained in:
@@ -1,4 +1,11 @@
|
||||
| {% extends 'layout.html' %}
|
||||
doctype html
|
||||
html(lang="en")
|
||||
head
|
||||
meta(charset="utf-8")
|
||||
title {% if self.page_title() %}{% block page_title %}{% endblock %} — {% endif %}Attract
|
||||
meta(name="viewport", content="width=device-width, initial-scale=1.0")
|
||||
|
||||
| {% block head %}{% endblock %}
|
||||
| {% block head %}
|
||||
style(type='text/css').
|
||||
option.invalid_task {
|
||||
@@ -6,3 +13,36 @@ style(type='text/css').
|
||||
background-color: #fee;
|
||||
}
|
||||
| {% endblock %}
|
||||
|
||||
script(src="{{ url_for('static_pillar', filename='assets/js/vendor/jquery-3.1.0.min.js')}}")
|
||||
|
||||
link(href='//fonts.googleapis.com/css?family=Roboto:300,400', rel='stylesheet', type='text/css')
|
||||
|
||||
link(href="{{ url_for('static_pillar', filename='assets/css/vendor/bootstrap.min.css') }}", rel="stylesheet")
|
||||
link(href="{{ url_for('static_attract', filename='assets/css/main.css') }}", rel="stylesheet")
|
||||
|
||||
| {% block style %}{% endblock %}
|
||||
|
||||
body
|
||||
#app-main
|
||||
#col_left
|
||||
nav.sidebar(role="navigation")
|
||||
dl
|
||||
dd
|
||||
a(href="") A
|
||||
dd
|
||||
a(href="") B
|
||||
dd
|
||||
a(href="") C
|
||||
dd
|
||||
a(href="") A
|
||||
|
||||
| {% block body %}
|
||||
#col_main
|
||||
h1 Main
|
||||
#col_right
|
||||
h1 Right
|
||||
| {% endblock %}
|
||||
|
||||
| {% block footer_scripts %}{% endblock %}
|
||||
|
||||
|
@@ -1,40 +1,49 @@
|
||||
| {% extends 'attract/layout.html' %}
|
||||
| {% block page_title %}Tasks{% endblock %}
|
||||
| {% block body %}
|
||||
#page-container
|
||||
#page-header
|
||||
.page-title
|
||||
| Tasks for project {{ project.name }}
|
||||
|
||||
#page-content
|
||||
.page-triplet-container.homepage
|
||||
.row
|
||||
.col-md-4
|
||||
p hey, here's a column too!
|
||||
.col-md-4
|
||||
.list-group#task-list
|
||||
| {% for task in tasks %}
|
||||
//- NOTE: this is tightly linked to the JS in tasks.js.
|
||||
a.list-group-item(id="task-{{task._id}}",href="javascript:open_task('{{ task._id }}');") {{ task.name }}
|
||||
| {% endfor %}
|
||||
.col-md-4
|
||||
.well
|
||||
#task-details
|
||||
| {% block page_title %}Tasks - {{ project.name }} {% endblock %}
|
||||
|
||||
| {% block style %}
|
||||
link(href="{{ url_for('static_attract', filename='assets/css/tasks.css') }}", rel="stylesheet")
|
||||
| {% endblock %}
|
||||
|
||||
| {% block body %}
|
||||
#col_main
|
||||
.col_header
|
||||
| Tasks - {{ project.name }}
|
||||
a#task-add(href="javascript:task_create();") + Create Task
|
||||
|
||||
#task-list.col-list
|
||||
| {% for task in tasks %}
|
||||
//- NOTE: this is tightly linked to the JS in tasks.js.
|
||||
a.col-list-item.task-list-item(
|
||||
id="task-{{task._id}}",
|
||||
class="status-{{ task.properties.status }}"
|
||||
href="javascript:task_open('{{ task._id }}');")
|
||||
span.status-indicator(class="{{ task.properties.status }}")
|
||||
span.name {{ task.name }}
|
||||
span.status {{ task.properties.status | undertitle }}
|
||||
| {% endfor %}
|
||||
#col_right
|
||||
.col_header
|
||||
| Task Details
|
||||
#status-bar Esa!
|
||||
#task-details
|
||||
| {% endblock %}
|
||||
|
||||
| {% block footer_scripts %}
|
||||
script.
|
||||
/**
|
||||
* Shows a task in the #task-details div.
|
||||
*/
|
||||
function open_task(task_id) {
|
||||
function task_open(task_id) {
|
||||
if (task_id === undefined) {
|
||||
if (console) console.log("open_task(undefined) called.");
|
||||
if (console) console.log("task_open(undefined) called.");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
$('#task-list').find('a').removeClass('active');
|
||||
$('#task-' + task_id).addClass('active');
|
||||
|
||||
|
||||
var base_url = "{{ url_for('attract.tasks.view_embed_task', project_url=project.url, task_id='TASKID') }}";
|
||||
var task_url = base_url.replace("TASKID", task_id);
|
||||
|
||||
@@ -48,4 +57,23 @@ script.
|
||||
$('#task-details').html(xhr.responseText);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a task and show it in the #task-details div.
|
||||
*/
|
||||
function task_create() {
|
||||
var base_url = "{{ url_for('attract.tasks.create_task', project_url=project.url) }}";
|
||||
|
||||
$.get(base_url, function(task_data) {
|
||||
|
||||
task_open(task_data.task_id);
|
||||
|
||||
}).fail(function(xhr) {
|
||||
if (console) {
|
||||
console.log('Error creating task');
|
||||
console.log('XHR:', xhr);
|
||||
}
|
||||
$('#task-details').html(xhr.responseText);
|
||||
});
|
||||
}
|
||||
| {% endblock %}
|
||||
|
@@ -1,10 +1,10 @@
|
||||
| {% extends 'attract/layout.html' %}
|
||||
| {% block page_title %}Tasks{% endblock %}
|
||||
| {% block page_title %}Tasks | {{ project.name }} {% endblock %}
|
||||
| {% block body %}
|
||||
#page-container
|
||||
#page-header
|
||||
.page-title
|
||||
| Attract - tasks
|
||||
| Attract - Tasks
|
||||
|
||||
#page-content
|
||||
.page-triplet-container.homepage
|
||||
|
@@ -1,12 +1,23 @@
|
||||
script(src="{{ url_for('static_attract', filename='js/tasks.js') }}",async=true)
|
||||
.task
|
||||
#task-view
|
||||
form(onsubmit="return save_task('{{task._id}}', '{{ url_for('attract.tasks.save', project_url=project['url'], task_id=task._id) }}')")
|
||||
.input-group
|
||||
span.input-group-addon#task-addon-name(title='Name') N
|
||||
input.form-control(name="name",autofocus=true,type=text,placeholder='Task name',aria-describedby="task-addon-name",value="{{ task.name|hide_none }}")
|
||||
.input-group
|
||||
span.input-group-addon#task-addon-type(title='Task type') T
|
||||
select.form-control(name="task_type",aria-describedby="task-addon-task_type")
|
||||
.input-transparent-group
|
||||
input.input-transparent.task-name(
|
||||
name="name",
|
||||
type=text,
|
||||
placeholder='Name',
|
||||
aria-describedby="task-addon-name",
|
||||
value="{{ task.name|hide_none }}")
|
||||
|
||||
.input-transparent-group
|
||||
textarea.input-transparent(
|
||||
name="description",
|
||||
type=text,
|
||||
placeholder='Description',
|
||||
aria-describedby="task-addon-description") {{ task.description|hide_none }}
|
||||
|
||||
.input-transparent-group
|
||||
select.input-transparent(name="task_type",aria-describedby="task-addon-task_type")
|
||||
| {% for task_type in attract_props.task_types.attract_shot %}
|
||||
| <option value="{{ task_type }}" {% if task_type == task.properties.task_type %}selected{% endif %}>{{ task_type|undertitle }}</option>
|
||||
| {% endfor %}
|
||||
@@ -14,14 +25,13 @@ script(src="{{ url_for('static_attract', filename='js/tasks.js') }}",async=true)
|
||||
option(value="{{ task.properties.task_type }}",selected).invalid_task {{ task.properties.task_type|undertitle }}
|
||||
| {% endif %}
|
||||
|
||||
.input-group
|
||||
span.input-group-addon#task-addon-description(title='Description') D
|
||||
textarea.form-control(name="description",type=text,placeholder='Task description',aria-describedby="task-addon-description") {{ task.description|hide_none }}
|
||||
.input-group
|
||||
span.input-group-addon#task-addon-status(title='Status') S
|
||||
select.form-control(name="status",aria-describedby="task-addon-status")
|
||||
.input-transparent-group
|
||||
select.input-transparent(
|
||||
name="status",
|
||||
aria-describedby="task-addon-status")
|
||||
| {% for status in task_node_type.dyn_schema.status.allowed %}
|
||||
| <option value="{{ status }}" {% if status == task.properties.status %}selected{% endif %}>{{ status|undertitle }}</option>
|
||||
| {% endfor %}
|
||||
.input-group
|
||||
|
||||
.input-transparent-group
|
||||
button.btn.btn-default(type=submit) Save task
|
||||
|
Reference in New Issue
Block a user