diff options
Diffstat (limited to 'app/views')
-rw-r--r-- | app/views/events/_form.html.erb | 5 | ||||
-rw-r--r-- | app/views/organisations/_form.html.erb | 22 | ||||
-rw-r--r-- | app/views/organisations/_organisation.html.erb | 7 | ||||
-rw-r--r-- | app/views/organisations/_organisation.json.jbuilder | 2 | ||||
-rw-r--r-- | app/views/organisations/edit.html.erb | 10 | ||||
-rw-r--r-- | app/views/organisations/index.html.erb | 14 | ||||
-rw-r--r-- | app/views/organisations/index.json.jbuilder | 1 | ||||
-rw-r--r-- | app/views/organisations/new.html.erb | 9 | ||||
-rw-r--r-- | app/views/organisations/show.html.erb | 10 | ||||
-rw-r--r-- | app/views/organisations/show.json.jbuilder | 1 |
10 files changed, 81 insertions, 0 deletions
diff --git a/app/views/events/_form.html.erb b/app/views/events/_form.html.erb index 2a41eec..98dd972 100644 --- a/app/views/events/_form.html.erb +++ b/app/views/events/_form.html.erb @@ -36,6 +36,11 @@ <%= form.label "Event name", style: "display: block" %> <%= form.text_field :name %> </div> + + <div> + <%= form.label "Organisation", style: "display: block" %> + <%= form.select :organisation, Organisation.all.collect { |o| [ o.name, o.id ] }, include_blank: true %> + </div> <div> <%= form.submit style: "background: green; color: white; margin-top: 1.1em;"%> 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 |