diff --git a/src/components/generics/icons/IconViewCount.vue b/src/components/generics/icons/IconViewCount.vue new file mode 100644 index 0000000000..e38986d5d8 --- /dev/null +++ b/src/components/generics/icons/IconViewCount.vue @@ -0,0 +1,14 @@ + + + diff --git a/src/js/constants/documentsProperties.json b/src/js/constants/documentsProperties.json index eb1709da1e..df31faee32 100644 --- a/src/js/constants/documentsProperties.json +++ b/src/js/constants/documentsProperties.json @@ -149,6 +149,8 @@ { "id": "date_start", "properties": { "url": "date", "required": false } }, { "id": "dates", "properties": { "url": "date", "required": false } }, { "id": "disable_comments" }, + { "id": "disable_view_count" }, + { "id": "view_count" }, { "id": "elevation_access", "properties": { "url": "oparka" } }, { "id": "elevation_down_snow", diff --git a/src/js/constants/fieldsProperties.json b/src/js/constants/fieldsProperties.json index 9cf2dde83c..6c1599e196 100644 --- a/src/js/constants/fieldsProperties.json +++ b/src/js/constants/fieldsProperties.json @@ -233,6 +233,13 @@ "type": "boolean", "default": false }, + "disable_view_count": { + "type": "boolean", + "default": false + }, + "view_count": { + "type": "number" + }, "durations": { "values": "route_duration_types", "multiple": true, diff --git a/src/translations/en.json b/src/translations/en.json index c4c8e4d211..373ce4e6c1 100644 --- a/src/translations/en.json +++ b/src/translations/en.json @@ -375,6 +375,8 @@ }, "difficulties_height": "Difficulties start altitude", "disable_comments": "Disable comments", + "disable_view_count": "Disable view count", + "view_count": "views", "durations": "Durations", "durations (days)": "duration (days)", "easy": { diff --git a/src/translations/fr.json b/src/translations/fr.json index e732b7c2ca..fc0896a271 100644 --- a/src/translations/fr.json +++ b/src/translations/fr.json @@ -1007,6 +1007,8 @@ }, "difficulties_height": "Altitude du début des difficultés", "disable_comments": "Désactiver les commentaires", + "disable_view_count": "Désactiver le compteur de vues", + "view_count": "vues", "draft": { "quality_types": "ébauche" }, diff --git a/src/views/document/utils/boxes/ToolBox.vue b/src/views/document/utils/boxes/ToolBox.vue index ad96601f2a..eaf28d97c5 100644 --- a/src/views/document/utils/boxes/ToolBox.vue +++ b/src/views/document/utils/boxes/ToolBox.vue @@ -81,6 +81,11 @@ {{ quality.i18nName }} {{ quality.i18nValue }} +
+ + {{ viewCount.value }} {{ viewCount.i18nName }} +
+ import IconQuality from '../../../../components/generics/icons/IconQuality.vue'; +import IconViewCount from '../../../../components/generics/icons/IconViewCount.vue'; import DeleteDocumentWindow from '../windows/DeleteDocumentWindow'; import DeleteLocaleWindow from '../windows/DeleteLocaleWindow'; import MergeDocumentWindow from '../windows/MergeDocumentWindow'; @@ -203,6 +209,7 @@ export default { LicenseBox, AssociatedDocuments, IconQuality, + IconViewCount, AssociationsWindow, DeleteLocaleWindow, DeleteDocumentWindow, @@ -269,6 +276,20 @@ export default { }; }, + viewCount() { + const fields = constants.objectDefinitions[this.documentType].fields; + const value = this.document[fields.view_count.name]; + const isValue = value !== null && value !== undefined; + if (!fields.view_count || !isValue) { + return; + } + return { + ...fields.view_count, + value, + i18nName: this.$gettext(fields.view_count.name), + }; + }, + fundraiser() { return getFundraiser(this.document); }, @@ -418,7 +439,7 @@ export default { content: ' \2022 '; /* \2022 is bull */ } -.quality { +.quality .view-count { span:nth-of-type(1) { @include colon; } diff --git a/src/views/wiki/edition/OutingEditionView.vue b/src/views/wiki/edition/OutingEditionView.vue index d21280e2e9..c40ffe58f8 100644 --- a/src/views/wiki/edition/OutingEditionView.vue +++ b/src/views/wiki/edition/OutingEditionView.vue @@ -149,6 +149,9 @@ /> +
+ +