-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path_form.html.erb
30 lines (26 loc) · 861 Bytes
/
_form.html.erb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
<%= form_with(model: article) do |form| %>
<% if article.errors.any? %>
<div style="color: red">
<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>
<%= form.label :title, style: "display: block" %>
<%= form.text_area :title %>
</div>
<div>
<%= form.label :body, style: "display: block" %>
<div data-controller="lexical">
<%= tag.div data:{ lexical_target: "editor" }, style: "width: 500px; height: 500px;", contenteditable: true %>
<%= form.hidden_field :body, data: { lexical_target:"input" }, value: article.body&.body&.to_html %>
</div>
</div>
<div>
<%= form.submit %>
</div>
<% end %>