scinote-web/app/views/result_texts/_edit.html.erb
2023-07-03 12:59:13 +02:00

28 lines
1.5 KiB
Text

<div class="well edit-text-result">
<%= form_with(model: @result, url: result_text_path(format: :json),
builder: SciFormHelper::SciFormBuilder,
data: { 'name-max-length': Constants::NAME_MAX_LENGTH, 'rich-text-max-length': Constants::RICH_TEXT_MAX_LENGTH },
remote: :true) do |f| %>
<div class="sci-input-container mb-4">
<%= f.text_field :name, style: "margin-top: 10px;", class: "sci-input-field" %><br />
</div>
<%= f.fields_for :result_text do |ff| %>
<%= ff.tiny_mce_editor(:text,
id: :result_text_attributes_textarea,
value: @result.result_text.tinymce_render(:text),
autocomplete: 'off',
data: { object_type: 'result_text',
object_id: @result.result_text.id,
my_module_id: @result.my_module_id,
last_updated: @result.updated_at.to_i * 1000 }) %>
<% end %><br />
<div class="align-right edit-result-texts-buttons'">
<button type="button" class="btn btn-secondary cancel-edit">
<%= t("general.cancel")%>
</button>
<%= f.button t("general.save"),
class: 'btn btn-primary save-result' %>
<%= javascript_include_tag 'results/result_texts/edit' %>
</div>
<% end %>
</div>