* Create DiscussionLocks
* Fix specs
* Update nullify_blank_notes_and_reason
* Update before_validation call
* Updated DiscussionLockPolicy for clarity
* Move permitted_attributes to a constant
* Update route
* Apply suggestions from code review for frontend
Co-authored-by: Suzanne Aitchison <suzanne@forem.com>
* Add title tags
* Wrap unlock confirm in main element
* Wrap flash messages up in div
* Actually fix title tags
* Hide comment reply button when discussion is locked
* Add E2E tests
* Try to fix E2E tests
* Cypress...you work locally but not in CI...why!?
* PR feedback
* Update E2E tests
* More E2E updates 😭
Co-authored-by: Suzanne Aitchison <suzanne@forem.com>
113 lines
5.1 KiB
Text
113 lines
5.1 KiB
Text
<div class="js-dashboard-story single-article <%= "single-article-unpublished" unless article.published %> <%= "single-article-archived hidden" if article.archived %>">
|
|
<div class="dashboard-collection-org-details">
|
|
<% if article.organization_id %>
|
|
<span class="dashboard-top-pill"><%= article.organization&.name %></span>
|
|
<% end %>
|
|
<% if article.collection_id %>
|
|
<span class="dashboard-top-pill"><strong>Series:</strong> <%= article.series %></span>
|
|
<% end %>
|
|
</div>
|
|
|
|
<div class="js-ellipsis-menu relative inline-block float-right">
|
|
<button id="ellipsis-menu-trigger-<%= article.id %>" aria-controls="ellipsis-menu-dropdown-<%= article.id %>" aria-expanded="false" aria-haspopup="true" class="crayons-btn crayons-btn--ghost crayons-btn--s crayons-btn--icon">
|
|
<%= inline_svg_tag("overflow-horizontal.svg", aria: true, class: "crayons-icon", title: "More...") %>
|
|
</button>
|
|
|
|
<div id="ellipsis-menu-dropdown-<%= article.id %>" class="crayons-dropdown top-100 right-0 z-10 align-left js-ellipsis-menu-dropdown p-1">
|
|
<%= form_for(article, method: :patch, remote: true, authenticity_token: true, html: { "data-type": "json", class: "p-0 js-archive-toggle" }) do |f| %>
|
|
<%= f.hidden_field :archived, value: !article.archived %>
|
|
|
|
<button type="submit" class="crayons-link crayons-link--block w-100 border-0 bg-transparent">
|
|
<%= article.archived ? "Unarchive post" : "Archive post" %>
|
|
</button>
|
|
<% end %>
|
|
</div>
|
|
</div>
|
|
|
|
<a href="<%= article.current_state_path %>"><h2><%= "[Archived] " if article.archived %><%= sanitize_and_decode article.title %></h2></a>
|
|
<div class="dashboard-meta-details">
|
|
<% if article.published %>
|
|
<span>
|
|
Published: <time datetime="<%= article.published_timestamp %>"><%= article.readable_publish_date %></time>
|
|
</span>
|
|
|
|
<% if article.edited? %>
|
|
<span>
|
|
· Edited: <time datetime="<%= article.edited_at.utc.iso8601 %>"><%= article.readable_edit_date %></time>
|
|
</span>
|
|
<% end %>
|
|
|
|
<% article.cached_tag_list_array.each do |tag| %>
|
|
<a href="/t/<%= tag %>"><span class="tag">#<%= tag %></span></a>
|
|
<% end %>
|
|
<% end %>
|
|
</div>
|
|
<div class="dashboard-actions">
|
|
<% if !article.published %>
|
|
<a href="<%= article.current_state_path %>" class="crayons-btn">Draft</a>
|
|
<% end %>
|
|
<a href="<%= article.path %>/edit" class="crayons-btn">Edit</a>
|
|
<% if manage_view %>
|
|
<a href="<%= article.path %>/delete_confirm" data-no-instant class="crayons-btn crayons-btn--danger">Delete</a>
|
|
<% if article.profile_pins.any? %>
|
|
<%= form_for(article.profile_pins.first) do |f| %>
|
|
<button class="crayons-btn crayons-btn--secondary">UNPIN</button>
|
|
<% end %>
|
|
<% else %>
|
|
<%= form_for(ProfilePin.new) do |f| %>
|
|
<%= f.hidden_field :pinnable_id, value: article.id %>
|
|
<button class="crayons-btn">Pin to profile</button>
|
|
<% end %>
|
|
<% end %>
|
|
<% elsif article.published %>
|
|
<a href="<%= article.path %>/manage" class="crayons-btn">Manage</a>
|
|
<% elsif @user == article.user %>
|
|
<a href="<%= article.path %>/delete_confirm" data-no-instant class="crayons-btn crayons-btn--danger">Delete</a>
|
|
<% end %>
|
|
|
|
<a href="<%= article.path %>/stats" data-no-instant class="crayons-btn">Stats</a>
|
|
|
|
<% if discussion_lock %>
|
|
<a href="<%= article.path %>/discussion_unlock_confirm" data-no-instant class="crayons-btn">Unlock discussion</a>
|
|
<% else %>
|
|
<a href="<%= article.path %>/discussion_lock_confirm" data-no-instant class="crayons-btn">Lock discussion</a>
|
|
<% end %>
|
|
|
|
<% if article.published %>
|
|
<span id="pageviews-<%= article.id %>" class="crayons-btn dashboard-pageviews-indicator" data-analytics-pageviews data-article-id="<%= article.id %>">
|
|
<span class="page-views-count">
|
|
<span class="value">
|
|
<% if article.page_views_count > 25 %>
|
|
<span class="value"><%= article.page_views_count %></span>
|
|
<% else %>
|
|
under 25
|
|
<% end %>
|
|
</span>
|
|
views
|
|
</span>
|
|
//
|
|
<span class="reactions-count">
|
|
<span class="value">
|
|
<%= article.public_reactions_count %>
|
|
</span>
|
|
<%= "reaction".pluralize(count: article.public_reactions_count) %>
|
|
</span>
|
|
//
|
|
<span class="comments-count">
|
|
<span class="value">
|
|
<%= article.comments_count %>
|
|
</span>
|
|
<%= "comment".pluralize(count: article.comments_count) %>
|
|
</span>
|
|
</span>
|
|
<% end %>
|
|
</div>
|
|
<% if organization && org_admin %>
|
|
<%= form_for(article) do |f| %>
|
|
<input type="hidden" name="destination" value="/dashboard/organization/<%= organization.id %>" />
|
|
AUTHOR: <%= f.select(:user_id, options_for_select(organization.users.pluck(:name, :id), article.user_id)) %>
|
|
<%= f.submit "Submit author change", class: "crayons-btn crayons-btn--secondary" %>
|
|
<% end %>
|
|
<% end %>
|
|
</div>
|
|
<%= javascript_packs_with_chunks_tag "dashboardDropdowns", defer: true %>
|