]> git.openstreetmap.org Git - rails.git/blobdiff - app/views/users/show.html.erb
Add links to days in user history from heatmap
[rails.git] / app / views / users / show.html.erb
index a32f5fae1e071337716f945fbd5b531093cd3e92..5ee0c190081ba4ebad035c5f6ec9f235d6e6d55f 100644 (file)
@@ -1,3 +1,7 @@
+<% content_for :head do %>
+  <%= stylesheet_link_tag "cal-heatmap/dist/cal-heatmap" %>
+  <%= javascript_include_tag "heatmap" %>
+<% end %>
 <% content_for :heading do %>
   <div class="row">
     <div class="col-sm-auto">
@@ -30,7 +34,7 @@
               <span class='badge count-number'><%= number_with_delimiter(current_user.diary_comments.size) %></span>
             </li>
             <li>
-              <%= link_to t(".my_account"), edit_account_path %>
+              <%= link_to t(".my_account"), account_path %>
             </li>
 
             <% if current_user.blocks.exists? %>
 
 <div class="richtext text-break clearfix"><%= @user.description.to_html %></div>
 
+<% if @heatmap_data.present? %>
+  <div class="row">
+    <div class="col overflow-auto">
+      <div class="heatmap-wrapper d-flex align-items-start">
+        <!-- Labels -->
+        <ul class="list-unstyled d-flex flex-column justify-content-between ch-domain-text mb-0 mt-4">
+          <li>&nbsp;</li>
+          <li><%= t("date.abbr_day_names")[1] %></li>
+          <li>&nbsp;</li>
+          <li><%= t("date.abbr_day_names")[3] %></li>
+          <li>&nbsp;</li>
+          <li><%= t("date.abbr_day_names")[5] %></li>
+          <li>&nbsp;</li>
+        </ul>
+        <!-- Heatmap -->
+        <div id="cal-heatmap" class="ms-2"
+          data-heatmap="<%= @heatmap_data.to_json %>" data-display-name="<%= @user.display_name %>">
+        </div>
+      </div>
+    </div>
+  </div>
+<% end %>
+
 <% if current_user and @user.id == current_user.id %>
   <div class="my-3">
     <%= link_to t(".edit_profile"), edit_profile_path, :class => "btn btn-outline-primary" %>