From 7f129f24e351cafafdb4bc58a44ca0d714e30af6 Mon Sep 17 00:00:00 2001 From: David Gay Date: Thu, 3 Jun 2021 20:50:58 -0400 Subject: Move timer and results to new game containers which are always visible --- app/views/application/_results.html.erb | 32 ++++++++++++++++++++++++++++++++ app/views/application/_timer.html.erb | 18 ++++++++++++++++++ 2 files changed, 50 insertions(+) create mode 100644 app/views/application/_results.html.erb create mode 100644 app/views/application/_timer.html.erb (limited to 'app/views/application') diff --git a/app/views/application/_results.html.erb b/app/views/application/_results.html.erb new file mode 100644 index 0000000..1da0af7 --- /dev/null +++ b/app/views/application/_results.html.erb @@ -0,0 +1,32 @@ +
+ <% results.each do |result| %> + <% case result[:type] %> + <% when "item" %> +

You got <%= result[:quantity] %> <%= link_to result[:item].name, item_path(result[:item])%>. + <% if result[:xp]&.any? %> + (<%= result[:xp].map { |award| "#{award[:amount] * result[:quantity]} #{award[:skill].name} XP" }.join(", ") %>) + <% end %> +

+ <% when "hearth_amenity" %> +

You constructed <%= result[:hearth_amenity].name %>.

+ <% when "hearth_planting" %> +

You planted <%= link_to result[:hearth_planting].item.name, + item_path(result[:hearth_planting].item) %> in the loam.

+ <% when "activity" %> +

You realized how to <%= result[:activity].name %>!

+ <% when "monster" %> +

You encountered a <%= result[:monster].name %>.

+

<%= result[:monster].description %>

+ <% when "xp" %> +

You gained <%= result[:xp] %> <%= result[:skill].name %> XP.

+ <% when "title" %> +

You earned the title <%= render "application/components/text/title", title: result[:title] %>!

+ <% when "message" %> +

<%= result[:body] %>

+ <% when "error" %> +

<%= result[:message] %>

+ <% when "br" %> +
+ <% end %> + <% end %> +
diff --git a/app/views/application/_timer.html.erb b/app/views/application/_timer.html.erb new file mode 100644 index 0000000..908689b --- /dev/null +++ b/app/views/application/_timer.html.erb @@ -0,0 +1,18 @@ +<% if current_char.activity %> +
+ +
+ + <% most_recent_cs = current_char.character_skills.order(:updated_at).last %> +
+
<%= most_recent_cs.skill.name %> level <%= most_recent_cs.level %>
+
<%= most_recent_cs.xp_to_next_level %> XP to next level
+
+ +
+ <%= button_to "Stop", stop_activity_path %> +
+<% end %> -- cgit v1.2.3