Refactor diary entry forms to use a custom form builder
This commit is contained in:
parent
170ea3399b
commit
547459314b
9 changed files with 92 additions and 49 deletions
0
app/views/shared/_html_help.erb
Normal file
0
app/views/shared/_html_help.erb
Normal file
19
app/views/shared/_markdown_help.html.erb
Normal file
19
app/views/shared/_markdown_help.html.erb
Normal 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></dd>
|
||||
</dl>
|
18
app/views/shared/_richtext_field.html.erb
Normal file
18
app/views/shared/_richtext_field.html.erb
Normal 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>
|
Loading…
Add table
Add a link
Reference in a new issue