Skip to content
This repository has been archived by the owner on Oct 18, 2022. It is now read-only.

Commit

Permalink
Fixed readonly() method.
Browse files Browse the repository at this point in the history
  • Loading branch information
mikebronner committed Sep 2, 2020
1 parent 0a88b9a commit 082657c
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 12 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

## [1.3.1] - 2020-09-02
### Fixed
- `readonly()` method.

## [1.3.0] - 2020-09-02
### Added
- inline create-related-resource link.
Expand Down
2 changes: 1 addition & 1 deletion dist/js/tool.js

Large diffs are not rendered by default.

19 changes: 8 additions & 11 deletions resources/js/components/Tool.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<template slot="field">
<div class="flex items-center">
<search-input
v-if="isSearchable && !isLocked && !isReadonly"
:clearable="field.nullable"
:data-testid="`${field.resourceName}-search-input`"
:data="availableResources"
Expand All @@ -15,7 +16,6 @@
class="w-full"
searchBy="display"
trackBy="value"
v-if="isSearchable && ! isLocked && ! isReadOnly"
>
<div
slot="default"
Expand Down Expand Up @@ -71,13 +71,13 @@
</search-input>

<select-control
v-if="!isSearchable || isLocked || isReadOnly"
v-if="!isSearchable || isLocked || isReadonly"
class="form-control form-select w-full"
:class="{ 'border-danger': hasError }"
:data-testid="`${field.resourceName}-select`"
:dusk="field.attribute"
@change="selectResourceFromSelectControl"
:disabled="isLocked || isReadOnly"
:disabled="isLocked || isReadonly"
:options="availableResources"
:selected="selectedResourceId"
label="display"
Expand Down Expand Up @@ -148,12 +148,7 @@
],
props: {
// resourceName: String,
resourceId: {},
// field: Object,
// viaResource: {},
// viaResourceId: {},
// viaRelationship: {},
},
data: () => ({
Expand Down Expand Up @@ -213,7 +208,7 @@
this.getAvailableResources();
}
if (this.isSearchable && this.shouldPrepopulate) {
if (!this.isReadonly && this.isSearchable && this.shouldPrepopulate) {
if (this.field.prepopulate_query) {
this.search = this.field.prepopulate_query;
}
Expand Down Expand Up @@ -390,11 +385,13 @@
},
isLocked() {
return this.viaResource == this.field.resourceName && this.field.reverse
return (this.viaResource == this.field.resourceName && this.field.reverse);
},
isReadonly() {
return this.field.readonly || _.get(this.field, 'extraAttributes.readonly')
return (
this.field.readonly || _.get(this.field, 'extraAttributes.readonly')
);
},
shouldShowTrashed() {
Expand Down

0 comments on commit 082657c

Please sign in to comment.