Sha256: e2a592867555ad5278df9705ebd084a82fe8c0e82d6184a8ae26da01660d0cb0

Contents?: true

Size: 1.02 KB

Versions: 15

Compression:

Stored size: 1.02 KB

Contents

<template>
  <button typ="button" class="btn btn-xs btn-default" @click.prevent="insert()">Utiliser</button>
</template>

<script>
import {mapState} from 'vuex'

export default {
  props: ['id', 'saveMethod'],
  data () {
    return {}
  },
  methods: {
    insert () {
      let doIt = (response) => {
        let id = this.id || response.data.id
        if (this.$store.state.ckEditorStore.ckId != "") {
          if (id) {
            this.$store.dispatch('mediasStore/fetchSingleImage', this.id).then(()=> {
              this.$store.dispatch('overlayStore/showInsertOverlay', true)
            })
          } else {
            this.$store.dispatch('overlayStore/showInsertOverlay', true)
          }
        } else {
          this.$store.dispatch('railsAdmin/insertImage', id)
        }
      }
      if (typeof this.saveMethod == "function") {
        this.saveMethod().then(doIt).catch(() => { console.log('Erreur lors de la sauvegarde');})
      } else {
        doIt()
      }

    }
  }
}
</script>

<style media="screen">
</style>

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
rails_admin_image_manager-0.1.34 app/assets/javascripts/rails_admin_image_manager/components/imageInsertButton.vue
rails_admin_image_manager-0.1.33 app/assets/javascripts/rails_admin_image_manager/components/imageInsertButton.vue
rails_admin_image_manager-0.1.31 app/assets/javascripts/rails_admin_image_manager/components/imageInsertButton.vue
rails_admin_image_manager-0.1.30 app/assets/javascripts/rails_admin_image_manager/components/imageInsertButton.vue
rails_admin_image_manager-0.1.3 app/assets/javascripts/rails_admin_image_manager/components/imageInsertButton.vue
rails_admin_image_manager-0.1.29 app/assets/javascripts/rails_admin_image_manager/components/imageInsertButton.vue
rails_admin_image_manager-0.1.28 app/assets/javascripts/rails_admin_image_manager/components/imageInsertButton.vue
rails_admin_image_manager-0.1.27 app/assets/javascripts/rails_admin_image_manager/components/imageInsertButton.vue
rails_admin_image_manager-0.1.26 app/assets/javascripts/rails_admin_image_manager/components/imageInsertButton.vue
rails_admin_image_manager-0.1.25 app/assets/javascripts/rails_admin_image_manager/components/imageInsertButton.vue
rails_admin_image_manager-0.1.24 app/assets/javascripts/rails_admin_image_manager/components/imageInsertButton.vue
rails_admin_image_manager-0.1.23 app/assets/javascripts/rails_admin_image_manager/components/imageInsertButton.vue
rails_admin_image_manager-0.1.22 app/assets/javascripts/rails_admin_image_manager/components/imageInsertButton.vue
rails_admin_image_manager-0.1.21 app/assets/javascripts/rails_admin_image_manager/components/imageInsertButton.vue
rails_admin_image_manager-0.1.20 app/assets/javascripts/rails_admin_image_manager/components/imageInsertButton.vue