Skip to content

Commit

Permalink
Merge pull request #719 from nearbeach/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
robotichead authored Dec 13, 2024
2 parents afad6e8 + 6c39214 commit 5210412
Show file tree
Hide file tree
Showing 6 changed files with 88 additions and 78 deletions.
2 changes: 1 addition & 1 deletion NearBeach/static/NearBeach/NearBeach.min.js

Large diffs are not rendered by default.

Binary file modified NearBeach/static/NearBeach/NearBeach.min.js.gz
Binary file not shown.

Large diffs are not rendered by default.

Binary file modified NearBeach/static/NearBeach/object-status-information.min.js.gz
Binary file not shown.
6 changes: 4 additions & 2 deletions NearBeach/views/document_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -257,8 +257,10 @@ def document_remove_folder(request, destination, location_id, *args, **kwargs):
# Getting folder update
folder_update = form.cleaned_data["folder_id"]

# Check the destination and location id
if not folder_update.destination == destination or not folder_update.location_id == location_id:
# Check the destination and location id match within the folder :)
check_object = getattr(folder_update, destination, 0)
check_id = getattr(check_object, "pk", 0)
if not int(check_id) == int(location_id):
return HttpResponseBadRequest("Mismatch of data")

# Get folder from the from
Expand Down
156 changes: 82 additions & 74 deletions src/js/components/object_status/ObjectStatusInformation.vue
Original file line number Diff line number Diff line change
@@ -1,90 +1,95 @@
<template>
<div class="card">
<div class="card-body">
<h1>{{ nearbeachTitle }}</h1>
<br/>
<a v-bind:href="`${this.rootUrl}object_status_list/`">
Go back to object status list
</a>
<hr>
<n-config-provider :theme="useNBTheme(theme)">
<div class="card">
<div class="card-body">
<h1>{{ nearbeachTitle }}</h1>
<br/>
<a v-bind:href="`${this.rootUrl}object_status_list/`">
Go back to object status list
</a>
<hr>

<div class="row">
<div class="col-md-4">
<strong>Editing Status</strong>
<p class="text-instructions">
Move the status' around to reorder them. Double click to edit text and settings.
</p>
</div>
<div class="col-md-8">
<strong>Status List</strong>
<span
class="error"
v-if="localStatusList.length === 0"
>
Please create at least one status
</span>
<br/>
<draggable
v-model="localStatusList"
item-key="status_id"
ghost-class="ghost"
@change="updateSortOrder"
>
<template
#item="{ element }"
type="transition"
name="flip-list"
<div class="row">
<div class="col-md-4">
<strong>Editing Status</strong>
<p class="text-instructions">
Move the status' around to reorder them. Double click to edit text and settings.
</p>
</div>
<div class="col-md-8">
<strong>Status List</strong>
<span
class="error"
v-if="localStatusList.length === 0"
>
Please create at least one status
</span>
<br/>
<draggable
v-model="localStatusList"
item-key="status_id"
ghost-class="ghost"
@change="updateSortOrder"
>
<div
class="sortable"
v-bind:key="element.status_id"
v-bind:data-id="element.status_id"
v-on:dblclick="editStatus($event)"
<template
#item="{ element }"
type="transition"
name="flip-list"
>
<div class="content">
<strong
v-bind:key="element.status_id"
v-bind:data-id="element.status_id"
>
{{ element.status }}
</strong>
</div>
<div class="icon"
v-on:click="removeStatus(element.status_id)"
v-if="localStatusList.length > 1"
<div
class="sortable"
v-bind:key="element.status_id"
v-bind:data-id="element.status_id"
v-on:dblclick="editStatus($event)"
>
<carbon-close-outline></carbon-close-outline>
<div class="content"
v-bind:key="element.status_id"
v-bind:data-id="element.status_id"
>
<strong
v-bind:key="element.status_id"
v-bind:data-id="element.status_id"
>
{{ element.status }}
</strong>
</div>
<div class="icon"
v-on:click="removeStatus(element.status_id)"
v-if="localStatusList.length > 1"
>
<carbon-close-outline></carbon-close-outline>
</div>
</div>
</div>
</template>
</draggable>
</template>
</draggable>

<div class="spacer"></div>
<div class="spacer"></div>

<button v-on:click="newStatus"
class="btn btn-primary"
>
New Status
</button>
<button v-on:click="newStatus"
class="btn btn-primary"
>
New Status
</button>
</div>
</div>
</div>
</div>
</div>

<object-status-modal
v-bind:status-data="statusData"
v-bind:status-id="statusId"
v-bind:status-list="localStatusList"
v-on:add_status="addStatus($event)"
v-on:update_status="updateStatus($event)"
></object-status-modal>
<object-status-modal
v-bind:status-data="statusData"
v-bind:status-id="statusId"
v-bind:status-list="localStatusList"
v-on:add_status="addStatus($event)"
v-on:update_status="updateStatus($event)"
></object-status-modal>

<object-status-confirm-delete
v-bind:status-data="statusData"
v-bind:status-id="statusId"
v-bind:status-list="localStatusList"
v-on:delete_status="delete_status"
></object-status-confirm-delete>
<object-status-confirm-delete
v-bind:status-data="statusData"
v-bind:status-id="statusId"
v-bind:status-list="localStatusList"
v-on:delete_status="delete_status"
></object-status-confirm-delete>
</n-config-provider>
</template>

<script>
Expand All @@ -98,6 +103,7 @@ import { Modal } from "bootstrap";
import ObjectStatusConfirmDelete from "./ObjectStatusConfirmDelete.vue";
import ObjectStatusModal from "./ObjectStatusModal.vue";
import {CarbonCloseOutline} from "../../components";
import {useNBTheme} from "../../composables/theme/useNBTheme";
export default {
name: "ObjectStatusInformation",
Expand Down Expand Up @@ -142,6 +148,7 @@ export default {
}
},
methods: {
useNBTheme,
addStatus(data) {
//Add the data to the local status list
this.localStatusList.push(data[0]);
Expand All @@ -153,6 +160,7 @@ export default {
});
},
editStatus(event) {
console.log("Event: ", event);
//Get the id
const status_id = parseInt(event.target.dataset.id);
Expand Down

0 comments on commit 5210412

Please sign in to comment.