Skip to content

Commit

Permalink
Continue work on profile page
Browse files Browse the repository at this point in the history
  • Loading branch information
renatolond committed Oct 2, 2024
1 parent 85c306a commit c57456c
Show file tree
Hide file tree
Showing 5 changed files with 318 additions and 13 deletions.
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ gem "sprockets-rails"
gem "falcon"

gem "haml" # Allows to use haml template files instead of erb
gem "kramdown" # Allows for markdown in haml files, look more into this

# Use JavaScript with ESM import maps [https://github.com/rails/importmap-rails]
gem "importmap-rails"
Expand Down
3 changes: 3 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,8 @@ GEM
rdoc (>= 4.0.0)
reline (>= 0.4.2)
json (2.7.2)
kramdown (2.4.0)
rexml
language_server-protocol (3.17.0.3)
lefthook (1.7.18)
localhost (1.3.1)
Expand Down Expand Up @@ -408,6 +410,7 @@ DEPENDENCIES
falcon
haml
importmap-rails
kramdown
lefthook
mocha
pronto (~> 0.11)
Expand Down
45 changes: 43 additions & 2 deletions app/models/profile_info.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,49 @@
# frozen_string_literal: true

ProfileInfo = Data.define(:display_name, :birth_date, :genders, :orientations, :age, :profile_picture) do
ABOUT_ME_TEXT = "I'm very much into computers. I spend most of my time jacked into the ship's computers using my neuro-port. I really am not that much into humans, but I'm hoping that maybe I can find someone that's into the same things that I am and we can maybe spend time in virtual.
I also make a mean carbonara, but most of the time I just live off Soylent Green, it has a distinct flavor that really pleases me."
ProfileInfo = Data.define(:display_name,
:birth_date,
:genders,
:orientations,
:age,
:profile_picture,
:location,
:about_me,
:pronouns,
:languages,
:relationship_status,
:relationship_type,
:tobacco,
:alcohol,
:marijuana,
:other_recreational_drugs,
:kids,
:wants_kids,
:pets,
:wants_pets) do
# TODO: remove default later, these are here to make it easier to create new profile page
def initialize(display_name: "Lommie Thorne", birth_date: Date.new(2083, 6, 12), genders: %i[genderfluid questioning], orientations: %i[asexual bisexual], age: nil, profile_picture: "https://external-content.duckduckgo.com/iu/?u=https%3A%2F%2Fvignette.wikia.nocookie.net%2Fnightflyers8841%2Fimages%2F3%2F35%2FLommie_Profile_Image.jpg%2Frevision%2Flatest%3Fcb%3D20181127123914&f=1&nofb=1&ipt=77a78fb901bd3c8c0a52d4797b5535c097c153458aea337cdcaf63c62acba7b9&ipo=images")
def initialize(display_name: "Lommie Thorne",
birth_date: Date.new(2083, 6, 12),
genders: %i[genderfluid questioning],
orientations: %i[asexual bisexual],
age: nil,
profile_picture: "https://picsum.photos/id/433/256/256",
location: "Nightflyer, Space",
about_me: ABOUT_ME_TEXT,
pronouns: "She/Her",
languages: %i[por eng qaa],
relationship_status: :single,
relationship_type: :non_monogamous,
tobacco: :never,
alcohol: :often,
marijuana: :sometimes,
other_recreational_drugs: :sometimes,
pets: :have,
wants_pets: :do_not_want_more,
kids: :have_not,
wants_kids: :dont_know)
age ||= begin
now = Time.now.utc.to_date
extra_year_or_not = 0
Expand Down
63 changes: 52 additions & 11 deletions app/views/profiles/show.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,55 @@
.media-content
.title.is-4
#{@profile_info.display_name}
- @profile_info.genders.each do |gender|
%span.tag.is-primary #{I18n.t(gender, scope: :genders)}
- @profile_info.orientations.each do |orientation|
%span.tag.is-info #{I18n.t(orientation, scope: :orientations)}
.subtitle.is-6 #{I18n.t("age", count: @profile_info.age)}
.content!
lorem ipsum dolor sit amet, consectetur adipiscing elit. phasellus nec
iaculis mauris. <a>@bulmaio</a>. <a href="#">#css</a>
<a href="#">#responsive</a>
<br />
<time datetime="2016-1-1">11:09 PM - 1 Jan 2016</time>
.subtitle.is-6 #{I18n.t("age", count: @profile_info.age)} &centerdot; #{@profile_info.location}
.content
.fixed-grid
.grid
.cell
#{I18n.t("gender")}
- @profile_info.genders.each do |gender|
%span.tag.is-primary #{I18n.t(gender, scope: :genders)}
.cell
#{I18n.t("orientation")}
- @profile_info.orientations.each do |orientation|
%span.tag.is-info #{I18n.t(orientation, scope: :orientations)}
.cell
#{I18n.t("pronouns")}
%span.tag.is-light.is-info #{@profile_info.pronouns}
.cell
#{I18n.t("relationship_status")}
%span.tag.is-primary #{I18n.t(@profile_info.relationship_status, scope: :relationship_status_list)}
.cell
#{I18n.t("relationship_type")}
%span.tag.is-info #{I18n.t(@profile_info.relationship_type, scope: :relationship_type_list)}
.cell
#{I18n.t("languages_known")}
- @profile_info.languages.each do |language|
%span.tag.is-info.is-light #{I18n.t(language, scope: :languages_known_list)}
.content
%hr
%h1 Some extra details:
.fixed-grid.has-3-cols
.grid
.cell
#{I18n.t("tobacco")}
%span.tag.is-primary.is-light #{I18n.t(@profile_info.tobacco, scope: :frequency)}
.cell
#{I18n.t("alcohol")}
%span.tag.is-primary.is-light #{I18n.t(@profile_info.alcohol, scope: :frequency)}
.cell
#{I18n.t("marijuana")}
%span.tag.is-primary.is-light #{I18n.t(@profile_info.marijuana, scope: :frequency)}
.cell
#{I18n.t("other_recreational_drugs")}
%span.tag.is-primary.is-light #{I18n.t(@profile_info.other_recreational_drugs, scope: :frequency)}
.cell
#{I18n.t("kids")}
%span.tag.is-primary.is-light #{[I18n.t(@profile_info.kids, this: I18n.t("kids").downcase, scope: :have_or_have_nots), I18n.t(@profile_info.wants_kids, scope: :wants)].compact.to_sentence}
.cell
#{I18n.t("pets")}
%span.tag.is-primary.is-light #{[I18n.t(@profile_info.pets, this: I18n.t("pets").downcase, scope: :have_or_have_nots), I18n.t(@profile_info.wants_pets, scope: :wants)].compact.to_sentence}
%hr
%h1 About me
:markdown
#{@profile_info.about_me}
219 changes: 219 additions & 0 deletions config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ en:
bad_password: "Incorrect password."
age:
other: '%{count} years old'
gender: "Gender"
genders:
man: Man
woman: Woman
Expand All @@ -62,6 +63,7 @@ en:
androgynous: Androgynous
questioning: Questioning
unsure: Unsure
orientation: "Sexual orientation"
orientations:
straight: Straight
bisexual: Bisexual
Expand All @@ -84,3 +86,220 @@ en:
fluctuating: Fluctuating
unsure: Unsure
questioning: Questioning
pronouns: "Pronouns"
languages_known: "Languages known"
languages_known_list:
abk: Abkhazian
aar: Afar
afr: Afrikaans
aka: Akan
sqi: Albanian
amh: Amharic
ara: Arabic
arg: Aragonese
hye: Armenian
asm: Assamese
ava: Avaric
ave: Avestan
aym: Aymara
aze: Azerbaijani
bam: Bambara
bak: Bashkir
eus: Basque
bel: Belarusian
ben: Bengali
bis: Bislama
bos: Bosnian
bre: Breton
bul: Bulgarian
mya: Burmese
cat: Catalan
cha: Chamorro
che: Chechen
nya: Chichewa
zho: Chinese
chu: Church Slavonic
chv: Chuvash
cor: Cornish
cos: Corsican
cre: Cree
hrv: Croatian
ces: Czech
dan: Danish
div: Divehi
nld: Dutch
dzo: Dzongkha
eng: English
epo: Esperanto
est: Estonian
ewe: Ewe
fao: Faroese
fij: Fijian
fin: Finnish
fra: French
fry: Western Frisian
ful: Fulah
gla: Gaelic
glg: Galician
lug: Ganda
kat: Georgian
deu: German
ell: Modern Greek
kal: Kalaallisut
grn: Guarani
guj: Gujarati
hat: Haitian
hau: Hausa
heb: Hebrew
her: Herero
hin: Hindi
hmo: Hiri Motu
hun: Hungarian
isl: Icelandic
ido: Ido
ibo: Igbo
ind: Indonesian
ina: Interlingua
ile: Interlingue
iku: Inuktitut
ipk: Inupiaq
gle: Irish
ita: Italian
jpn: Japanese
jav: Javanese
kan: Kannada
kau: Kanuri
kas: Kashmiri
kaz: Kazakh
khm: Central Khmer
kik: Kikuyu
kin: Kinyarwanda
kir: Kirghiz
kom: Komi
kon: Kongo
kor: Korean
kua: Kuanyama
kur: Kurdish
lao: Lao
lat: Latin
lav: Latvian
lim: Limburgan
lin: Lingala
lit: Lithuanian
lub: Luba-Katanga
ltz: Luxembourgish
mkd: Macedonian
mlg: Malagasy
msa: Malay
mal: Malayalam
mlt: Maltese
glv: Manx
mri: Maori
mar: Marathi
mah: Marshallese
mon: Mongolian
nau: Nauru
nav: Navajo
nde: North Ndebele
nbl: South Ndebele
ndo: Ndonga
nep: Nepali
nor: Norwegian
nob: Norwegian Bokmål
nno: Norwegian Nynorsk
oci: Occitan
oji: Ojibwa
ori: Oriya
orm: Oromo
oss: Ossetian
pli: Pali
pus: Pashto
fas: Persian
pol: Polish
por: Portuguese
pan: Punjabi
que: Quechua
ron: Romanian
roh: Romansh
run: Rundi
rus: Russian
sme: Northern Sami
smo: Samoan
sag: Sango
san: Sanskrit
srd: Sardinian
srp: Serbian
sna: Shona
snd: Sindhi
sin: Sinhala
slk: Slovak
slv: Slovenian
som: Somali
sot: Southern Sotho
spa: Spanish
sun: Sundanese
swa: Swahili
ssw: Swati
swe: Swedish
tgl: Tagalog
tah: Tahitian
tgk: Tajik
tam: Tamil
tat: Tatar
tel: Telugu
tha: Thai
bod: Tibetan
tir: Tigrinya
ton: Tonga (Tonga Islands)
tso: Tsonga
tsn: Tswana
tur: Turkish
tuk: Turkmen
twi: Twi
uig: Uighur
ukr: Ukrainian
urd: Urdu
uzb: Uzbek
ven: Venda
vie: Vietnamese
vol: Volapük
wln: Walloon
cym: Welsh
wol: Wolof
xho: Xhosa
iii: Sichuan Yi
yid: Yiddish
yor: Yoruba
zha: Zhuang
zul: Zulu
# qaa-qtz are reserved for local use in ISO-639-3, so we use for funny languages we might want to add. Do not use it for real languages, consult the real language in https://iso639-3.sil.org/code_tables/639/data/all
qaa: Binary
relationship_status_list:
single: Single
partnered: Partnered
married: Married
relationship_status: "Relationship status"
relationship_type_list:
monogamous: Monogamous
non_monogamous: "Non-monogamous"
relationship_type: "Relationship type"
marijuana: "Marijuana"
alcohol: "Alcohol"
tobacco: "Tobacco"
other_recreational_drugs: "Other recreational drugs"
frequency:
often: "Often"
sometimes: "Sometimes"
never: "Never"
have_or_have_nots:
have: "I have %{this}"
have_not: "I don't have %{this}"
kids: "Kids"
pets: "Pets"
wants:
want_more: "want more"
do_not_want_more: "don't want more"
want_some: "want some"
do_not_want_any: "don't want them"
dont_know: "don't know if I want them"
maybe: "I might want"

0 comments on commit c57456c

Please sign in to comment.