]> git.openstreetmap.org Git - rails.git/commitdiff
Convert history page to sidebar layout
authorJohn Firebaugh <john.firebaugh@gmail.com>
Sat, 28 Sep 2013 01:05:47 +0000 (18:05 -0700)
committerJohn Firebaugh <john.firebaugh@gmail.com>
Sun, 13 Oct 2013 21:45:58 +0000 (14:45 -0700)
app/assets/javascripts/changeset.js
app/assets/javascripts/index.js
app/assets/stylesheets/common.css.scss
app/controllers/changeset_controller.rb
app/views/changeset/_map.html.erb [deleted file]
app/views/changeset/list.html.erb
config/locales/en.yml

index d9c09bab49ee5a288d200eadad22978a2837a9e5..0aecced85d699e4e9ea7143a32b25b941beeabac 100644 (file)
@@ -1,14 +1,6 @@
-$(document).ready(function () {
+function initializeChangesets(map) {
   var changesets = [], rects = {};
 
-  var map = L.map("changeset_list_map", {
-    attributionControl: false,
-    zoomControl: false
-  }).addLayer(new L.OSM.Mapnik());
-
-  L.OSM.zoom()
-    .addTo(map);
-
   var group = L.featureGroup().addTo(map);
 
   $("[data-changeset]").each(function () {
@@ -60,14 +52,4 @@ $(document).ready(function () {
       unHighlightChangeset($(this).data("changeset").id);
     }
   });
-
-  $(window).scroll(function() {
-        if ($(window).scrollTop() > $('.content-heading').outerHeight() + $('#top-bar').outerHeight() ) {
-            $('#changeset_list_map_wrapper').addClass('scrolled');
-        } else {
-            $('#changeset_list_map_wrapper').removeClass('scrolled');
-        }
-  });
-
-  map.fitBounds(OSM.mapParams().bounds || group.getBounds());
-});
+}
index d09213c5d34b90c458d693d73b1e4051bb6a4791..dff433a8a3e190fed06600a2394c1df09b1f7a8a 100644 (file)
@@ -211,6 +211,8 @@ $(document).ready(function () {
   initializeExport(map);
   initializeBrowse(map, params);
   initializeNotes(map, params);
+
+  if ('undefined' !== typeof initializeChangesets) initializeChangesets(map);
 });
 
 function updateLocation() {
index f9065266b89b84afe004841cb4b453303b62e03a..fe8e4f2385de73e956c2d852f405c28c5c2bb948 100644 (file)
@@ -594,9 +594,7 @@ nav.secondary {
 
 /* Rules for the home page */
 
-.site-export #map,
-.site-index #map,
-.site-edit #map {
+#map {
   height: 100%;
   overflow: hidden;
 }
@@ -927,7 +925,8 @@ ul.results-list li { border-bottom: 1px solid #ccc; }
 
 .site-index,
 .site-export,
-.site-edit {
+.site-edit,
+.changeset-list {
   #content {
     position: absolute;
     top: $headerHeight;
@@ -1081,51 +1080,6 @@ ul.results-list li { border-bottom: 1px solid #ccc; }
 
 /* Rules for the changeset list shown by the history tab etc */
 
-#changeset_list {
-  width: 100%;
-  ul {
-    padding: $lineheight/2 0;
-    margin-bottom: 0px;
-    border-top: 1px solid #ccc;
-    &:last-child {
-      border-bottom: 1px solid #ccc;
-    }
-  }
-  .selected {
-    background: #FFFFC0;
-  }
-  .date,
-  .user {
-    border-left: 1px solid #ccc;
-    padding-left: $lineheight/4;
-    margin-right: $lineheight/4;
-  }
-}
-
-#changeset_list_map_wrapper {
-  position: absolute;
-  width: 50%;
-  height: 490px;
-  top: 0;
-  right: 0;
-}
-
-#changeset_list_map_wrapper.scrolled {
-  position: fixed;
-}
-
-#changeset_list_map {
-  position: absolute;
-  bottom: $lineheight;
-  top: $lineheight;
-  right: $lineheight;
-  left: $lineheight;
-  border: 1px solid #ccc;
-}
-
-#changeset_list_map_wrapper.scrolled #changeset_list_map {
-  margin-left: 93px;
-}
 
 /* Rules for the data browser */
 
index 36b3b5124ed3b725d3cc518f33096dc2150c0cc5..b07ca36ca28d022c1a6e7b749cc151a3fa3e5057 100644 (file)
@@ -296,7 +296,6 @@ class ChangesetController < ApplicationController
 
       if bbox
         changesets = conditions_bbox(changesets, bbox)
-        bbox_link = render_to_string :partial => "bbox", :object => bbox
       end
 
       if user
@@ -305,28 +304,16 @@ class ChangesetController < ApplicationController
 
       if params[:friends] and @user
         @title =  t 'changeset.list.title_friend'
-        @heading =  t 'changeset.list.heading_friend'
-        @description = t 'changeset.list.description_friend'
+        @heading =  t 'changeset.list.title_friend'
       elsif params[:nearby] and @user
         @title = t 'changeset.list.title_nearby'
-        @heading = t 'changeset.list.heading_nearby'
-        @description = t 'changeset.list.description_nearby'
-      elsif user and bbox
-        @title =  t 'changeset.list.title_user_bbox', :user => user.display_name, :bbox => bbox.to_s
-        @heading =  t 'changeset.list.heading_user_bbox', :user => user.display_name, :bbox => bbox.to_s
-        @description = t 'changeset.list.description_user_bbox', :user => user_link, :bbox => bbox_link
+        @heading = t 'changeset.list.title_nearby'
       elsif user
         @title =  t 'changeset.list.title_user', :user => user.display_name
-        @heading =  t 'changeset.list.heading_user', :user => user.display_name
-        @description = t 'changeset.list.description_user', :user => user_link
-      elsif bbox
-        @title =  t 'changeset.list.title_bbox', :bbox => bbox.to_s
-        @heading =  t 'changeset.list.heading_bbox', :bbox => bbox.to_s
-        @description = t 'changeset.list.description_bbox', :bbox => bbox_link
+        @heading =  t('changeset.list.title_user', :user => user_link).html_safe
       else
         @title =  t 'changeset.list.title'
-        @heading =  t 'changeset.list.heading'
-        @description = t 'changeset.list.description'
+        @heading =  t 'changeset.list.title'
       end
 
       @page = (params[:page] || 1).to_i
diff --git a/app/views/changeset/_map.html.erb b/app/views/changeset/_map.html.erb
deleted file mode 100644 (file)
index 9730059..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-<div id="changeset_list_map">
-</div>
index ee8610574be79dfb4c58e553c44571cc15bdeab1..262cae15ff56bdc194f5e1a14edc3beb104693c4 100644 (file)
@@ -1,37 +1,23 @@
 <% content_for :head do -%>
+  <%= javascript_include_tag "index" %>
   <%= javascript_include_tag "changeset" %>
-<% end -%>
-
-<% content_for :heading do %>
-
-  <h1><%= @heading %></h1>
-  <ul class='secondary-actions clearfix'>
-    <li><%= raw(@description) %></li>
-    <% unless params[:friends] or params[:nearby] -%>
-      <li><%= atom_link_to params.merge({ :page => nil, :action => :feed }) %></li>
-    <% end -%>
-  </ul>
 
-<% end %>
+  <% unless params[:friends] or params[:nearby] -%>
+    <%= auto_discovery_link_tag :atom, params.merge({ :page => nil, :action => :feed }) %>
+  <% end -%>
+<% end -%>
 
-<%= render :partial => 'changeset_paging_nav' %>
+<% content_for :sidebar do %>
+  <h2><%= @heading %></h2>
 
-<% if @edits.size > 0 %>
-  <div id='changeset_list_map_wrapper'>
-    <%= render :partial => 'map' %>
-  </div>
-  <div class='column-1'>
+  <% if @edits.size > 0 %>
     <%= render :partial => 'changesets', :locals => { :showusername => !params.has_key?(:display_name) } %>
-  </div>
-  <%= render :partial => 'changeset_paging_nav' %>
-<% elsif @user and @user.display_name == params[:display_name] %>
-  <h4><%= t('changeset.list.empty_user_html') %></h4>
-<% else %>
-  <h4><%= t('changeset.list.empty_anon_html') %></h4>
+    <%= render :partial => 'changeset_paging_nav' %>
+  <% elsif @user and @user.display_name == params[:display_name] %>
+    <h4><%= t('changeset.list.empty_user_html') %></h4>
+  <% else %>
+    <h4><%= t('changeset.list.empty_anon_html') %></h4>
+  <% end %>
 <% end %>
 
-<% unless params[:friends] or params[:nearby] -%>
-  <% content_for :head do -%>
-    <%= auto_discovery_link_tag :atom, params.merge({ :page => nil, :action => :feed }) %>
-  <% end -%>
-<% end -%>
\ No newline at end of file
+<%= render :template => 'layouts/map' %>
index 3afa70365f31ea3cf3e7fb3f6dade421b13b9797..3268e7733d1f84410e990493ca4d5a847bebda31 100644 (file)
@@ -321,22 +321,8 @@ en:
     list:
       title: "Changesets"
       title_user: "Changesets by %{user}"
-      title_bbox: "Changesets within %{bbox}"
-      title_user_bbox: "Changesets by %{user} within %{bbox}"
       title_friend: "Changesets by your friends"
       title_nearby: "Changesets by nearby users"
-      heading: "Changesets"
-      heading_user: "Changesets"
-      heading_bbox: "Changesets"
-      heading_user_bbox: "Changesets"
-      heading_friend: "Changesets"
-      heading_nearby: "Changesets"
-      description: "Browse recent contributions to the map"
-      description_user: "Changesets by %{user}"
-      description_bbox: "Changesets within %{bbox}"
-      description_user_bbox: "Changesets by %{user} within %{bbox}"
-      description_friend: "Changesets by your friends"
-      description_nearby: "Changesets by nearby users"
       empty_user_html: "It looks you haven't made any edits yet. To get started, check out the <a href='http://wiki.openstreetmap.org/wiki/Beginners_Guide_1.3'>Beginners Guide</a>."
       empty_anon_html: "No edits made yet."
     timeout: