From dd9e0691acae3eb63bdfbc8665eb3f8ce516536d Mon Sep 17 00:00:00 2001 From: hellekin Date: Fri, 9 Oct 2020 12:47:31 +0200 Subject: Fix Resource edition --- app/views/resources/_edit.html.erb | 4 ++-- app/views/resources/_resource.html.erb | 10 +++++----- app/views/resources/edit.html.erb | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) (limited to 'app/views') diff --git a/app/views/resources/_edit.html.erb b/app/views/resources/_edit.html.erb index fdb2921..55c59f6 100644 --- a/app/views/resources/_edit.html.erb +++ b/app/views/resources/_edit.html.erb @@ -1,6 +1,6 @@ -

Edit <%= resource.presence&.name || 'new resource' %>

+

Edit <%= @resource.presence.feature['properties']['name'] || 'new resource' %>

Context: <%= current_agent %>

-<%= form_with model: [current_agent,@resource] do |f| %> +<%= form_with model: [current_agent,@resource], url: controller.action_name == 'new' ? agent_resources_path(agent: current_agent) : resource_path(@resource) do |f| %> <%= render partial: 'form', locals: { resource: resource, f: f } %> <% end %> diff --git a/app/views/resources/_resource.html.erb b/app/views/resources/_resource.html.erb index f013523..585bed8 100644 --- a/app/views/resources/_resource.html.erb +++ b/app/views/resources/_resource.html.erb @@ -1,9 +1,9 @@
-

<%= h resource.name %>

+

<%= resource.properties['name'] %>

<%= h resource.description %>

@@ -13,8 +13,8 @@
diff --git a/app/views/resources/edit.html.erb b/app/views/resources/edit.html.erb index 80d8206..b52c60d 100644 --- a/app/views/resources/edit.html.erb +++ b/app/views/resources/edit.html.erb @@ -1,2 +1,2 @@ -<%= render partial: 'edit', locals: { resource: @resource } %> +<%= render partial: 'edit', locals: { resource: @resource, foo: 'foo' } %> -- cgit v1.2.3