From 8c7c0501e49871765d6ac971e4027dac0ea20407 Mon Sep 17 00:00:00 2001 From: hellekin Date: Tue, 6 Oct 2020 20:34:48 +0200 Subject: First pass at Resources... --- app/controllers/resources_controller.rb | 2 +- app/views/resources/_resource.html.erb | 12 +++++++++++- app/views/resources/edit.html.erb | 8 ++++++-- app/views/resources/show.html.erb | 1 + 4 files changed, 19 insertions(+), 4 deletions(-) create mode 100644 app/views/resources/show.html.erb (limited to 'app') diff --git a/app/controllers/resources_controller.rb b/app/controllers/resources_controller.rb index d7fd822..75fcedf 100644 --- a/app/controllers/resources_controller.rb +++ b/app/controllers/resources_controller.rb @@ -1,5 +1,5 @@ class ResourcesController < ApplicationController - before_action :set_resource, only: [:new, :edit, :update, :delete, :destroy] + before_action :set_resource, only: [:new, :show, :edit, :update, :delete, :destroy] # GET /resources def index diff --git a/app/views/resources/_resource.html.erb b/app/views/resources/_resource.html.erb index 39997ef..f013523 100644 --- a/app/views/resources/_resource.html.erb +++ b/app/views/resources/_resource.html.erb @@ -6,5 +6,15 @@

<%= resource_url(resource) %>

<%= h resource.description %>
- <%= h resource.feature.as_json %> +
+
<%= h JSON.pretty_generate(resource.feature.as_json) %>
+

... <%= session[:current_agent] %>...

+ diff --git a/app/views/resources/edit.html.erb b/app/views/resources/edit.html.erb index 61b0939..7e9799f 100644 --- a/app/views/resources/edit.html.erb +++ b/app/views/resources/edit.html.erb @@ -1,2 +1,6 @@ -

Resources#edit

-

Find me in app/views/resources/edit.html.erb

+<%= form_with model: @resource do |f| %> + <%= f.label :name, "Name of this Resource" %> + <%= f.text_field :name %> + + <%= f.submit 'Save' %> +<% end %> diff --git a/app/views/resources/show.html.erb b/app/views/resources/show.html.erb new file mode 100644 index 0000000..5855d72 --- /dev/null +++ b/app/views/resources/show.html.erb @@ -0,0 +1 @@ +<%= render @resource %> -- cgit v1.2.3