<commit_before># Base View for creating and editing requests
# extended by requestFormEdit and requestFormNew

FormBaseView = require './formBaseView'

Request = require '../models/Request'

class RequestFormBase extends FormBaseView

    template: require '../templates/requestForm'

    # A list of request inputs that we want taggable
    taggables: ->
        type = @model?.get('request')?.requestType || @requestType
        racks = _.pluck @racks.toJSON(), 'id'
        [
            { 
                name: 'owners', selector: '#owners'
                options:
                    tags: true
                    containerCssClass: 'select-owners hide-select2-spinner'
                    dropdownCssClass: 'hidden'
            }
            { 
                name: 'rackAffinity', selector: "#rackAffinity-#{type}"
                options: tags: racks
            }
        ]

    events: ->
        _.extend super,
            'click #type .btn': 'handleChangeType'
            'change #schedule-type': 'handleScheduleTypeChange'

    initialize: ({@requestId, @racks}) ->
        super

    renderFormElements: ->
        for input in @taggables()
            options = $.extend({}, {tokenSeparators: [',',' ']}, input.options)
            @[input.name] = @$("#{input.selector}").select2 options

        @scheduleSelect = @generateSelectBox '#schedule-type', {containerCssClass : "select2-select-box select-box-small"}
<commit_msg>The request form adds the currently being typed email and rack affinity as a tag when losing focus<commit_after># Base View for creating and editing requests
# extended by requestFormEdit and requestFormNew

FormBaseView = require './formBaseView'

Request = require '../models/Request'

class RequestFormBase extends FormBaseView

    template: require '../templates/requestForm'

    # A list of request inputs that we want taggable
    taggables: ->
        type = @model?.get('request')?.requestType || @requestType
        racks = _.pluck @racks.toJSON(), 'id'
        [
            { 
                name: 'owners', selector: '#owners'
                options:
                    tags: []
                    containerCssClass: 'select-owners hide-select2-spinner'
                    dropdownCssClass: 'hidden'
                    selectOnBlur: true
            }
            { 
                name: 'rackAffinity', selector: "#rackAffinity-#{type}"
                options:
                    tags: racks
                    selectOnBlur: true
            }
        ]

    events: ->
        _.extend super,
            'click #type .btn': 'handleChangeType'
            'change #schedule-type': 'handleScheduleTypeChange'

    initialize: ({@requestId, @racks}) ->
        super

    renderFormElements: ->
        for input in @taggables()
            options = $.extend({}, {tokenSeparators: [',',' ']}, input.options)
            @[input.name] = @$("#{input.selector}").select2 options

        @scheduleSelect = @generateSelectBox '#schedule-type', {containerCssClass : "select2-select-box select-box-small"}

{'fraction_non_alphanumeric': 0.11722565939433409, 'fraction_numerical': 0.0019537609899055682, 'mean_word_length': 2.0, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6978227', 'n_tokens_mistral': 826, 'n_tokens_neox': 787, 'n_words': 208}