adapting web components for dev interface
This commit is contained in:
parent
a55e15865e
commit
1bd56947be
|
@ -22,11 +22,17 @@
|
|||
props: {
|
||||
field: {
|
||||
type: Object
|
||||
},
|
||||
options: {
|
||||
type: String
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
getOptions(){
|
||||
if (this.field) {
|
||||
if ( this.options && this.options !== '' ){
|
||||
return this.options.split("\n");
|
||||
}
|
||||
else if (this.field) {
|
||||
const fields = this.field.field.field_type_options.options;
|
||||
return ( fields ) ? fields.split("\n") : [];
|
||||
}
|
||||
|
|
|
@ -20,11 +20,17 @@
|
|||
props: {
|
||||
field: {
|
||||
type: Object
|
||||
},
|
||||
options: {
|
||||
type: String
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
getOptions(){
|
||||
if (this.field) {
|
||||
if ( this.options && this.options !== '' ){
|
||||
return this.options.split("\n");
|
||||
}
|
||||
else if (this.field) {
|
||||
const fields = this.field.field.field_type_options.options;
|
||||
return ( fields ) ? fields.split("\n") : [];
|
||||
}
|
||||
|
|
|
@ -22,7 +22,8 @@ class Radio extends Field_Type {
|
|||
|
||||
public function render( $itemMetadata ){
|
||||
$options = ( isset( $this->options['options'] ) ) ? $this->options['options'] : '';
|
||||
return '<tainacan-radio
|
||||
return '<tainacan-radio
|
||||
options="' . $options . '"
|
||||
field_id ="'.$itemMetadata->get_field()->get_id().'"
|
||||
item_id="'.$itemMetadata->get_item()->get_id().'"
|
||||
value=\''.json_encode( $itemMetadata->get_value() ).'\'
|
||||
|
|
|
@ -35,6 +35,9 @@
|
|||
props: {
|
||||
field: {
|
||||
type: Object
|
||||
},
|
||||
collection_id: {
|
||||
type: Number
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
|
@ -50,7 +53,7 @@
|
|||
if (query !== '') {
|
||||
this.loading = true;
|
||||
this.options = [];
|
||||
let collectionId = this.field.field.field_type_options.collection_id;
|
||||
let collectionId = ( this.field && this.field.field.field_type_options.collection_id ) ? this.field.field.field_type_options.collection_id : this.collection_id;
|
||||
axios.get('/collection/'+collectionId+'/items')
|
||||
.then( res => {
|
||||
let result = [];
|
||||
|
|
|
@ -24,6 +24,7 @@ class Relationship extends Field_Type {
|
|||
|
||||
public function render( $itemMetadata ){
|
||||
return '<tainacan-relationship
|
||||
collection_id="' . $this->options['collection_id'] . '"
|
||||
field_id ="'.$itemMetadata->get_field()->get_id().'"
|
||||
item_id="'.$itemMetadata->get_item()->get_id().'"
|
||||
value=\''.json_encode( $itemMetadata->get_value() ).'\'
|
||||
|
|
|
@ -22,11 +22,17 @@
|
|||
props: {
|
||||
field: {
|
||||
type: Object
|
||||
},
|
||||
options: {
|
||||
type: String
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
getOptions(){
|
||||
if (this.field && this.field.field.field_type_options.options) {
|
||||
if ( this.options && this.options !== '' ){
|
||||
return this.options.split("\n");
|
||||
}
|
||||
else if ( this.field && this.field.field.field_type_options.options ) {
|
||||
const fields = this.field.field.field_type_options.options;
|
||||
return ( fields ) ? fields.split("\n") : [];
|
||||
}
|
||||
|
|
|
@ -23,6 +23,7 @@ class Selectbox extends Field_Type {
|
|||
public function render( $itemMetadata ){
|
||||
$options = ( isset( $this->options['options'] ) ) ? $this->options['options'] : '';
|
||||
return '<tainacan-selectbox
|
||||
options="' . $options . '"
|
||||
field_id ="'.$itemMetadata->get_field()->get_id().'"
|
||||
item_id="'.$itemMetadata->get_item()->get_id().'"
|
||||
value=\''.json_encode( $itemMetadata->get_value() ).'\'
|
||||
|
|
|
@ -15,16 +15,17 @@ import Checkbox from '../classes/field-types/checkbox/Checkbox.vue';
|
|||
import Radio from '../classes/field-types/radio/Radio.vue';
|
||||
import Numeric from '../classes/field-types/numeric/Numeric.vue';
|
||||
import Date from '../classes/field-types/date/Date.vue';
|
||||
import Relationship from '../classes/field-types/relationship/Relationship.vue';
|
||||
|
||||
|
||||
Vue.customElement('tainacan-text', Text);
|
||||
eventBus.registerComponent( 'tainacan-text' );
|
||||
|
||||
Vue.customElement('tainacan-textarea', Textarea);
|
||||
eventBus.registerComponent( 'tainacan-numeric' );
|
||||
eventBus.registerComponent( 'tainacan-textarea' );
|
||||
|
||||
Vue.customElement('tainacan-selectbox', Selectbox);
|
||||
eventBus.registerComponent( 'tainacan-textarea' );
|
||||
eventBus.registerComponent( 'tainacan-selectbox' );
|
||||
|
||||
Vue.customElement('tainacan-checkbox', Checkbox);
|
||||
eventBus.registerComponent( 'tainacan-checkbox' );
|
||||
|
@ -38,4 +39,7 @@ eventBus.registerComponent( 'tainacan-numeric' );
|
|||
Vue.customElement('tainacan-date', Date);
|
||||
eventBus.registerComponent( 'tainacan-date' );
|
||||
|
||||
Vue.customElement('tainacan-relationship', Relationship);
|
||||
eventBus.registerComponent( 'tainacan-relationship' );
|
||||
|
||||
eventBus.listener();
|
Loading…
Reference in New Issue