Skip to content

Commit

Permalink
Merge pull request #41 from robotichead/development-0.12.1
Browse files Browse the repository at this point in the history
Development 0.12.1
  • Loading branch information
robotichead authored Apr 18, 2018
2 parents c1578fe + 5ccd8d8 commit 29616af
Show file tree
Hide file tree
Showing 19 changed files with 321 additions and 62 deletions.
21 changes: 18 additions & 3 deletions forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -670,6 +670,15 @@ class kanban_board_form(forms.Form):
)


class kanban_edit_xy_name_form(forms.Form):
kanban_xy_name=forms.CharField(
max_length=50,
widget=TextInput(attrs={
'placeholder': 'Column/Level Name',
}),
)


class kanban_properties_form(ModelForm):
kanban_board_name=forms.CharField(
max_length=255,
Expand All @@ -695,6 +704,10 @@ def __init__(self, *args, **kwargs):

self.fields['kanban_column'].queryset = kanban_column.objects.filter(kanban_board=kanban_board_id)
self.fields['kanban_level'].queryset = kanban_level.objects.filter(kanban_board=kanban_board_id)

self.fields['kanban_column'].empty_label = None
self.fields['kanban_level'].empty_label = None

class Meta:
model = kanban_card
fields = {
Expand Down Expand Up @@ -1472,19 +1485,19 @@ class product_and_service_form(ModelForm):
product_name = forms.CharField(
max_length=255,
widget=forms.TextInput(attrs={
'placeholder': 'Product Name'
'placeholder': 'Product/Service Name'
}),
)
product_part_number = forms.CharField(
max_length=255,
widget=forms.TextInput(attrs={
'placeholder': 'Product Part Number'
'placeholder': 'Product/Service Part Number'
}),
)
product_description = forms.CharField(
required=False,
widget=forms.Textarea(attrs={
'placeholder': 'Product Description'
'placeholder': 'Product/Service Description'
}),
)
class Meta:
Expand Down Expand Up @@ -1886,6 +1899,7 @@ class user_information_form(ModelForm):
'type': 'password',
'placeholder': 'Password',
'onkeyup': 'enable_submit()',
'autocomplete': 'off',
})
)
password2 = forms.CharField(
Expand All @@ -1895,6 +1909,7 @@ class user_information_form(ModelForm):
'type': 'password',
'placeholder': 'Repeate Password',
'onkeyup': 'enable_submit()',
'autocomplete': 'off',
})
)
username = forms.CharField(
Expand Down
20 changes: 20 additions & 0 deletions migrations/0011_permission_set_tax.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.7 on 2018-04-08 22:14
from __future__ import unicode_literals

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('NearBeach', '0010_list_of_bug_client_api_bug'),
]

operations = [
migrations.AddField(
model_name='permission_set',
name='tax',
field=models.IntegerField(choices=[(0, 'No Permission'), (1, 'Read Only'), (2, 'Edit Only'), (3, 'Add and Edit'), (4, 'Full Permission')], default=0),
),
]
6 changes: 6 additions & 0 deletions models.py
Original file line number Diff line number Diff line change
Expand Up @@ -1470,6 +1470,7 @@ def get_by_natural_key(
requirement,
requirement_link,
task,
tax,
documents,
contact_history,
kanban_comment,
Expand Down Expand Up @@ -1500,6 +1501,7 @@ def get_by_natural_key(
requirement=requirement,
requirement_link=requirement_link,
task=task,
tax=tax,
documents=documents,
contact_history=contact_history,
kanban_comment=kanban_comment,
Expand Down Expand Up @@ -1600,6 +1602,10 @@ class permission_set(models.Model):
choices=PERMISSION_LEVEL,
default=0,
)
tax = models.IntegerField(
choices=PERMISSION_LEVEL,
default=0,
)
"""
ADDITIVE PERMISSIONS
~~~~~~~~~~~~~~~~~~~~
Expand Down
4 changes: 2 additions & 2 deletions templates/NearBeach/bug_client_information.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{% extends "./template.html" %}
{% block content %}
{% load static %} %}
{% load static %}
<h2>Bug Client Information</h2>
<form action={% url 'bug_client_information' bug_client_id %} method="post" class="bug_client_information" id="input-form">
{% csrf_token %}
Expand All @@ -9,7 +9,7 @@ <h2>Bug Client Information</h2>
<li>{{ bug_client_form.bug_client_name }}</li>
<li>{{ bug_client_form.list_of_bug_client }}</li>
<li>{{ bug_client_form.bug_client_url }}</li>
<li><input type="submit" value="Update Bug Client"></li>
<li><input type="submit" value="Update Bug Client"><a href="{% url 'bug_client_list' %}">Cancel</a></li>
<li>Please note: NearBeach checks the connection of the bug client by;
<ol>
<li>Connecting to the bug client</li>
Expand Down
6 changes: 3 additions & 3 deletions templates/NearBeach/dashboard_widgets/active_projects.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ <h2>Projects Assigned to me</h2>
</tr>
{% for row in assigned_users_results %}
<tr>
<td><a href="{% url 'project_information' row.project_id.project_id %}">PRO{{ row.project_id.project_id }}</a></td>
<td>{{ row.project_id.project_name }}</td>
<td>{{ row.project_id.project_end_date }}</td>
<td><a href="{% url 'project_information' row.project_id__project_id %}">PRO{{ row.project_id__project_id }}</a></td>
<td>{{ row.project_id__project_name }}</td>
<td>{{ row.project_id__project_end_date }}</td>
</tr>
{% endfor %}
</table>
Expand Down
6 changes: 3 additions & 3 deletions templates/NearBeach/dashboard_widgets/active_tasks.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ <h2>Tasks Assigned to me</h2>
</tr>
{% for row in assigned_users_results %}
<tr>
<td><a href="{% url 'task_information' row.task_id.tasks_id%}">Task{{ row.task_id.tasks_id }}</a></td>
<td>{{ row.task_id.task_short_description}}</td>
<td>{{ row.task_id.task_end_date }}</td>
<td><a href="{% url 'task_information' row.task_id__tasks_id%}">Task{{ row.task_id__tasks_id }}</a></td>
<td>{{ row.task_id__task_short_description}}</td>
<td>{{ row.task_id__task_end_date }}</td>
</tr>
{% endfor %}
</table>
Expand Down
14 changes: 14 additions & 0 deletions templates/NearBeach/group_information.html
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,20 @@ <h2>Group List</h2>
})
});

function close_group_create() {
$("#create_group").html('<a href="javascript:void(0)" onclick="load_create_group()">Create New Group</a>');
}


function close_group_edit() {
$("#edit_group").html("");
$("#user_list").html("");
$("#add_permission_set").html("");

}



function on_page_load() {
load_group_list();
}
Expand Down
2 changes: 1 addition & 1 deletion templates/NearBeach/groups/groups_create.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{% csrf_token %}
<ul>
<li>{{ groups_form.group_name }}</li>
<li><input type="submit" value="Submit New Group"></li>
<li><input type="submit" value="Submit New Group"><a href="javascript:void(0)" onclick="close_group_create()">Close</a></li>
</ul>
2 changes: 1 addition & 1 deletion templates/NearBeach/groups/groups_edit.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<h2>Edit Groups</h2>
<ul>
<li>{{ groups_form.group_name }}</li>
<li><input type="submit" value="Save Changes"></li>
<li><input type="submit" value="Save Changes"><a href="javascript:void(0)" onclick="close_group_edit()">Close</a> </li>
<li value="{{ group_id }}" id="edit_group_id"></li>
</ul>
{% endif %}
Expand Down
5 changes: 5 additions & 0 deletions templates/NearBeach/kanban/kanban_edit_xy_name.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{% csrf_token %}
<ul>
<li>{{ kanban_edit_xy_name_form.kanban_xy_name }}</li>
<li><input type="submit" value="Save Changes"><a href="javascript:void(0)">Cancel</a></li>
</ul>
96 changes: 86 additions & 10 deletions templates/NearBeach/kanban/kanban_properties.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
{% extends "../template.html" %}
{% block content %}
{% load static %}
<style>
.drag_element {
opacity: 0.4;
}

.over {
border-top: 2px solid blue;
}
</style>
<script type="text/javascript" src="{% static 'NearBeach/javascript/csrf_finder.js' %}"></script>
<script type="text/javascript" src="{% static 'NearBeach/javascript/jquery/jquery-3.2.1.min.js' %}"></script>
<h2>Kanban Properties</h2>
Expand All @@ -14,7 +23,7 @@ <h3>Columns</h3>
<td>
<ul id="columns">
{% for row in kanban_column_results %}
<li class="column_title" data-id="{{ row.kanban_column_id }}">{{ row.kanban_column_name }}</li>
<li class="column_title" draggable="true" data-id="{{ row.kanban_column_id }}" value="{{ row.kanban_column_id }}">{{ row.kanban_column_name }}</li>
{% endfor %}
</ul>
</td>
Expand All @@ -28,7 +37,7 @@ <h3>Levels</h3>
<td>
<ul id="levels">
{% for row in kanban_level_results %}
<li class="level_title" data-id="{{ row.kanban_level_id }}">{{ row.kanban_level_name }}</li>
<li class="level_title" draggable="true" data-id="{{ row.kanban_level_id }}" value="{{ row.kanban_level_id }}">{{ row.kanban_level_name }}</li>
{% endfor %}
</ul>
</td>
Expand All @@ -38,7 +47,10 @@ <h3>Levels</h3>
</form>

<script>
$('document').ready(on_page_load());
//Page variables
var drag_source_element = null;


$("#kanban_properties_form").on('submit', function(event) {
event.preventDefault();

Expand All @@ -47,15 +59,11 @@ <h3>Levels</h3>
var column = {};

column.id = this.value;
column.title = $(this).text()
column.title = $(this).text();

return column;
});

/*
*/


//Get the JSON data ready
var levels = $("#levels").find("li").map(function() {
Expand All @@ -67,6 +75,7 @@ <h3>Levels</h3>
return level;
});


data_to_send = {
"columns": columns,
"levels": levels,
Expand Down Expand Up @@ -98,9 +107,76 @@ <h3>Levels</h3>
});
});

function on_page_load() {
function handle_drag_start(element) {
// Set the drag source element as this element
drag_source_element = this;

element.dataTransfer.effectAllowed = 'move';
element.dataTransfer.setData('text/html', this.outerHTML);

this.classList.add('drag_element');
}
</script>

function handle_drag_over(element) {
if (element.preventDefault) {
element.preventDefault();
}

this.classList.add('over');

element.dataTransfer.dropEffect = 'move';

return false;
}

function handle_drag_enter(element) {
//Left empty at the moment.
}

function handle_drag_leave() {
this.classList.remove('over');
}

function handle_drop(element) {
if (element.stopPropagation) {
element.stopPropagation(); // Stops from redirecting
}

// Don't need to do anything if dropping in the same column
if (drag_source_element != this) {
this.parentNode.removeChild(drag_source_element);
var dropHTML = element.dataTransfer.getData('text/html');
this.insertAdjacentHTML('beforebegin', dropHTML);
var drop_element = this.previousSibling;
add_DnD_handlers(drop_element);
}

this.classList.remove('over');
return false;
}

function handle_drag_end() {
this.classList.remove('over');
}


function add_DnD_handlers(element) {
//DnD is not dungeons and dragons
element.addEventListener('dragstart', handle_drag_start, false);
element.addEventListener('dragenter', handle_drag_enter, false);
element.addEventListener('dragover', handle_drag_over, false);
element.addEventListener('dragleave', handle_drag_leave, false);
element.addEventListener('drop', handle_drop, false);
element.addEventListener('dragend', handle_drag_end, false);
}

//Find all the column elements and give them the ability to drag and drop
var cols = document.querySelectorAll('#columns .column_title');
[].forEach.call(cols,add_DnD_handlers);

var levels = document.querySelectorAll('#levels .level_title');
[].forEach.call(levels,add_DnD_handlers);
</script>


{% endblock %}
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ <h2>Edit Product or Service</h2>
<li>{{ product_and_service_form.product_or_service }}</li>
<li>{{ product_and_service_form.product_name }}</li>
<li>{{ product_and_service_form.product_part_number }}</li>
<li>Product Cost: {{ product_and_service_form.product_cost }}</li>
<li>Product Price: {{ product_and_service_form.product_price }}</li>
<li>Product/Services Cost: {{ product_and_service_form.product_cost }}</li>
<li>Product/Services Price: {{ product_and_service_form.product_price }}</li>
<li>{{ product_and_service_form.product_description }}</li>
<li><input type="submit" value="Save Changes and return"><a href="{% url 'product_and_service_search' %}">Cancel</a></li>
</ul>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ <h2>New Product or Service</h2>
<li>{{ product_and_service_form.product_or_service }}</li>
<li>{{ product_and_service_form.product_name }}</li>
<li>{{ product_and_service_form.product_part_number }}</li>
<li>Product Cost: {{ product_and_service_form.product_cost }}</li>
<li>Product Price: {{ product_and_service_form.product_price }}</li>
<li>Product/Services Cost: {{ product_and_service_form.product_cost }}</li>
<li>Product/Services Price: {{ product_and_service_form.product_price }}</li>
<li>{{ product_and_service_form.product_description }}</li>
<li><input type="submit" value="Save Changes and return"><a href="{% url 'product_and_service_search' %}">Cancel</a></li>
</ul>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ <h2>Services</h2>
</tr>
{% for row in service_results %}
<tr>
<td><a href="#">{{ row.product_name }}</a></td>
<td><a href="{% url 'product_and_service_edit' row.product_id %}">{{ row.product_name }}</a></td>
<td>{{ row.product_part_number }}</td>
<td>{{ row.product_cost }}</td>
<td>{{ row.product_price }}</td>
Expand Down
Loading

0 comments on commit 29616af

Please sign in to comment.