<commit_before><template>
  <dialog-form
    v-model="showDialog"
    icon="mdi-calendar-plus"
    :title="$tc('components.dialog.dialogCategoryCreate.title')"
    max-width="600px"
    :submit-action="createCategory"
    submit-color="success"
    :cancel-action="close">
    <template #activator="scope">
      <slot name="activator" v-bind="scope" />
    </template>

    <dialog-category-form
      v-if="!loading"
      :camp="camp"
      :is-new="true"
      :category="entityData" />
  </dialog-form>
</template>

<script>
import DialogForm from './DialogForm.vue'
import DialogBase from './DialogBase.vue'
import DialogCategoryForm from './DialogCategoryForm.vue'

export default {
  name: 'DialogCategoryCreate',
  components: {
    DialogCategoryForm,
    DialogForm
  },
  extends: DialogBase,
  props: {
    camp: { type: Object, required: true }
  },
  data () {
    return {
      entityProperties: [
        'camp',
        'short',
        'name',
        'color',
        'numberingStyle'
      ],
      embeddedCollections: [
        'preferredContentTypes'
      ],
      entityUri: '/categories'
    }
  },
  watch: {
    showDialog: function (showDialog) {
      if (showDialog) {
        this.setEntityData({
          camp: this.camp._meta.self,
          short: '',
          name: '',
          color: '#000000',
          numberingStyle: '1'
        })
      } else {
        // clear form on exit
        this.clearEntityData()
      }
    }
  },
  methods: {
    createCategory () {
      return this.create().then(() => {
        this.api.reload(this.camp)
      })
    }
  }
}
</script>

<style scoped>

</style><commit_msg>DialogCategoryCreate.vue: reload categories instead of the camp<commit_after><template>
  <dialog-form
    v-model="showDialog"
    icon="mdi-calendar-plus"
    :title="$tc('components.dialog.dialogCategoryCreate.title')"
    max-width="600px"
    :submit-action="createCategory"
    submit-color="success"
    :cancel-action="close">
    <template #activator="scope">
      <slot name="activator" v-bind="scope" />
    </template>

    <dialog-category-form
      v-if="!loading"
      :camp="camp"
      :is-new="true"
      :category="entityData" />
  </dialog-form>
</template>

<script>
import DialogForm from './DialogForm.vue'
import DialogBase from './DialogBase.vue'
import DialogCategoryForm from './DialogCategoryForm.vue'

export default {
  name: 'DialogCategoryCreate',
  components: {
    DialogCategoryForm,
    DialogForm
  },
  extends: DialogBase,
  props: {
    camp: { type: Object, required: true }
  },
  data () {
    return {
      entityProperties: [
        'camp',
        'short',
        'name',
        'color',
        'numberingStyle'
      ],
      embeddedCollections: [
        'preferredContentTypes'
      ],
      entityUri: '/categories'
    }
  },
  watch: {
    showDialog: function (showDialog) {
      if (showDialog) {
        this.setEntityData({
          camp: this.camp._meta.self,
          short: '',
          name: '',
          color: '#000000',
          numberingStyle: '1'
        })
      } else {
        // clear form on exit
        this.clearEntityData()
      }
    }
  },
  methods: {
    createCategory () {
      return this.create().then(() => {
        this.api.reload(this.camp.categories())
      })
    }
  }
}
</script>

<style scoped>

</style>
{'fraction_non_alphanumeric': 0.1492138831207357, 'fraction_numerical': 0.0059329575793533075, 'mean_word_length': 2.2579710144927536, 'pattern_counts': {'":': 0, '<': 27, '<?xml version=': 0, '>': 29, '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': '369467', 'n_tokens_mistral': 1056, 'n_tokens_neox': 1042, 'n_words': 189}