Sha256: cf064785496dfca998a3d8e100a1645b4cd9e1fc5e40e95f47273e5c5e9fe92c

Contents?: true

Size: 1.51 KB

Versions: 16

Compression:

Stored size: 1.51 KB

Contents

const overlayStore = {
  namespaced: true,
  state: {
    showInsertOverlay: false,
    showProgress: false,
    notifications: [],
    confirmation: {
      msg: '',
      callback: null
    }
  },
  mutations: {
    SET_SHOW_INSERT_OVERLAY (state, value) {
      state.showInsertOverlay = value
    },
    SET_SHOW_PROGRESS_OVERLAY (state, value) {
      state.showProgress = value
    },
    PUSH_CONFIRMATION (state, object) {
      if(object.hasOwnProperty('msg')) state.confirmation.msg = object.msg
      if(object.hasOwnProperty('callback')) state.confirmation.callback = object.callback
    },
    CLEAR_CONFIRMATION (state) {
      state.confirmation.msg = ''
      state.confirmation.callback = null
    },
    PUSH_NOTIFICATION (state, object) {
      state.notifications.push(object)
    },
    POP_NOTIFICATION (state) {
      state.notifications.pop()
    }
  },
  actions: {
    showInsertOverlay ({ commit, state }, value) {
      commit('SET_SHOW_INSERT_OVERLAY', value)
    },
    showProgressOverlay ({ commit, state }, value) {
      commit('SET_SHOW_PROGRESS_OVERLAY', value)
    },
    pushNotification ({ commit, state }, notificationObject) {
      commit('PUSH_NOTIFICATION', notificationObject)
      let t = setTimeout(() => {
        commit('POP_NOTIFICATION')
      }, 2000)
    },
    pushConfirmation({ commit, state }, confirmationObject) {
      commit('PUSH_CONFIRMATION', confirmationObject)
    },
    clearConfirmation({commit}) {
      commit('CLEAR_CONFIRMATION')
    }

  }
}

export default overlayStore

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
rails_admin_image_manager-0.1.34 app/assets/javascripts/rails_admin_image_manager/stores/overlay.js
rails_admin_image_manager-0.1.33 app/assets/javascripts/rails_admin_image_manager/stores/overlay.js
rails_admin_image_manager-0.1.31 app/assets/javascripts/rails_admin_image_manager/stores/overlay.js
rails_admin_image_manager-0.1.30 app/assets/javascripts/rails_admin_image_manager/stores/overlay.js
rails_admin_image_manager-0.1.3 app/assets/javascripts/rails_admin_image_manager/stores/overlay.js
rails_admin_image_manager-0.1.29 app/assets/javascripts/rails_admin_image_manager/stores/overlay.js
rails_admin_image_manager-0.1.28 app/assets/javascripts/rails_admin_image_manager/stores/overlay.js
rails_admin_image_manager-0.1.27 app/assets/javascripts/rails_admin_image_manager/stores/overlay.js
rails_admin_image_manager-0.1.26 app/assets/javascripts/rails_admin_image_manager/stores/overlay.js
rails_admin_image_manager-0.1.25 app/assets/javascripts/rails_admin_image_manager/stores/overlay.js
rails_admin_image_manager-0.1.24 app/assets/javascripts/rails_admin_image_manager/stores/overlay.js
rails_admin_image_manager-0.1.23 app/assets/javascripts/rails_admin_image_manager/stores/overlay.js
rails_admin_image_manager-0.1.22 app/assets/javascripts/rails_admin_image_manager/stores/overlay.js
rails_admin_image_manager-0.1.21 app/assets/javascripts/rails_admin_image_manager/stores/overlay.js
rails_admin_image_manager-0.1.20 app/assets/javascripts/rails_admin_image_manager/stores/overlay.js
rails_admin_image_manager-0.1.15 app/assets/javascripts/rails_admin_image_manager/stores/overlay.js