From: Marc Foley Date: Thu, 17 Jul 2025 08:49:53 +0000 (+0100) Subject: AddTags wip X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=51b38e0db0fde689dc22ff98207ca851a3414f73;p=thirdparty%2Fgoogle%2Ffonts.git AddTags wip --- diff --git a/tagger2/AddTags.js b/tagger2/AddTags.js index 4c5f9d266..678b8ea30 100644 --- a/tagger2/AddTags.js +++ b/tagger2/AddTags.js @@ -1,28 +1,78 @@ export default { + + schema: { + categories: ["a", "b", "c"], + lowTag: { + filters: [], + score: 10 + }, + highTag: { + filters: [], + score: 100 + } + }, + props: ["categories"], data: function() { return { + currentCategories: [], currentAxis: "", currentPosition: 0, currentOp: "", + currentScore: 0, filters: [], } }, methods: { addFilter() { - filters.push( - {axis: this.currentAxis, op: this.currentOp, value: this.currentPosition} + this.filters.push( + { + axis: this.currentAxis, + op: this.currentOp, + value: this.currentPosition, + score: this.currentScore + } ) + }, + addTags() { + const filterSet = { + categories: this.currentCategories, + filters: this.filters + }; + this.$emit('tags-added', filterSet); + this.filters = []; } }, template: ` - - - - +
+

Add Tags

+

Category

+ +
+ + + + + +
+
+

Current Filters

+
    +
  • + {{ filter.axis }} {{ filter.op }} {{ filter.value }} + +
  • +
+
+ +
` } \ No newline at end of file diff --git a/tagger2/index.html b/tagger2/index.html index c9db07d5c..ed2662741 100644 --- a/tagger2/index.html +++ b/tagger2/index.html @@ -15,6 +15,7 @@ +
@@ -37,6 +38,7 @@ import AddCategory from "./AddCategory.js"; import VFView from "./VFView.js"; import { linter } from "./linter.js"; + import AddTags from "./AddTags.js"; import AddCategory from "./AddCategory.js"; import VFView from "./VFView.js"; @@ -85,6 +87,25 @@ tag.family = family this.tags.items.push(tag); }, + addTags(filterSet) { + let tags = [] + let filteredFamilies = [] + for (let family of this.gf.families) { + let includeFamily = false; + for (let axis of family.axes) { + if ( + filterSet.filters.map(f => f.axis).includes(axis.tag) && + axis.min <= filterSet.filters.find(f => f.axis === axis.tag).value && + axis.max >= filterSet.filters.find(f => f.axis === axis.tag).value) { + includeFamily = true; + } + } + if (includeFamily) { + console.log("Including family:", family); + } + includeFamily = false; + } + }, addCategory(category) { console.log("Adding category", category); if (!this.tags.categories.includes(category)) { @@ -106,6 +127,8 @@ this.gf.linter = linter; this.tags = new Tags(this.gf); this.tags.sortCategories(); + + // Subscribe to events this.$root.$on("remove-tag", this.removeTag); } });