docbrown/app/views/dashboards/show.html.erb
Mac Siri afa73e06e3
Replace Webpacker with Esbuild (#20470)
* Migrate to esbuild WIP

* Add exclude

* Remove redundant file

* Move file

* Move to javascript_include_tag

* Lint fix

* WIP

* WIP

* Add watch mode to esbuild WIP

* Get jest working

* Remove babel

* Revert "Remove babel"

This reverts commit 6da35260aa19d6f97f586deb66c0ecaf48433b73.

* More WIP

* Got image to load

* WIP

* Resolve audit

* Lint fix

* WIP

* Fix jest spec

* [CI] Remove asset-restore for test build stage

* Production compliant

* Temp disable sourcemap

* Update glob

* Add esbuild helper to stimulus

* Import fragment

* Temp disable coverage to see failing tests

* Fix broken spec

* Address lint

* Set proper es6 target

* Use esbuild for everything

* wait what

* Revert "Set proper es6 target"

This reverts commit 98f5278093421baa8ffe2ca580845b01c1a1eadf.

* Revert "Use esbuild for everything"

This reverts commit 0ac46738f07ffcb6af095ccb1ffa5e439b7fefa3.

* Replace uglifier with terser

* New compiled assets version

* Remvoe honeybadger-io/webpack

* Remove cypress coverage checks for now

* Update jsconfig.json

* Update docker-compose

* Remove public/packs-test from ci cache
2024-01-25 20:29:21 +00:00

71 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_include_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, article_series: article.collection.present? %>
<% 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_include_tag "archivedPostFilters", "dashboards/convertCoauthorIdsToUsernameInputs", defer: true %>