Skip to content

Commit dc47809

Browse files
authored
Merge pull request #271 from indentlabs/materialize-upgrades
UI/UX changes
2 parents 7c9f0ed + 8d48ee9 commit dc47809

25 files changed

+190
-233
lines changed

app/assets/javascripts/application.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,4 @@
1212
//
1313
//= require autocomplete-rails
1414
//= require cocoon
15-
//= require social-share-button
16-
//= require social-share-button/wechat
1715
//= require_tree .
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
$( -> $(".button-collapse").sideNav() )
1+
$( -> $(".button-collapse").sidenav() )

app/assets/javascripts/search.js

Lines changed: 0 additions & 13 deletions
This file was deleted.

app/assets/stylesheets/content.css.scss

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,11 @@ p.long-form {
4343
}
4444

4545
.content-field {
46-
min-height: 140px;
46+
min-height: 100px;
47+
48+
textarea.materialize-textarea {
49+
height: 80px;
50+
}
4751
}
4852

4953
.formatted-text {
@@ -77,10 +81,6 @@ p.long-form {
7781
}
7882
}
7983

80-
.autocomplete-content {
81-
position: absolute !important;
82-
}
83-
8484
.spaced-paragraphs {
8585
p {
8686
margin-bottom: 18px !important;
@@ -94,4 +94,4 @@ p.long-form {
9494
}
9595

9696
margin-bottom: 30px;
97-
}
97+
}

app/assets/stylesheets/search.scss

Lines changed: 0 additions & 68 deletions
This file was deleted.
Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,6 @@
1-
.side-nav {
1+
.sidenav {
22
padding-top: 64px;
33

4-
.content-search {
5-
div {
6-
margin: 5px;
7-
}
8-
9-
#search {
10-
border: 1px solid #ccc;
11-
}
12-
}
13-
144
.header {
155
background: #10B6FF;
166
color: white;
@@ -21,5 +11,4 @@
2111
height: 20px;
2212
line-height: 20px;
2313
}
24-
2514
}
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
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

app/views/cards/serendipitous/_content_question.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ if question.present? &&
4242
class: 'tooltipped tristan',
4343
data: {
4444
position: 'right',
45-
delay: '500',
45+
enterDelay: '500',
4646
tooltip: "Hey, I'm Tristan! I'm happy to look up relevant information like this for you."
4747
} %>
4848
</div>

app/views/content/cards/_in_universe_content_list.html.erb

Lines changed: 24 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,42 @@
11
<%
22
content_type_class = content_type.to_s.titleize.constantize
3-
4-
if content_list.count > 100
5-
content_list = content_list.first(100)
6-
card_title ||= "100+ #{content_type.to_s.pluralize}"
7-
end
83
%>
94
<div class="card hoverable">
10-
<div class="card-image waves-effect waves-block waves-light">
11-
<% images = [] # content_list.flat_map(&:image_uploads) #todo reinstate this with optimizations %>
5+
<div class="card-image">
6+
<% images = ImageUpload.where(content_type: content_type.to_s.titleize, content_id: content_list.map(&:id)) %>
127
<% if images.any? && rand(3) < 2 %>
138
<%= image_tag images.sample.src(:large), class: 'activator', style: 'height: 265px' %>
149
<% else %>
1510
<%= image_tag "card-headers/#{content_type.to_s.pluralize}.jpg", class: 'activator', style: 'height: 265px' %>
1611
<% end %>
17-
</div>
18-
<div class="card-content">
19-
<span class="card-title activator grey-text text-darken-4">
12+
<span class="card-title" style="text-shadow: 1px 1px #000000">
2013
<% if defined?(card_title) && !card_title.blank? %>
2114
<%= card_title %>
2215
<% else %>
2316
<%= pluralize(content_list.count, content_type.to_s) %>
2417
<% end %>
25-
<i class="material-icons right">arrow_upward</i>
2618
</span>
27-
<p>
28-
<%= link_to "Create #{content_list.empty? ? 'your first one!' : ['another ', content_type].join}", new_polymorphic_path(content_type) if user_signed_in? %>
29-
</p>
19+
<% if user_signed_in? %>
20+
<%= link_to new_polymorphic_path(content_type), class: "btn-floating btn-large halfway-fab waves-effect waves-light #{content_type_class.color} tooltipped",
21+
data: {
22+
position: 'bottom',
23+
tooltip: "Create a #{content_type.to_s}",
24+
enterDelay: 50
25+
} do %>
26+
<i class="material-icons">add</i>
27+
<% end %>
28+
29+
<%= link_to polymorphic_path(content_type_class), class: "btn-floating halfway-fab waves-effect waves-light grey black-text tooltipped", style: "right: 90px",
30+
data: {
31+
position: 'bottom',
32+
tooltip: "View all #{content_type.to_s.pluralize}",
33+
enterDelay: 50
34+
} do %>
35+
<i class="material-icons">reorder</i>
36+
<% end %>
37+
<% end %>
38+
</div>
39+
<div class="card-content">
3040
</div>
3141
<div class="card-reveal">
3242
<span class="card-title grey-text text-darken-4">

app/views/content/display/_floating_action_buttons.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
<%= link_to '#',
2929
class: "btn-floating btn-small halfway-fab waves-effect waves-light white expand",
3030
style: 'z-index: 500; margin-right: 61px;' do %>
31-
<%#data: { position: 'bottom', delay: '500', tooltip: 'Expand all tabs vertically'}%>
31+
<%#data: { position: 'bottom', enterDelay: '500', tooltip: 'Expand all tabs vertically'}%>
3232
<i class="material-icons black-text">format_line_spacing</i>
3333
<% end %>
3434

0 commit comments

Comments
 (0)