From 65c1ee3dbaf5c0a030dd28a7e3f41d47c7652cb1 Mon Sep 17 00:00:00 2001 From: David Gay Date: Thu, 27 May 2021 18:41:51 -0400 Subject: Move active action display with timer and results to a `LookController` --- app/views/look/_results.html.erb | 27 +++++++++++++++++++++++++++ app/views/look/_timer.html.erb | 18 ++++++++++++++++++ app/views/look/show.html.erb | 10 ++++++++++ 3 files changed, 55 insertions(+) create mode 100644 app/views/look/_results.html.erb create mode 100644 app/views/look/_timer.html.erb create mode 100644 app/views/look/show.html.erb (limited to 'app/views/look') diff --git a/app/views/look/_results.html.erb b/app/views/look/_results.html.erb new file mode 100644 index 0000000..36e8103 --- /dev/null +++ b/app/views/look/_results.html.erb @@ -0,0 +1,27 @@ +
+ <% 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]} xp #{award[:skill].name}" }.join(", ") %>) + <% end %> +

+ <% when "hearth_amenity" %> +

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

+ <% 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] %>

+ <% end %> + <% end %> +
diff --git a/app/views/look/_timer.html.erb b/app/views/look/_timer.html.erb new file mode 100644 index 0000000..908689b --- /dev/null +++ b/app/views/look/_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 %> diff --git a/app/views/look/show.html.erb b/app/views/look/show.html.erb new file mode 100644 index 0000000..a0c1bd7 --- /dev/null +++ b/app/views/look/show.html.erb @@ -0,0 +1,10 @@ +

<%= current_char.activity.name %>

+

<%= current_char.activity.description %>

+ +
+
+ +
+ <%= render "timer" %> +
-- cgit v1.2.3