From 964efa871cd16c05021ea10681b0aa2c9fecbda7 Mon Sep 17 00:00:00 2001 From: "byte[]" Date: Fri, 29 Nov 2019 12:03:39 -0500 Subject: [PATCH] add footer and tag table data --- config/config.exs | 4 +- config/footer.json | 96 ++++ config/quick_tag_table.json | 499 ++++++++++++++++++ .../templates/layout/_footer.html.slime | 15 + lib/philomena_web/views/layout_view.ex | 13 + 5 files changed, 626 insertions(+), 1 deletion(-) create mode 100644 config/footer.json create mode 100644 config/quick_tag_table.json diff --git a/config/config.exs b/config/config.exs index 0e099c5a..cc3f4913 100644 --- a/config/config.exs +++ b/config/config.exs @@ -19,7 +19,9 @@ config :philomena, badge_url_root: "/media", image_file_root: "priv/static/system/images", cdn_host: "", - proxy_host: nil + proxy_host: nil, + quick_tags_json: File.read!("config/quick_tag_table.json"), + footer_json: File.read!("config/footer.json") config :philomena, :pow, user: Philomena.Users.User, diff --git a/config/footer.json b/config/footer.json new file mode 100644 index 00000000..f9881a0b --- /dev/null +++ b/config/footer.json @@ -0,0 +1,96 @@ +{ + "cols": [ + "Site Resources", + "Help & Information", + "Community" + ], + "Site Resources": [ + { + "title": "Site Rules", + "url": "/pages/rules", + "bold": true + }, + { + "title": "Privacy Policy", + "url": "/pages/privacy", + "bold": true + }, + { + "title": "Tag Guidelines", + "url": "/pages/tags", + "bold": true + }, + { + "title": "About Uploading", + "url": "/pages/uploading" + }, + { + "title": "Spoiler Guidelines", + "url": "/pages/spoilers" + }, + { + "title": "Takedown Requests", + "url": "/pages/takedowns" + }, + { + "title": "Do-Not-Post List", + "url": "/dnp" + } + ], + "Help & Information": [ + { + "title": "Changelog", + "url": "/changelog", + "bold": true + }, + { + "title": "FAQs", + "url": "/pages/faq", + "bold": true + }, + { + "title": "API Docs", + "url": "/pages/api" + }, + { + "title": "Keyboard Shortcuts", + "url": "/pages/shortcuts" + }, + { + "title": "Advertising", + "url": "/pages/advertising" + }, + { + "title": "Onion Service", + "url": "/pages/onion" + } + ], + "Community": [ + { + "title": "Contact", + "url": "/pages/contact", + "bold": true + }, + { + "title": "Donations", + "url": "/donations", + "bold": true + }, + { + "title": "Site Staff List", + "url": "/staff" + }, + { + "title": "Statistics", + "url": "/stats" + }, + { + "title": "About", + "url": "/pages/about" + }, + { + "title": "Twitter", + "url": "https://twitter.com/Derpibooru" + } + ] +} diff --git a/config/quick_tag_table.json b/config/quick_tag_table.json new file mode 100644 index 00000000..eed55010 --- /dev/null +++ b/config/quick_tag_table.json @@ -0,0 +1,499 @@ +{ + "tabs": [ + "Main", + "Species", + "Shorthands A", + "B", + "Ships ts", + "rd", + "ry", + "aj", + "fs", + "pp", + "misc", + "Season 9", + "8", + "7", + "6", + "5", + "4", + "3", + "2", + "1" + ], + "tab_modes": { + "Main": "default", + "Species": "default", + "Shorthands A": "shorthand", + "B": "shorthand", + "Ships ts": "shipping", + "rd": "shipping", + "ry": "shipping", + "aj": "shipping", + "fs": "shipping", + "pp": "shipping", + "misc": "shipping", + "Season 9": "season", + "8": "season", + "7": "season", + "6": "season", + "5": "season", + "4": "season", + "3": "season", + "2": "season", + "1": "season" + }, + "Main": { + "Ratings": [ + "safe", + "suggestive", + "questionable", + "explicit", + "semi-grimdark", + "grimdark", + "grotesque" + ], + "Episode Spoilers": [ + "spoiler:s09e20", + "spoiler:s09e21", + "spoiler:s09e22", + "spoiler:s09e23", + "spoiler:s09e24", + "spoiler:s09e25", + "spoiler:s09e26" + ], + "General Spoilers": [ + "spoiler:eqg specials", + "spoiler:comic", + "spoiler:eqg series (season 2)", + "spoiler:s09", + "spoiler:rainbow roadtrip", + "spoilers for another series" + ], + "Species": [ + "anthro", + "equestria girls", + "human", + "humanized", + "pony", + "earth pony", + "pegasus", + "unicorn", + "alicorn" + ], + "Often Forgotten": [ + "solo", + "screencap", + "image macro", + "monochrome", + "oc", + "photo", + "Tag original characters oc:name" + ] + }, + "Species": { + "Major": [ + "bat pony", + "changeling", + "changedling", + "deer", + "dragon", + "griffon", + "classical hippogriff", + "yak", + "zebra" + ], + "Minor": [ + "abyssinian", + "breezie", + "centaur", + "diamond dog", + "draconequus", + "kirin", + "seapony (g4)", + "siren", + "sphinx" + ], + "Animal": [ + "chimera", + "cockatrice", + "hydra", + "manticore", + "parasprite", + "phoenix", + "tatzlwurm", + "timber wolf", + "windigo" + ], + "Misc": [ + "original species", + "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" + } + }, + "Ships ts": { + "implying": [ + "shipping", + "twilight sparkle" + ], + "not_implying": [ + + ] + }, + "rd": { + "implying": [ + "shipping", + "rainbow dash" + ], + "not_implying": [ + + ] + }, + "ry": { + "implying": [ + "shipping", + "rarity" + ], + "not_implying": [ + + ] + }, + "aj": { + "implying": [ + "shipping", + "applejack" + ], + "not_implying": [ + + ] + }, + "fs": { + "implying": [ + "shipping", + "fluttershy" + ], + "not_implying": [ + + ] + }, + "pp": { + "implying": [ + "shipping", + "pinkie pie" + ], + "not_implying": [ + + ] + }, + "misc": { + "implying": [ + "shipping" + ], + "not_implying": [ + "twilight sparkle", + "rainbow dash", + "rarity", + "applejack", + "fluttershy", + "pinkie pie" + ] + }, + "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" + }, + "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" + }, + "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" + }, + "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" + }, + "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" + }, + "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" + }, + "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" + }, + "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": { + "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" + } +} diff --git a/lib/philomena_web/templates/layout/_footer.html.slime b/lib/philomena_web/templates/layout/_footer.html.slime index a6acdc81..aec0ca3a 100644 --- a/lib/philomena_web/templates/layout/_footer.html.slime +++ b/lib/philomena_web/templates/layout/_footer.html.slime @@ -1,4 +1,19 @@ footer#footer + #footer_content + - footer_data = footer_data() + + = for column <- footer_data["cols"] do + .footercol + h5 = column + + = for row <- footer_data[column] do + = if row["bold"] do + strong + a href=row["url"] = row["title"] + - else + a href=row["url"] = row["title"] + br + #serving_info ' Powered by the a href="https://github.com/derpibooru/philomena" philomena project diff --git a/lib/philomena_web/views/layout_view.ex b/lib/philomena_web/views/layout_view.ex index 311cc938..183bf2c8 100644 --- a/lib/philomena_web/views/layout_view.ex +++ b/lib/philomena_web/views/layout_view.ex @@ -47,6 +47,19 @@ defmodule PhilomenaWeb.LayoutView do tag(:div, class: "js-datastore", data: data) end + def footer_data do + case Application.get_env(:philomena, :footer) do + nil -> + footer = Jason.decode!(Application.get_env(:philomena, :footer_json)) + Application.put_env(:philomena, :footer, footer) + + footer + + footer -> + footer + end + end + def stylesheet_path(conn, %{theme: "dark"}), do: Routes.static_path(conn, "/css/dark.css")