-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from uurcank/update_views
Update views
- Loading branch information
Showing
12 changed files
with
120 additions
and
164 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,47 @@ | ||
<%= form_for [@support_thread, @support_post], | ||
url: (@support_post.persisted? ? help_center.support_thread_support_post_path(@support_thread, @support_post) : help_center.support_thread_support_posts_path(@support_thread)), | ||
html: { data: { behavior: "comment-form" } } do |f| %> | ||
<% if @support_post.errors.any? %> | ||
<%= form_for @support_thread, | ||
url: (@support_thread.persisted? ? help_center.support_thread_path(@support_thread) : help_center.support_threads_path), | ||
html: { data: {behavior: "comment-form"} } do |f| %> | ||
<% if @support_thread.errors.any? %> | ||
<div id="error_explanation"> | ||
<h2><%= pluralize(@support_post.errors.count, "error") %> prohibited this support_post from being saved:</h2> | ||
|
||
<h2><%= pluralize(@support_thread.errors.count, "error") %> prohibited this support_thread from being saved:</h2> | ||
<ul> | ||
<% @support_post.errors.full_messages.each do |message| %> | ||
<li><%= message %></li> | ||
<% end %> | ||
<% @support_thread.errors.full_messages.each do |message| %> | ||
<li><%= message %></li> | ||
<% end %> | ||
</ul> | ||
</div> | ||
<% end %> | ||
|
||
<div class="form-group"> | ||
<%= f.text_area :body, placeholder: t('add_a_comment'), rows: 8, class: "form-control simplemde", data: { behavior: "comment-body" } %> | ||
<div class="mb-4"> | ||
<%= f.label :support_category_id, t('choose_a_category') %> | ||
<%= f.collection_select :support_category_id, SupportCategory.sorted, :id, :name, {include_blank: t('pick_a_category')}, {autofocus: true, class: "form-control"} %> | ||
</div> | ||
|
||
<div class="text-right"> | ||
<div class="pull-left"> | ||
<small> | ||
<%# Describe text formatting options here with a link %> | ||
<%#= link_to "Parsed with Markdown", "https://guides.github.com/features/mastering-markdown/", target: "_blank" %> | ||
</small> | ||
</div> | ||
|
||
<%= f.button "#{f.object.new_record? ? t('comment') : t('update_comment') }", class: "btn btn-primary", data: {disable_with: "<i class='fa fa-spinner fa-spin'></i> #{t('saving_comment')}"} %> | ||
<div class="mb-4"> | ||
<%= f.label t('title') %> | ||
<%= f.text_field :title, placeholder: t('how_do_i'), class: "form-control" %> | ||
</div> | ||
<div class="mb-4"> | ||
<%= f.label t('position') %> | ||
<%= f.text_field :position, class: "form-control" %> | ||
</div> | ||
<div class="mb-4"> | ||
<%= f.label t('content') %> | ||
<%= f.rich_text_area :content %> | ||
</div> | ||
<% if local_assigns.fetch(:posts, true) %> | ||
<% if !f.object.new_record? %> | ||
<%= f.fields_for :support_posts do |p| %> | ||
<div class="mb-4"> | ||
<%= 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" } %> | ||
</div> | ||
<% end %> | ||
<% end %> | ||
<% end %> | ||
<div class="mb-4 text-right"> | ||
<% if f.object.new_record? %> | ||
<%= f.button t('add'), class: "btn btn-primary", data: {disable_with: "<i class='fa fa-spinner fa-spin'></i> #{t('saving')}"} %> | ||
<% else %> | ||
<%= f.button t('update'), class: "btn btn-primary", data: {disable_with: "<i class='fa fa-spinner fa-spin'></i> #{t('saving')}"} %> | ||
<% end %> | ||
</div> | ||
|
||
<% end %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<div class="container mx-auto"> | ||
<div class="flex flex-wrap mb-8"> | ||
<% if current_user && current_user.admin? %> | ||
<div class="flex w-full pr-4 pl-4 justify-end"> | ||
<%= link_to icon("fas","pencil"), help_center.edit_support_thread_path(@support_thread), | ||
class: "text-muted", | ||
data: { toggle: "tooltip", placement: "left" }, | ||
title: t('edit_this_thread') %> | ||
</div> | ||
<% end %> | ||
<div class="md:w-full pr-4 pl-41"> | ||
<small class="mb-2"><%= support_category_link(@support_thread.support_category) %> > <%= @support_thread.title %></small> | ||
<h1><%= icon "fas", "thumb-tack", class: "text-muted" if @support_thread.pinned? %> <%= @support_thread.title %></h1> | ||
</div> | ||
|
||
</div> | ||
<%= @support_thread.content %> | ||
<!-- | ||
<div class="thread-reaction"> | ||
<p>Did this answer your question?</p> | ||
<p class="thread-reaction-links"> | ||
<a>😞<a> | ||
<a>😃<a> | ||
</p> | ||
<div> | ||
--> | ||
<% if HelpCenter.enable_comments %> | ||
<hr> | ||
<%= render partial: "help_center/support_posts/support_post", collection: @support_thread.support_posts.includes(:user).sorted %> | ||
<%= render partial: "help_center/support_posts/form" if user_signed_in? %> | ||
<% end %> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,56 +1,47 @@ | ||
<%= form_for @support_thread, | ||
url: (@support_thread.persisted? ? help_center.support_thread_path(@support_thread) : help_center.support_threads_path), | ||
html: { data: {behavior: "comment-form"} } do |f| %> | ||
<% if @support_thread.errors.any? %> | ||
<div id="error_explanation"> | ||
<h2><%= pluralize(@support_thread.errors.count, "error") %> prohibited this support_thread from being saved:</h2> | ||
|
||
<ul> | ||
<% @support_thread.errors.full_messages.each do |message| %> | ||
<li><%= message %></li> | ||
<% end %> | ||
</ul> | ||
</div> | ||
<% end %> | ||
|
||
<div class="form-group"> | ||
<div class="mb-4"> | ||
<%= f.label :support_category_id, t('choose_a_category') %> | ||
<%= f.collection_select :support_category_id, SupportCategory.sorted, :id, :name, {include_blank: t('pick_a_category')}, {autofocus: true, class: "form-control"} %> | ||
</div> | ||
|
||
<div class="form-group"> | ||
<div class="mb-4"> | ||
<%= f.label t('title') %> | ||
<%= f.text_field :title, placeholder: t('how_do_i'), class: "form-control" %> | ||
</div> | ||
|
||
<div class="form-group"> | ||
<div class="mb-4"> | ||
<%= f.label t('position') %> | ||
<%= f.text_field :position, class: "form-control" %> | ||
</div> | ||
|
||
<div class="form-group"> | ||
<div class="mb-4"> | ||
<%= f.label t('content') %> | ||
<%= f.rich_text_area :content %> | ||
</div> | ||
|
||
<% if local_assigns.fetch(:posts, true) %> | ||
<% if !f.object.new_record? %> | ||
<%= f.fields_for :support_posts do |p| %> | ||
<div class="form-group"> | ||
<div class="mb-4"> | ||
<%= 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" } %> | ||
</div> | ||
<% end %> | ||
<% end %> | ||
<% end %> | ||
|
||
<div class="form-group text-right"> | ||
<div class="mb-4 text-right"> | ||
<% if f.object.new_record? %> | ||
<%= f.button t('add'), class: "btn btn-primary", data: {disable_with: "<i class='fa fa-spinner fa-spin'></i> #{t('saving')}"} %> | ||
<% else %> | ||
<%= f.button t('update'), class: "btn btn-primary", data: {disable_with: "<i class='fa fa-spinner fa-spin'></i> #{t('saving')}"} %> | ||
<% end %> | ||
</div> | ||
|
||
<% end %> |
15 changes: 5 additions & 10 deletions
15
app/views/help_center/support_threads/_support_thread.html.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,25 @@ | ||
<%= cache support_thread do %> | ||
<div class="support-thread"> | ||
<div class="row"> | ||
|
||
<div class="col"> | ||
<div class="flex flex-wrap"> | ||
<div class="flex-grow mb-2"> | ||
<%= link_to help_center.support_thread_path(support_thread) do %> | ||
<h4> | ||
<%= support_thread.title %> | ||
</h4> | ||
|
||
<p class="text-muted"><%= truncate(support_thread.content.to_plain_text, length: 200) %></p> | ||
|
||
<div class="thread-details"> | ||
<p class="text-gray-500 hover:text-gray-700"><%= truncate(support_thread.content.to_plain_text, length: 200) %></p> | ||
<div class="thread-details mt-2"> | ||
<%= t('content_updated_at', update_time: time_ago_in_words(support_thread.created_at)) %> | ||
</div> | ||
<% end %> | ||
</div> | ||
|
||
<% if HelpCenter.enable_comments %> | ||
<div class="col-sm-1 text-center"> | ||
<div class="sm:w-1/6 pr-4 pl-4 text-center"> | ||
<%= link_to help_center.support_thread_path(support_thread), class: "thread-posts-count" do %> | ||
<span class="count"><%= support_thread.support_posts_count %></span> | ||
<small><%= t("post", count: support_thread.support_posts_count) %></small> | ||
<% end %> | ||
</div> | ||
<% end %> | ||
|
||
</div> | ||
</div> | ||
<% end %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,19 @@ | ||
<% if @support_threads.none? %> | ||
|
||
<div><%= t('search_not_found') %>. <%= t('check_out') %> <%= link_to t('latest_questions'), help_center.support_threads_path %> <%= t('instead') %> </div> | ||
|
||
<% else %> | ||
<div class="container"> | ||
<div class="container mx-auto"> | ||
<% if request.url.include?('category') %> | ||
<%# If category, list all articles %> | ||
<div class="col-12 text-left p-0"> | ||
<div class="w-1/62 text-left p-0"> | ||
<h3> <%= @support_threads.first.support_category.name %></h3> | ||
</div> | ||
<hr> | ||
<%= render partial: "help_center/support_threads/support_thread", collection: @support_threads, spacer_template: "shared/spacer" %> | ||
|
||
<div class="support-threads-nav text-center"> | ||
<%= will_paginate @support_threads, url_builder: help_center, renderer: HelpCenter::BootstrapLinkRenderer %> | ||
</div> | ||
|
||
<% else %> | ||
<%# Set default index here %> | ||
<% end %> | ||
</div> | ||
<% end %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1 @@ | ||
<div class="container"> | ||
<div class="row"> | ||
<div class="col-md-11"> | ||
<small class="mb-2"><%= support_category_link(@support_thread.support_category) %> > <%= @support_thread.title %></small> | ||
<h1><%= icon "fas", "thumb-tack", class: "text-muted" if @support_thread.pinned? %> <%= @support_thread.title %></h1> | ||
</div> | ||
|
||
<% if is_moderator_or_owner?(@support_thread) %> | ||
<div class="col-md-1"> | ||
<%= link_to icon("fas","pencil"), help_center.edit_support_thread_path(@support_thread), | ||
class: "text-muted", | ||
data: { toggle: "tooltip", placement: "left" }, | ||
title: t('edit_this_thread') %> | ||
</div> | ||
<% end %> | ||
|
||
</div> | ||
|
||
<p class="thread-details d-flex"> | ||
<%= t('written_by_author', author: @support_thread.user.name) %> | ||
<small><%= t('content_updated_at', update_time: time_ago_in_words(@support_thread.updated_at)) %></small> | ||
</p> | ||
|
||
<%= @support_thread.content %> | ||
|
||
<div class="thread-reaction"> | ||
<p>Did this answer your question?</p> | ||
<p class="thread-reaction-links"> | ||
<a>😞<a> | ||
<a>😃<a> | ||
</p> | ||
<div> | ||
|
||
<% if HelpCenter.enable_comments %> | ||
<hr> | ||
<%= render partial: "help_center/support_posts/support_post", collection: @support_thread.support_posts.includes(:user).sorted %> | ||
<%= render partial: "help_center/support_posts/form" if user_signed_in? %> | ||
<% end %> | ||
</div> | ||
<%= render "article" %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,9 @@ | ||
<div style="position: relative"> | ||
<%= gravatar_image_tag @support_post.user.email, style: "float: left" %> | ||
|
||
<div style="margin-left:60px"> | ||
<p><strong><%= @support_post.user.name %></strong> <small>commented:</small></p> | ||
<%= formatted_content @support_post.body %> | ||
</div> | ||
</div> | ||
|
||
<br /> | ||
|
||
<p><%= link_to "Reply to this comment", support_thread_url(@support_post.support_thread, anchor: "support_post_#{@support_post.id}"), style: "background:#be2126; color:#fff; text-decoration:none; padding: 10px 20px" %></p> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,9 @@ | ||
<div style="position: relative"> | ||
<%= gravatar_image_tag @support_post.user.email, style: "float: left" %> | ||
|
||
<div style="margin-left:60px"> | ||
<p><strong><%= @support_post.user.name %></strong> <small>commented:</small></p> | ||
<%= formatted_content @support_post.body %> | ||
</div> | ||
</div> | ||
|
||
<br /> | ||
|
||
<p><%= link_to "Reply to this comment", support_thread_url(@support_post.support_thread, anchor: "support_post_#{@support_post.id}"), style: "background:#be2126; color:#fff; text-decoration:none; padding: 10px 20px" %></p> |
Oops, something went wrong.