From f00aea423bafe7889c7bcc8d85b3561e2c9606d9 Mon Sep 17 00:00:00 2001 From: David Gay Date: Thu, 10 Jun 2021 09:09:34 -0400 Subject: Fix bug in timer partial render caused by not having an active character (#11) --- app/views/application/_timer.html.erb | 100 +++++++++++++++++----------------- 1 file changed, 51 insertions(+), 49 deletions(-) (limited to 'app/views/application') diff --git a/app/views/application/_timer.html.erb b/app/views/application/_timer.html.erb index d683c6a..51d9b81 100644 --- a/app/views/application/_timer.html.erb +++ b/app/views/application/_timer.html.erb @@ -1,61 +1,63 @@ -<% if current_char.activity %> -

<%= current_char.activity.name %>

-
-
- -
-
-
+<% if current_char %> + <% if current_char.activity %> +

<%= current_char.activity.name %>

+
+
+ +
+
+
+
-
- - <% 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, class: "text-sm" %> -
- -
- <% if current_char.activity.gid.include?("beastslay") %> - <%= current_char.wounds %> / <%= pluralize(current_char.max_wounds, "wound") %> - <% end %> - <% current_char.active_states.each do |state| %> -
- <%= state.condition.name %> -
-
- (expires in <%= distance_of_time_in_words_to_now(state.expires_at) %>) -
- <% end %> -
+ <% 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
+
-<% else %> -
- <% if current_char.resting? %> -

You're resting.

- <% else %> -

You're not doing anything.

- <% end %> +
+ <%= button_to "Stop", stop_activity_path, class: "text-sm" %> +
-
- <%= button_to current_char.resting? ? "Stop Resting" : "Start Resting", toggle_resting_path %> +
+ <% if current_char.activity.gid.include?("beastslay") %> + <%= current_char.wounds %> / <%= pluralize(current_char.max_wounds, "wound") %> + <% end %> + <% current_char.active_states.each do |state| %> +
+ <%= state.condition.name %> +
+
+ (expires in <%= distance_of_time_in_words_to_now(state.expires_at) %>) +
+ <% end %>
-
- You have <%= distance_of_time_in_words_to_now(current_char.rested_until) %> of rested time. + <% else %> +
<% if current_char.resting? %> - This does not include time from your current rest. That time will be added when you stop resting. +

You're resting.

+ <% else %> +

You're not doing anything.

<% end %> + +
+ <%= button_to current_char.resting? ? "Stop Resting" : "Start Resting", toggle_resting_path %> +
+ +
+ You have <%= distance_of_time_in_words_to_now(current_char.rested_until) %> of rested time. + <% if current_char.resting? %> + This does not include time from your current rest. That time will be added when you stop resting. + <% end %> +
-
+ <% end %> <% end %> -- cgit v1.2.3