|
| 1 | +class AutocompleteService < Service |
| 2 | + # TODO not make this giant case so awful |
| 3 | + # TODO move the literal arrays into Generators that use the translation file |
| 4 | + |
| 5 | + # Adding a field name to this switch/case will enable autocompleting |
| 6 | + # for that field across any page type. |
| 7 | + def self.for(field_name) |
| 8 | + case field_name |
| 9 | + when 'bodytype' |
| 10 | + t('body_types') |
| 11 | + when 'education' |
| 12 | + %w(None Elementary Highschool College Graduate Diploma Advanced Homeschooled PhD GED Self-taught Highly-educated) |
| 13 | + when 'eyecolor' |
| 14 | + t('eye_colors') |
| 15 | + when 'facialhair' |
| 16 | + t('facial_hair_styles') |
| 17 | + when 'fave_animal' |
| 18 | + %w(Cats Dogs Wolves Foxes Horses Lions Birds Tigers Deer Dragons Owls Snakes Bears Horses Rabbits Ravens Pandas Eagles Dolphins Bunnies Rabbits Hawks Panthers Elephants Giraffes Turtles Crwos Cheetahs Doves Fish Phoenix Penguins Otters Sharks Butterflies Caterpillars Koalas Puppies Kittens Falcons Bats Sheep Lizards Monkeys Squirrels Unicorns Lynx Humans Sloths) |
| 19 | + when 'fave_color' |
| 20 | + %w(Blue Green Red Purple Black Yellow Pink Orange White Gold Grey Silver Brown Teal Violet Lavender Maroon Navy Crimson Magenta Indigo Burgundy Turquoise Cyan Aqua Scarlet Pitch Peach) |
| 21 | + when 'fave_food' |
| 22 | + %w(Pizza Sushi Steak Pasta Chocolate Apples Chicken Spaghetti Tacos Meat Fish Strawberries Cake Salad Ramen Pancakes Burgers Bread Sweets Lasagna Salmon Coffee Hamburgers Cookies Rice Noodes Curry Waffles Oranges Seafood Lobsters Fries Bacon Cheese Shrimp Pie Peaches Soup Cheesecake Popcorn Fruit Cupcakes Grapes Venison Candy Berries Stew Potatoes Tea Lamb Watermelon Nachos Chinese Pork Donuts Italian Mexican) |
| 23 | + when 'fave_weapon' |
| 24 | + t('weapon_types') + t('shield_types') + t('axe_types') + t('bow_types') + |
| 25 | + t('club_types') + t('flexible_weapon_types') + t('fist_weapon_types') + t('thrown_weapon_types') + |
| 26 | + t('polearm_types') + t('shortsword_types') + t('sword_types') |
| 27 | + when 'flaws' |
| 28 | + %w(Stubbornness Naivety Prideful Impulsiveness Selfishness Arrogance Recklessness Clumsiness Anger Self-control Anxiety Shiness Insecurities Overprotectiveness Paranoia Pridefulness Perfectionism Bossiness Manipulative Cockiness Laziness Greedy Forgetful Gullible Depression Loyalty Bluntness Hubris Sensitivity Alcoholicism Addictions Cowardly Childish Overconfident Untrusting Anxious Headstrong Rude Oblivious Jealous Proud Hot-headed Secretive Liar) |
| 29 | + when 'gender' |
| 30 | + %w(Male Female Agender Masculino Nonbinary Genderfluid He/Him She/Her Genderless They/Them Unknown Masculine Feminine) |
| 31 | + when 'hairstyle' |
| 32 | + t('hair_styles') |
| 33 | + when 'haircolor' |
| 34 | + t('hair_colors') |
| 35 | + when 'hobbies' |
| 36 | + %w(Reading Drawing Cooking Gardening Painting Writing Singing Art Dancing Music Hunting Photography Baking Training Running Swimming Diving Knitting Sewing Archery Horsebackriding Reading Sports Sleeping Football Drinking Chess Gaming Basketball Reading Piano Drawing Tinkering Electronics Programming Killing Guitar Running Murder Altruism Volunteering Exploring Adventuring Baseball Magic Flying Boxing Stealing Gambling Painting Whittling Poetry Fighting Quidditch Shopping Violin Stargazing Science) |
| 37 | + when 'identmarks' |
| 38 | + %w(None Freckles Glasses Scars Tattoos Eyes Wings Mouth Ears Hair Mole Fangs Vitiligo Height Weight Clothing) |
| 39 | + when 'item_type' |
| 40 | + t('weapon_types') + t('shield_types') + t('axe_types') + t('bow_types') + |
| 41 | + t('club_types') + t('flexible_weapon_types') + t('fist_weapon_types') + t('thrown_weapon_types') + |
| 42 | + t('polearm_types') + t('shortsword_types') + t('sword_types') + t('other_item_types') |
| 43 | + when 'mannerisms' |
| 44 | + %w(Polite Quiet Kind Shy Angry Rude Brazen Aggressive Paranoid Sarcastic Confident Proper Calm Loud Good Reserved Friendly Sweet Nice Blunt Sassy Figety Formal Protective Nervous Stoic Sly Timid Motherly Twitchy Smiley Stutters Flirty Childish Awkward Arrogant Inappropriate) |
| 45 | + when 'motivations' |
| 46 | + %w(Family Love Power Money Revenge Survival Freedom Justice Friends Honor Adventure Spite Curiosity Love Food Knowledge Altruism Fear Fun Success Loyalty Music Friendship Anger Happiness Greed Security Fame Ambition Winning Boredom Pride Vengeance Kindness Love) |
| 47 | + when 'occupation' |
| 48 | + %w(Student King Queen Princess Prince Assassin Woodsman Programmer Athlete Hunter Soldier Unemployed Teacher Mercenary Doctor Nurse President Adventurer Thief Warrior Farmer Healer Musician Pirate Mechanic Scientist Spy Blacksmith Bartender Waitress Baker Lawyer Guard Knight Barista Marketer Librarian Detective Officer General Guardian Parent Superhero Rebel Artist Writer Witch Engineer Mage Prostitute Singer Designer Preacher Priest Journalist Criminal Florist Merchant Emperor Hunter Chef Fighter Wizard Housewife Caretaker Actor Ruler Bodyguard Seamstress Manager CEO) |
| 49 | + when 'personality_type' |
| 50 | + %w(INTJ INTP ENTJ ENTP INFJ INFP ENFJ ENFP ISTJ ISFJ ESTJ ESFJ ISTP ISFP ESTP ESFP Architect Logician Commander Debater Advocate Mediator Protagonist Campaigner Logistician Defender Executive Consul Virtuoso Adventuer Entrepreneur Entertainer Introverted Extroverted) |
| 51 | + when 'politics' |
| 52 | + %w(Liberal Democrat Republican Conservative Monarchy Anarchist Neutral Independent Central Left Right Rebel Socialist Communist Moderate Apolitical Progressive Labour Undecided) |
| 53 | + when 'race' |
| 54 | + t('character_races') |
| 55 | + when 'religion' |
| 56 | + %w(Atheist Christian Catholic Agnostic Jewish Muslim Judaism Islam Pagan Wiccan Protestant Quaker Satanism Buddhism Baptist Shinto Hinduism Lutheran Mormon Spiritual Polytheism Magic) |
| 57 | + when 'role' |
| 58 | + ['Protagonist', 'Antagonist', 'Main character', 'Supporting character', 'Side character', 'Hero', 'Enemy', 'Wise Old Man', 'Secondary Character', 'Love interest', 'Minor character', 'Villain', 'NPC', 'Ally', 'Father', 'Mother', 'Best friend', 'Background character', 'Companion', 'Deity', 'Healer', 'Warrior', 'Witch', 'Assassin', 'Superhero', 'Brother', 'Sister'] |
| 59 | + when 'skintone' |
| 60 | + t('skin_tones') |
| 61 | + when 'talents' |
| 62 | + %w(Singing Dancing Magic Drawing Cooking Reading Art Painting Sketching Fighting Writing Listening Archery Blacksmithery Music Healing Piano Guitar Baking Acting Sports Swordfighting Weaponry Manipulation Photography Hunting Survival Running Lying Speaking Persuasion Gardening Shapeshifting Strength Soccer Basketball Chemistry Biology Science Stealth Memory Violin Necromancy Recall Jumping Hopskotch Smoothtalking) |
| 63 | + else |
| 64 | + [] |
| 65 | + end.uniq |
| 66 | + end |
| 67 | + |
| 68 | + def self.autocompleteable?(field_name) |
| 69 | + self.for(field_name).any? |
| 70 | + end |
| 71 | + |
| 72 | + # helper method so we don't have to I18n every time |
| 73 | + def self.t(key) |
| 74 | + I18n.t(key) |
| 75 | + end |
| 76 | +end |
0 commit comments