From fc1500af30dd3cfbfad6dbc84495acf7e0fd5577 Mon Sep 17 00:00:00 2001 From: ToMaarton Date: Mon, 14 Oct 2024 22:30:13 +0200 Subject: [PATCH 1/5] added total tag counters to album cover cards --- app/components/cards/photo-album-card.hbs | 7 ++++++ app/models/photo-album.js | 11 ++++++++++ .../components/cards/photo-album-card.scss | 8 +++++++ yarn.lock | 22 ++++--------------- 4 files changed, 30 insertions(+), 18 deletions(-) diff --git a/app/components/cards/photo-album-card.hbs b/app/components/cards/photo-album-card.hbs index d205ca647..042270d2b 100644 --- a/app/components/cards/photo-album-card.hbs +++ b/app/components/cards/photo-album-card.hbs @@ -5,11 +5,18 @@ src='{{album.albumMediumUrl}}' class='card-img-rounded' /> +

{{album.title}}

{{moment-format album.date 'DD-MM-YYYY'}}

+ {{#if album.amountOfTags}} + + + {{album.amountOfTags}} + + {{/if}}
\ No newline at end of file diff --git a/app/models/photo-album.js b/app/models/photo-album.js index d1f4f98c2..9eeb2860c 100644 --- a/app/models/photo-album.js +++ b/app/models/photo-album.js @@ -35,6 +35,17 @@ export default class PhotoAlbum extends Model { return this.photos?.sortBy('exifDateTimeOriginal', 'createdAt'); } + get amountOfTags() { + var c = 0 + for(var p of this.photos._objects){ + c += p.amountOfTags + console.log(c) + } + + //console.log(this.photos?._objects[1]?.amountOfTags) + return c + } + // Methods isOwner(user) { if (user.get('id') === this.author.get('id')) { diff --git a/app/styles/components/cards/photo-album-card.scss b/app/styles/components/cards/photo-album-card.scss index 6fa9418a4..f746809a1 100644 --- a/app/styles/components/cards/photo-album-card.scss +++ b/app/styles/components/cards/photo-album-card.scss @@ -19,4 +19,12 @@ .card-title { font-size: 1.5rem; } + + .album-tag-counter { + position: absolute; + bottom: 0; + margin-bottom: 1rem; + margin-right: 15px; + padding-left: 5px; + } } diff --git a/yarn.lock b/yarn.lock index 1f111a5f8..c3e9592c1 100644 --- a/yarn.lock +++ b/yarn.lock @@ -8827,24 +8827,10 @@ __metadata: languageName: node linkType: hard -"caniuse-lite@npm:^1.0.0, caniuse-lite@npm:^1.0.30000844, caniuse-lite@npm:^1.0.30001313": - version: 1.0.30001458 - resolution: "caniuse-lite@npm:1.0.30001458" - checksum: 258cc5a25babbbfe483bf788c6f321a19400ff80b2bf156b360bac09a6f9f4da44516350d187a30395667cb142c682d9ea96577ea0df236d35f76234b07ccb41 - languageName: node - linkType: hard - -"caniuse-lite@npm:^1.0.30001449": - version: 1.0.30001485 - resolution: "caniuse-lite@npm:1.0.30001485" - checksum: 2db8a9e5facf8df5275c96e44714a6caf3b9485813be1fe0aa5a72a7ced974137adeeed806a9a97f713d2f6d1b5c342949b88355ee0323ba35656bfa00d57fea - languageName: node - linkType: hard - -"caniuse-lite@npm:^1.0.30001541": - version: 1.0.30001547 - resolution: "caniuse-lite@npm:1.0.30001547" - checksum: ec0fc2b46721887f6f4aca1f3902f03d9a1a07416d16a86b7cd4bfba60e7b6b03ab3969659d3ea0158cc2f298972c80215c06c9457eb15c649d7780e8f5e91a7 +"caniuse-lite@npm:^1.0.0, caniuse-lite@npm:^1.0.30000844, caniuse-lite@npm:^1.0.30001313, caniuse-lite@npm:^1.0.30001449, caniuse-lite@npm:^1.0.30001541": + version: 1.0.30001668 + resolution: "caniuse-lite@npm:1.0.30001668" + checksum: ce6996901b5883454a8ddb3040f82342277b6a6275876dfefcdecb11f7e472e29877f34cae47c2b674f08f2e71971dd4a2acb9bc01adfe8421b7148a7e9e8297 languageName: node linkType: hard From 18ffadcefc6558685f1720cd507fad04c3580131 Mon Sep 17 00:00:00 2001 From: ToMaarton Date: Mon, 14 Oct 2024 22:39:52 +0200 Subject: [PATCH 2/5] added number of tagged photos out of total --- app/components/cards/photo-album-card.hbs | 2 +- app/models/photo-album.js | 21 ++++++++++++++------- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/app/components/cards/photo-album-card.hbs b/app/components/cards/photo-album-card.hbs index 042270d2b..ec5e0a436 100644 --- a/app/components/cards/photo-album-card.hbs +++ b/app/components/cards/photo-album-card.hbs @@ -14,7 +14,7 @@ {{#if album.amountOfTags}} - {{album.amountOfTags}} + {{album.amountOfTags}}, {{album.amountOfTaggedPhotos}}/{{album.amountOfPhotos}} {{/if}} diff --git a/app/models/photo-album.js b/app/models/photo-album.js index 9eeb2860c..455dbf840 100644 --- a/app/models/photo-album.js +++ b/app/models/photo-album.js @@ -36,14 +36,21 @@ export default class PhotoAlbum extends Model { } get amountOfTags() { - var c = 0 - for(var p of this.photos._objects){ - c += p.amountOfTags - console.log(c) + var counter = 0 + for(var photo of this.photos._objects){ + counter += photo.amountOfTags } - - //console.log(this.photos?._objects[1]?.amountOfTags) - return c + return counter + } + get amountOfTaggedPhotos() { + var counter = 0 + for(var photo of this.photos._objects){ + counter += photo.amountOfTags>0? 1 : 0 + } + return counter + } + get amountOfPhotos() { + return this.photos.length } // Methods From 5515fbe787db486a383ac32a3445b7e730ffe241 Mon Sep 17 00:00:00 2001 From: ToMaarton Date: Tue, 15 Oct 2024 17:07:00 +0200 Subject: [PATCH 3/5] added photo tag counter in album view --- app/components/cards/photo-album-card.hbs | 2 +- app/styles/routes/photos.scss | 1 + .../photo-albums/photo-album/photos/index.hbs | 12 +++++++++--- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/app/components/cards/photo-album-card.hbs b/app/components/cards/photo-album-card.hbs index ec5e0a436..92efc2d3a 100644 --- a/app/components/cards/photo-album-card.hbs +++ b/app/components/cards/photo-album-card.hbs @@ -14,7 +14,7 @@ {{#if album.amountOfTags}} - {{album.amountOfTags}}, {{album.amountOfTaggedPhotos}}/{{album.amountOfPhotos}} + {{album.amountOfTaggedPhotos}}/{{album.amountOfPhotos}} {{/if}} diff --git a/app/styles/routes/photos.scss b/app/styles/routes/photos.scss index 75776231e..6e1387823 100644 --- a/app/styles/routes/photos.scss +++ b/app/styles/routes/photos.scss @@ -8,6 +8,7 @@ bottom: 0; margin-bottom: 1rem; margin-left: 15px; + margin-right: 15px; padding-left: 5px; } diff --git a/app/templates/photo-albums/photo-album/photos/index.hbs b/app/templates/photo-albums/photo-album/photos/index.hbs index 77d05cdae..bbab2ce02 100644 --- a/app/templates/photo-albums/photo-album/photos/index.hbs +++ b/app/templates/photo-albums/photo-album/photos/index.hbs @@ -21,10 +21,16 @@ @route='photo-albums.photo-album.photos.photo' @model={{photo.id}} > - {{#if photo.amountOfComments}} + {{#if (or photo.amountOfComments photo.amountOfTags)}} - - {{photo.amountOfComments}} + {{#if photo.amountOfComments}} + + {{photo.amountOfComments}} + {{/if}} + {{#if photo.amountOfTags}} + + {{photo.amountOfTags}} + {{/if}} {{/if}} From acf65a9720a9ba0de0bdc6c421bac7a9af91852f Mon Sep 17 00:00:00 2001 From: ToMaarton Date: Tue, 15 Oct 2024 17:21:03 +0200 Subject: [PATCH 4/5] fixed lint --- app/components/cards/photo-album-card.hbs | 8 +++--- app/models/photo-album.js | 26 ++++++++++--------- .../components/cards/photo-album-card.scss | 2 +- app/styles/routes/photos.scss | 1 - 4 files changed, 19 insertions(+), 18 deletions(-) diff --git a/app/components/cards/photo-album-card.hbs b/app/components/cards/photo-album-card.hbs index 92efc2d3a..048c9d2ba 100644 --- a/app/components/cards/photo-album-card.hbs +++ b/app/components/cards/photo-album-card.hbs @@ -12,10 +12,10 @@

{{moment-format album.date 'DD-MM-YYYY'}}

{{#if album.amountOfTags}} - - - {{album.amountOfTaggedPhotos}}/{{album.amountOfPhotos}} - + + + {{album.amountOfTaggedPhotos}}/{{album.amountOfPhotos}} + {{/if}} diff --git a/app/models/photo-album.js b/app/models/photo-album.js index 455dbf840..4fc174f82 100644 --- a/app/models/photo-album.js +++ b/app/models/photo-album.js @@ -36,21 +36,23 @@ export default class PhotoAlbum extends Model { } get amountOfTags() { - var counter = 0 - for(var photo of this.photos._objects){ - counter += photo.amountOfTags - } - return counter + var counter = 0; + for (var photo of this.photos._objects) { + counter += photo.amountOfTags; + } + return counter; } - get amountOfTaggedPhotos() { - var counter = 0 - for(var photo of this.photos._objects){ - counter += photo.amountOfTags>0? 1 : 0 - } - return counter + + get amountOfTaggedPhotos() { //not used anymore + var counter = 0; + for (var photo of this.photos._objects) { + counter += photo.amountOfTags>0? 1 : 0; + } + return counter; } + get amountOfPhotos() { - return this.photos.length + return this.photos.length; } // Methods diff --git a/app/styles/components/cards/photo-album-card.scss b/app/styles/components/cards/photo-album-card.scss index f746809a1..8ec6541d8 100644 --- a/app/styles/components/cards/photo-album-card.scss +++ b/app/styles/components/cards/photo-album-card.scss @@ -23,8 +23,8 @@ .album-tag-counter { position: absolute; bottom: 0; - margin-bottom: 1rem; margin-right: 15px; + margin-bottom: 1rem; padding-left: 5px; } } diff --git a/app/styles/routes/photos.scss b/app/styles/routes/photos.scss index 6e1387823..75776231e 100644 --- a/app/styles/routes/photos.scss +++ b/app/styles/routes/photos.scss @@ -8,7 +8,6 @@ bottom: 0; margin-bottom: 1rem; margin-left: 15px; - margin-right: 15px; padding-left: 5px; } From 0f81f0de3ebd1c516be743cf913e413ea632f9a9 Mon Sep 17 00:00:00 2001 From: ToMaarton Date: Thu, 17 Oct 2024 14:57:00 +0200 Subject: [PATCH 5/5] lint fix 2 --- app/components/cards/photo-album-card.hbs | 2 +- app/models/photo-album.js | 12 ++---------- 2 files changed, 3 insertions(+), 11 deletions(-) diff --git a/app/components/cards/photo-album-card.hbs b/app/components/cards/photo-album-card.hbs index 048c9d2ba..5d54d979c 100644 --- a/app/components/cards/photo-album-card.hbs +++ b/app/components/cards/photo-album-card.hbs @@ -11,7 +11,7 @@

{{album.title}}

{{moment-format album.date 'DD-MM-YYYY'}}

- {{#if album.amountOfTags}} + {{#if album.amountOfTaggedPhotos}} {{album.amountOfTaggedPhotos}}/{{album.amountOfPhotos}} diff --git a/app/models/photo-album.js b/app/models/photo-album.js index 4fc174f82..2320c1fe1 100644 --- a/app/models/photo-album.js +++ b/app/models/photo-album.js @@ -35,18 +35,10 @@ export default class PhotoAlbum extends Model { return this.photos?.sortBy('exifDateTimeOriginal', 'createdAt'); } - get amountOfTags() { + get amountOfTaggedPhotos() { var counter = 0; for (var photo of this.photos._objects) { - counter += photo.amountOfTags; - } - return counter; - } - - get amountOfTaggedPhotos() { //not used anymore - var counter = 0; - for (var photo of this.photos._objects) { - counter += photo.amountOfTags>0? 1 : 0; + counter += photo.amountOfTags > 0 ? 1 : 0; } return counter; }