From 65752b4f73cf8e1ce83cdaf8227b5d67923ac729 Mon Sep 17 00:00:00 2001 From: David Gay Date: Fri, 28 May 2021 21:45:50 -0400 Subject: Quickly port leaderboard and rankings from old Esoterra --- app/views/application/_header.html.erb | 3 + .../components/text/_name_and_title.html.erb | 1 + app/views/characters/rankings/index.html.erb | 36 ++++++++ app/views/characters/show.html.erb | 5 +- app/views/leaderboard/index.html.erb | 95 ++++++++++++++++++++++ 5 files changed, 139 insertions(+), 1 deletion(-) create mode 100644 app/views/application/components/text/_name_and_title.html.erb create mode 100644 app/views/characters/rankings/index.html.erb create mode 100644 app/views/leaderboard/index.html.erb (limited to 'app/views') diff --git a/app/views/application/_header.html.erb b/app/views/application/_header.html.erb index 25067f3..38bfcf4 100644 --- a/app/views/application/_header.html.erb +++ b/app/views/application/_header.html.erb @@ -13,6 +13,9 @@
  • <%= link_to "Items", items_path %>
  • +
  • + <%= link_to "Leaderboard", leaderboard_path %> +
  • <%= link_to "Logout", logout_path %>
  • diff --git a/app/views/application/components/text/_name_and_title.html.erb b/app/views/application/components/text/_name_and_title.html.erb new file mode 100644 index 0000000..41a4f27 --- /dev/null +++ b/app/views/application/components/text/_name_and_title.html.erb @@ -0,0 +1 @@ +<%= render "application/components/text/title", title: character.active_title %> <%= character.name %> diff --git a/app/views/characters/rankings/index.html.erb b/app/views/characters/rankings/index.html.erb new file mode 100644 index 0000000..8f41bd2 --- /dev/null +++ b/app/views/characters/rankings/index.html.erb @@ -0,0 +1,36 @@ +

    Rankings for <%= render "application/components/text/name_and_title", character: @character %>

    + +
    + <%= link_to "Refresh", character_rankings_path %> +
    + +
    +

    Total Level: <%= @character.total_level %> (Rank <%= @character.total_level_rank %>)

    +

    Total XP: <%= @character.total_xp %> (Rank <%= @character.total_xp_rank %>)

    +
    + +
    +
    + + + + + + + + + + + <% Skill.all.each do |skill| %> + <% character_skill = @character.character_skills.find_by(skill: skill) %> + + + + + + + <% end %> + +
    SkillRankLevelXP
    <%= skill.name %><%= character_skill.rank %><%= character_skill.level %><%= character_skill.xp %>
    +
    +
    diff --git a/app/views/characters/show.html.erb b/app/views/characters/show.html.erb index ce1c2db..1b5439a 100644 --- a/app/views/characters/show.html.erb +++ b/app/views/characters/show.html.erb @@ -3,7 +3,10 @@
    - <%= link_to "Titles", character_titles_path(@character) %> +

    First entered the planes diff --git a/app/views/leaderboard/index.html.erb b/app/views/leaderboard/index.html.erb new file mode 100644 index 0000000..006def1 --- /dev/null +++ b/app/views/leaderboard/index.html.erb @@ -0,0 +1,95 @@ +

    Leaderboard

    +

    These rankings are not meant to declare the best characters, only those +with the most XP. XP is far from the only indicator of achievement in Esoterra.

    + +<% if current_char %> +
    + <%= link_to "View rankings for #{current_char.name}", character_rankings_path(current_char) %> +
    +<% end %> + +
    + <%= link_to "Refresh", leaderboard_path %> +
    + +
    +
    +
    +

    Total Level

    + + + + + + + + + + <% @top_total_level.each_with_index do |c, index| %> + + + + + + <% end %> + +
    RankCharacterTotal Level
    <%= index + 1 %><%= link_to c.name, character_rankings_path(c) %><%= c.total_level %>
    +
    +
    +
    +
    +

    Total XP

    + + + + + + + + + + <% @top_total_xp.each_with_index do |c, index| %> + + + + + + <% end %> + +
    RankCharacterTotal XP
    <%= index + 1 %><%= link_to c.name, character_rankings_path(c) %><%= c.total_xp %>
    +
    + + +
    +
    + +
    +

    Skill XP Totals

    +
    + <% @top_per_skill.each do |skill_name, skill_trainings| %> +
    +

    <%= skill_name %>

    + + + + + + + + + + + <% skill_trainings.each_with_index do |st, index| %> + + + + + + + <% end %> + +
    RankCharacterLevelXP
    <%= index + 1 %><%= link_to st.character.name, character_rankings_path(st.character) %><%= st.level %><%= st.xp %>
    +
    + <% end %> +
    +
    -- cgit v1.2.3