aboutsummaryrefslogtreecommitdiff
path: root/resources/vue/components/ContentmodulesEditTable.vue
blob: 58fe01db9ee7251fda87694a4941b66db774fe08 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
<template>
    <table class="admin_contentmodules table default">
        <colgroup>
            <col style="width: 20px" v-if="filterCategory === null" />
            <col style="width: 20px" />
            <col />
            <col style="width: 24px" />
        </colgroup>
        <thead>
            <tr>
                <th v-if="filterCategory === null"></th>
                <th></th>
                <th>{{ $gettext('Name') }}</th>
                <th class="actions">{{ $gettext('Aktionen') }}</th>
            </tr>
        </thead>
        <draggable v-model="activeModules"
                   handle=".dragarea"
                   tag="tbody"
                   item-key="id"
        >
            <template #item="{element}">
                <tr :class="getModuleCSSClasses(element)" v-cloak>
                    <td v-if="filterCategory === null">
                        <a
                            class="dragarea"
                            tabindex="0"
                            :aria-label="
                                $gettext(
                                    'Sortierelement für Module %{module}. Drücken Sie die Tasten Pfeil-nach-oben oder Pfeil-nach-unten, um dieses Element in der Liste zu verschieben.',
                                    { module: element.displayname },
                                    true
                                )
                            "
                            @keydown="keyboardHandler($event, element)"
                            v-if="element.active"
                            :ref="`draghandle-${element.id}`"
                        >
                            <span class="drag-handle"></span>
                        </a>
                    </td>
                    <td>
                        <input
                            type="checkbox"
                            v-model="element.active"
                            @click="toggleModuleActivation(element)"
                            v-if="!element.mandatory"
                            :ref="'checkbox_' + element.id"
                        />
                    </td>
                    <td>
                        <a
                            class="upper_part"
                            :class="{ dragrea: element.active }"
                            :href="getDescriptionURL(element)"
                            data-dialog
                        >
                        <StudipIcon v-if="element.icon" :shape="element.icon.shape" :size="20" />
                            {{ element.displayname }}
                        </a>
                    </td>
                    <td class="actions">
                        <a
                            href="#"
                            v-if="showVisibilityToggle(element)"
                            role="checkbox"
                            :aria-checked="element.visibility !== 'tutor' ? 'true' : 'false'"
                            @click.prevent="toggleModuleVisibility(element)"
                        >
                            <studip-icon
                                :shape="element.visibility !== 'tutor' ? 'visibility-visible' : 'visibility-invisible'"
                                class="text-bottom"
                                :title="
                                    $gettext(
                                        'Inhaltsmodul %{ name } für Teilnehmende unsichtbar bzw. sichtbar schalten',
                                        { name: element.displayname },
                                        true
                                    )
                                "
                            ></studip-icon>
                        </a>
                        <a :href="getRenameURL(element)" data-dialog="size=auto" v-if="element.active">
                            <studip-icon
                                shape="edit"
                                class="text-bottom"
                                :title="
                                    $gettext(
                                        'Umbenennen des Inhaltsmoduls %{ name }',
                                        { name: element.displayname },
                                        true
                                    )
                                "
                            ></studip-icon>
                        </a>
                    </td>
                </tr>
            </template>
        </draggable>
        <tbody>
            <tr v-for="module in inactiveModules" :key="module.id" :class="getModuleCSSClasses(module)" v-cloak>
                <td v-if="filterCategory === null"></td>
                <td>
                    <input
                        type="checkbox"
                        v-model="module.active"
                        @click="toggleModuleActivation(module)"
                        v-if="!module.mandatory"
                        :ref="'checkbox_' + module.id"
                    />
                </td>
                <td>
                    <a class="upper_part" :href="getDescriptionURL(module)" data-dialog>
                        <StudipIcon v-if="module.icon" :shape="module.icon.shape" :size="20" />
                        {{ module.displayname }}
                    </a>
                </td>
                <td></td>
            </tr>
        </tbody>
    </table>
</template>

<script>
import ContentModulesMixin from '../mixins/ContentModulesMixin.js';

export default {
    name: 'contentmodules-edit-table',
    mixins: [ContentModulesMixin],
};
</script>
<style lang="scss">
@use '../../assets/stylesheets/mixins/colors.scss';

table.admin_contentmodules > tbody > tr {
    &.sortable-ghost {
        * {
            opacity: 0;
        }
    }
    > td:first-child {
        background-image: linear-gradient(var(--dark-gray-color-60), var(--dark-gray-color-60));
        background-repeat: no-repeat;
        background-position: left;
        background-size: 10px auto;
        padding-left: 15px;
    }
    &.visibility-visible > td:first-child {
        background-image: linear-gradient(var(--green), var(--green));
    }
    &.visibility-invisible > td:first-child {
        background-image: linear-gradient(var(--yellow), var(--yellow));
    }
    > td {
        height: 31px; //to make all rows equally high

        a {
            display: flex;
            flex-direction: row;
            gap: 10px;
            color: var(--color--content-link);

            &:hover {
                color: var(--color--content-link-hover);
            }
        }
    }
}
</style>