Skip to content

Commit 87df381

Browse files
committed
Merge branch 'features/priority_column' into dev
2 parents 10e336e + 27ad883 commit 87df381

File tree

5 files changed

+54
-20
lines changed

5 files changed

+54
-20
lines changed

app/Repositories/Bugs/BugRepository.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ public function getAllBugsPaginatedForProject(Project $project, Request $request
4747
public function getAllFollowedBugsPaginated(Request $request, int $nb_per_page = 10): LengthAwarePaginator
4848
{
4949
$query = Bug::with(['project'])
50+
->withCount('bug_comments')
5051
->whereHas('user_followers', function ($q) {
5152
$q->where('user_id', auth()->id());
5253
})

resources/js/Helpers/bug.js

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,16 @@ const getStatusObject = (id) => {
2727
return status
2828
}
2929

30-
const nb_notes = (nb_responses) => {
31-
return nb_responses - 1;
30+
const nb_notes = (nb_responses) => nb_responses - 1;
31+
const nb_notes_labels = (bug) => {
32+
const nbAddtionalNotes = nb_notes(bug.bug_comments_count);
33+
return nbAddtionalNotes > 1 ? `${nbAddtionalNotes} notes` : `${nbAddtionalNotes} note`;
34+
35+
}
36+
37+
const bug_priority_class = (bug) => {
38+
const prioObj = getPriorityObject(bug.priority)
39+
return `text-bg-priority-${prioObj.weight}`;
3240
}
3341

3442
const format_text = (text) => {
@@ -37,4 +45,4 @@ const format_text = (text) => {
3745
return text.replace(/\n/g, '<br>')
3846
}
3947

40-
export {getPriorityObject, getStatusObject, nb_notes, format_text}
48+
export {getPriorityObject, getStatusObject, nb_notes,nb_notes_labels, bug_priority_class, format_text}

resources/js/Pages/Dashboard.vue

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,8 @@
5757
<th :class="sortingClass('project', params)" @click="sort('project')">Projet</th>
5858
<th :class="sortingClass('title', params)" @click="sort('title')">Titre</th>
5959
<th :class="sortingClass('status', params)" @click="sort('status')">Statut</th>
60-
<th>Assigné à</th>
60+
<th style="width: 200px">Assigné à</th>
61+
<th style="width: 100px" :class="sortingClass('priority', params)" @click="sort('priority')">Priorité</th>
6162
<th :class="sortingClass('date', params)" @click="sort('date')">Date</th>
6263
</tr>
6364
</thead>
@@ -73,13 +74,13 @@
7374
{{bug.project.name}}
7475
</Link>
7576
</td>
76-
<td class="align-middle">
77+
<td >
7778
<p class="mb-0 d-flex flex-column align-items-start">
7879
<Link :href="route('projects.bug.show', [bug.project.slug, bug.id])" class="fw-bold bug_title d-flex align-items-center">
7980
<StarIcon class="size-1 text-status-in_progress me-1"/>
8081
{{ bug.title }}
8182
</Link>
82-
<small class="text-secondary">{{ getPriorityObject(bug.priority)?.extended_label}}</small>
83+
<small class="text-secondary"><ChatBubbleLeftIcon class="size-1"/> {{nb_notes_labels(bug)}}</small>
8384
</p>
8485
</td>
8586
<td class="align-middle">
@@ -92,6 +93,14 @@
9293
</div>
9394
<em class="mb-0 opacity-75" v-else>Non assigné</em>
9495
</td>
96+
<td class="align-middle">
97+
<div class="priority rounded-pill"
98+
data-bs-toggle="tooltip"
99+
data-bs-placement="bottom"
100+
:data-bs-title="getPriorityObject(bug.priority)?.extended_label"
101+
:class="bug_priority_class(bug)"></div>
102+
103+
</td>
95104
<td class="text-sm text-secondary">
96105
<InfoDateBug :bug="bug"/>
97106
</td>
@@ -117,15 +126,17 @@ import {Link, usePage, router} from "@inertiajs/vue3";
117126
import CardProject from "@/Components/ui/project/CardProject.vue";
118127
import Pagination from "@/Components/ui/Pagination.vue";
119128
import {sortingClass} from "@/Helpers/datatable.js";
120-
import {getPriorityObject} from "@/Helpers/bug.js";
129+
import {bug_priority_class, getPriorityObject, nb_notes_labels} from "@/Helpers/bug.js";
121130
import {StarIcon} from "@heroicons/vue/24/solid/index.js";
122131
import BagdeStatusBug from "@/Components/ui/bug/BagdeStatusBug.vue";
123132
import InfoDateBug from "@/Components/ui/bug/InfoDateBug.vue";
124-
import {computed, ref, watch} from "vue";
133+
import {computed, onMounted, onUnmounted, ref, watch} from "vue";
125134
import {pickBy, throttle} from "lodash";
126135
import InputLabel from "@/Components/ui/form/InputLabel.vue";
127136
import FormSelect from "@/Components/ui/form/FormSelect.vue";
128137
import TextInput from "@/Components/ui/form/TextInput.vue";
138+
import {ChatBubbleLeftIcon} from "@heroicons/vue/24/outline/index.js";
139+
import {disposeToolTips, enableToolTips} from "@/Helpers/bs_tooltips.js";
129140
130141
const props = defineProps({
131142
projects:{
@@ -206,4 +217,8 @@ watch(params, throttle(function () {
206217
//request
207218
router.get(route('dashboard'), my_params, {replace: true, preserveState: true})
208219
}, 300), {deep: true})
220+
221+
const tooltipList = ref([]);
222+
onMounted(() => enableToolTips(tooltipList))
223+
onUnmounted(() => disposeToolTips(tooltipList))
209224
</script>

resources/js/Pages/SingleProject/SingleProjectIndex.vue

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@
4646
<th :class="sortingClass('id', params)" @click="sort('id')">#</th>
4747
<th :class="sortingClass('title', params)" @click="sort('title')">Titre</th>
4848
<th :class="sortingClass('status', params)" @click="sort('status')">Statut</th>
49-
<th>Notes</th>
5049
<th>Assigné à</th>
50+
<th style="width: 100px" :class="sortingClass('priority', params)" @click="sort('priority')">Priorité</th>
5151
<th :class="sortingClass('date', params)" @click="sort('date')">Date</th>
5252
</tr>
5353
</thead>
@@ -64,23 +64,29 @@
6464
<StarIcon class="size-1 text-status-in_progress me-1" v-if="bug.is_followed_by_me"/>
6565
{{ bug.title }}
6666
</Link>
67-
<small class="text-secondary">{{ getPriorityObject(bug.priority)?.extended_label}}</small>
67+
68+
<small class="text-secondary"><ChatBubbleLeftIcon class="size-1"/> {{nb_notes_labels(bug)}}</small>
6869

6970
</p>
7071
</td>
7172
<td class="align-middle">
7273
<BagdeStatusBug :bug="bug"/>
7374
</td>
74-
75-
<td class="text-secondary text-sm text-center align-middle"><span class="badge text-bg-secondary rounded-pill">{{nb_notes(bug.bug_comments_count)}}</span></td>
7675
<td class="text-secondary text-sm text-center align-middle">
7776
<div class="d-flex align-items-center" v-if="bug.assigned_user">
7877
<Avatar :user="bug.assigned_user" class="me-1 bordered"/>
7978
{{ bug.assigned_user.full_name }}
8079
</div>
8180
<em class="mb-0 opacity-75" v-else>Non assigné</em>
8281
</td>
82+
<td class="align-middle">
83+
<div class="priority rounded-pill"
84+
data-bs-toggle="tooltip"
85+
data-bs-placement="bottom"
86+
:data-bs-title="getPriorityObject(bug.priority)?.extended_label"
87+
:class="bug_priority_class(bug)"></div>
8388

89+
</td>
8490
<td class="text-sm text-secondary">
8591
<InfoDateBug :bug="bug"/>
8692
</td>
@@ -101,7 +107,7 @@
101107
import AuthenticatedLayout from "@/Layouts/AuthenticatedLayout.vue";
102108
import {PlusCircleIcon} from "@heroicons/vue/24/outline/index.js";
103109
import Card from "@/Components/ui/Card.vue";
104-
import {computed, ref, watch} from "vue";
110+
import {computed, onMounted, onUnmounted, ref, watch} from "vue";
105111
import {router, Link, usePage} from "@inertiajs/vue3";
106112
import InfoDateBug from "@/Components/ui/bug/InfoDateBug.vue";
107113
import BagdeStatusBug from "@/Components/ui/bug/BagdeStatusBug.vue";
@@ -113,7 +119,9 @@ import {pickBy, throttle} from "lodash";
113119
import FormSelect from "@/Components/ui/form/FormSelect.vue";
114120
import Avatar from "@/Components/ui/user/avatar.vue";
115121
import {StarIcon} from "@heroicons/vue/24/solid/index.js";
116-
import {getPriorityObject, nb_notes} from "../../Helpers/bug.js";
122+
import {bug_priority_class, getPriorityObject, nb_notes, nb_notes_labels} from "../../Helpers/bug.js";
123+
import {ChatBubbleLeftIcon} from "@heroicons/vue/24/outline/index.js";
124+
import {disposeToolTips, enableToolTips} from "@/Helpers/bs_tooltips.js";
117125
118126
const props = defineProps({
119127
project: {
@@ -186,6 +194,9 @@ watch(params, throttle(function () {
186194
//request
187195
router.get(route('projects.show', props.project.slug), my_params, {replace: true, preserveState: true})
188196
}, 300), {deep: true})
197+
const tooltipList = ref([]);
198+
onMounted(() => enableToolTips(tooltipList))
199+
onUnmounted(() => disposeToolTips(tooltipList))
189200
</script>
190201

191202
<style scoped>

resources/scss/components/_bug.scss

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
.bug_title{
2-
width: 500px; /* Définit la largeur maximale de l'élément */
2+
width: 450px; /* Définit la largeur maximale de l'élément */
33
overflow: hidden; /* Cache le texte qui dépasse la largeur */
44
white-space: nowrap; /* Empêche le texte de se répartir sur plusieurs lignes */
55
text-overflow: ellipsis; /* Ajoute les points de suspension */
@@ -21,9 +21,8 @@
2121
}
2222
}
2323
}
24-
.dropZone{
25-
/* background: $light;
26-
height: 100%;
27-
border: 1px solid darken($light, 10%);
28-
border-radius: .5rem;*/
24+
.priority{
25+
width: 27px;
26+
height: 8px;
27+
margin: 0 auto;
2928
}

0 commit comments

Comments
 (0)