| 1 |
import Vue from 'vue'; |
| 2 |
import ajaxCaller from '../ajaxCaller'; |
| 3 |
import locale from 'element-ui/lib/locale'; |
| 4 |
import lang from 'element-ui/lib/locale/lang/en'; |
| 5 |
|
| 6 |
import Settings from './Settings.vue'; |
| 7 |
import reCaptcha from './reCaptcha.vue'; |
| 8 |
import pdf_settings from './pdf.vue'; |
| 9 |
import GeneralIntegrationSettings from './GeneralIntegrationSettings'; |
| 10 |
import DoubleOptinSettings from './DoubleOptinSettings'; |
| 11 |
|
| 12 |
import { |
| 13 |
Button, |
| 14 |
Radio, |
| 15 |
RadioGroup, |
| 16 |
Form, |
| 17 |
FormItem, |
| 18 |
Input, |
| 19 |
Tooltip, |
| 20 |
Row, |
| 21 |
Col, |
| 22 |
Select, |
| 23 |
Option, |
| 24 |
OptionGroup, |
| 25 |
Switch, |
| 26 |
Dialog, |
| 27 |
Loading, |
| 28 |
Notification, |
| 29 |
Checkbox, |
| 30 |
CheckboxGroup, |
| 31 |
ColorPicker, |
| 32 |
InputNumber |
| 33 |
} from 'element-ui'; |
| 34 |
|
| 35 |
locale.use(lang); |
| 36 |
Vue.use(Button); |
| 37 |
Vue.use(Form); |
| 38 |
Vue.use(Row); |
| 39 |
Vue.use(Col); |
| 40 |
Vue.use(Input); |
| 41 |
Vue.use(Checkbox); |
| 42 |
Vue.use(CheckboxGroup); |
| 43 |
Vue.use(Select); |
| 44 |
Vue.use(Option); |
| 45 |
Vue.use(OptionGroup); |
| 46 |
Vue.use(Switch); |
| 47 |
Vue.use(Tooltip); |
| 48 |
Vue.use(FormItem); |
| 49 |
Vue.use(ajaxCaller); |
| 50 |
Vue.use(Loading.directive); |
| 51 |
Vue.use(InputNumber); |
| 52 |
Vue.use(ColorPicker); |
| 53 |
Vue.use(RadioGroup); |
| 54 |
Vue.use(Radio); |
| 55 |
Vue.use(Dialog); |
| 56 |
Vue.prototype.$notify = Notification; |
| 57 |
Vue.prototype.$loading = Loading.service; |
| 58 |
|
| 59 |
new Vue({ |
| 60 |
el: '#ff_global_settings_option_app', |
| 61 |
components: { |
| 62 |
settings: Settings, |
| 63 |
re_captcha: reCaptcha, |
| 64 |
pdf_settings: pdf_settings, |
| 65 |
'general-integration-settings': GeneralIntegrationSettings, |
| 66 |
'double_optin_settings': DoubleOptinSettings |
| 67 |
}, |
| 68 |
data: { |
| 69 |
component: 'settings', |
| 70 |
App: window.FluentFormApp, |
| 71 |
settings_key: '' |
| 72 |
}, |
| 73 |
methods: { |
| 74 |
setRoute(hash) { |
| 75 |
// get component by hash |
| 76 |
let $el = jQuery('.ff_settings_list li').find('a[data-hash=' + hash + ']'); |
| 77 |
let component = hash; |
| 78 |
if ($el.data('component')) { |
| 79 |
component = $el.data('component'); |
| 80 |
} else { |
| 81 |
$el = jQuery('.ff_settings_list li').find('a[data-component=' + hash + ']'); |
| 82 |
} |
| 83 |
if (this.$options.components[component]) { |
| 84 |
jQuery('.ff_settings_list li').removeClass('active'); |
| 85 |
$el.parent().addClass('active'); |
| 86 |
this.settings_key = jQuery($el).attr('data-settings_key'); |
| 87 |
this.component = component; |
| 88 |
} |
| 89 |
} |
| 90 |
}, |
| 91 |
created() { |
| 92 |
let hash = location.hash.substr(1); |
| 93 |
if (hash) { |
| 94 |
this.setRoute(hash); |
| 95 |
} |
| 96 |
|
| 97 |
const that = this; |
| 98 |
jQuery('.ff_settings_list li a').on('click', function () { |
| 99 |
let hash = jQuery(this).attr('data-hash'); |
| 100 |
if (hash) { |
| 101 |
that.setRoute(hash); |
| 102 |
} |
| 103 |
jQuery(this).parent().addClass('active'); |
| 104 |
}); |
| 105 |
} |
| 106 |
}); |
| 107 |
|