Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use action text by default #39

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions app/helpers/simple_discussion/forum_posts_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,6 @@ def category_link(category)
style: "color: #{category.color}"
end

# Override this method to provide your own content formatting like Markdown
def formatted_content(text)
simple_format(text)
end

def forum_post_classes(forum_post)
klasses = ["forum-post", "card", "mb-3"]
klasses << "solved" if forum_post.solved?
Expand Down
2 changes: 2 additions & 0 deletions app/models/forum_post.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
class ForumPost < ApplicationRecord
belongs_to :forum_thread, counter_cache: true, touch: true
belongs_to :user

has_rich_text :body

validates :user_id, :body, presence: true

Expand Down
2 changes: 1 addition & 1 deletion app/views/simple_discussion/forum_posts/_form.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<% end %>

<div class="form-group">
<%= f.text_area :body, placeholder: t('add_a_comment'), rows: 8, class: "form-control simplemde", data: { behavior: "comment-body" } %>
<%= f.rich_text_area :body, placeholder: t('add_a_comment'), rows: 8, class: "form-control simplemde", data: { behavior: "comment-body" } %>
</div>

<div class="text-right">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
</div>

<div class="card-body">
<%= formatted_content forum_post.body %>
<%= forum_post.body %>
</div>

<% if @forum_thread.solved? && forum_post.solved? %>
Expand Down
2 changes: 1 addition & 1 deletion app/views/simple_discussion/forum_threads/_form.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
<%= f.fields_for :forum_posts do |p| %>
<div class="form-group">
<%= p.label :body, t('what_help_needed') %>
<%= p.text_area :body, placeholder: t('add_a_comment'), rows: 10, class: "form-control simplemde", data: { behavior: "comment-body" } %>
<%= p.rich_text_area :body, placeholder: t('add_a_comment'), rows: 10, class: "form-control simplemde", data: { behavior: "comment-body" } %>
</div>
<% end %>
<% end %>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
• <%= t('asked_time_ago', time: time_ago_in_words(forum_thread.created_at), author: forum_thread.user.name) %>
</div>

<p class="text-muted"><%= truncate(forum_thread.forum_posts.first.body, length: 200) %></p>
<p class="text-muted"><%= truncate(forum_thread.forum_posts.first.body.to_plain_text, length: 200) %></p>
</div>

<div class="col-sm-2 text-center">
Expand Down
2 changes: 1 addition & 1 deletion app/views/simple_discussion/user_mailer/new_post.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

<div style="margin-left:60px">
<p><strong><%= @forum_post.user.name %></strong> <small>commented:</small></p>
<%= formatted_content @forum_post.body %>
<%= @forum_post.body %>
</div>
</div>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

<div style="margin-left:60px">
<p><strong><%= @forum_post.user.name %></strong> <small>commented:</small></p>
<%= formatted_content @forum_post.body %>
<%= @forum_post.body %>
</div>
</div>

Expand Down