Skip to content

Commit

Permalink
feat(#35): add decimal as property type
Browse files Browse the repository at this point in the history
  • Loading branch information
SteKoe committed Apr 20, 2022
1 parent d316958 commit caa90e2
Show file tree
Hide file tree
Showing 9 changed files with 38 additions and 20 deletions.
2 changes: 1 addition & 1 deletion appinfo/info.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
</screenshot>
<dependencies>
<php min-version="7.3" />
<nextcloud min-version="20" max-version="22" />
<nextcloud min-version="20" max-version="24" />
</dependencies>
<settings>
<admin>OCA\CustomProperties\Settings\AdminSettings</admin>
Expand Down
2 changes: 1 addition & 1 deletion infrastructure/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ services:
app:
image: ghcr.io/stekoe/nextcloud-docker-testing:main
ports:
- 80:80
- "80:80"
volumes:
# - ../../nextcloud-server:/var/www/html
- ../:/var/www/html/apps/customproperties
Expand Down
4 changes: 2 additions & 2 deletions js/src-adminsettings.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion js/src-adminsettings.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions js/src-sidebartab.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion js/src-sidebartab.js.map

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
"scripts": {
"build": "NODE_ENV=production webpack --progress --config webpack.config.js",
"dev": "NODE_ENV=development webpack --progress --config webpack.config.js",
"watch": "NODE_ENV=development webpack --progress --watch --config webpack.config.js",
"test": "npm-run-all --parallel test:js test:php",
"test:js": "jest --env=jsdom",
"test:php": "docker-compose -f infrastructure/docker-compose.yml run app phpunit --bootstrap tests/bootstrap.php apps/customproperties/tests/.",
Expand Down
1 change: 1 addition & 0 deletions src/components/customPropertyForm/CustomPropertyForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ export default {
{ name: 'Month', value: 'month' },
{ name: 'Time', value: 'time' },
{ name: 'Number', value: 'number' },
{ name: 'Decimal', value: 'decimal' },
],
}
},
Expand Down
40 changes: 29 additions & 11 deletions src/views/sidebar/input/PropertyTextInput.vue
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
<template>
<div class="customproperty-form-group">
<label :for="'property_'+property_.propertyname">{{ property_.propertylabel }}</label>

<label :for="'property'+property.propertyname">{{ property.propertylabel }}</label>
<div class="customproperty-input-group">
<input :id="'property_'+property_.propertyname"
v-model="property_.propertyvalue"
<input :id="'property'+property.propertyname"
v-model="value"
:aria-disabled="disabled"
:disabled="disabled"
:name="property_.propertyname"
:type="property_.propertytype"
:name="property.propertyname"
:type="type"
:step="stepSize"
class="customproperty-form-control"
@blur="blur">
</div>
Expand All @@ -18,9 +18,6 @@
<script>
export default {
name: 'PropertyTextInput',
model: {
prop: 'property',
},
props: {
property: {
type: Object,
Expand All @@ -33,12 +30,33 @@ export default {
},
data() {
return {
property_: this.property,
value: this.property.propertyvalue,
}
},
computed: {
stepSize() {
return this.property.propertytype?.toLowerCase() === 'decimal' ? 'any' : null
},
type() {
if (this.property.propertytype) {
const propertyType = this.property.propertytype.toLowerCase()
switch (propertyType) {
case 'decimal':
return 'number'
default:
return propertyType
}
}
return 'text'
},
},
methods: {
blur() {
this.$emit('blur', this.property_)
this.$emit('blur', {
...this.property,
propertyvalue: this.value,
})
},
},
}
Expand Down

0 comments on commit caa90e2

Please sign in to comment.