mirror of
https://github.com/Growstuff/growstuff.git
synced 2026-11-02 11:14:23 -05:00
- Updated post actions menu to link directly to the edit post path. - Enhanced post form to include a React-based body editor using Tiptap, with a fallback to a plain textarea. - Added Tiptap dependencies to package.json and updated yarn.lock. - Created a feature spec to verify navigation to the edit page from the post actions menu.
41 lines
1.4 KiB
Plaintext
41 lines
1.4 KiB
Plaintext
-# The body editor is a React island.
|
|
- content_for :scripts do
|
|
= javascript_include_tag 'react_islands', defer: true
|
|
|
|
.card.col-md-8.col-lg-7.mx-auto.float-none.white.z-depth-1.py-2.px-2
|
|
= bootstrap_form_for(@post) do |f|
|
|
.card-header
|
|
- if content_for? :title
|
|
%h1.h2-responsive.text-center
|
|
%strong=yield :title
|
|
- if @post.errors.any?
|
|
#error_explanation
|
|
%h2
|
|
= pluralize(@post.errors.size, "error")
|
|
prohibited this post from being saved:
|
|
%ul
|
|
- @post.errors.full_messages.each do |msg|
|
|
%li= msg
|
|
|
|
.card-body
|
|
= f.text_field :subject, autofocus: 'autofocus', maxlength: 255
|
|
|
|
- if @post.forum || @forum
|
|
= label_tag :body, "What's up?"
|
|
- else
|
|
= label_tag :body, "What's going on in your food garden?"
|
|
-# Falls back to the plain textarea if the editor script does not load.
|
|
= react_component('PostEditor', { name: 'post[body]', value: @post.body.to_s }) do
|
|
= f.text_area :body, rows: 12, label: false
|
|
%span.form-text= render partial: "shared/markdown_help"
|
|
|
|
- if @post.forum || @forum
|
|
- forum = @post.forum || @forum
|
|
%p
|
|
This post will be posted in the forum
|
|
= link_to forum.name, forum
|
|
.field
|
|
= f.hidden_field :forum_id, value: forum.id
|
|
.card-footer
|
|
.text-end= f.submit "Post"
|