Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Bower components Debian packages RPM packages NuGet packages

jsarnowski / jsarnowski/jet-engine   php

Repository URL to install this package:

Version: 2.7.7 

/ modules / rest-api-listings / inc / assets / js / admin / form-notification.js

Vue.component( 'jet-rest-notification', {
	template: '#jet-rest-notification',
	props: [ 'value', 'fields' ],
	data: function () {
		return {
			result: {},
			formFields: [],
			authTypes: window.JetEngineRestData.auth_types,
		};
	},
	created: function() {

		this.result = this.value;

		if ( ! this.result ) {
			this.result = {};
		}

	},
	computed: {
		fieldsString: function() {

			var macros = [];

			for (var i = 0; i < this.fields.length; i++) {
				macros.push( '%' + this.fields[ i ] + '%' );
			}

			return macros.join( ', ' );

		}
	},
	methods: {
		setField: function( $event, key ) {

			var value;

			if ( 'checkbox' === $event.target.type  ) {
				value = $event.target.checked;
			} else {
				value = $event.target.value;
			}

			this.$set( this.result, key, value );
			this.$emit( 'input', this.result );

		},
	}
});