docbrown/app/views/dashboards/show.html.erb
Mario See fda048dc12 Listing Drafts and Deletion (#3540)
* wip init handle draft class and styling

* add draft button

* start splitting up listing row into multile files

* separate tag links

* split location

* fix location

* separate listing row action buttons

* update listing row proptypes to describe listing object

* contact via connect to jsx

* fix default checked

* init draft creation and first publish charge

* fix first publish logic and credit charging

* handle drafts in dashboard filtering

* adjust isDraft bool statement

* hide drafts from main listings feed

* fix expired and draft bools in listing row

* adjust create listing org credits

* internally handle drafts

* adjust listing row

* break down update method

* remove unnecessary logic and shorten lines

* fix logic again woops

* convert input hidden value + submit into one form button submit with corresponding name and value

also adds clear message that drafts do not cost credits

* handle insufficient org credits on first publish

- uses user credits to publish
- similar to bump implementation

* fix sorting for personal and all orgs

* space out some elements

* don't spend original users credit for them

* add delete buttons and delete_confirm and destroy methods

* remove notification removal since listings dont trigger notifications

* move draft message and add draft_params to tests

* Update classified_listings_controller.rb

* update tests

* update snapshot

* add del tests

* add guard preventing free draft publish

* fix draft filter

* update from master and resolve merge conflict in listing preact

* Revert "update from master and resolve merge conflict in listing preact"

This reverts commit 0a34fccf334a2ca0902644b486cb26ead6bef664.

* update column spec

instead of setting and saving

* separate two expectations into their own tests

* split more tests into single expectations

* change to unless bumped_at? instead of if nil

* Fix listing draft edge cases and styling

* Add title tags to listings pages
2019-09-01 13:54:54 -04:00

55 lines
2.5 KiB
Text

<% title "Dashboard" %>
<div class="dashboard-container" id="user-dashboard">
<%= render "actions" %>
<% if @organizations && @organizations.size > 0 && (params[:which].blank? || params[:which] == "organization") %>
<h1>
<a href="/dashboard" class="rounded-btn <%= "active" if params[:which].blank? %>">Personal</a>
<% @organizations.each do |org| %>
<a href="/dashboard/organization/<%= org.id %>" class="rounded-btn <%= "active" if params[:org_id].to_i == org.id %>"><%= org.name %> (<%= org.articles_count %>)</a>
<% end %>
</h1>
<% end %>
<% if params[:which] == "organization" %>
<%= render "analytics" %>
<% @articles.each do |article| %>
<%= render "dashboard_article", article: article, organization: article.organization, org_admin: true, manage_view: false %>
<% end %>
<% elsif @articles.any? %>
<%= render "analytics" %>
<div class="actions-secondary">
<% if current_user.created_at < 2.weeks.ago %>
<a class="video-upload-cta cta" href="/videos/new" data-no-instant>
Upload a Video 🎥
</a>
<% end %>
<a class="video-upload-cta cta" href="/listings/dashboard" data-no-instant>
Create/Manage Listings
</a>
<%= select_tag "dashhboard_sort", options_for_select(sort_options, params[:sort]) %>
<% if @articles.any? {|article| article.archived } %>
<%= link_to "Show archived", "javascript:;", id: "toggleArchivedLink" %>
<% end %>
</div>
<% @articles.each do |article| %>
<%= render "dashboard_article", article: article, organization: nil, org_admin: false, manage_view: false %>
<% end %>
<% else %>
<div class="no-articles">
<h3>This is where you can manage your posts, but you haven't written anything yet.</h3>
<a href="/new" class="cta big">
Write your first post now
</a>
<%= image_tag(cl_image_path(asset_path("/assets/sloan.png"),
type: "fetch",
width: 300,
crop: "imagga_scale",
quality: "auto",
flags: "progressive",
fetch_format: "auto",
sign_url: true), class: "sloan", alt: "Sloan, the sloth mascot") %>
<br />
<h3>Also check out the <a href="/welcome" data-no-instant>Welcome Thread</a> to introduce yourself!</h3>
</div>
<% end %>
</div>