aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhellekin <hellekin@cepheide.org>2020-10-06 20:34:48 +0200
committerhellekin <hellekin@cepheide.org>2020-10-06 20:34:48 +0200
commit8c7c0501e49871765d6ac971e4027dac0ea20407 (patch)
tree7642357fc3e4c1cce6330f9aaae08bf128f6aebe
parent1564af069472e32ed322bf9acedc9c487bce1a15 (diff)
downloadincommon-map-8c7c0501e49871765d6ac971e4027dac0ea20407.tar.gz
First pass at Resources...
-rw-r--r--app/controllers/resources_controller.rb2
-rw-r--r--app/views/resources/_resource.html.erb12
-rw-r--r--app/views/resources/edit.html.erb8
-rw-r--r--app/views/resources/show.html.erb1
4 files changed, 19 insertions, 4 deletions
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 @@
<p class="identifier"><%= resource_url(resource) %></p>
</header>
<div><%= h resource.description %></div>
- <code><%= h resource.feature.as_json %></code>
+ <hr>
+ <code><pre><%= h JSON.pretty_generate(resource.feature.as_json) %></pre></code>
+ <p>... <%= session[:current_agent] %>...</p>
+ <nav>
+ <ul>
+ <li><%= link_to('show', resource_url(resource)) %></li>
+ <% if session[:current_agent] == resource.source %>
+ <li><%= link_to 'edit', edit_resource_url(resource) %></li>
+ <li><span class="disabled">delete</span></li>
+ <% end %></ul>
+ </nav>
</section>
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 @@
-<h1>Resources#edit</h1>
-<p>Find me in app/views/resources/edit.html.erb</p>
+<%= 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 %>