views: add html ids for main menu and subnav menu.

Also refactor secondary links to put the <menu> element in the default
layout instead of in each _secondary_links partial.
This commit is contained in:
evazion
2019-09-17 00:28:41 -05:00
parent c85bbbf8c2
commit a5ef86bbe8
28 changed files with 277 additions and 340 deletions

View File

@@ -1,10 +1,8 @@
<% content_for(:secondary_links) do %> <% content_for(:secondary_links) do %>
<menu>
<%= quick_search_form_for(:text_matches, artist_commentaries_path, "commentaries") %> <%= quick_search_form_for(:text_matches, artist_commentaries_path, "commentaries") %>
<%= subnav_link_to "Search", search_artist_commentaries_path %> <%= subnav_link_to "Search", search_artist_commentaries_path %>
<%= subnav_link_to "Listing", artist_commentaries_path %> <%= subnav_link_to "Listing", artist_commentaries_path %>
<%= subnav_link_to "Recent changes", artist_commentary_versions_path %> <%= subnav_link_to "Recent changes", artist_commentary_versions_path %>
<%= subnav_link_to "Translation requests", artist_commentaries_path(:search => {:post_tags_match => "commentary_request"}) %> <%= subnav_link_to "Translation requests", artist_commentaries_path(:search => {:post_tags_match => "commentary_request"}) %>
<%= subnav_link_to "Help", wiki_pages_path(:title => "help:artist_commentary") %> <%= subnav_link_to "Help", wiki_pages_path(:title => "help:artist_commentary") %>
</menu>
<% end %> <% end %>

View File

@@ -1,7 +1,5 @@
<% content_for(:secondary_links) do %> <% content_for(:secondary_links) do %>
<menu>
<%= subnav_link_to "Listing", artists_path %> <%= subnav_link_to "Listing", artists_path %>
<%= subnav_link_to "New", new_artist_path %> <%= subnav_link_to "New", new_artist_path %>
<%= subnav_link_to "Search", search_artist_versions_path %> <%= subnav_link_to "Search", search_artist_versions_path %>
</menu>
<% end %> <% end %>

View File

@@ -1,5 +1,4 @@
<% content_for(:secondary_links) do %> <% content_for(:secondary_links) do %>
<menu>
<%= quick_search_form_for(:any_name_or_url_matches, artists_path, "artists", autocomplete: "artist") %> <%= quick_search_form_for(:any_name_or_url_matches, artists_path, "artists", autocomplete: "artist") %>
<%= subnav_link_to "Listing", artists_path %> <%= subnav_link_to "Listing", artists_path %>
<%= subnav_link_to "Banned", banned_artists_path %> <%= subnav_link_to "Banned", banned_artists_path %>
@@ -32,5 +31,4 @@
<% end %> <% end %>
<% end %> <% end %>
<% end %> <% end %>
</menu>
<% end %> <% end %>

View File

@@ -1,6 +1,4 @@
<% content_for(:secondary_links) do %> <% content_for(:secondary_links) do %>
<menu>
<%= subnav_link_to "Listing", bans_path %> <%= subnav_link_to "Listing", bans_path %>
<%= subnav_link_to "Ban", new_ban_path %> <%= subnav_link_to "Ban", new_ban_path %>
</menu>
<% end %> <% end %>

View File

@@ -1,6 +1,4 @@
<% content_for(:secondary_links) do %> <% content_for(:secondary_links) do %>
<menu>
<%= subnav_link_to "Listing", bulk_update_requests_path %> <%= subnav_link_to "Listing", bulk_update_requests_path %>
<%= subnav_link_to "New", new_bulk_update_request_path %> <%= subnav_link_to "New", new_bulk_update_request_path %>
</menu>
<% end %> <% end %>

View File

@@ -1,8 +1,6 @@
<% content_for(:secondary_links) do %> <% content_for(:secondary_links) do %>
<menu>
<%= quick_search_form_for(:body_matches, comments_path, "comments") %> <%= quick_search_form_for(:body_matches, comments_path, "comments") %>
<%= subnav_link_to "Listing", comments_path(:group_by => "post") %> <%= subnav_link_to "Listing", comments_path(:group_by => "post") %>
<%= subnav_link_to "Search", search_comments_path %> <%= subnav_link_to "Search", search_comments_path %>
<%= subnav_link_to "Help", wiki_pages_path(:title => "help:comments") %> <%= subnav_link_to "Help", wiki_pages_path(:title => "help:comments") %>
</menu>
<% end %> <% end %>

View File

@@ -1,5 +1,4 @@
<% content_for(:secondary_links) do %> <% content_for(:secondary_links) do %>
<menu>
<%= quick_search_form_for(:message_matches, dmails_path, "dmails") %> <%= quick_search_form_for(:message_matches, dmails_path, "dmails") %>
<%= subnav_link_to "All", all_dmails_path(set_default_folder: true) %> <%= subnav_link_to "All", all_dmails_path(set_default_folder: true) %>
<%= subnav_link_to "Received", received_dmails_path(set_default_folder: true) %> <%= subnav_link_to "Received", received_dmails_path(set_default_folder: true) %>
@@ -10,5 +9,4 @@
<%= subnav_link_to "Mark all as read", {:controller => "dmails", :action => "mark_all_as_read"}, :method => :post, :remote => true %></li> <%= subnav_link_to "Mark all as read", {:controller => "dmails", :action => "mark_all_as_read"}, :method => :post, :remote => true %></li>
<li>|</li> <li>|</li>
<%= subnav_link_to "Help", wiki_pages_path(title: "help:dmail") %> <%= subnav_link_to "Help", wiki_pages_path(title: "help:dmail") %>
</menu>
<% end %> <% end %>

View File

@@ -1,5 +1,4 @@
<% content_for(:secondary_links) do %> <% content_for(:secondary_links) do %>
<menu>
<%= subnav_link_to "Listing", favorite_groups_path %> <%= subnav_link_to "Listing", favorite_groups_path %>
<% if CurrentUser.is_member? %> <% if CurrentUser.is_member? %>
<%= subnav_link_to "New", new_favorite_group_path %> <%= subnav_link_to "New", new_favorite_group_path %>
@@ -18,5 +17,4 @@
<% end %> <% end %>
<% end %> <% end %>
<% end %> <% end %>
</menu>
<% end %> <% end %>

View File

@@ -1,5 +1,4 @@
<% content_for(:secondary_links) do %> <% content_for(:secondary_links) do %>
<menu>
<%= quick_search_form_for(:body_matches, forum_posts_path, "forum posts") %> <%= quick_search_form_for(:body_matches, forum_posts_path, "forum posts") %>
<%= subnav_link_to "Listing", forum_topics_path %> <%= subnav_link_to "Listing", forum_topics_path %>
@@ -43,5 +42,4 @@
<% end %> <% end %>
<% end %> <% end %>
<% end %> <% end %>
</menu>
<% end %> <% end %>

View File

@@ -1,6 +1,4 @@
<% content_for(:secondary_links) do %> <% content_for(:secondary_links) do %>
<menu>
<%= subnav_link_to "Listing", ip_bans_path %> <%= subnav_link_to "Listing", ip_bans_path %>
<%= subnav_link_to "New", new_ip_ban_path %> <%= subnav_link_to "New", new_ip_ban_path %>
</menu>
<% end %> <% end %>

View File

@@ -1,6 +1,4 @@
<% content_for(:secondary_links) do %> <% content_for(:secondary_links) do %>
<menu>
<%= subnav_link_to "Listing", janitor_trials_path %> <%= subnav_link_to "Listing", janitor_trials_path %>
<%= subnav_link_to "New", new_janitor_trial_path %> <%= subnav_link_to "New", new_janitor_trial_path %>
</menu>
<% end %> <% end %>

View File

@@ -1,4 +1,4 @@
<menu class="main"> <menu id="main-menu" class="main">
<% if CurrentUser.is_anonymous? %> <% if CurrentUser.is_anonymous? %>
<%= nav_link_to("Sign in", new_session_path) %> <%= nav_link_to("Sign in", new_session_path) %>
<% else %> <% else %>

View File

@@ -101,7 +101,7 @@
<%= render "news_updates/listing" %> <%= render "news_updates/listing" %>
<header id="top"> <header id="top">
<h1><%= link_to Danbooru.config.app_name, "/" %></h1> <h1 id="app-name-header"><%= link_to Danbooru.config.app_name, "/" %></h1>
<div id="maintoggle"> <div id="maintoggle">
<a href="#"><i id="maintoggle-on" class="fas fa-bars"></i></a> <a href="#"><i id="maintoggle-on" class="fas fa-bars"></i></a>
@@ -110,7 +110,11 @@
<nav id="nav"> <nav id="nav">
<%= render "layouts/main_links" %> <%= render "layouts/main_links" %>
<% if content_for(:secondary_links).present? %>
<menu id="subnav-menu">
<%= yield :secondary_links %> <%= yield :secondary_links %>
</menu>
<% end %>
</nav> </nav>
</header> </header>

View File

@@ -1,6 +1,4 @@
<% content_for(:secondary_links) do %> <% content_for(:secondary_links) do %>
<menu>
<%= subnav_link_to "Listing", news_updates_path %> <%= subnav_link_to "Listing", news_updates_path %>
<%= subnav_link_to "New", new_news_update_path %> <%= subnav_link_to "New", new_news_update_path %>
</menu>
<% end %> <% end %>

View File

@@ -1,5 +1,4 @@
<% content_for(:secondary_links) do %> <% content_for(:secondary_links) do %>
<menu>
<%= quick_search_form_for(:body_matches, notes_path, "notes") %> <%= quick_search_form_for(:body_matches, notes_path, "notes") %>
<%= subnav_link_to "Listing", notes_path %> <%= subnav_link_to "Listing", notes_path %>
<%= subnav_link_to "Posts", posts_path(:tags => "order:note") %> <%= subnav_link_to "Posts", posts_path(:tags => "order:note") %>
@@ -7,5 +6,4 @@
<%= subnav_link_to "History", note_versions_path %> <%= subnav_link_to "History", note_versions_path %>
<%= subnav_link_to "Requests", posts_path(:tags => "translation_request") %> <%= subnav_link_to "Requests", posts_path(:tags => "translation_request") %>
<%= subnav_link_to "Help", wiki_pages_path(:title => "help:notes") %> <%= subnav_link_to "Help", wiki_pages_path(:title => "help:notes") %>
</menu>
<% end %> <% end %>

View File

@@ -1,5 +1,4 @@
<% content_for(:secondary_links) do %> <% content_for(:secondary_links) do %>
<menu>
<%= quick_search_form_for(:name_matches, pools_path, "pools", autocomplete: "pool") %> <%= quick_search_form_for(:name_matches, pools_path, "pools", autocomplete: "pool") %>
<%= subnav_link_to "Gallery", gallery_pools_path %> <%= subnav_link_to "Gallery", gallery_pools_path %>
<%= subnav_link_to "Listing", pools_path %> <%= subnav_link_to "Listing", pools_path %>
@@ -26,5 +25,4 @@
<%= subnav_link_to "Order", edit_pool_order_path(@pool) %> <%= subnav_link_to "Order", edit_pool_order_path(@pool) %>
<% end %> <% end %>
<% end %> <% end %>
</menu>
<% end %> <% end %>

View File

@@ -1,9 +1,7 @@
<% content_for(:secondary_links) do %> <% content_for(:secondary_links) do %>
<menu>
<%= subnav_link_to "Listing", posts_path %> <%= subnav_link_to "Listing", posts_path %>
<%= subnav_link_to "Upload", new_upload_path %> <%= subnav_link_to "Upload", new_upload_path %>
<%= subnav_link_to "Search", search_post_versions_path %> <%= subnav_link_to "Search", search_post_versions_path %>
<%= subnav_link_to "Changes", post_versions_path %> <%= subnav_link_to "Changes", post_versions_path %>
<%= subnav_link_to "Help", wiki_pages_path(:title => "help:posts") %> <%= subnav_link_to "Help", wiki_pages_path(:title => "help:posts") %>
</menu>
<% end %> <% end %>

View File

@@ -1,5 +1,4 @@
<% content_for(:secondary_links) do %> <% content_for(:secondary_links) do %>
<menu>
<%= subnav_link_to "Listing", posts_path %> <%= subnav_link_to "Listing", posts_path %>
<%= subnav_link_to "Upload", new_upload_path %> <%= subnav_link_to "Upload", new_upload_path %>
<%= subnav_link_to "Hot", posts_path(:tags => "order:rank", :d => "1") %> <%= subnav_link_to "Hot", posts_path(:tags => "order:rank", :d => "1") %>
@@ -18,5 +17,4 @@
<%= subnav_link_to "Moderate", moderator_post_queue_path %> <%= subnav_link_to "Moderate", moderator_post_queue_path %>
<% end %> <% end %>
<%= subnav_link_to "Help", wiki_pages_path(:title => "help:posts") %> <%= subnav_link_to "Help", wiki_pages_path(:title => "help:posts") %>
</menu>
<% end %> <% end %>

View File

@@ -1,6 +1,4 @@
<% content_for(:secondary_links) do %> <% content_for(:secondary_links) do %>
<menu>
<%= subnav_link_to "View posts", posts_path(:tags => "search:all") %> <%= subnav_link_to "View posts", posts_path(:tags => "search:all") %>
<%= subnav_link_to "Manage saved searches", saved_searches_path %> <%= subnav_link_to "Manage saved searches", saved_searches_path %>
</menu>
<% end %> <% end %>

View File

@@ -1,7 +1,5 @@
<% content_for(:secondary_links) do %> <% content_for(:secondary_links) do %>
<menu>
<%= subnav_link_to "Sign up", new_user_path %> <%= subnav_link_to "Sign up", new_user_path %>
<%= subnav_link_to "Reset Password", new_maintenance_user_password_reset_path %> <%= subnav_link_to "Reset Password", new_maintenance_user_password_reset_path %>
<%= subnav_link_to "Login Reminder", new_maintenance_user_login_reminder_path %> <%= subnav_link_to "Login Reminder", new_maintenance_user_login_reminder_path %>
</menu>
<% end %> <% end %>

View File

@@ -1,9 +1,7 @@
<% content_for(:secondary_links) do %> <% content_for(:secondary_links) do %>
<menu>
<%= subnav_link_to "Listing", tag_aliases_path %> <%= subnav_link_to "Listing", tag_aliases_path %>
<%= subnav_link_to "MetaSearch", meta_searches_tags_path %> <%= subnav_link_to "MetaSearch", meta_searches_tags_path %>
<%= subnav_link_to "Request alias", new_tag_alias_request_path %> <%= subnav_link_to "Request alias", new_tag_alias_request_path %>
<%= subnav_link_to "Request bulk update", new_bulk_update_request_path %> <%= subnav_link_to "Request bulk update", new_bulk_update_request_path %>
<%= subnav_link_to "Help", wiki_pages_path(:title => "help:tag_aliases") %> <%= subnav_link_to "Help", wiki_pages_path(:title => "help:tag_aliases") %>
</menu>
<% end %> <% end %>

View File

@@ -1,9 +1,7 @@
<% content_for(:secondary_links) do %> <% content_for(:secondary_links) do %>
<menu>
<%= subnav_link_to "Listing", tag_implications_path %> <%= subnav_link_to "Listing", tag_implications_path %>
<%= subnav_link_to "MetaSearch", meta_searches_tags_path %> <%= subnav_link_to "MetaSearch", meta_searches_tags_path %>
<%= subnav_link_to "Request implication", new_tag_implication_request_path %> <%= subnav_link_to "Request implication", new_tag_implication_request_path %>
<%= subnav_link_to "Request bulk update", new_bulk_update_request_path %> <%= subnav_link_to "Request bulk update", new_bulk_update_request_path %>
<%= subnav_link_to "Help", wiki_pages_path(:title => "help:tag_implications") %> <%= subnav_link_to "Help", wiki_pages_path(:title => "help:tag_implications") %>
</menu>
<% end %> <% end %>

View File

@@ -1,5 +1,4 @@
<% content_for(:secondary_links) do %> <% content_for(:secondary_links) do %>
<menu>
<%= quick_search_form_for(:name_matches, tags_path, "tags", autocomplete: "tag") %> <%= quick_search_form_for(:name_matches, tags_path, "tags", autocomplete: "tag") %>
<%= subnav_link_to "Listing", tags_path %> <%= subnav_link_to "Listing", tags_path %>
<%= subnav_link_to "MetaSearch", meta_searches_tags_path %> <%= subnav_link_to "MetaSearch", meta_searches_tags_path %>
@@ -14,5 +13,4 @@
<%= subnav_link_to "Fix", new_tag_correction_path(:tag_id => @tag.id) %> <%= subnav_link_to "Fix", new_tag_correction_path(:tag_id => @tag.id) %>
<% end %> <% end %>
<% end %> <% end %>
</menu>
<% end %> <% end %>

View File

@@ -1,9 +1,7 @@
<% content_for(:secondary_links) do %> <% content_for(:secondary_links) do %>
<menu>
<%= subnav_link_to "Listing", uploads_path %> <%= subnav_link_to "Listing", uploads_path %>
<%= subnav_link_to "New", new_upload_path %> <%= subnav_link_to "New", new_upload_path %>
<%= subnav_link_to "Batch Upload", batch_uploads_path %> <%= subnav_link_to "Batch Upload", batch_uploads_path %>
<%= subnav_link_to "Similar Images Search", iqdb_queries_path %> <%= subnav_link_to "Similar Images Search", iqdb_queries_path %>
<%= subnav_link_to "Help", wiki_pages_path(search: { title: "help:upload" }) %> <%= subnav_link_to "Help", wiki_pages_path(search: { title: "help:upload" }) %>
</menu>
<% end %> <% end %>

View File

@@ -1,5 +1,4 @@
<% content_for(:secondary_links) do %> <% content_for(:secondary_links) do %>
<menu>
<% if CurrentUser.is_gold? %> <% if CurrentUser.is_gold? %>
<% if @user_feedback %> <% if @user_feedback %>
<%= subnav_link_to "New", new_user_feedback_path(:user_feedback => {:user_id => @user_feedback.user_id}) %> <%= subnav_link_to "New", new_user_feedback_path(:user_feedback => {:user_id => @user_feedback.user_id}) %>
@@ -11,5 +10,4 @@
<% end %> <% end %>
<%= subnav_link_to "Listing", user_feedbacks_path %> <%= subnav_link_to "Listing", user_feedbacks_path %>
<%= subnav_link_to "Search", search_user_feedbacks_path %> <%= subnav_link_to "Search", search_user_feedbacks_path %>
</menu>
<% end %> <% end %>

View File

@@ -1,7 +1,5 @@
<% content_for(:secondary_links) do %> <% content_for(:secondary_links) do %>
<menu>
<%= subnav_link_to "Listing", user_name_change_requests_path %> <%= subnav_link_to "Listing", user_name_change_requests_path %>
<%= subnav_link_to "New", new_user_name_change_request_path %> <%= subnav_link_to "New", new_user_name_change_request_path %>
<%= subnav_link_to "Help", wiki_pages_path(:search => {:title => "help:user_name_change_requests"}) %> <%= subnav_link_to "Help", wiki_pages_path(:search => {:title => "help:user_name_change_requests"}) %>
</menu>
<% end %> <% end %>

View File

@@ -1,5 +1,4 @@
<% content_for(:secondary_links) do %> <% content_for(:secondary_links) do %>
<menu>
<%= quick_search_form_for(:name_matches, users_path, "users", autocomplete: "user") %> <%= quick_search_form_for(:name_matches, users_path, "users", autocomplete: "user") %>
<%= subnav_link_to "Listing", users_path %> <%= subnav_link_to "Listing", users_path %>
<%= subnav_link_to "Search", search_users_path %> <%= subnav_link_to "Search", search_users_path %>
@@ -37,5 +36,4 @@
<li>|</li> <li>|</li>
<%= subnav_link_to "Sign out", sign_out_session_path %> <%= subnav_link_to "Sign out", sign_out_session_path %>
<% end %> <% end %>
</menu>
<% end %> <% end %>

View File

@@ -1,49 +1,32 @@
<% content_for(:secondary_links) do %> <% content_for(:secondary_links) do %>
<menu>
<%= quick_search_form_for(:title, wiki_pages_path, "wiki pages", autocomplete: "wiki-page") %> <%= quick_search_form_for(:title, wiki_pages_path, "wiki pages", autocomplete: "wiki-page") %>
<%= subnav_link_to "Listing", wiki_pages_path %> <%= subnav_link_to "Listing", wiki_pages_path %>
<%= subnav_link_to "Search", search_wiki_pages_path %> <%= subnav_link_to "Search", search_wiki_pages_path %>
<% if CurrentUser.is_member? %> <% if CurrentUser.is_member? %>
<%= subnav_link_to "New", new_wiki_page_path %> <%= subnav_link_to "New", new_wiki_page_path %>
<% end %> <% end %>
<%= subnav_link_to "Help", wiki_pages_path(:search => {:title => "help:wiki"}) %> <%= subnav_link_to "Help", wiki_pages_path(:search => {:title => "help:wiki"}) %>
<% if @wiki_page && @wiki_page.new_record? && @wiki_page.try(:tag).present? %> <% if @wiki_page && @wiki_page.new_record? && @wiki_page.try(:tag).present? %>
<li>|</li> <li>|</li>
<%= subnav_link_to "Posts (#{@wiki_page.tag.post_count})", posts_path(:tags => @wiki_page.title) %> <%= subnav_link_to "Posts (#{@wiki_page.tag.post_count})", posts_path(:tags => @wiki_page.title) %>
<% elsif @wiki_page && !@wiki_page.new_record? %> <% elsif @wiki_page && !@wiki_page.new_record? %>
<li>|</li> <li>|</li>
<%= subnav_link_to "Posts (#{@wiki_page.tag.try(:post_count) || 0})", posts_path(:tags => @wiki_page.title) %> <%= subnav_link_to "Posts (#{@wiki_page.tag.try(:post_count) || 0})", posts_path(:tags => @wiki_page.title) %>
<%= subnav_link_to "History", wiki_page_versions_path(:search => {:wiki_page_id => @wiki_page.id}) %> <%= subnav_link_to "History", wiki_page_versions_path(:search => {:wiki_page_id => @wiki_page.id}) %>
<% if CurrentUser.is_member? %> <% if CurrentUser.is_member? %>
<%= subnav_link_to "Edit", edit_wiki_page_path(@wiki_page), "data-shortcut": "e" %> <%= subnav_link_to "Edit", edit_wiki_page_path(@wiki_page), "data-shortcut": "e" %>
<% end %> <% end %>
<% if CurrentUser.is_builder? && !@wiki_page.is_deleted? %> <% if CurrentUser.is_builder? && !@wiki_page.is_deleted? %>
<%= subnav_link_to "Delete", wiki_page_path(@wiki_page), :remote => true, :method => :delete, :"data-shortcut" => "shift+d", :"data-confirm" => "Are you sure you want to delete this wiki page?" %> <%= subnav_link_to "Delete", wiki_page_path(@wiki_page), :remote => true, :method => :delete, :"data-shortcut" => "shift+d", :"data-confirm" => "Are you sure you want to delete this wiki page?" %>
<% end %> <% end %>
<% elsif @wiki_page_version %> <% elsif @wiki_page_version %>
<li>|</li> <li>|</li>
<%= subnav_link_to "Newest", wiki_page_path(@wiki_page_version.wiki_page_id) %> <%= subnav_link_to "Newest", wiki_page_path(@wiki_page_version.wiki_page_id) %>
<% if @wiki_page_version.previous %> <% if @wiki_page_version.previous %>
<%= subnav_link_to "Diff", diff_wiki_page_versions_path(:otherpage => @wiki_page_version.id, :thispage => @wiki_page_version.previous.id) %> <%= subnav_link_to "Diff", diff_wiki_page_versions_path(:otherpage => @wiki_page_version.id, :thispage => @wiki_page_version.previous.id) %>
<% end %> <% end %>
<% if CurrentUser.is_member? %> <% if CurrentUser.is_member? %>
<%= subnav_link_to "Revert to", revert_wiki_page_path(@wiki_page_version.wiki_page_id, :version_id => @wiki_page_version.id), :method => :put, :data => {:confirm => "Are you sure you want to revert to this version?"} %> <%= subnav_link_to "Revert to", revert_wiki_page_path(@wiki_page_version.wiki_page_id, :version_id => @wiki_page_version.id), :method => :put, :data => {:confirm => "Are you sure you want to revert to this version?"} %>
<% end %> <% end %>
<% end %> <% end %>
</menu>
<% end %> <% end %>