Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: corrected edit document icon in Project page #342

Merged
merged 3 commits into from
Jun 14, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions core/migrations/0025_auto_20220517_1622.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Generated by Django 2.2.25 on 2022-05-17 14:22

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('core', '0024_auto_20211004_1610'),
]

operations = [
migrations.AlterField(
model_name='document',
name='domain_type',
field=models.TextField(choices=[('not_specified', 'Not Specified'), ('agreement', 'Agreement'), ('ethics_approval', 'Ethics Approval'), ('consent_form', 'Consent Form'), ('subject_information_sheet', 'Subject Information Sheet'), ('project_proposal', 'Project Proposal'), ('data_protection_impact_assessment', 'Data Protection Impact Assessment'), ('other', 'Other')], default='not_specified', verbose_name='Domain Type'),
),
migrations.AlterField(
model_name='userestriction',
name='use_restriction_rule',
field=models.TextField(choices=[('PROHIBITION', 'PROHIBITION'), ('OBLIGATION', 'OBLIGATION'), ('PERMISSION', 'PERMISSION'), ('CONSTRAINED_PERMISSION', 'CONSTRAINED_PERMISSION')], default='PROHIBITION', max_length=64, verbose_name='Use Restriction Rule'),
),
]
2 changes: 1 addition & 1 deletion core/models/document.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class Document(CoreModel):
("agreement", "Agreement"),
("ethics_approval", "Ethics Approval"),
("consent_form", "Consent Form"),
("subject_informationsheet", "Subject InformationSheet"),
("subject_information_sheet", "Subject Information Sheet"),
("project_proposal", "Project Proposal"),
('data_protection_impact_assessment', 'Data Protection Impact Assessment'),
("other", "Other"))
Expand Down
41 changes: 41 additions & 0 deletions web/templates/_includes/documents_table.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<h2 class="card-title"><span><i class="material-icons">link</i></span> Documents</h2>
<table class="table table-striped">
<thead>
<tr>
<th style="max-width: 200px; overflow: auto">Document Type</th>
<th style="max-width: 200px; min-width:120px; overflow: auto">Expiry</th>
<th>Notes</th>
<th style="max-width: 400px; overflow: auto">File</th>
<th style="max-width: 200px; overflow: auto"><small>Size<small></th>


{% if can_edit %}
<th style="width:7em">Actions</th>
{% endif %}
</tr>
</thead>
<tbody>
{% for file in datafiles %}
<tr>
<td style="max-width: 200px; overflow: auto"><span class="col-xs-4 text-center">{{ file.get_domain_type_display }}</span></td>
<td style="max-width: 200px; overflow: auto"><span class="col-xs-4 text-center">{{ file.expiry_date | default:'-' }}</span></td>
<td><span class="col-xs-4 text-center">{{ file.content_notes | default:'-' }}</span>
<td style="max-width: 400px; overflow: auto"><a href="{% url 'document_download' pk=file.id %}">{{ file.shortname}}</a></td>
<td><small><span class="col-xs-4 text-center">{{ file.size | filesizeformat }}</span></small></td>
<td>
<a data-toggle="modal" id="btnupdate" class="jsBtn clickable"
data-target="#modal"
data-modal-title="Update document"
data-ajax-url="{% url "document_edit" pk=file.id %}"
title="Update document">
<i class="material-icons">edit</i>
</a>
<i title="Delete document" class="material-icons red clickable" data-method="delete"
data-confirmation = "delete"
data-parent-to-remove="tr"
data-url="{% url 'document_delete' pk=file.id %}">delete_forever</i>
</td>
</tr>
{% endfor %}
</tbody>
</table>
38 changes: 2 additions & 36 deletions web/templates/contracts/contract.html
Original file line number Diff line number Diff line change
Expand Up @@ -132,42 +132,8 @@ <h2 class="card-title">Participants</h2>
</button>
</div>
</div>
<h2 class="card-title"><span><i class="material-icons">link</i></span> Documents</h2>
<table class="table table-striped">
<thead>
<tr>
<th>File</th>
<th>Size</th>
<th>Expiry</th>
<th>Document Type</th>
{% if can_edit %}
<th style="width:7em">Actions</th>{% endif %}
</tr>
</thead>
<tbody>
{% for file in datafiles %}
<tr>
<td><a href="{% url 'document_download' pk=file.id %}">{{ file.shortname}}</a></td>
<td><span class="col-xs-4 text-center">size: {{ file.size | filesizeformat }}</span></td>
<td><span class="col-xs-4 text-center">{{ file.expiry_date | default:'-' }}</span></td>
<td><span class="col-xs-4 text-center">{{ file.domain_type }}</span></td>
<td>
<a data-toggle="modal" id="btnupdate" class="jsBtn clickable"
data-target="#modal"
data-modal-title="Update document"
data-ajax-url="{% url "document_edit" pk=file.id %}"
title="Update document">
<i class="material-icons">edit</i>
</a>
<i title="Delete document" class="material-icons red clickable" data-method="delete"
data-confirmation = "delete"
data-parent-to-remove="tr"
data-url="{% url 'document_delete' pk=file.id %}">delete_forever</i>
</td>
</tr>
{% endfor %}
</tbody>
</table>

{% include "_includes/documents_table.html" %}
</div>
</div>
</div>
Expand Down
42 changes: 5 additions & 37 deletions web/templates/projects/project.html
Original file line number Diff line number Diff line change
Expand Up @@ -298,49 +298,17 @@ <h2 class="card-title"><span><i class="material-icons">link</i></span> Contracts
<div class="card-body">
<div class="ml-1 float-right btn-group">
<button class="btn bmd-btn-fab bmd-btn-fab-sm dropdown-toggle" type="button" id="adddocument" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" title="Add document to project">
<i class="material-icons">add</i>
</button>
<i class="material-icons">add</i>
</button>
<div class="dropdown-menu dropdown-menu-right" aria-labelledby="adddocument">

<button data-toggle="modal" data-target="#modal" data-modal-title="Add document to project" data-ajax-url="{% url 'document_add' object_id=object_id content_type=content_type %}" class="dropdown-item" type="button" title="Add document to project">
Upload new document
</button>
Upload new document
</button>
</div>
</div>
<h2 class="card-title"><span><i class="material-icons">link</i></span> Documents</h2>

<table class="table table-striped">
<thead>
<tr>
<th>File</th>
<th>Size</th>
<th>Expiry</th>
<th>Document Type</th>
{% if can_edit %}
<th style="width:7em">Actions</th>{% endif %}
</tr>
</thead>
<tbody>
{% for file in datafiles %}
<tr>
<td><a href="{% url 'document_download' pk=file.id %}">{{ file.shortname}}</a></td>
<td><span class="col-xs-4 text-center">{{ file.size | filesizeformat }}</span></td>
<td><span class="col-xs-4 text-center">{{ file.expiry_date | default:'-' }}</span></td>
<td><span class="col-xs-4 text-center">{{ file.domain_type }}</span></td>
{% if can_edit %}
<td>
<a data-toggle="modal" id="btnupdate" class="jsBtn clickable" data-target="#modal" data-modal-title="Update document" data-ajax-url="{% url "document_edit" pk=file.id %}" title="Update document"></a>
<i class="material-icons">edit</i>
</a>
<i title="Delete document" class="material-icons red clickable" data-method="delete" data-parent-to-remove="tr" data-url="{% url 'document_delete' pk=file.id %}">delete_forever</i>
</td>
{% endif %}
</tr>
{% endfor %}
</tbody>

</table>

{% include "_includes/documents_table.html" %}
</div>
</div>
</div>
Expand Down