Exemplo n.º 1
0
    render: function () {
        var view = this;
        var modal = this.$el.html(template({
            phase: this.model
        })).girderModal(this).on('shown.bs.modal', function () {
            view.$('#c-phase-name').focus();
        }).on('hidden.bs.modal', function () {
            if (view.create) {
                handleClose('create');
            } else {
                handleClose('edit');
            }
        }).on('ready.girder.modal', function () {
            if (view.model) {
                view.$('#c-phase-name').val(view.model.get('name'));
                view.$('#c-phase-description').val(view.model.get('description'));
                if (view.model.get('active')) {
                    view.$('#c-phase-active').attr('checked', 'checked');
                } else {
                    view.$('#c-phase-active').removeAttr('checked');
                }
                if (view.model.get('type') === 'training') {
                    view.$('#c-phase-training').attr('checked', 'checked');
                } else {
                    view.$('#c-phase-training').removeAttr('checked');
                }
                if (view.model.get('hideScores')) {
                    view.$('#c-phase-hide-scores').attr('checked', 'checked');
                } else {
                    view.$('#c-phase-hide-scores').removeAttr('checked');
                }

                view.dateTimeRangeWidget.setElement(view.$('#c-phase-timeframe')).render();
                view.dateTimeRangeWidget.setFromDate(view.model.get('startDate'));
                view.dateTimeRangeWidget.setToDate(view.model.get('endDate'));

                view.create = false;
            } else {
                view.create = true;
            }
        });
        modal.trigger($.Event('ready.girder.modal', {relatedTarget: modal}));
        this.$('#c-phase-name').focus();

        if (view.model) {
            handleOpen('edit');
        } else {
            handleOpen('create');
        }

        return this;
    },
Exemplo n.º 2
0
    render: function () {
        this.$el.html(ResetPasswordDialogTemplate({
            registrationPolicy: this.registrationPolicy
        })).girderModal(this).on('shown.bs.modal', () => {
            this.$('#g-email').focus();
        }).on('hidden.bs.modal', () => {
            handleClose('resetpassword', {replace: true});
        });
        this.$('#g-email').focus();

        handleOpen('resetpassword', {replace: true});

        return this;
    }
Exemplo n.º 3
0
    render: function () {
        this.$el.html(LoginDialogTemplate({
            registrationPolicy: this.registrationPolicy,
            enablePasswordLogin: this.enablePasswordLogin,
            showOtp: true
        })).girderModal(this)
            .on('shown.bs.modal', () => {
                this.$('#g-login').focus();
            }).on('hidden.bs.modal', () => {
                handleClose('login', {replace: true});
            });

        handleOpen('login', {replace: true});
        this.$('#g-login').focus();

        return this;
    }
Exemplo n.º 4
0
    render: function () {
        if (!this.model.get('access') || !this.flagList) {
            new LoadingAnimation({
                el: this.$el,
                parentView: this
            }).render();
            return;
        }

        var closeFunction;
        if (this.modal && this.modelType === 'folder') {
            handleOpen('folderaccess');
            closeFunction = function () {
                handleClose('folderaccess');
            };
        } else if (this.modal) {
            handleOpen('access');
            closeFunction = function () {
                handleClose('access');
            };
        }

        var template = this.modal ? accessEditorTemplate : accessEditorNonModalTemplate;

        this.$el.html(template({
            _,
            model: this.model,
            modelType: this.modelType,
            publicFlag: this.model.get('public'),
            publicFlags: this.model.get('publicFlags'),
            hideRecurseOption: this.hideRecurseOption,
            hideSaveButton: this.hideSaveButton,
            hidePrivacyEditor: this.hidePrivacyEditor,
            flagList: this.flagList,
            isAdmin: this.isAdmin
        }));

        if (this.modal) {
            this.$el.girderModal(this).on('hidden.bs.modal', closeFunction);
        }

        _.each(this.model.get('access').groups, function (groupAccess) {
            this.$('#g-ac-list-groups').append(accessEntryTemplate({
                _,
                accessTypes: AccessType,
                type: 'group',
                flagList: this.flagList,
                isAdmin: this.isAdmin,
                hideAccessType: this.hideAccessType,
                noAccessFlag: this.noAccessFlag,
                entry: _.extend(groupAccess, {
                    title: groupAccess.name,
                    subtitle: groupAccess.description
                })
            }));
        }, this);

        _.each(this.model.get('access').users, function (userAccess) {
            this.$('#g-ac-list-users').append(accessEntryTemplate({
                _,
                accessTypes: AccessType,
                type: 'user',
                flagList: this.flagList,
                isAdmin: this.isAdmin,
                hideAccessType: this.hideAccessType,
                noAccessFlag: this.noAccessFlag,
                entry: _.extend(userAccess, {
                    title: userAccess.name,
                    subtitle: userAccess.login
                })
            }));
        }, this);
        this._makeTooltips();

        this.searchWidget.setElement(this.$('.g-search-field-container')).render();

        this.privacyChanged();

        return this;
    },