Basic UI to toggle collection publication status
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
class Collections::PublicationsController < ApplicationController
|
||||
include CollectionScoped
|
||||
|
||||
def create
|
||||
@collection.publish
|
||||
redirect_to edit_collection_path(@collection)
|
||||
end
|
||||
|
||||
def destroy
|
||||
@collection.unpublish
|
||||
redirect_to edit_collection_path(@collection)
|
||||
end
|
||||
end
|
||||
@@ -33,14 +33,10 @@
|
||||
<div class="panel shadow center flex flex-column">
|
||||
<%= render "collections/edit/workflows", collection: @collection %>
|
||||
<%= render "collections/edit/auto_close", collection: @collection %>
|
||||
<%= render "collections/edit/publication", collection: @collection %>
|
||||
|
||||
<hr class="separator--horizontal full-width margin-block-end margin-block-start-double" style="--border-color: var(--color-ink-light);" aria-hidden="true" />
|
||||
|
||||
<%= form_with model: @collection, class: "txt-align-center", method: :delete do |form| %>
|
||||
<%= form.button class: "btn txt-negative borderless txt-small", data: { turbo_confirm: "Are you sure you want to permanently delete this Collection?" } do %>
|
||||
<%= icon_tag "trash" %>
|
||||
<span>Delete this Collection</span>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<%= render "collections/edit/delete", collection: @collection %>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
<%= form_with model: collection, class: "txt-align-center", method: :delete do |form| %>
|
||||
<%= form.button class: "btn txt-negative borderless txt-small", data: { turbo_confirm: "Are you sure you want to permanently delete this Collection?" } do %>
|
||||
<%= icon_tag "trash" %>
|
||||
<span>Delete this Collection</span>
|
||||
<% end %>
|
||||
<% end %>
|
||||
@@ -0,0 +1,15 @@
|
||||
<strong class="txt-large">Publish this collection</strong>
|
||||
|
||||
<% if collection.published? %>
|
||||
<div class="flex justify-center margin-block-end">This collection is public.</div>
|
||||
<%= button_to "Unpublish", collection_publication_path(collection), method: :delete, class: "btn btn--negative" %>
|
||||
<%= text_field_tag :publication_url, published_collection_url(collection), disabled: true %>
|
||||
<%= button_to_copy_to_clipboard(published_collection_url(collection)) do %>
|
||||
<%= icon_tag "copy-paste" %>
|
||||
<span class="for-screen-reader">Copy join link</span>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<div class="flex justify-center margin-block-end">Make this collection public.</div>
|
||||
<%= button_to "Publish", collection_publication_path(collection), method: :post, class: "btn" %>
|
||||
<% end %>
|
||||
|
||||
@@ -19,6 +19,7 @@ Rails.application.routes.draw do
|
||||
resource :subscriptions
|
||||
resource :workflow, only: :update
|
||||
resource :involvement
|
||||
resource :publication
|
||||
end
|
||||
|
||||
resources :cards
|
||||
@@ -102,6 +103,13 @@ Rails.application.routes.draw do
|
||||
resources :pins
|
||||
end
|
||||
|
||||
namespace :public do
|
||||
resources :collections
|
||||
end
|
||||
|
||||
direct :published_collection do |collection, options|
|
||||
route_for :public_collection, collection.publication.key
|
||||
end
|
||||
|
||||
resolve "Card" do |card, options|
|
||||
route_for :collection_card, card.collection, card, options
|
||||
|
||||
Reference in New Issue
Block a user