<commit_before>import template from '../../mixins/template';

FLOW.FormView = Ember.View.extend(template('navSurveys/form'), {
  showFormBasics: false,

  manageTranslations: false,
  manageNotifications: false,

  form: Ember.computed(() => FLOW.selectedControl.get('selectedSurvey')).property('FLOW.selectedControl.selectedSurvey'),

  toggleShowFormBasics() {
    this.set('showFormBasics', !this.get('showFormBasics'));
  },

  isNewForm: Ember.computed(() => {
    const form = FLOW.selectedControl.get('selectedSurvey');
    return form && form.get('code') == 'New Form';
  }).property('FLOW.selectedControl.selectedSurvey'),

  visibleFormBasics: Ember.computed(function () {
    return this.get('isNewForm') || this.get('showFormBasics');
  }).property('showFormBasics'),

  doManageTranslations() {
    FLOW.translationControl.populate();
    this.set('manageNotifications', false);
    this.set('manageTranslations', true);
  },

  doManageNotifications() {
    FLOW.notificationControl.populate();
    this.set('manageTranslations', false);
    this.set('manageNotifications', true);
  },

  disableFormFields: Ember.computed(function () {
    const form = this.get('form');
    return !FLOW.permControl.canEditForm(form);
  }).property('this.form'),

  showFormTranslationsButton: Ember.computed(function () {
    const form = this.get('form');
    return FLOW.permControl.canEditForm(form);
  }).property('this.form'),

  showFormDeleteButton: Ember.computed(function () {
    const form = this.get('form');
    return FLOW.permControl.canEditForm(form);
  }).property('this.form'),

  showFormPublishButton: Ember.computed(function () {
    const form = this.get('form');
    return FLOW.permControl.canEditForm(form);
  }).property('this.form'),

  disableFormPublishButton: Ember.computed(function () {
    const form = this.get('form');
    return form.get('status') === 'PUBLISHED';
  }).property('this.form'),
});
<commit_msg>[#3855] Only enable the publish button when the questions have been loaded<commit_after>import template from '../../mixins/template';

FLOW.FormView = Ember.View.extend(template('navSurveys/form'), {
  showFormBasics: false,

  manageTranslations: false,
  manageNotifications: false,

  form: Ember.computed(() => FLOW.selectedControl.get('selectedSurvey')).property('FLOW.selectedControl.selectedSurvey'),

  toggleShowFormBasics() {
    this.set('showFormBasics', !this.get('showFormBasics'));
  },

  isNewForm: Ember.computed(() => {
    const form = FLOW.selectedControl.get('selectedSurvey');
    return form && form.get('code') == 'New Form';
  }).property('FLOW.selectedControl.selectedSurvey'),

  visibleFormBasics: Ember.computed(function () {
    return this.get('isNewForm') || this.get('showFormBasics');
  }).property('showFormBasics'),

  doManageTranslations() {
    FLOW.translationControl.populate();
    this.set('manageNotifications', false);
    this.set('manageTranslations', true);
  },

  doManageNotifications() {
    FLOW.notificationControl.populate();
    this.set('manageTranslations', false);
    this.set('manageNotifications', true);
  },

  disableFormFields: Ember.computed(function () {
    const form = this.get('form');
    return !FLOW.permControl.canEditForm(form);
  }).property('this.form'),

  showFormTranslationsButton: Ember.computed(function () {
    const form = this.get('form');
    return FLOW.permControl.canEditForm(form);
  }).property('this.form'),

  showFormDeleteButton: Ember.computed(function () {
    const form = this.get('form');
    return FLOW.permControl.canEditForm(form);
  }).property('this.form'),

  showFormPublishButton: Ember.computed(function () {
    const form = this.get('form');
    return FLOW.permControl.canEditForm(form);
  }).property('this.form'),

  disableFormPublishButton: Ember.computed(function () {
    const form = this.get('form');
    const questionsLoading = !FLOW.questionControl.content.isLoaded;
    return questionsLoading || form.get('status') === 'PUBLISHED';
  }).property('this.form', 'FLOW.questionControl.content.isLoaded'),
});

{'fraction_non_alphanumeric': 0.1654006370987503, 'fraction_numerical': 0.00098015192354815, 'mean_word_length': 4.9245283018867925, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, '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': '7241264', 'n_tokens_mistral': 1295, 'n_tokens_neox': 1257, 'n_words': 192}