Add node version pages
This commit is contained in:
parent
e71355c5bb
commit
85c284aaa6
11 changed files with 79 additions and 6 deletions
|
@ -6,6 +6,7 @@ class Ability
|
|||
def initialize(user)
|
||||
can [:relation, :relation_history, :way, :way_history, :node, :node_history,
|
||||
:changeset, :query], :browse
|
||||
can [:show], OldNode
|
||||
can [:show, :new], Note
|
||||
can :search, :direction
|
||||
can [:index, :permalink, :edit, :help, :fixthemap, :offline, :export, :about, :communities, :preview, :copyright, :key, :id], :site
|
||||
|
|
|
@ -355,6 +355,16 @@ $(document).ready(function () {
|
|||
return page;
|
||||
};
|
||||
|
||||
OSM.OldBrowse = function () {
|
||||
var page = {};
|
||||
|
||||
page.pushstate = page.popstate = function (path) {
|
||||
OSM.loadSidebarContent(path);
|
||||
};
|
||||
|
||||
return page;
|
||||
};
|
||||
|
||||
var history = OSM.History(map);
|
||||
|
||||
OSM.router = OSM.Router(map, {
|
||||
|
@ -369,6 +379,7 @@ $(document).ready(function () {
|
|||
"/user/:display_name/history": history,
|
||||
"/note/:id": OSM.Note(map),
|
||||
"/node/:id(/history)": OSM.Browse(map, "node"),
|
||||
"/node/:id/history/:version": OSM.OldBrowse(),
|
||||
"/way/:id(/history)": OSM.Browse(map, "way"),
|
||||
"/relation/:id(/history)": OSM.Browse(map, "relation"),
|
||||
"/changeset/:id": OSM.Changeset(map),
|
||||
|
|
19
app/controllers/old_nodes_controller.rb
Normal file
19
app/controllers/old_nodes_controller.rb
Normal file
|
@ -0,0 +1,19 @@
|
|||
class OldNodesController < ApplicationController
|
||||
layout :map_layout
|
||||
|
||||
before_action :authorize_web
|
||||
before_action :set_locale
|
||||
before_action -> { check_database_readable(:need_api => true) }
|
||||
before_action :require_oauth
|
||||
|
||||
authorize_resource
|
||||
|
||||
around_action :web_timeout
|
||||
|
||||
def show
|
||||
@type = "node"
|
||||
@feature = OldNode.preload(:old_tags, :changeset => [:changeset_tags, :user]).find([params[:id], params[:version]])
|
||||
rescue ActiveRecord::RecordNotFound
|
||||
render :action => "not_found", :status => :not_found
|
||||
end
|
||||
end
|
|
@ -19,7 +19,7 @@
|
|||
</li>
|
||||
<li>
|
||||
<%= t "browse.in_changeset" %>
|
||||
#<%= link_to common_details.changeset_id, :action => :changeset, :id => common_details.changeset_id %>
|
||||
#<%= link_to common_details.changeset_id, changeset_path(common_details.changeset) %>
|
||||
</li>
|
||||
|
||||
<% if @type == "node" and common_details.visible? %>
|
||||
|
@ -33,4 +33,4 @@
|
|||
<% end %>
|
||||
</ul>
|
||||
|
||||
<%= render :partial => "tag_details", :object => common_details.tags %>
|
||||
<%= render :partial => "browse/tag_details", :object => common_details.tags %>
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
</div>
|
||||
<% else %>
|
||||
<div class="browse-section browse-node">
|
||||
<%= render :partial => "common_details", :object => node %>
|
||||
<%= render :partial => "browse/common_details", :object => node %>
|
||||
|
||||
<% unless node.ways.empty? and node.containing_relation_members.empty? %>
|
||||
<h4><%= t "browse.part_of" %></h4>
|
||||
|
@ -17,7 +17,7 @@
|
|||
<summary><%= t "browse.part_of_ways", :count => node.ways.uniq.count %></summary>
|
||||
<ul class="list-unstyled">
|
||||
<% node.ways.uniq.each do |way| %>
|
||||
<li><%= link_to printable_name(way), { :action => "way", :id => way.id.to_s }, { :class => link_class("way", way), :title => link_title(way) } %></li>
|
||||
<li><%= link_to printable_name(way), way_path(way), { :class => link_class("way", way), :title => link_title(way) } %></li>
|
||||
<% end %>
|
||||
</ul>
|
||||
</details>
|
||||
|
@ -26,7 +26,7 @@
|
|||
<details <%= "open" if node.containing_relation_members.count < 10 %>>
|
||||
<summary><%= t "browse.part_of_relations", :count => node.containing_relation_members.uniq.count %></summary>
|
||||
<ul class="list-unstyled">
|
||||
<%= render :partial => "containing_relation", :collection => node.containing_relation_members.uniq %>
|
||||
<%= render :partial => "browse/containing_relation", :collection => node.containing_relation_members.uniq %>
|
||||
</ul>
|
||||
</details>
|
||||
<% end %>
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<h4><%= t ".tags" %></h4>
|
||||
<div class='mb-3 border border-grey rounded overflow-hidden'>
|
||||
<table class='mb-0 browse-tag-list table align-middle text-break'>
|
||||
<%= render :partial => "tag", :collection => tag_details.sort %>
|
||||
<%= render :partial => "browse/tag", :collection => tag_details.sort %>
|
||||
</table>
|
||||
</div>
|
||||
<% end %>
|
||||
|
|
7
app/views/old_nodes/not_found.html.erb
Normal file
7
app/views/old_nodes/not_found.html.erb
Normal file
|
@ -0,0 +1,7 @@
|
|||
<% set_title(t("browse.not_found.title")) %>
|
||||
|
||||
<%= render "sidebar_header", :title => t("browse.not_found.title") %>
|
||||
|
||||
<div>
|
||||
<p><%= t ".sorry", :id => params[:id], :version => params[:version] %></p>
|
||||
</div>
|
5
app/views/old_nodes/show.html.erb
Normal file
5
app/views/old_nodes/show.html.erb
Normal file
|
@ -0,0 +1,5 @@
|
|||
<% set_title t("browse.node.title_html", :name => printable_name(@feature)) %>
|
||||
|
||||
<%= render "sidebar_header", :title => t("browse.node.title_html", :name => printable_name(@feature)) %>
|
||||
|
||||
<%= render :partial => "browse/node", :object => @feature %>
|
Loading…
Add table
Add a link
Reference in a new issue