docbrown/app/views/dashboards/_actions_mobile.html.erb
Jeremy Friesen dce7c4b275
Ensuring VideoPolicy#new? is canonical (#16735)
This commit compresses the policy check that spanned both :new? and
:enabled?.  We hide the ability to upload a video (as per the altered
html.erb files of this commit) but we didn't enforce the same logic in
the controller.

Further, as Videos are a subset of Article, I'm adding the "verify the
user is not suspended" test.

Directly relates to #16483

For sleuthing this relates:

- #16728
- forem/forem#16537
- #16634

And for historical context, this relates to:

- #10955
- #10954
- forem/internalEngineering#149
2022-03-01 11:46:31 -05:00

24 lines
2 KiB
Text

<div class="block m:hidden pt-3">
<select id="mobile_nav_dashboard" class="crayons-select">
<option value="/dashboard" <%= "selected" if params[:action] == "show" && (params[:which] == "organization" || params[:which].blank?) %>><%= t("views.dashboard.actions.mobile.posts", num: @user.articles_count) %></option>
<option value="/dashboard/user_followers" <%= "selected" if params[:action] == "followers" %>><%= t("views.dashboard.actions.mobile.followers", num: @user.followers_count) %></option>
<option value="/dashboard/following_tags" <%= "selected" if params[:action] == "following_tags" %>><%= t("views.dashboard.actions.mobile.following_tags", num: @user.following_tags_count) %></option>
<option value="/dashboard/following_users" <%= "selected" if params[:action] == "following_users" %>><%= t("views.dashboard.actions.mobile.following_users", num: @user.following_users_count) %></option>
<option value="/dashboard/following_organizations" <%= "selected" if params[:action] == "following_organizations" %>><%= t("views.dashboard.actions.mobile.following_orgs", num: @user.following_organizations_count) %></option>
<option value="/dashboard/following_podcasts" <%= "selected" if params[:action] == "following_podcasts" %>><%= t("views.dashboard.actions.mobile.following_pods", num: @user.following_podcasts_count) %></option>
<option value="/listings/dashboard"><%= t("views.dashboard.actions.listings") %></option>
<option value="<%= dashboard_analytics_path %>"><%= t("views.dashboard.actions.analytics") %></option>
<% if @organizations && (params[:which].blank? || params[:which] == "organization") %>
<% @organizations.each do |org| %>
<option value="<%= dashboard_analytics_org_path(org.id) %>"><%= t("views.dashboard.actions.for_org", org: org.name) %></option>
<% end %>
<% end %>
<% if policy(:video).new? %>
<option value="<%= new_video_path %>"><%= t("views.dashboard.actions.upload") %></option>
<% end %>
</select>
</div>