./bin/rails importmap:install
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
<div id="<%= dom_id article %>" class="scaffold_record">
|
||||
<p>
|
||||
<strong>Title:</strong>
|
||||
<%= article.title %>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<strong>Text:</strong>
|
||||
<%= article.text %>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<%= link_to "Show this article", article %>
|
||||
</p>
|
||||
</div>
|
||||
@@ -0,0 +1,2 @@
|
||||
json.extract! article, :id, :title, :text, :created_at, :updated_at
|
||||
json.url article_url(article, format: :json)
|
||||
@@ -0,0 +1,27 @@
|
||||
<%= form_with(model: article) do |form| %>
|
||||
<% if article.errors.any? %>
|
||||
<div id="error_explanation">
|
||||
<h2><%= pluralize(article.errors.count, "error") %> prohibited this article from being saved:</h2>
|
||||
|
||||
<ul>
|
||||
<% article.errors.each do |error| %>
|
||||
<li><%= error.full_message %></li>
|
||||
<% end %>
|
||||
</ul>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<div class="field">
|
||||
<%= form.label :title %>
|
||||
<%= form.text_field :title %>
|
||||
</div>
|
||||
|
||||
<div class="field">
|
||||
<%= form.label :text %>
|
||||
<%= form.text_area :text %>
|
||||
</div>
|
||||
|
||||
<div class="actions">
|
||||
<%= form.submit %>
|
||||
</div>
|
||||
<% end %>
|
||||
@@ -0,0 +1,10 @@
|
||||
<h1>Editing article</h1>
|
||||
|
||||
<%= render "form", article: @article %>
|
||||
|
||||
<br>
|
||||
|
||||
<div>
|
||||
<%= link_to "Show this article", @article %> |
|
||||
<%= link_to "Back to articles", articles_path %>
|
||||
</div>
|
||||
@@ -0,0 +1,9 @@
|
||||
<p id="notice"><%= notice %></p>
|
||||
|
||||
<h1>Article</h1>
|
||||
|
||||
<div id="articles">
|
||||
<%= render @articles %>
|
||||
</div>
|
||||
|
||||
<%= link_to "New article", new_article_path %>
|
||||
@@ -0,0 +1 @@
|
||||
json.array! @articles, partial: "articles/article", as: :article
|
||||
@@ -0,0 +1,9 @@
|
||||
<h1>New article</h1>
|
||||
|
||||
<%= render "form", article: @article %>
|
||||
|
||||
<br>
|
||||
|
||||
<div>
|
||||
<%= link_to "Back to articles", articles_path %>
|
||||
</div>
|
||||
@@ -0,0 +1,10 @@
|
||||
<p id="notice"><%= notice %></p>
|
||||
|
||||
<%= render @article %>
|
||||
|
||||
<div>
|
||||
<%= link_to "Edit this article", edit_article_path(@article) %> |
|
||||
<%= link_to "Back to articles", articles_path %>
|
||||
|
||||
<%= button_to "Destroy this article", article_path(@article), method: :delete %>
|
||||
</div>
|
||||
@@ -0,0 +1 @@
|
||||
json.partial! "articles/article", article: @article
|
||||
Reference in New Issue
Block a user