<commit_before>ETahi.ManuscriptManagerTemplateNewRoute = Ember.Route.extend ETahi.AlertUnsavedChanges,
  controllerName: 'manuscriptManagerTemplateEdit'

  model: (params) ->
    journal = @modelFor('journal')
    newTemplate = @store.createRecord 'manuscriptManagerTemplate',
      journal:   journal
      paperType: "Research"

    newTemplate.get('phaseTemplates').pushObject(
      @store.createRecord 'phaseTemplate', name: "Phase 1", position: 0
    )

    newTemplate.get('phaseTemplates').pushObject(
      @store.createRecord 'phaseTemplate', name: "Phase 2", position: 1
    )

    newTemplate.get('phaseTemplates').pushObject(
      @store.createRecord 'phaseTemplate', name: "Phase 3", position: 2
    )

    @set('journal', journal)
    @set('newTemplate', newTemplate)
    newTemplate

  setupController: (controller, model) ->
    controller.set('model', model)
    controller.set('journal', @modelFor('journal'))

  renderTemplate: ->
    @render 'manuscript_manager_template/edit'

  actions:
    didRollBack: ->
      @get('journal.manuscriptManagerTemplates').removeObject(@get('newTemplate'))
      @transitionTo('journal')
<commit_msg>acts_as_list is one based, not zero based.  Passing in zero as the position means “put element at very first position and push everything else to the right”<commit_after>ETahi.ManuscriptManagerTemplateNewRoute = Ember.Route.extend ETahi.AlertUnsavedChanges,
  controllerName: 'manuscriptManagerTemplateEdit'

  model: (params) ->
    journal = @modelFor('journal')
    newTemplate = @store.createRecord 'manuscriptManagerTemplate',
      journal:   journal
      paperType: "Research"

    newTemplate.get('phaseTemplates').pushObject(
      @store.createRecord 'phaseTemplate', name: "Phase 1", position: 1
    )

    newTemplate.get('phaseTemplates').pushObject(
      @store.createRecord 'phaseTemplate', name: "Phase 2", position: 2
    )

    newTemplate.get('phaseTemplates').pushObject(
      @store.createRecord 'phaseTemplate', name: "Phase 3", position: 3
    )

    @set('journal', journal)
    @set('newTemplate', newTemplate)
    newTemplate

  setupController: (controller, model) ->
    controller.set('model', model)
    controller.set('journal', @modelFor('journal'))

  renderTemplate: ->
    @render 'manuscript_manager_template/edit'

  actions:
    didRollBack: ->
      @get('journal.manuscriptManagerTemplates').removeObject(@get('newTemplate'))
      @transitionTo('journal')

{'fraction_non_alphanumeric': 0.12535612535612536, 'fraction_numerical': 0.004884004884004884, 'mean_word_length': 4.378555798687089, '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': '5713813', 'n_tokens_mistral': 727, 'n_tokens_neox': 682, 'n_words': 144}