From cf6b277ca3f22e575b059a8d8029163ddcee86db Mon Sep 17 00:00:00 2001 From: hellekin Date: Tue, 6 Oct 2020 21:59:13 +0200 Subject: Fix form, add flash --- app/views/application/_flash.html.erb | 3 +++ app/views/layouts/application.html.erb | 1 + app/views/resources/edit.html.erb | 15 ++++++++++++--- 3 files changed, 16 insertions(+), 3 deletions(-) create mode 100644 app/views/application/_flash.html.erb (limited to 'app/views') diff --git a/app/views/application/_flash.html.erb b/app/views/application/_flash.html.erb new file mode 100644 index 0000000..0b5cc5f --- /dev/null +++ b/app/views/application/_flash.html.erb @@ -0,0 +1,3 @@ +
<% flash.each do |type, msg| %> + <%= msg %> +<% end %>
diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 4aae3ea..38dcf46 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -26,5 +26,6 @@ + <%= render partial: 'flash' %> diff --git a/app/views/resources/edit.html.erb b/app/views/resources/edit.html.erb index 7e9799f..fa61a0a 100644 --- a/app/views/resources/edit.html.erb +++ b/app/views/resources/edit.html.erb @@ -1,6 +1,15 @@ -<%= form_with model: @resource do |f| %> - <%= f.label :name, "Name of this Resource" %> - <%= f.text_field :name %> +<%= form_with model: @resource, local: true do |f| %> + <%= f.label :name %> + <%= f.text_field :name, value: @resource.name %> + + + <%= tag.legend "Geographic Position" %> + <%= f.label :longitude %> + <%= f.text_field :longitude, value: @resource.lon %> + <%= f.label :latitude %> + <%= f.text_field :latitude, value: @resource.lat %> + + <%= f.submit 'Save' %> <% end %> -- cgit v1.2.3