Finish routes for projects
This commit is contained in:
@@ -24,6 +24,9 @@
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<% if flash[:notice] %>
|
||||
<p class="flash"><%= flash[:notice] %></p>
|
||||
<% end %>
|
||||
<%= yield %>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
21
app/views/projects/_form.html.erb
Normal file
21
app/views/projects/_form.html.erb
Normal file
@@ -0,0 +1,21 @@
|
||||
<%= form_with model: project do |f| %>
|
||||
<% if project.errors.any? %>
|
||||
<div class="errors">
|
||||
<h2><%= pluralize(project.errors.count, "error") %> prohibited this project from being saved:</h2>
|
||||
<ul>
|
||||
<% project.errors.full_messages.each do |message| %>
|
||||
<li><%= message %></li>
|
||||
<% end %>
|
||||
</ul>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<div class="field">
|
||||
<%= f.label :name %>
|
||||
<%= f.text_field :name %>
|
||||
</div>
|
||||
|
||||
<div class="actions">
|
||||
<%= f.submit %>
|
||||
</div>
|
||||
<% end %>
|
||||
3
app/views/projects/edit.html.erb
Normal file
3
app/views/projects/edit.html.erb
Normal file
@@ -0,0 +1,3 @@
|
||||
<h1>Edit Project</h1>
|
||||
|
||||
<%= render "form", project: @project %>
|
||||
@@ -3,3 +3,4 @@
|
||||
<% @projects.each do |project| %>
|
||||
<li><%= link_to project.name, project_path(project) %></li>
|
||||
<% end %>
|
||||
<p><%= link_to "New project", new_project_path %></p>
|
||||
3
app/views/projects/new.html.erb
Normal file
3
app/views/projects/new.html.erb
Normal file
@@ -0,0 +1,3 @@
|
||||
<h1>New project</h1>
|
||||
|
||||
<%= render "form", project: @project %>
|
||||
@@ -1,2 +1,4 @@
|
||||
<h1><%= @project.name %></h1>
|
||||
<%= link_to "Edit", edit_project_path %>
|
||||
<%= button_to "Delete", project_path, method: :delete %>
|
||||
<%= link_to "Back", projects_path %>
|
||||
Reference in New Issue
Block a user