form fixes

This commit is contained in:
Andrew Brown 2023-05-22 11:49:19 -07:00
parent 433c807d24
commit e66b08240c
3 changed files with 9 additions and 6 deletions

View File

@ -549,7 +549,10 @@ class ContentController < ApplicationController
@content = @entity
update_page_tags
render json: attribute_value.to_json, status: 200
respond_to do |format|
format.html { redirect_back(fallback_location: root_path, notice: "#{@attribute_field.label} updated!") }
format.json { render json: attribute_value.to_json, status: 200 }
end
end
def universe_field_update

View File

@ -29,7 +29,7 @@
<%=
text_area_tag "field[value]",
value,
class: "max-w-3xl shadow-sm block w-full focus:ring-notebook-blue focus:border-notebook-blue sm:text-sm border-0 border-l-4 border-r-4 border-gray-200 rounded-md" \
class: "shadow-sm block w-full focus:ring-notebook-blue focus:border-notebook-blue sm:text-sm border-0 border-l-4 border-r-4 border-gray-200 rounded-md" \
+ " js-can-mention-pages js-autosize-textarea" \
+ "#{' autocomplete js-autocomplete-' + field[:id].to_s if should_autocomplete}" \
+ "#{' autosave-closest-form-on-change' if should_autosave}",

View File

@ -12,7 +12,7 @@
<i class="material-icons float-left <%= content.class_text_color %> mr-2"><%= category[:icon] %></i>
<%= category[:label] %>
</h3>
<% if category[:percent_complete].present? && category[:percent_complete] > 10 %>
<% if category[:percent_complete].present? && category[:percent_complete] >= 25 %>
<div class="flex-1 bg-gray-200 rounded-full h-4 relative top-1.5"
x-show="showEditMode"
>
@ -34,7 +34,7 @@
<%= field[:label] %>
</label>
</div>
<div class="mt-1 sm:mt-0 sm:col-span-3 mb-6"
<div class="mt-1 sm:mt-0 col-span-3 mb-6"
x-show="!showEditMode"
>
<%=
@ -52,10 +52,10 @@
end
%>
</div>
<div class="-mt-1 -ml-2 col-span-2 col-start-2 mb-4"
<div class="-mt-1 -ml-2 col-span-3 col-start-2 mb-4"
x-show="showEditMode"
>
<%= form_for content.raw_model, url: FieldTypeService.form_path(field), remote: true do |f| %>
<%= form_for content.raw_model, url: FieldTypeService.form_path(field), remote: true, authenticity_token: true do |f| %>
<%= hidden_field_tag "entity[entity_id]", content.id %>
<%= hidden_field_tag "entity[entity_type]", content.class_name %>
<%=