From 49547108a3b8ec132586cb31f3e152b790726a25 Mon Sep 17 00:00:00 2001 From: Luna D Date: Tue, 20 Oct 2020 23:18:53 +0200 Subject: [PATCH] unscrew quick tags (fixes philomena-dev/philomena#51) --- config/quick_tag_table.json | 978 +++++------------- .../tag/_quick_tag_table_season.html.slime | 4 +- .../tag/_quick_tag_table_shorthand.html.slime | 6 +- lib/philomena_web/views/tag_view.ex | 9 +- 4 files changed, 292 insertions(+), 705 deletions(-) diff --git a/config/quick_tag_table.json b/config/quick_tag_table.json index bf9d10f1..02776f88 100644 --- a/config/quick_tag_table.json +++ b/config/quick_tag_table.json @@ -130,80 +130,80 @@ "hybrid" ] }, - "Shorthands A": { - "Mane Cast": { - "m6": "mane six", - "pt": "princess twilight", - "ts": "twilight sparkle", - "rd": "rainbow dash", - "ry": "rarity", - "aj": "applejack", - "fs": "fluttershy", - "pp": "pinkie pie", - "sp": "spike" - }, - "Secondary Cast": { - "cmc": "cutie mark crusaders", - "ab": "apple bloom", - "sl": "scootaloo", - "sb": "sweetie belle", - "tia": "princess celestia", - "luna": "princess luna", - "pcd": "princess cadance", - "sa": "shining armor", - "sg": "starlight glimmer" - }, - "More Ponies": { - "tx": "trixie", - "sus": "sunset shimmer", - "sombra": "king sombra", - "qc": "queen chrysalis", - "dc": "discord", - "nmm": "nightmare moon", - "sf": "spitfire", - "sn": "soarin'", - "ld": "lightning dust" - }, - "More Apples": { - "bm": "big macintosh", - "gs": "granny smith", - "bb": "braeburn", - "bs": "babs seed" - }, - "Fillies and Colts": { - "ss": "silver spoon", - "dt": "diamond tiara", - "pfh": "princess flurry heart" - } - }, - "B": { - "Background Ponies": { - "dh": "derpy hooves", - "dw": "doctor whooves", - "cgt": "colgate", - "bon": "bon bon", - "oct": "octavia melody", - "dj": "vinyl scratch", - "bp": "berry punch", - "pbb": "prince blueblood" - }, - "Uncategorized": { - "maud": "maud pie", - "coco": "coco pommel", - "suri": "suri polomare", - "rg": "royal guard", - "za": "zecora", - "mm": "mayor mare", - "pdp": "pinkamena diane pie", - "owol": "owlowiscious", - "opal": "opalescence" - }, - "Other Things": { - "cm": "cutie mark", - "eoh": "elements of harmony", - "nmn": "nightmare night" - } - }, + "Shorthands A": [ + ["Mane Cast", [ + ["m6", "mane six"], + ["pt", "princess twilight"], + ["ts", "twilight sparkle"], + ["rd", "rainbow dash"], + ["ry", "rarity"], + ["aj", "applejack"], + ["fs", "fluttershy"], + ["pp", "pinkie pie"], + ["sp", "spike"] + ]], + ["Secondary Cast", [ + ["cmc", "cutie mark crusaders"], + ["ab", "apple bloom"], + ["sl", "scootaloo"], + ["sb", "sweetie belle"], + ["tia", "princess celestia"], + ["luna", "princess luna"], + ["pcd", "princess cadance"], + ["sa", "shining armor"], + ["sg", "starlight glimmer"] + ]], + ["More Ponies", [ + ["tx", "trixie"], + ["sus", "sunset shimmer"], + ["sombra", "king sombra"], + ["qc", "queen chrysalis"], + ["dc", "discord"], + ["nmm", "nightmare moon"], + ["sf", "spitfire"], + ["sn", "soarin'"], + ["ld", "lightning dust"] + ]], + ["More Apples", [ + ["bm", "big macintosh"], + ["gs", "granny smith"], + ["bb", "braeburn"], + ["bs", "babs seed"] + ]], + ["Fillies and Colts", [ + ["ss", "silver spoon"], + ["dt", "diamond tiara"], + ["pfh", "princess flurry heart"] + ]] + ], + "B": [ + ["Background Ponies", [ + ["dh", "derpy hooves"], + ["dw", "doctor whooves"], + ["cgt", "colgate"], + ["bon", "bon bon"], + ["oct", "octavia melody"], + ["dj", "vinyl scratch"], + ["bp", "berry punch"], + ["pbb", "prince blueblood"] + ]], + ["Uncategorized", [ + ["maud", "maud pie"], + ["coco", "coco pommel"], + ["suri", "suri polomare"], + ["rg", "royal guard"], + ["za", "zecora"], + ["mm", "mayor mare"], + ["pdp", "pinkamena diane pie"], + ["owol", "owlowiscious"], + ["opal", "opalescence"] + ]], + ["Other Things", [ + ["cm", "cutie mark"], + ["eoh", "elements of harmony"], + ["nmn", "nightmare night"] + ]] + ], "Ships ts": { "implying": [ "shipping", @@ -272,642 +272,228 @@ ] }, "Season 9": [ - { - "1-2": "the beginning of the end" - }, - { - "3": "uprooted" - }, - { - "4": "twilight's seven" - }, - { - "5": "the point of no return" - }, - { - "6": "common ground" - }, - { - "7": "she's all yak" - }, - { - "8": "frenemies (episode)" - }, - { - "9": "sweet and smoky" - }, - { - "10": "going to seed" - }, - { - "11": "student counsel" - }, - { - "12": "the last crusade (episode)" - }, - { - "13": "between dark and dawn" - }, - { - "14": "that's a laugh" - }, - { - "15": "2 4 6 greaaat" - }, - { - "16": "a trivial pursuit" - }, - { - "17": "the summer sun setback" - }, - { - "18": "she talks to angel" - }, - { - "19": "dragon dropped" - }, - { - "20": "a horse shoe-in" - }, - { - "21": "daring doubt" - }, - { - "22": "growing up is hard to do" - }, - { - "23": "the big mac question" - }, - { - "24-25": "the ending of the end" - }, - { - "26": "the last problem" - } + ["1-2", "the beginning of the end"], + ["3", "uprooted"], + ["4", "twilight's seven"], + ["5", "the point of no return"], + ["6", "common ground"], + ["7", "she's all yak"], + ["8", "frenemies (episode)"], + ["9", "sweet and smoky"], + ["10", "going to seed"], + ["11", "student counsel"], + ["12", "the last crusade (episode)"], + ["13", "between dark and dawn"], + ["14", "that's a laugh"], + ["15", "2 4 6 greaaat"], + ["16", "a trivial pursuit"], + ["17", "the summer sun setback"], + ["18", "she talks to angel"], + ["19", "dragon dropped"], + ["20", "a horse shoe-in"], + ["21", "daring doubt"], + ["22", "growing up is hard to do"], + ["23", "the big mac question"], + ["24-25", "the ending of the end"], + ["26", "the last problem"] ], "8": [ - { - "1-2": "school daze" - }, - { - "3": "the maud couple" - }, - { - "4": "fake it 'til you make it" - }, - { - "5": "grannies gone wild" - }, - { - "6": "surf and/or turf" - }, - { - "7": "horse play" - }, - { - "8": "the parent map" - }, - { - "9": "non-compete clause" - }, - { - "10": "the break up breakdown" - }, - { - "11": "molt down" - }, - { - "12": "marks for effort" - }, - { - "13": "the mean 6" - }, - { - "14": "a matter of principals" - }, - { - "15": "the hearth's warming club" - }, - { - "16": "friendship university" - }, - { - "17": "the end in friend" - }, - { - "18": "yakity-sax" - }, - { - "19": "on the road to friendship" - }, - { - "20": "the washouts (episode)" - }, - { - "21": "a rockhoof and a hard place" - }, - { - "22": "what lies beneath" - }, - { - "23": "sounds of silence" - }, - { - "24": "father knows beast" - }, - { - "25-26": "school raze" - }, - { - "Special": "best gift ever" - } + ["1-2", "school daze"], + ["3", "the maud couple"], + ["4", "fake it 'til you make it"], + ["5", "grannies gone wild"], + ["6", "surf and/or turf"], + ["7", "horse play"], + ["8", "the parent map"], + ["9", "non-compete clause"], + ["10", "the break up breakdown"], + ["11", "molt down"], + ["12", "marks for effort"], + ["13", "the mean 6"], + ["14", "a matter of principals"], + ["15", "the hearth's warming club"], + ["16", "friendship university"], + ["17", "the end in friend"], + ["18", "yakity-sax"], + ["19", "on the road to friendship"], + ["20", "the washouts (episode)"], + ["21", "a rockhoof and a hard place"], + ["22", "what lies beneath"], + ["23", "sounds of silence"], + ["24", "father knows beast"], + ["25-26", "school raze"], + ["Special", "best gift ever"] ], "7": [ - { - "1": "celestial advice" - }, - { - "2": "all bottled up" - }, - { - "3": "a flurry of emotions" - }, - { - "4": "rock solid friendship" - }, - { - "5": "fluttershy leans in" - }, - { - "6": "forever filly" - }, - { - "7": "parental glideance" - }, - { - "8": "hard to say anything" - }, - { - "9": "honest apple" - }, - { - "10": "a royal problem" - }, - { - "11": "not asking for trouble" - }, - { - "12": "discordant harmony" - }, - { - "13": "the perfect pear" - }, - { - "14": "fame and misfortune" - }, - { - "15": "triple threat" - }, - { - "16": "campfire tales" - }, - { - "17": "to change a changeling" - }, - { - "18": "daring done?" - }, - { - "19": "it isn't the mane thing about you" - }, - { - "20": "a health of information" - }, - { - "21": "marks and recreation" - }, - { - "22": "once upon a zeppelin" - }, - { - "23": "secrets and pies" - }, - { - "24": "uncommon bond" - }, - { - "25-26": "shadow play" - } + ["1", "celestial advice"], + ["2", "all bottled up"], + ["3", "a flurry of emotions"], + ["4", "rock solid friendship"], + ["5", "fluttershy leans in"], + ["6", "forever filly"], + ["7", "parental glideance"], + ["8", "hard to say anything"], + ["9", "honest apple"], + ["10", "a royal problem"], + ["11", "not asking for trouble"], + ["12", "discordant harmony"], + ["13", "the perfect pear"], + ["14", "fame and misfortune"], + ["15", "triple threat"], + ["16", "campfire tales"], + ["17", "to change a changeling"], + ["18", "daring done?"], + ["19", "it isn't the mane thing about you"], + ["20", "a health of information"], + ["21", "marks and recreation"], + ["22", "once upon a zeppelin"], + ["23", "secrets and pies"], + ["24", "uncommon bond"], + ["25-26", "shadow play"] ], "6": [ - { - "1-2": "the crystalling" - }, - { - "3": "the gift of the maud pie" - }, - { - "4": "on your marks" - }, - { - "5": "gauntlet of fire" - }, - { - "6": "no second prances" - }, - { - "7": "newbie dash" - }, - { - "8": "a hearth's warming tail" - }, - { - "9": "the saddle row review" - }, - { - "10": "applejack's \"day\" off" - }, - { - "11": "flutter brutter" - }, - { - "12": "spice up your life" - }, - { - "13": "stranger than fan fiction" - }, - { - "14": "the cart before the ponies" - }, - { - "15": "28 pranks later" - }, - { - "16": "the times they are a changeling" - }, - { - "17": "dungeons and discords" - }, - { - "18": "buckball season" - }, - { - "19": "the fault in our cutie marks" - }, - { - "20": "viva las pegasus" - }, - { - "21": "every little thing she does" - }, - { - "22": "ppov" - }, - { - "23": "where the apple lies" - }, - { - "24": "top bolt" - }, - { - "25-26": "to where and back again" - } + ["1-2", "the crystalling"], + ["3", "the gift of the maud pie"], + ["4", "on your marks"], + ["5", "gauntlet of fire"], + ["6", "no second prances"], + ["7", "newbie dash"], + ["8", "a hearth's warming tail"], + ["9", "the saddle row review"], + ["10", "applejack's \"day\" off"], + ["11", "flutter brutter"], + ["12", "spice up your life"], + ["13", "stranger than fan fiction"], + ["14", "the cart before the ponies"], + ["15", "28 pranks later"], + ["16", "the times they are a changeling"], + ["17", "dungeons and discords"], + ["18", "buckball season"], + ["19", "the fault in our cutie marks"], + ["20", "viva las pegasus"], + ["21", "every little thing she does"], + ["22", "ppov"], + ["23", "where the apple lies"], + ["24", "top bolt"], + ["25-26", "to where and back again"] ], "5": [ - { - "1-2": "the cutie map" - }, - { - "3": "castle sweet castle" - }, - { - "4": "bloom and gloom" - }, - { - "5": "tanks for the memories" - }, - { - "6": "appleoosa's most wanted" - }, - { - "7": "make new friends but keep discord" - }, - { - "8": "the lost treasure of griffonstone" - }, - { - "9": "slice of life (episode)" - }, - { - "10": "princess spike" - }, - { - "11": "party pooped" - }, - { - "12": "amending fences" - }, - { - "13": "do princesses dream of magic sheep" - }, - { - "14": "canterlot boutique" - }, - { - "15": "rarity investigates" - }, - { - "16": "made in manehattan" - }, - { - "17": "brotherhooves social" - }, - { - "18": "crusaders of the lost mark" - }, - { - "19": "the one where pinkie pie knows" - }, - { - "20": "hearthbreakers" - }, - { - "21": "scare master" - }, - { - "22": "what about discord?" - }, - { - "23": "the hooffields and mccolts" - }, - { - "24": "the mane attraction" - }, - { - "25-26": "the cutie remark" - } + ["1-2", "the cutie map"], + ["3", "castle sweet castle"], + ["4", "bloom and gloom"], + ["5", "tanks for the memories"], + ["6", "appleoosa's most wanted"], + ["7", "make new friends but keep discord"], + ["8", "the lost treasure of griffonstone"], + ["9", "slice of life (episode)"], + ["10", "princess spike"], + ["11", "party pooped"], + ["12", "amending fences"], + ["13", "do princesses dream of magic sheep"], + ["14", "canterlot boutique"], + ["15", "rarity investigates"], + ["16", "made in manehattan"], + ["17", "brotherhooves social"], + ["18", "crusaders of the lost mark"], + ["19", "the one where pinkie pie knows"], + ["20", "hearthbreakers"], + ["21", "scare master"], + ["22", "what about discord?"], + ["23", "the hooffields and mccolts"], + ["24", "the mane attraction"], + ["25-26", "the cutie remark"] ], "4": [ - { - "1-2": "princess twilight sparkle (episode)" - }, - { - "3": "castle mane-ia" - }, - { - "4": "daring don't" - }, - { - "5": "flight to the finish" - }, - { - "6": "power ponies" - }, - { - "7": "bats!" - }, - { - "8": "rarity takes manehattan" - }, - { - "9": "pinkie apple pie" - }, - { - "10": "rainbow falls" - }, - { - "11": "three's a crowd" - }, - { - "12": "pinkie pride" - }, - { - "13": "simple ways" - }, - { - "14": "filli vanilli" - }, - { - "15": "twilight time" - }, - { - "16": "it ain't easy being breezies" - }, - { - "17": "somepony to watch over me" - }, - { - "18": "maud pie (episode)" - }, - { - "19": "for whom the sweetie belle toils" - }, - { - "20": "leap of faith" - }, - { - "21": "testing testing 1-2-3" - }, - { - "22": "trade ya" - }, - { - "23": "inspiration manifestation" - }, - { - "24": "equestria games" - }, - { - "25-26": "twilight's kingdom" - } + ["1-2", "princess twilight sparkle (episode)"], + ["3", "castle mane-ia"], + ["4", "daring don't"], + ["5", "flight to the finish"], + ["6", "power ponies"], + ["7", "bats!"], + ["8", "rarity takes manehattan"], + ["9", "pinkie apple pie"], + ["10", "rainbow falls"], + ["11", "three's a crowd"], + ["12", "pinkie pride"], + ["13", "simple ways"], + ["14", "filli vanilli"], + ["15", "twilight time"], + ["16", "it ain't easy being breezies"], + ["17", "somepony to watch over me"], + ["18", "maud pie (episode)"], + ["19", "for whom the sweetie belle toils"], + ["20", "leap of faith"], + ["21", "testing testing 1-2-3"], + ["22", "trade ya"], + ["23", "inspiration manifestation"], + ["24", "equestria games"], + ["25-26", "twilight's kingdom"] ], "3": [ - { - "1-2": "the crystal empire" - }, - { - "3": "too many pinkie pies" - }, - { - "4": "one bad apple" - }, - { - "5": "magic duel" - }, - { - "6": "sleepless in ponyville" - }, - { - "7": "wonderbolts academy" - }, - { - "8": "just for sidekicks" - }, - { - "9": "apple family reunion" - }, - { - "10": "spike at your service" - }, - { - "11": "keep calm and flutter on" - }, - { - "12": "games ponies play" - }, - { - "13": "magical mystery cure" - } + ["1-2", "the crystal empire"], + ["3", "too many pinkie pies"], + ["4", "one bad apple"], + ["5", "magic duel"], + ["6", "sleepless in ponyville"], + ["7", "wonderbolts academy"], + ["8", "just for sidekicks"], + ["9", "apple family reunion"], + ["10", "spike at your service"], + ["11", "keep calm and flutter on"], + ["12", "games ponies play"], + ["13", "magical mystery cure"] ], "2": [ - { - "1-2": "the return of harmony" - }, - { - "3": "lesson zero" - }, - { - "4": "luna eclipsed" - }, - { - "5": "sisterhooves social" - }, - { - "6": "the cutie pox" - }, - { - "7": "may the best pet win" - }, - { - "8": "the mysterious mare do well" - }, - { - "9": "sweet and elite" - }, - { - "10": "secret of my excess" - }, - { - "11": "family appreciation day" - }, - { - "12": "baby cakes" - }, - { - "13": "hearth's warming eve (episode)" - }, - { - "14": "the last roundup" - }, - { - "15": "the super speedy cider squeezy 6000" - }, - { - "16": "read it and weep" - }, - { - "17": "hearts and hooves day (episode)" - }, - { - "18": "a friend in deed" - }, - { - "19": "putting your hoof down" - }, - { - "20": "it's about time" - }, - { - "21": "dragon quest" - }, - { - "22": "hurricane fluttershy" - }, - { - "23": "ponyville confidential" - }, - { - "24": "mmmystery on the friendship express" - }, - { - "25-26": "a canterlot wedding" - } + ["1-2", "the return of harmony"], + ["3", "lesson zero"], + ["4", "luna eclipsed"], + ["5", "sisterhooves social"], + ["6", "the cutie pox"], + ["7", "may the best pet win"], + ["8", "the mysterious mare do well"], + ["9", "sweet and elite"], + ["10", "secret of my excess"], + ["11", "family appreciation day"], + ["12", "baby cakes"], + ["13", "hearth's warming eve (episode)"], + ["14", "the last roundup"], + ["15", "the super speedy cider squeezy 6000"], + ["16", "read it and weep"], + ["17", "hearts and hooves day (episode)"], + ["18", "a friend in deed"], + ["19", "putting your hoof down"], + ["20", "it's about time"], + ["21", "dragon quest"], + ["22", "hurricane fluttershy"], + ["23", "ponyville confidential"], + ["24", "mmmystery on the friendship express"], + ["25-26", "a canterlot wedding"] ], "1": [ - { - "1-2": "friendship is magic" - }, - { - "3": "the ticket master" - }, - { - "4": "applebuck season" - }, - { - "5": "griffon the brush off" - }, - { - "6": "boast busters" - }, - { - "7": "dragonshy" - }, - { - "8": "look before you sleep" - }, - { - "9": "bridle gossip" - }, - { - "10": "swarm of the century" - }, - { - "11": "winter wrap up" - }, - { - "12": "call of the cutie" - }, - { - "13": "fall weather friends" - }, - { - "14": "suited for success" - }, - { - "15": "feeling pinkie keen" - }, - { - "16": "sonic rainboom (episode)" - }, - { - "17": "stare master" - }, - { - "18": "the show stoppers" - }, - { - "19": "a dog and pony show" - }, - { - "20": "green isn't your color" - }, - { - "21": "over a barrel" - }, - { - "22": "a bird in the hoof" - }, - { - "23": "the cutie mark chronicles" - }, - { - "24": "owl's well that ends well" - }, - { - "25": "party of one" - }, - { - "26": "the best night ever" - } + ["1-2", "friendship is magic"], + ["3", "the ticket master"], + ["4", "applebuck season"], + ["5", "griffon the brush off"], + ["6", "boast busters"], + ["7", "dragonshy"], + ["8", "look before you sleep"], + ["9", "bridle gossip"], + ["10", "swarm of the century"], + ["11", "winter wrap up"], + ["12", "call of the cutie"], + ["13", "fall weather friends"], + ["14", "suited for success"], + ["15", "feeling pinkie keen"], + ["16", "sonic rainboom (episode)"], + ["17", "stare master"], + ["18", "the show stoppers"], + ["19", "a dog and pony show"], + ["20", "green isn't your color"], + ["21", "over a barrel"], + ["22", "a bird in the hoof"], + ["23", "the cutie mark chronicles"], + ["24", "owl's well that ends well"], + ["25", "party of one"], + ["26", "the best night ever"] ] -} \ No newline at end of file +} diff --git a/lib/philomena_web/templates/tag/_quick_tag_table_season.html.slime b/lib/philomena_web/templates/tag/_quick_tag_table_season.html.slime index 963a9196..1f451a67 100644 --- a/lib/philomena_web/templates/tag/_quick_tag_table_season.html.slime +++ b/lib/philomena_web/templates/tag/_quick_tag_table_season.html.slime @@ -1,9 +1,9 @@ = for slice <- Enum.chunk_every(@data, 10) do div = for map <- slice do - - [{header, tag_name}] = Enum.to_list(map) + - [header, tag_name] = Enum.to_list(map) = header ' . = tag_link @tags[tag_name], tag_name - br \ No newline at end of file + br diff --git a/lib/philomena_web/templates/tag/_quick_tag_table_shorthand.html.slime b/lib/philomena_web/templates/tag/_quick_tag_table_shorthand.html.slime index 9385a74b..ad34a181 100644 --- a/lib/philomena_web/templates/tag/_quick_tag_table_shorthand.html.slime +++ b/lib/philomena_web/templates/tag/_quick_tag_table_shorthand.html.slime @@ -1,10 +1,10 @@ -= for {heading, maps} <- @data do += for [heading, maps] <- @data do div strong = heading br - = for {name, alias_name} <- maps do + = for [name, alias_name] <- maps do => name ' - = tag_link @tags[alias_name], alias_name - br \ No newline at end of file + br diff --git a/lib/philomena_web/views/tag_view.ex b/lib/philomena_web/views/tag_view.ex index 240f25f2..766e61b0 100644 --- a/lib/philomena_web/views/tag_view.ex +++ b/lib/philomena_web/views/tag_view.ex @@ -115,14 +115,15 @@ defmodule PhilomenaWeb.TagView do end defp names_in_tab("season", data) do - data - |> Enum.flat_map(&Map.values/1) + Enum.map(data, fn [_number, name] -> name end) end defp names_in_tab("shorthand", data) do data - |> Map.values() - |> Enum.flat_map(&Map.values/1) + |> Enum.map(fn [_title, tags] -> tags end) + |> IO.inspect(label: "after map") + |> Enum.flat_map(&Enum.map(&1, fn [_shorthand, tag] -> tag end)) + |> IO.inspect(label: "after flatmap") end defp names_in_tab(_mode, _data), do: []