diff options
Diffstat (limited to 'app/views/operations')
-rw-r--r-- | app/views/operations/_form.html.erb | 22 | ||||
-rw-r--r-- | app/views/operations/_operation.html.erb | 7 | ||||
-rw-r--r-- | app/views/operations/_operation.json.jbuilder | 2 | ||||
-rw-r--r-- | app/views/operations/edit.html.erb | 10 | ||||
-rw-r--r-- | app/views/operations/index.html.erb | 14 | ||||
-rw-r--r-- | app/views/operations/index.json.jbuilder | 1 | ||||
-rw-r--r-- | app/views/operations/new.html.erb | 9 | ||||
-rw-r--r-- | app/views/operations/show.html.erb | 10 | ||||
-rw-r--r-- | app/views/operations/show.json.jbuilder | 1 |
9 files changed, 76 insertions, 0 deletions
diff --git a/app/views/operations/_form.html.erb b/app/views/operations/_form.html.erb new file mode 100644 index 0000000..adadad8 --- /dev/null +++ b/app/views/operations/_form.html.erb @@ -0,0 +1,22 @@ +<%= form_with(model: operation) do |form| %> + <% if operation.errors.any? %> + <div style="color: red"> + <h2><%= pluralize(operation.errors.count, "error") %> prohibited this operation from being saved:</h2> + + <ul> + <% operation.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/operations/_operation.html.erb b/app/views/operations/_operation.html.erb new file mode 100644 index 0000000..6349848 --- /dev/null +++ b/app/views/operations/_operation.html.erb @@ -0,0 +1,7 @@ +<div id="<%= dom_id operation %>"> + <p> + <strong>Name:</strong> + <%= operation.name %> + </p> + +</div> diff --git a/app/views/operations/_operation.json.jbuilder b/app/views/operations/_operation.json.jbuilder new file mode 100644 index 0000000..8016989 --- /dev/null +++ b/app/views/operations/_operation.json.jbuilder @@ -0,0 +1,2 @@ +json.extract! operation, :id, :name, :created_at, :updated_at +json.url operation_url(operation, format: :json) diff --git a/app/views/operations/edit.html.erb b/app/views/operations/edit.html.erb new file mode 100644 index 0000000..650350a --- /dev/null +++ b/app/views/operations/edit.html.erb @@ -0,0 +1,10 @@ +<h1>Editing operation</h1> + +<%= render "form", operation: @operation %> + +<br> + +<div> + <%= link_to "Show this operation", @operation %> | + <%= link_to "Back to operations", operations_path %> +</div> diff --git a/app/views/operations/index.html.erb b/app/views/operations/index.html.erb new file mode 100644 index 0000000..8bf9009 --- /dev/null +++ b/app/views/operations/index.html.erb @@ -0,0 +1,14 @@ +<p style="color: green"><%= notice %></p> + +<h1>Operations</h1> + +<div id="operations"> + <% @operations.each do |operation| %> + <%= render operation %> + <p> + <%= link_to "Show this operation", operation %> + </p> + <% end %> +</div> + +<%= link_to "New operation", new_operation_path %> diff --git a/app/views/operations/index.json.jbuilder b/app/views/operations/index.json.jbuilder new file mode 100644 index 0000000..bef1085 --- /dev/null +++ b/app/views/operations/index.json.jbuilder @@ -0,0 +1 @@ +json.array! @operations, partial: "operations/operation", as: :operation diff --git a/app/views/operations/new.html.erb b/app/views/operations/new.html.erb new file mode 100644 index 0000000..be6230d --- /dev/null +++ b/app/views/operations/new.html.erb @@ -0,0 +1,9 @@ +<h1>New operation</h1> + +<%= render "form", operation: @operation %> + +<br> + +<div> + <%= link_to "Back to operations", operations_path %> +</div> diff --git a/app/views/operations/show.html.erb b/app/views/operations/show.html.erb new file mode 100644 index 0000000..d19705b --- /dev/null +++ b/app/views/operations/show.html.erb @@ -0,0 +1,10 @@ +<p style="color: green"><%= notice %></p> + +<%= render @operation %> + +<div> + <%= link_to "Edit this operation", edit_operation_path(@operation) %> | + <%= link_to "Back to operations", operations_path %> + + <%= button_to "Destroy this operation", @operation, method: :delete %> +</div> diff --git a/app/views/operations/show.json.jbuilder b/app/views/operations/show.json.jbuilder new file mode 100644 index 0000000..ada5250 --- /dev/null +++ b/app/views/operations/show.json.jbuilder @@ -0,0 +1 @@ +json.partial! "operations/operation", operation: @operation |