77 lines
3.4 KiB
Text
77 lines
3.4 KiB
Text
<% title "Dashboard" %>
|
|
|
|
<main>
|
|
<header class="crayons-layout">
|
|
<h1 class="p-2 pb-0 m:p-0">Dashboard</h1>
|
|
<%= render "actions_mobile" %>
|
|
<%= render "analytics" %>
|
|
</header>
|
|
|
|
<div class="crayons-layout crayons-layout--2-cols">
|
|
<aside class="crayons-layout__sidebar-left">
|
|
<%= render "actions" %>
|
|
</aside>
|
|
|
|
<div class="crayons-layout__content flex flex-col">
|
|
<div class="flex items-center justify-between mb-3">
|
|
<h2 class="hidden m:block fs-l fw-heavy">Posts</h2>
|
|
|
|
<div class="flex flex-wrap">
|
|
<% if params[:which] != "organization" %>
|
|
<% if @articles.any?(&:archived) %>
|
|
<%= link_to "Show archived", "javascript:;", id: "toggleArchivedLink", class: "crayons-btn crayons-btn--outlined ml-2 whitespace-nowrap my-1" %>
|
|
<% end %>
|
|
<% if @articles.any? %>
|
|
<%= select_tag "dashboard_sort", options_for_select(sort_options, params[:sort]), 'aria-label': "Sort By", class: "crayons-select w-auto ml-2 my-1" %>
|
|
<% end %>
|
|
<% end %>
|
|
|
|
<% if @organizations && @organizations.size > 0 && (params[:which].blank? || params[:which] == "organization") %>
|
|
<select id="dashboard_author" class="crayons-select w-auto ml-2 my-1">
|
|
<option value="/dashboard" <%= "selected" if params[:which].blank? %>>Personal</option>
|
|
<% @organizations.each do |org| %>
|
|
<option value="/dashboard/organization/<%= org.id %>" <%= "selected" if params[:org_id].to_i == org.id %>><%= org.name %> (<%= org.articles_count %>)</option>
|
|
<% end %>
|
|
</select>
|
|
<% end %>
|
|
</div>
|
|
</div>
|
|
|
|
<% if @articles.any? %>
|
|
<div class="crayons-card mb-6">
|
|
<% @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 SiteConfig.mascot_image_url.present? %>
|
|
<%= image_tag(cl_image_path(SiteConfig.mascot_image_url,
|
|
type: "fetch",
|
|
width: 300,
|
|
crop: "imagga_scale",
|
|
quality: "auto",
|
|
flags: "progressive",
|
|
fetch_format: "auto",
|
|
sign_url: true),
|
|
class: "sloan mb-7",
|
|
alt: SiteConfig.mascot_image_description.to_s) %>
|
|
<% end %>
|
|
<p class="mb-6">This is where you can manage your posts, but you haven't written anything yet.</p>
|
|
<p><a href="/new" class="crayons-btn crayons-btn--l">Write your first post now</a></p>
|
|
</div>
|
|
</div>
|
|
<% end %>
|
|
</div>
|
|
</div>
|
|
</main>
|