Skip to content
Snippets Groups Projects
Select Git revision
  • b742d3008e6a47a1cd431392fc18bc98b05d7891
  • main default protected
  • studip-rector
  • ci-opt
  • course-members-export-as-word
  • data-vue-app
  • pipeline-improvements
  • webpack-optimizations
  • rector
  • icon-renewal
  • http-client-and-factories
  • jsonapi-atomic-operations
  • vueify-messages
  • tic-2341
  • 135-translatable-study-areas
  • extensible-sorm-action-parameters
  • sorm-configuration-trait
  • jsonapi-mvv-routes
  • docblocks-for-magic-methods
19 results

AutoInsert.class.php

Blame
  • Forked from Stud.IP / Stud.IP
    Source project has a limited visibility.
    Code owners
    Assign users and groups as approvers for specific file changes. Learn more.
    StudipProxiedCheckbox.vue 1.32 KiB
    <script>
    let uuid = 0;
    export default {
        name: 'studip-proxied-checkbox',
        model: {
            prop: 'selected',
            event: 'change',
        },
        props: {
            name: String,
            id: String,
            value: {
                required: true
            },
            selected: {
                type: Array,
                required: true
            }
        },
        methods: {
            changeCollection () {
                const selected = new Set(this.selected);
    
                if (this.checked) {
                    selected.delete(this.value);
                } else {
                    selected.add(this.value);
                }
    
                this.$emit('change', [...selected.values()]);
            }
        },
        computed: {
            proxiedId () {
                return this.id ?? `proxied-checkbox-${uuid++}`;
            },
            checked () {
                return this.selected.includes(this.value);
            },
        },
        render (createElement) {
            const checkbox = createElement('input', {
                attrs: {
                    type: 'checkbox',
                    name: this.name,
                    id: this.proxiedId,
                    value: this.value,
                },
                domProps: {
                    checked: this.checked,
                },
                on: {
                    change: this.changeCollection,
                }
            });
    
            return checkbox;
        }
    };
    </script>