From 4c96893a114059dc4e748307c6d046ec1faa778f Mon Sep 17 00:00:00 2001 From: David Gay Date: Wed, 2 Jun 2021 22:15:02 -0400 Subject: Magiculture --- .../hearth/hearth_plantings/index.html.erb | 29 ++++++++++++++++++++++ app/views/characters/hearth/index.html.erb | 3 +++ app/views/look/_results.html.erb | 3 +++ 3 files changed, 35 insertions(+) create mode 100644 app/views/characters/hearth/hearth_plantings/index.html.erb (limited to 'app/views') diff --git a/app/views/characters/hearth/hearth_plantings/index.html.erb b/app/views/characters/hearth/hearth_plantings/index.html.erb new file mode 100644 index 0000000..8aaefcc --- /dev/null +++ b/app/views/characters/hearth/hearth_plantings/index.html.erb @@ -0,0 +1,29 @@ +

Loamspire

+ +

You have <%= @hearth.available_planting_spots %> available planting spots.

+ +
+ <%= form_with url: start_activity_path, method: :post do |f| %> + <%= f.select :id, @planting_activities.sort_by { |a| a.name }.map { |a| [a.name, a.id] } %> + <%= f.number_field :actions, value: 1, size: 5, min: 1, max: 2_000_000_000 %> + <%= f.submit "Plant" %> + <% end %> +
+ +
+ <% @hearth_plantings.each do |hp| %> +
+

<%= hp.item.name %>

+ <% if hp.ripens_at > Time.now %> +

Ripens in <%= distance_of_time_in_words_to_now(hp.ripens_at) %>

+ <% else %> + <% harvest_activity = Activity.find_by_gid(hp.item.whatnot[:harvest_activity]) %> + <%= form_with url: start_activity_path(harvest_activity) do |f| %> + <%= f.hidden_field :id, value: harvest_activity.id %> + <%= f.hidden_field :actions, value: current_char.hearth.ripe_hearth_plantings_of(hp.item).count %> + <%= f.submit "Harvest" %> + <% end %> + <% end %> +
+ <% end %> +
diff --git a/app/views/characters/hearth/index.html.erb b/app/views/characters/hearth/index.html.erb index c058007..7ff34c5 100644 --- a/app/views/characters/hearth/index.html.erb +++ b/app/views/characters/hearth/index.html.erb @@ -24,6 +24,9 @@ <% if built_amenity.usable? %> <%= button_to "Use", hearth_amenity_use_path(built_amenity.hearth_amenity) %> <% end %> + <% if built_amenity.hearth_amenity.gid == "loamspire" %> + <%= link_to "Manage", character_hearth_loamspire_path, class: "btn btn-primary" %> + <% end %> <% end %> <% next_level = built_amenity ? built_amenity.level + 1 : 1 %> <% construct_activity = ha.construct_activity(next_level) %> diff --git a/app/views/look/_results.html.erb b/app/views/look/_results.html.erb index beb2deb..2c79812 100644 --- a/app/views/look/_results.html.erb +++ b/app/views/look/_results.html.erb @@ -9,6 +9,9 @@

<% 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" %> -- cgit v1.2.3