diff options
author | David Gay <david@davidgay.org> | 2021-05-22 14:32:38 -0400 |
---|---|---|
committer | David Gay <david@davidgay.org> | 2021-05-22 14:32:44 -0400 |
commit | 88bd4f77db3a4372c118a9faef613615db66bc52 (patch) | |
tree | c0ad67b0cdde98e58199052198c9b4f1c45a85f2 /app/views | |
parent | 2dd5608409f0a506cd2a682107d9be302cec8079 (diff) |
Titles
Diffstat (limited to 'app/views')
-rw-r--r-- | app/views/application/components/text/_title.html.erb | 8 | ||||
-rw-r--r-- | app/views/characters/show.html.erb | 4 | ||||
-rw-r--r-- | app/views/characters/titles/index.html.erb | 32 | ||||
-rw-r--r-- | app/views/chat_messages/_message.html.erb | 4 |
4 files changed, 46 insertions, 2 deletions
diff --git a/app/views/application/components/text/_title.html.erb b/app/views/application/components/text/_title.html.erb new file mode 100644 index 0000000..7d87180 --- /dev/null +++ b/app/views/application/components/text/_title.html.erb @@ -0,0 +1,8 @@ +<% if title %> + <% case title.gid %> + <% when "steward" %> + <span class="text-red-500 text-glow">Steward</span> + <% else %> + <%= title.name %> + <% end %> +<% end %> diff --git a/app/views/characters/show.html.erb b/app/views/characters/show.html.erb index 4f2ae2e..819881b 100644 --- a/app/views/characters/show.html.erb +++ b/app/views/characters/show.html.erb @@ -2,6 +2,10 @@ <%= @character.name %> </h1> +<div class="text-lg mb-4"> + <%= link_to "Titles", character_titles_path(@character) %> +</div> + <p class="mb-4">First entered the planes <%= pluralize((Date.current - @character.created_at.to_date).to_i, "day") %> ago.</p> diff --git a/app/views/characters/titles/index.html.erb b/app/views/characters/titles/index.html.erb new file mode 100644 index 0000000..3fb2781 --- /dev/null +++ b/app/views/characters/titles/index.html.erb @@ -0,0 +1,32 @@ +<h1 class="text-3xl mb-4">Titles</h1> + +<p class="mb-4">Here are the titles you've earned. Though they are forever yours until the end of these realms, + you may only display one at a time. How do you wish to be known?</p> + +<table class="table-auto"> + <thead> + <tr> + <th class="table-header-padded">Displayed?</th> + <th class="table-header-padded">Title</th> + <th class="table-header-padded"></th> + </tr> + </thead> + <tbody> + <% @title_awards.each do |title_award| %> + <tr> + <td><%= title_award.title == @character.active_title ? "Yes️" : "" %></td> + <td class="table-cell-padded"> + <%= render "application/components/text/title", title: title_award.title %> + </td> + <td class="table-cell-padded"> + <%= button_to "Display", character_title_activate_path(title_id: title_award.title.id) %> + </td> + </tr> + <% end %> + </tbody> +</table> + +<% unless @title_awards.any? %> + <p>You haven't earned any titles, but fret not. The time has come for champions of all kinds. + Your hour is not far off.</p> +<% end %> diff --git a/app/views/chat_messages/_message.html.erb b/app/views/chat_messages/_message.html.erb index e9663ec..793ed7f 100644 --- a/app/views/chat_messages/_message.html.erb +++ b/app/views/chat_messages/_message.html.erb @@ -28,14 +28,14 @@ <% elsif chat_message.chat_room.gid == "news" %> <span class="<%= chat_room_text_class %>"><%= chat_message.body %></span> <% elsif chat_message.chat_room.gid == "achievement" %> - <%#= render "components/text/title", title: chat_message.target.current_title %> + <%= render "application/components/text/title", title: chat_message.target.active_title %> <span class="<%= chat_room_text_class %>"> <%# TODO: Sort out this subject/target stuff that I just half-blindly ported over from old Esoterra. %> <%= chat_message.target&.name %> <%= chat_message.body %> </span> <% else %> <% if chat_message.sender %> - <%#= render "components/text/title", title: chat_message.sender.current_title %> + <%= render "application/components/text/title", title: chat_message.sender.active_title %> <% end %> <span class="<%= chat_room_text_class %>"> <% if chat_message.sender %> |