app/views/layouts/help_center.html.erb in help_center-0.0.4 vs app/views/layouts/help_center.html.erb in help_center-0.0.5

- old
+ new

@@ -1,35 +1,39 @@ -<% @layout = 'website' %> +<% if current_user && (current_user.admin? || current_user.moderator?) %> + <div class="fixed bottom-0 w-full z-50 bg-purple-600 text-purple-200 text-sm text-center font-brand-semibold px-4 py-3" role="alert"> + You're logged in as <b>help center moderator user</b> (<%= current_user.email %>)</b> + <%= link_to t('add_an_article'), help_center.new_support_thread_path, class: "text-purple-100 hover:no-underline font-semibold underline mr-4 ml-6" %> + <%= link_to t('add_category'), help_center.new_support_category_path, class: "text-purple-100 hover:no-underline font-semibold underline" %> + <%= link_to "Logout", back_masquerade_path(current_user), class: "text-purple-100 hover:no-underline font-semibold underline ml-6" %> + </div> +<% end %> + <div class="container mx-auto mt-2"> <div class="flex flex-wrap help_center"> <div class="md:w-1/4 pr-4 pl-4 mb-3"> <div class="relative flex flex-col min-w-0 rounded break-words border bg-white border-1 border-grey-light flex-auto p-6"> - <% if current_user && (current_user.admin? || current_user.moderator?) %> - <%= link_to t('add_an_article'), help_center.new_support_thread_path, class: "btn btn-outline-primary btn-block" %> - <hr /> - <% end %> <div class="support-thread-filters"> <% SupportCategory.sorted.each do |category| %> <div class="pb-3"> - <%= support_link_to help_center.support_category_support_threads_path(category) do %> + <%= support_link_to help_center.support_category_path(category) do %> <div class="mb-2 mt-3"> <span class="font-extrabold"> <%= category.name %> </span> </div> <% end %> - <div> + <div class="ml-2 pl-1"> <% threads = SupportThread.where(support_category_id: category.id).order(:position) %> <% threads.each do |thread| %> <div class="mb-2"> <%= support_link_to help_center.support_thread_path(thread) do %> <%= thread.title %> <% end %> </div> <% end %> - </div> + </div> </div> <% end %> </div> <% if HelpCenter.enable_comments %> <hr /> @@ -73,11 +77,11 @@ </div> <% if @support_thread.present? && @support_thread.persisted? %> <hr /> <%# User has not posted in the thread or subscribed %> <h5><%= t('.notifications') %></h5> - <%= link_to help_center.support_thread_notifications_path(@support_thread), method: :post, class: "btn btn-secondary btn-sm btn-block mb-2" do %> + <%= link_to help_center.support_thread_notifications_path(@support_thread), method: :post, class: "btn-secondary btn-sm btn-block mb-2" do %> <% if @support_thread.subscribed? current_user %> <%= icon "fa-fw fas", "bell-slash" %> <%= t('.unsubscribe') %> <% else %> <%= icon "fa-fw fas", "bell" %> <%= t('.suscribe') %> @@ -88,17 +92,37 @@ <% end %> </div> </div> <div class="md:w-3/4 pr-4 pl-4 mb-3"> <div class="relative flex flex-col min-w-0 rounded break-words bg-white flex-auto p-6"> - <% if request.env['REQUEST_URI'] == "/support" %> - <% if SupportThread.exists?(id: 1) %> - <% @support_thread = SupportThread.find(1) %> - <%= render "help_center/support_threads/article"%> + <%# Show first article by default on home pag %> + <% if current_page?(help_center_path) %> + <% if SupportThread.all.count > 0 %> + <% @support_thread = SupportThread.all.first %> + <div class="container mx-auto"> + <div class="flex flex-wrap mb-8"> + <% if is_moderator_or_owner?(@support_thread) %> + <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> <% end %> <% end %> + <%= yield %> </div> </div> </div> </div> + <% parent_layout("application") %>