Skip to content

Commit

Permalink
Cleaning up the overcrowded navbar by moving individual resource menu…
Browse files Browse the repository at this point in the history
… items into resource pages.
  • Loading branch information
omnilord committed Sep 20, 2018
1 parent 9ef8c8e commit 84e7f45
Show file tree
Hide file tree
Showing 23 changed files with 92 additions and 30 deletions.
12 changes: 12 additions & 0 deletions app/views/distribution_points/_menu.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<% if user_signed_in? %>
<div class="navbar">
<ul>
<li><span><strong>DISTRIBUTION POINTS: </strong></span></li>
<li><%= link_to "Outdated Distribution Point Records", outdated_distribution_points_path %></li>
<% if admin? %>
<li><%= link_to "Distribution Points Update Queue", drafts_distribution_points_path %></li>
<li><%= link_to "Archived Distribution Points", archived_distribution_points_path %></li>
<% end %>
</ul>
</div>
<% end %>
2 changes: 2 additions & 0 deletions app/views/distribution_points/archived.html.erb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
<% content_for :sub_menu { render partial: 'menu' } %>

<%= render @page %>
<h1>Archived Distribution Points</h1>

Expand Down
2 changes: 2 additions & 0 deletions app/views/distribution_points/drafts.html.erb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
<% content_for :sub_menu { render partial: 'menu' } %>

<h1>Distribution Points Update Queue</h2>

<%= render "shared/drafts_table", rows: @drafts, columns: @columns, headers: @headers %>
3 changes: 3 additions & 0 deletions app/views/distribution_points/edit.html.erb
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
<% content_for :sub_menu { render partial: 'menu' } %>

<h1>Edit <%= @distribution_point.facility_name %></h1>

<% if admin? %>
<% if @distribution_point.active %>
<%= link_to 'Archive', archive_distribution_point_path(@distribution_point),
Expand Down
2 changes: 2 additions & 0 deletions app/views/distribution_points/index.html.erb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
<% content_for :sub_menu { render partial: 'menu' } %>

<%= render @page %>
<h1>Distribution Points</h1>

Expand Down
2 changes: 2 additions & 0 deletions app/views/distribution_points/new.html.erb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
<% content_for :sub_menu { render partial: 'menu' } %>

<h1>New Distribution Point</h1>

<%= render 'form', distribution_point: @distribution_point %>
2 changes: 2 additions & 0 deletions app/views/distribution_points/outdated.html.erb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
<% content_for :sub_menu { render partial: 'menu' } %>

<h1>Distribution Points Needing Updates</h2>

<%= render "shared/table", rows: @distribution_points, columns: @columns, headers: @headers, reverse_chron: true %>
3 changes: 2 additions & 1 deletion app/views/distribution_points/show.html.erb
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<h1><%= @distribution_point.facility_name %></h1>
<% content_for :sub_menu { render partial: 'menu' } %>

<h1><%= @distribution_point.facility_name %></h1>

<%= link_to 'Update', [:edit, @distribution_point], class: 'button button-clear' %> |
<%= link_to 'Back', distribution_points_path, class: 'button button-clear' %>
Expand Down
48 changes: 19 additions & 29 deletions app/views/layouts/application.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -29,24 +29,9 @@
<ul>
<li><%= link_to "Home", root_path %></li>
<li><%= link_to "Shelters", shelters_path %></li>
<% if user_signed_in? %>
<li><%= link_to "Help Call Shelters", outdated_shelters_path %></li>
<% end %>
<% if admin? %>
<li><%= link_to "Shelters Update Queue", drafts_shelters_path %></li>
<li><%= link_to "Archived Shelters", archived_shelters_path %></li>
<% end %>
<li><%= link_to "Distribution Points", distribution_points_path %></li>
<% if user_signed_in? %>
<li><%= link_to "Outdated Distribution Point Records", outdated_distribution_points_path %></li>
<% end %>
<% if admin? %>
<li><%= link_to "Distribution Points Update Queue", drafts_distribution_points_path %></li>
<li><%= link_to "Archived Distribution Points", archived_distribution_points_path %></li>
<% end %>
<li><%= link_to "Needs", needs_path %></li>
<% if admin? %>
<li><%= link_to "Needs Update Queue", drafts_needs_path %></li>
<li><%= link_to "Users", users_path %></li>
<li><%= link_to "AmazonProducts", amazon_products_path %></li>
<li><%= link_to "Charitable Organizations", charitable_organizations_path %></li>
Expand All @@ -64,21 +49,26 @@
</div>
</ul>
</div>
<div class="container">
<p id="notice"><%= notice %></p>
<p id="alert"><%= alert %></p>
<div class="new-record-notification"></div>
<%= yield %>
</div>
<% if content_for :sub_menu %>
<%= yield :sub_menu %>
<% end %>
<div class="container">
<p id="notice"><%= notice %></p>
<p id="alert"><%= alert %></p>
<div class="new-record-notification"></div>
<%= yield %>
</div>

<footer>
Code is available at <a href="http://github.com/hurricane-response/florence-api">GitHub</a>. Contributors welcome!
</footer>

<script src="https://maps.googleapis.com/maps/api/js?key=<%= ENV['GOOGLE_MAPS_JS_API_KEY'] %>&libraries=places"></script>

<footer>
Code is available at <a href="http://github.com/hurricane-response/florence-api">GitHub</a>. Contributors welcome!
</footer>
<script src="https://maps.googleapis.com/maps/api/js?key=<%= ENV['GOOGLE_MAPS_JS_API_KEY'] %>&libraries=places"></script>
<% if ENV["GOOGLE_MAPS_JS_API_KEY"].blank? %>
<script>
<% if ENV["GOOGLE_MAPS_JS_API_KEY"].blank? %>
<script>
console.log("To enable the Google auto-complete, you'll need to set a google maps API key in .env")
</script>
<% end %>
</script>
<% end %>
</body>
</html>
10 changes: 10 additions & 0 deletions app/views/needs/_menu.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<% if admin? %>
<div class="navbar">
<ul>
<li><span><strong>NEEDS: </strong></span></li>
<li><%= link_to "Needs Update Queue", drafts_needs_path %></li>
</ul>
</div>
<% end %>


2 changes: 2 additions & 0 deletions app/views/needs/drafts.html.erb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
<% content_for :sub_menu { render partial:'menu' } %>

<h1>Needs Update Queue</h2>

<%= render "shared/drafts_table", rows: @drafts, columns: @columns, headers: @headers %>
2 changes: 2 additions & 0 deletions app/views/needs/edit.html.erb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
<% content_for :sub_menu { render partial:'menu' } %>

<h1>Edit Need <%= @need.id %></h1>

<%= render 'form', need: @need %>
2 changes: 2 additions & 0 deletions app/views/needs/index.html.erb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
<% content_for :sub_menu { render partial:'menu' } %>

<h1>Needs</h1>

<script type="text/javascript">
Expand Down
2 changes: 2 additions & 0 deletions app/views/needs/new.html.erb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
<% content_for :sub_menu { render partial:'menu' } %>

<h1>New Need</h1>

<%= render 'form', need: @need %>
2 changes: 2 additions & 0 deletions app/views/needs/show.html.erb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
<% content_for :sub_menu { render partial:'menu' } %>

<h1>Need <%= @need.id %></h1>

<%= link_to 'Update', [:edit, @need], class: "button button-clear" %> |
Expand Down
12 changes: 12 additions & 0 deletions app/views/shelters/_menu.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<% if user_signed_in? %>
<div class="navbar">
<ul>
<li><span><strong>SHELTERS: </strong></span></li>
<li><%= link_to "Help Call Shelters", outdated_shelters_path %></li>
<% if admin? %>
<li><%= link_to "Shelters Update Queue", drafts_shelters_path %></li>
<li><%= link_to "Archived Shelters", archived_shelters_path %></li>
<% end %>
</ul>
</div>
<% end %>
2 changes: 2 additions & 0 deletions app/views/shelters/archived.html.erb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
<% content_for :sub_menu { render partial: 'menu' } %>

<h1>Archived Shelters</h1>

<script type="text/javascript">
Expand Down
2 changes: 2 additions & 0 deletions app/views/shelters/drafts.html.erb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
<% content_for :sub_menu { render partial: 'menu' } %>

<h1>Shelters Update Queue</h2>

<%= render "shared/drafts_table", rows: @drafts, columns: @columns, headers: @headers %>
2 changes: 2 additions & 0 deletions app/views/shelters/edit.html.erb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
<% content_for :sub_menu { render partial: 'menu' } %>

<h1>Edit <%= @shelter.shelter %></h1>
<% if admin? %>
<% if @shelter.active %>
Expand Down
2 changes: 2 additions & 0 deletions app/views/shelters/index.html.erb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
<% content_for :sub_menu { render partial: 'menu' } %>

<%= render @page %>
<h1>Shelters</h1>

Expand Down
2 changes: 2 additions & 0 deletions app/views/shelters/new.html.erb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
<% content_for :sub_menu { render partial: 'menu' } %>

<h1>New Shelter</h1>

<%= render 'form', shelter: @shelter %>
2 changes: 2 additions & 0 deletions app/views/shelters/outdated.html.erb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
<% content_for :sub_menu { render partial: 'menu' } %>

<h1>Shelters Needing Updates</h2>

<%= render "shared/table", rows: @outdated, columns: @columns, headers: @headers, reverse_chron: true %>
2 changes: 2 additions & 0 deletions app/views/shelters/show.html.erb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
<% content_for :sub_menu { render partial: 'menu' } %>

<h1><%= @shelter.shelter %></h1>


Expand Down

0 comments on commit 84e7f45

Please sign in to comment.