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

Commit

Permalink
Fixed rendering of non-default lat/long fields on index page
Browse files Browse the repository at this point in the history
  • Loading branch information
mikebronner committed Jun 26, 2019
1 parent d4d5eb6 commit 0bad2ba
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 5 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

## [Unreleased]

## [0.1.4] - 2019-06-26
### Fixed
- rendering of non-default lat/long fields on index page.

## [0.1.3] - 2019-06-26
### Fixed
- an issue where the detail screen didn't read non-default `latitude` and
Expand Down
2 changes: 1 addition & 1 deletion dist/js/field.js

Large diffs are not rendered by default.

15 changes: 11 additions & 4 deletions resources/js/components/IndexField.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,20 @@
export default {
props: ['resourceName', 'field'],
data: function () {
return {
latitude: this.field.value[this.field.latitude || "latitude"] || 0,
longitude: this.field.value[this.field.longitude || "longitude"] || 0,
};
},
computed: {
hasLatitude: function () {
return (this.field.value.latitude.length > 0);
return (this.latitude.length > 0);
},
hasLongitude: function () {
return (this.field.value.longitude.length > 0);
return (this.longitude.length > 0);
},
},
};
Expand All @@ -21,14 +28,14 @@ export default {
class="location"
>
<svg aria-hidden="true" width="16" height="16" focusable="false" data-prefix="fas" data-icon="line-height" class="svg-inline--fa fa-line-height fa-w-20" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 512"><path fill="currentColor" d="M626.29 224H269.71c-7.57 0-13.71 7.16-13.71 16v32c0 8.84 6.14 16 13.71 16h356.58c7.57 0 13.71-7.16 13.71-16v-32c0-8.84-6.14-16-13.71-16zm0 160H269.71c-7.57 0-13.71 7.16-13.71 16v32c0 8.84 6.14 16 13.71 16h356.58c7.57 0 13.71-7.16 13.71-16v-32c0-8.84-6.14-16-13.71-16zm0-320H269.71C262.14 64 256 71.16 256 80v32c0 8.84 6.14 16 13.71 16h356.58c7.57 0 13.71-7.16 13.71-16V80c0-8.84-6.14-16-13.71-16zM176 144c14.31 0 21.33-17.31 11.31-27.31l-80-80a16 16 0 0 0-22.62 0l-80 80C-4.64 126 .36 144 16 144h48v224H16c-14.29 0-21.31 17.31-11.29 27.31l80 80a16 16 0 0 0 22.62 0l80-80C196.64 386 191.64 368 176 368h-48V144z"></path></svg>
{{ field.value.latitude }}
{{ latitude }}
</span>
<span
v-if="hasLongitude"
class="location"
>
<svg aria-hidden="true" width="16" height="16" focusable="false" data-prefix="fas" data-icon="line-height" class="svg-inline--fa fa-line-height fa-w-20 fa-rotate-270" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 512"><path fill="currentColor" d="M626.29 224H269.71c-7.57 0-13.71 7.16-13.71 16v32c0 8.84 6.14 16 13.71 16h356.58c7.57 0 13.71-7.16 13.71-16v-32c0-8.84-6.14-16-13.71-16zm0 160H269.71c-7.57 0-13.71 7.16-13.71 16v32c0 8.84 6.14 16 13.71 16h356.58c7.57 0 13.71-7.16 13.71-16v-32c0-8.84-6.14-16-13.71-16zm0-320H269.71C262.14 64 256 71.16 256 80v32c0 8.84 6.14 16 13.71 16h356.58c7.57 0 13.71-7.16 13.71-16V80c0-8.84-6.14-16-13.71-16zM176 144c14.31 0 21.33-17.31 11.31-27.31l-80-80a16 16 0 0 0-22.62 0l-80 80C-4.64 126 .36 144 16 144h48v224H16c-14.29 0-21.31 17.31-11.29 27.31l80 80a16 16 0 0 0 22.62 0l80-80C196.64 386 191.64 368 176 368h-48V144z"></path></svg>
{{ field.value.longitude }}
{{ longitude }}
</span>
</span>
</template>
Expand Down

0 comments on commit 0bad2ba

Please sign in to comment.