<commit_before>adminFormView = Backbone.View.extend(
  el: '#OrchestraBOModal'
  events:
    'keyup input#none' : 'refreshAlias'
  initialize: (options) ->
    @url = options.url
    @method = if options.method then options.method else 'GET'
    _.bindAll this, "refreshAlias", "bindEvent", "render", "call", "addEventOnForm"
    @call()
    return
  call: ->
    viewContext = this
    displayLoader('.modal-body')
    $("#OrchestraBOModal").modal "show"
    $.ajax
      url: @url
      method: @method
      success: (response) ->
        viewContext.render(
          html: response
        )
      error: ->
        $('.modal-body', viewContext.el).html 'Erreur durant le chargement'
    return
  render: (options) ->
    @html = options.html
    $('.modal-body', @el).html @html
    $('.modal-title', @el).html $('#dynamic-modal-title').html()
    $("[data-prototype]").each ->
      PO.formPrototypes.addPrototype $(this)
      return
    @addEventOnForm()
    @bindEvent()
  addEventOnForm: ->
    viewContext = this
    $("form", @$el).on "submit", (e) ->
      e.preventDefault() # prevent native submit
      $(this).ajaxSubmit
        statusCode:
          200: (response) ->
            view = viewContext.render(
              html: response
            )
            Backbone.history.loadUrl(Backbone.history.fragment)
    return
  refreshAlias: (event) ->
    console.log 'RefreshAlias'
    $('input#node_alias').val(event.target.value.replace(/[^a-z0-9]/gi,'_'))
  bindEvent: ->
    if $('input#node_alias').val() is ''
      @events['keyup input#node_name'] = "refreshAlias"
)
<commit_msg>Add Refresh Alias<commit_after>adminFormView = Backbone.View.extend(
  el: '#OrchestraBOModal'
  events:
    'keyup input#node_name' : 'refreshAlias'
  initialize: (options) ->
    @url = options.url
    @aliasIsRefreshable = false
    @method = if options.method then options.method else 'GET'
    _.bindAll this, "refreshAlias"
    @call()
    return
  call: ->
    viewContext = this
    displayLoader('.modal-body')
    $("#OrchestraBOModal").modal "show"
    $.ajax
      url: @url
      method: @method
      success: (response) ->
        viewContext.render(
          html: response
        )
      error: ->
        $('.modal-body', viewContext.el).html 'Erreur durant le chargement'
    return
  render: (options) ->
    @html = options.html
    $('.modal-body', @el).html @html
    $('.modal-title', @el).html $('#dynamic-modal-title').html()
    $("[data-prototype]").each ->
      PO.formPrototypes.addPrototype $(this)
      return
    @aliasIsRefreshable = $('input#node_alias').val() is ''
    @addEventOnForm()
  addEventOnForm: ->
    viewContext = this
    $("form", @$el).on "submit", (e) ->
      e.preventDefault() # prevent native submit
      $(this).ajaxSubmit
        statusCode:
          200: (response) ->
            view = viewContext.render(
              html: response
            )
            Backbone.history.loadUrl(Backbone.history.fragment)
    return
  refreshAlias: (event) ->
    if @aliasIsRefreshable
      $('input#node_alias').val(event.target.value.replace(/[^a-z0-9]/gi,'_'))
)

{'fraction_non_alphanumeric': 0.15985960433950222, 'fraction_numerical': 0.003190810465858328, 'mean_word_length': 2.5463800904977374, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 24, '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': '3018071', 'n_tokens_mistral': 982, 'n_tokens_neox': 989, 'n_words': 197}