Refactor diary entry forms to use a custom form builder

This commit is contained in:
Andy Allan 2020-12-24 13:31:04 +00:00
parent 170ea3399b
commit 547459314b
9 changed files with 92 additions and 49 deletions

View file

View file

@ -0,0 +1,19 @@
<h5><%= t ".title_html" %></h5>
<dl>
<dt><%= t ".headings" %></dt>
<dd># <%= t ".heading" %><br>
## <%= t ".subheading" %></dd>
<dt><%= t ".unordered" %></dt>
<dd>* <%= t ".first" %><br>
* <%= t ".second" %></dd>
<dt><%= t ".ordered" %></dt>
<dd>1. <%= t ".first" %><br>
2. <%= t ".second" %></dd>
<dt><%= t ".link" %></dt>
<dd>[<%= t ".text" %>](<%= t ".url" %>)</dd>
<dt><%= t ".image" %></dt>
<dd>![<%= t ".alt" %>](<%= t ".url" %>)</dd>
</dl>

View file

@ -0,0 +1,18 @@
<div class="form-group">
<label><%= object.class.human_attribute_name(attribute) %></label>
<div id="<%= id %>_container" class="form-row richtext_container">
<div id="<%= id %>_content" class="col-sm-8 mb-3 richtext_content">
<%= builder.text_area(attribute, options.merge(:wrapper => false, "data-preview-url" => preview_url(:type => type))) %>
<div id="<%= id %>_preview" class="richtext_preview richtext"></div>
</div>
<div id="<%= id %>_help" class="col-sm-4 richtext_help">
<div class="card bg-light">
<div class="card-body">
<%= render :partial => "shared/#{type}_help" %>
<%= submit_tag t(".edit"), :id => "#{id}_doedit", :class => "richtext_doedit btn btn-primary", :disabled => true %>
<%= submit_tag t(".preview"), :id => "#{id}_dopreview", :class => "richtext_dopreview btn btn-primary" %>
</div>
</div>
</div>
</div>
</div>