aboutsummaryrefslogtreecommitdiffstats
path: root/app/views/organisations
diff options
context:
space:
mode:
Diffstat (limited to 'app/views/organisations')
-rw-r--r--app/views/organisations/_form.html.erb22
-rw-r--r--app/views/organisations/_organisation.html.erb7
-rw-r--r--app/views/organisations/_organisation.json.jbuilder2
-rw-r--r--app/views/organisations/edit.html.erb10
-rw-r--r--app/views/organisations/index.html.erb14
-rw-r--r--app/views/organisations/index.json.jbuilder1
-rw-r--r--app/views/organisations/new.html.erb9
-rw-r--r--app/views/organisations/show.html.erb10
-rw-r--r--app/views/organisations/show.json.jbuilder1
9 files changed, 76 insertions, 0 deletions
diff --git a/app/views/organisations/_form.html.erb b/app/views/organisations/_form.html.erb
new file mode 100644
index 0000000..ebe8ea3
--- /dev/null
+++ b/app/views/organisations/_form.html.erb
@@ -0,0 +1,22 @@
+<%= form_with(model: organisation) do |form| %>
+ <% if organisation.errors.any? %>
+ <div style="color: red">
+ <h2><%= pluralize(organisation.errors.count, "error") %> prohibited this organisation from being saved:</h2>
+
+ <ul>
+ <% organisation.errors.each do |error| %>
+ <li><%= error.full_message %></li>
+ <% end %>
+ </ul>
+ </div>
+ <% end %>
+
+ <div>
+ <%= form.label :name, style: "display: block" %>
+ <%= form.text_field :name %>
+ </div>
+
+ <div>
+ <%= form.submit %>
+ </div>
+<% end %>
diff --git a/app/views/organisations/_organisation.html.erb b/app/views/organisations/_organisation.html.erb
new file mode 100644
index 0000000..c5ea553
--- /dev/null
+++ b/app/views/organisations/_organisation.html.erb
@@ -0,0 +1,7 @@
+<div id="<%= dom_id organisation %>">
+ <p>
+ <strong>Name:</strong>
+ <%= organisation.name %>
+ </p>
+
+</div>
diff --git a/app/views/organisations/_organisation.json.jbuilder b/app/views/organisations/_organisation.json.jbuilder
new file mode 100644
index 0000000..e4d8f92
--- /dev/null
+++ b/app/views/organisations/_organisation.json.jbuilder
@@ -0,0 +1,2 @@
+json.extract! organisation, :id, :name, :created_at, :updated_at
+json.url organisation_url(organisation, format: :json)
diff --git a/app/views/organisations/edit.html.erb b/app/views/organisations/edit.html.erb
new file mode 100644
index 0000000..95bea56
--- /dev/null
+++ b/app/views/organisations/edit.html.erb
@@ -0,0 +1,10 @@
+<h1>Editing organisation</h1>
+
+<%= render "form", organisation: @organisation %>
+
+<br>
+
+<div>
+ <%= link_to "Show this organisation", @organisation %> |
+ <%= link_to "Back to organisations", organisations_path %>
+</div>
diff --git a/app/views/organisations/index.html.erb b/app/views/organisations/index.html.erb
new file mode 100644
index 0000000..45d5b16
--- /dev/null
+++ b/app/views/organisations/index.html.erb
@@ -0,0 +1,14 @@
+<p style="color: green"><%= notice %></p>
+
+<h1>Organisations</h1>
+
+<div id="organisations">
+ <% @organisations.each do |organisation| %>
+ <%= render organisation %>
+ <p>
+ <%= link_to "Show this organisation", organisation %>
+ </p>
+ <% end %>
+</div>
+
+<%= link_to "New organisation", new_organisation_path %>
diff --git a/app/views/organisations/index.json.jbuilder b/app/views/organisations/index.json.jbuilder
new file mode 100644
index 0000000..4490dc6
--- /dev/null
+++ b/app/views/organisations/index.json.jbuilder
@@ -0,0 +1 @@
+json.array! @organisations, partial: "organisations/organisation", as: :organisation
diff --git a/app/views/organisations/new.html.erb b/app/views/organisations/new.html.erb
new file mode 100644
index 0000000..a749bc8
--- /dev/null
+++ b/app/views/organisations/new.html.erb
@@ -0,0 +1,9 @@
+<h1>New organisation</h1>
+
+<%= render "form", organisation: @organisation %>
+
+<br>
+
+<div>
+ <%= link_to "Back to organisations", organisations_path %>
+</div>
diff --git a/app/views/organisations/show.html.erb b/app/views/organisations/show.html.erb
new file mode 100644
index 0000000..3de432b
--- /dev/null
+++ b/app/views/organisations/show.html.erb
@@ -0,0 +1,10 @@
+<p style="color: green"><%= notice %></p>
+
+<%= render @organisation %>
+
+<div>
+ <%= link_to "Edit this organisation", edit_organisation_path(@organisation) %> |
+ <%= link_to "Back to organisations", organisations_path %>
+
+ <%= button_to "Destroy this organisation", @organisation, method: :delete %>
+</div>
diff --git a/app/views/organisations/show.json.jbuilder b/app/views/organisations/show.json.jbuilder
new file mode 100644
index 0000000..c228d36
--- /dev/null
+++ b/app/views/organisations/show.json.jbuilder
@@ -0,0 +1 @@
+json.partial! "organisations/organisation", organisation: @organisation