<commit_before><script lang="coffee">
import Session        from '@/shared/services/session'
import Records        from '@/shared/services/records'
import AbilityService from '@/shared/services/ability_service'
import AppConfig      from '@/shared/services/app_config'
import UserHelpService from '@/shared/services/user_help_service'
import EventBus from '@/shared/services/event_bus'
import Flash from '@/shared/services/flash'
import { onError } from '@/shared/helpers/form'

export default
  data: ->
    submitted: false
    message: Records.contactMessages.build()
    isDisabled: false
    helpLink: UserHelpService.helpLink()
    contactEmail: AppConfig.contactEmail

  mounted: ->
    EventBus.$emit 'currentComponent',
      titleKey: 'contact_message_form.contact_us'
      page: 'inboxPage'

  created: ->
    if @isLoggedIn
      @message.name = Session.user().name
      @message.email = Session.user().email
      @message.userId = Session.user().id

  methods:
    submit: ->
      @message.save()
      .then =>
        Flash.success "contact_message_form.new_contact_message"
        @submitted = true
      .catch onError(@message)

  computed:
    isLoggedIn: ->
      Session.isSignedIn()
</script>

<template lang="pug">
v-main
  v-container.contact-page
    v-card.contact-form(v-show='!submitted')
      submit-overlay(:value='message.processing')
      v-card-title
        p.text-heading(tabindex="-1" v-t="'contact_message_form.alt_title'")
      v-card-subtitle(v-t="'contact_message_form.title'")
      v-card-text
        p(v-html="$t('contact_message_form.this_is_for')")
        p(v-html="$t('contact_message_form.read_the_manual', { link: helpLink })")
        p
        div(v-if='!isLoggedIn')
          label(v-t="")
          v-text-field(:label="$t('contact_message_form.name_label')" :placeholder="$t('contact_message_form.name_placeholder')" v-model='message.name')
          validation-errors(:subject='message', field='name')
        div(v-if='!isLoggedIn')
          v-text-field(:label="$t('contact_message_form.email_label')" :placeholder="$t('contact_message_form.email_placeholder')", v-model='message.email')
          validation-errors(:subject='message', field='email')

        v-text-field(:label="$t('contact_message_form.subject_label')" :placeholder="$t('contact_message_form.subject_placeholder')", v-model='message.subject')
        validation-errors(:subject='message', field='subject')

        v-textarea(:label="$t('contact_message_form.message_label')" v-model='message.message', :placeholder="$t('contact_message_form.message_placeholder')")
        validation-errors(:subject='message', field='message')

        p.text--secondary(v-html="$t('contact_message_form.contact_us_email', { email: contactEmail })")
        v-card-actions
          v-spacer
          v-btn(color="primary" @click='submit' v-t="'contact_message_form.send_message'")

    v-card.contact-form__success(v-show='submitted')
      v-card-title
        h1.headline(tabindex="-1" v-t="$t('contact_message_form.success_via_email', { name: message.name })")
</template>
<commit_msg>max width on contact page<commit_after><script lang="coffee">
import Session        from '@/shared/services/session'
import Records        from '@/shared/services/records'
import AbilityService from '@/shared/services/ability_service'
import AppConfig      from '@/shared/services/app_config'
import UserHelpService from '@/shared/services/user_help_service'
import EventBus from '@/shared/services/event_bus'
import Flash from '@/shared/services/flash'
import { onError } from '@/shared/helpers/form'

export default
  data: ->
    submitted: false
    message: Records.contactMessages.build()
    isDisabled: false
    helpLink: UserHelpService.helpLink()
    contactEmail: AppConfig.contactEmail

  mounted: ->
    EventBus.$emit 'currentComponent',
      titleKey: 'contact_message_form.contact_us'
      page: 'inboxPage'

  created: ->
    if @isLoggedIn
      @message.name = Session.user().name
      @message.email = Session.user().email
      @message.userId = Session.user().id

  methods:
    submit: ->
      @message.save()
      .then =>
        Flash.success "contact_message_form.new_contact_message"
        @submitted = true
      .catch onError(@message)

  computed:
    isLoggedIn: ->
      Session.isSignedIn()
</script>

<template lang="pug">
v-main
  v-container.contact-page.d-flex.justify-center
    v-card.contact-form(v-show='!submitted').max-width-800
      submit-overlay(:value='message.processing')
      v-card-title
        p.text-heading(tabindex="-1" v-t="'contact_message_form.alt_title'")
      v-card-subtitle(v-t="'contact_message_form.title'")
      v-card-text
        p(v-html="$t('contact_message_form.this_is_for')")
        p(v-html="$t('contact_message_form.read_the_manual', { link: helpLink })")
        p
        div(v-if='!isLoggedIn')
          label(v-t="")
          v-text-field(:label="$t('contact_message_form.name_label')" :placeholder="$t('contact_message_form.name_placeholder')" v-model='message.name')
          validation-errors(:subject='message', field='name')
        div(v-if='!isLoggedIn')
          v-text-field(:label="$t('contact_message_form.email_label')" :placeholder="$t('contact_message_form.email_placeholder')", v-model='message.email')
          validation-errors(:subject='message', field='email')

        v-text-field(:label="$t('contact_message_form.subject_label')" :placeholder="$t('contact_message_form.subject_placeholder')", v-model='message.subject')
        validation-errors(:subject='message', field='subject')

        v-textarea(:label="$t('contact_message_form.message_label')" v-model='message.message', :placeholder="$t('contact_message_form.message_placeholder')")
        validation-errors(:subject='message', field='message')

        p.text--secondary(v-html="$t('contact_message_form.contact_us_email', { email: contactEmail })")
        v-card-actions
          v-spacer
          v-btn(color="primary" @click='submit' v-t="'contact_message_form.send_message'")

    v-card.contact-form__success(v-show='submitted')
      v-card-title
        h1.headline(tabindex="-1" v-t="$t('contact_message_form.success_via_email', { name: message.name })")
</template>

{'fraction_non_alphanumeric': 0.15635957921581128, 'fraction_numerical': 0.0014344915524386356, 'mean_word_length': 3.864341085271318, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 23, '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': '4134498', 'n_tokens_mistral': 1949, 'n_tokens_neox': 1926, 'n_words': 266}