* Basics might be working? * Stop propagating button clicks in autocomplete pills * Better blank slate * Better location to stop propagation * Remove author_id from org co-authors * Move UserStore and try testing it * Remove extraneous comments * OH... that's what that does! * Very basic testing * Re-organize javascripts * Rename & re-org for testing * Cleanup * More tests * Remove unnecessary nesting * Coninuing to try to bump coverage * Include /packs/ in code coverage metric * Try tweaking jest coverage more? We probably can't collect coverage from all of packs/* (because coverage is too low) but maybe we can try to opt-in for newer areas as we go? * Relocate JS tests, for build & coverage * User ID exception on search, not fetch * Remove commented-out console.log --------- Co-authored-by: Mac Siri <krairit.siri@gmail.com>
72 lines
3.4 KiB
Text
72 lines
3.4 KiB
Text
<% title t("views.dashboard.heading") %>
|
|
<main id="main-content" class="crayons-layout crayons-layout--header-inside crayons-layout--2-cols">
|
|
<header class="crayons-page-header block">
|
|
<h1 class="crayons-title"><%= t("views.dashboard.heading") %></h1>
|
|
<%= render "actions_mobile" %>
|
|
<%= render "analytics" %>
|
|
</header>
|
|
|
|
<div class="crayons-layout__sidebar-left">
|
|
<%= render "actions" %>
|
|
</div>
|
|
|
|
<div class="crayons-layout__content">
|
|
<div class="flex items-center justify-between mt-3">
|
|
<h2 class="hidden m:block crayons-subtitle-2"><%= t("views.dashboard.posts.heading") %></h2>
|
|
|
|
<div class="flex flex-wrap px-3 gap-2">
|
|
<% if params[:which] != "organization" %>
|
|
<% if @articles.any?(&:archived) %>
|
|
<%= link_to t("views.dashboard.posts.archived"), "javascript:;", id: "toggleArchivedLink", class: "crayons-btn crayons-btn--outlined whitespace-nowrap" %>
|
|
<% end %>
|
|
<% if @articles.any? %>
|
|
<%= select_tag "dashboard_sort", options_for_select(sort_options, params[:sort]), "aria-label": t("views.dashboard.posts.option.aria_label"), class: "crayons-select w-auto" %>
|
|
<% end %>
|
|
<% end %>
|
|
|
|
<% if @organizations && @organizations.size > 0 && (params[:which].blank? || params[:which] == "organization") %>
|
|
<select id="dashboard_author" class="crayons-select w-auto">
|
|
<option value="/dashboard" <%= "selected" if params[:which].blank? %>><%= t("views.dashboard.posts.personal") %></option>
|
|
<% @organizations.each do |org| %>
|
|
<option value="/dashboard/organization/<%= org.id %>" <%= "selected" if params[:org_id].to_i == org.id %>><%= t("views.dashboard.posts.org", name: org.name, num: org.articles_count) %></option>
|
|
<% end %>
|
|
</select>
|
|
<% end %>
|
|
</div>
|
|
</div>
|
|
|
|
<% if @articles.any? %>
|
|
<%= javascript_packs_with_chunks_tag "dashboardDropdowns", defer: true %>
|
|
<div class="crayons-card mb-6 mt-3">
|
|
<% @articles.each do |article| %>
|
|
<% if params[:which] == "organization" %>
|
|
<%= render "dashboard_article_row", article: article, organization: article.organization, org_admin: true, manage_view: false %>
|
|
<% else %>
|
|
<%= render "dashboard_article_row", article: article, organization: nil, org_admin: false, manage_view: false %>
|
|
<% end %>
|
|
<% end %>
|
|
</div>
|
|
|
|
<div class="mb-4 pl-3">
|
|
<%= paginate @articles, params: { i: nil } %>
|
|
</div>
|
|
|
|
<% else %>
|
|
<div class="p-6 m:p-9 crayons-card crayons-card--secondary align-center fs-l h-100 flex items-center justify-center flex-1">
|
|
<div>
|
|
<% if Settings::General.mascot_image_url.present? %>
|
|
<% image_url = Images::Optimizer.call(Settings::General.mascot_image_url, width: 300, crop: "crop") %>
|
|
<%= image_tag(image_url, class: "sloan mb-7", alt: "Mascot image") %>
|
|
<% end %>
|
|
<p class="mb-6"><%= t("views.dashboard.posts.empty.desc") %></p>
|
|
<% if policy(Article).create? %>
|
|
<p><a href="/new" class="crayons-btn crayons-btn--l"><%= t("views.dashboard.posts.empty.new") %></a></p>
|
|
<% end %>
|
|
</div>
|
|
</div>
|
|
<% end %>
|
|
</div>
|
|
</main>
|
|
|
|
<%= javascript_packs_with_chunks_tag "archivedPostFilters", defer: true %>
|
|
<%= javascript_packs_with_chunks_tag "dashboards/convertCoauthorIdsToUsernameInputs", defer: true %>
|