Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mild rejig of the browse pages #487

Closed
wants to merge 28 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
bbf5561
browse page: improve css for h4 headings
danstowell Sep 18, 2013
7371ae9
browse page: collect "download xml" & "edit" links w other right-hand…
danstowell Sep 19, 2013
7dc49f3
browse page: collapse "last edited" info rows into a sentence under t…
danstowell Sep 19, 2013
47f7afe
browse page: float browse-nav to right-hand side
danstowell Sep 19, 2013
c2d2b09
browse page: less wordy headers for changeset content panes
danstowell Sep 19, 2013
bebdbae
browse page: express last-edited time as user-friendly "time ago"
danstowell Sep 19, 2013
93fe5a2
browse page: undo my mistaken reordering of divs
danstowell Sep 21, 2013
c881ef4
browse page: no top-border-bar for first child needed now
danstowell Sep 21, 2013
63e1e77
browse page: better way of specifying "time ago" (for i18n)
danstowell Sep 21, 2013
cd8b516
browse page: more approachable headings
danstowell Sep 21, 2013
2da012d
browse page: ensure neat render (no spurious top bar) when no-tags-no…
danstowell Sep 21, 2013
ae5bdb2
browse page: formatting tweaks for small-screen mode
danstowell Sep 22, 2013
43b3f8a
browse page: printable_name() opt args converted to named hash options
danstowell Sep 28, 2013
6c48876
browse page: full rather than "lego" i18n strings for editsummary
danstowell Sep 28, 2013
64b98e0
browse page: reinstate version metadata on history page
danstowell Sep 28, 2013
45a056f
browse page: remove title translations that are now no-op
danstowell Sep 28, 2013
d0b8718
bugfix: remove superfluous bracket in css
danstowell Oct 8, 2013
6e18e76
browse pages: use common "pager" style across large and small
danstowell Oct 8, 2013
83d787a
browse page: improve line-wrapping of the new edit summary
danstowell Oct 8, 2013
f091f75
update locales to remove three browse.*.*_title keys no longer used
danstowell Oct 8, 2013
ca98e8d
fix previous linebreak commit so it looks good on the history pages too
danstowell Oct 8, 2013
8348c4e
browse page: don't show edit summary stats if redacted
danstowell Oct 8, 2013
3af7c2a
browse page: update tests for redactions
danstowell Oct 8, 2013
b94c1c7
browse page: move changeset's when+who info into heading, matching th…
danstowell Oct 27, 2013
471bc62
browse page: fix misaligned "Comment" heading
danstowell Oct 28, 2013
2e043a3
browse page: historylink inside versioninchangeset (not working for h…
danstowell Nov 3, 2013
19469ed
browse page: history link in version text
danstowell Nov 3, 2013
a634f12
browse page: "View history" title for version link
danstowell Nov 4, 2013
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions app/assets/stylesheets/common.css.scss
Original file line number Diff line number Diff line change
Expand Up @@ -1230,6 +1230,10 @@ ul.results-list li { border-bottom: 1px solid #ccc; }
}
}

.edit_summary_chunk {
display: inline-block;
}

/* Rules for small maps in content areas */

.content_map {
Expand Down Expand Up @@ -1301,8 +1305,11 @@ ul.results-list li { border-bottom: 1px solid #ccc; }
border-top: 1px solid #ccc;
margin-top: $lineheight/2;
padding-top: $lineheight/2;
clear: left;
&:first-child {
margin-top: 0;
border-top: 0;
padding-top: 0;
}
.warning {
background-color: #ffe0cc;
Expand All @@ -1324,9 +1331,10 @@ ul.results-list li { border-bottom: 1px solid #ccc; }
}
h4 {
float: left;
width: 33.3333%;
width: 18%;
display: inline-block;
vertical-align: top;
clear: left;
}
}

Expand Down Expand Up @@ -1941,7 +1949,8 @@ ul.secondary-actions {
margin-left: 0;
&.pager {
display: inline-block;
margin-right: 60px;
margin-right: 20px;
float: right;
}
> li {
display: block;
Expand Down
3 changes: 3 additions & 0 deletions app/assets/stylesheets/small.css.scss
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,8 @@ h2, h3, h4 {
#browse_map ul.secondary-actions {
float: right;
font-size: 10px;
margin-left: 5px;
margin-right: 5px;
}

#map {
Expand Down Expand Up @@ -216,6 +218,7 @@ p.search_results_entry {

/* Rules for the browse pages */

.browse_details.common div,
.browse-section.common div{
clear: both;
}
Expand Down
29 changes: 23 additions & 6 deletions app/helpers/browse_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,41 @@ def link_to_page(page, page_param)
return link_to(page, page_param => page)
end

def printable_name(object, version=false)
def printable_name(object, options={})
options = {
:type => false, # :type can be set to a string indicating object type, such as t('browse.way.way')
:version => false
}.merge(options)
if object.id.is_a?(Array)
id = object.id[0]
else
id = object.id
end
name = t 'printable_name.with_id', :id => id.to_s
if version
name = t 'printable_name.with_version', :id => name, :version => object.version.to_s
name = t 'printable_name.with_id', :id => id.to_s, :type => options[:type]
if options[:version]
name = t 'printable_name.with_version', :id => name, :type => options[:type], :version => object.version.to_s
end

# don't look at object tags if redacted, so as to avoid giving
# away redacted version tag information.
unless object.redacted?
nametag = false
if object.tags.include? "name:#{I18n.locale}"
name = t 'printable_name.with_name', :name => object.tags["name:#{I18n.locale}"].to_s, :id => name
nametag = object.tags["name:#{I18n.locale}"].to_s
elsif object.tags.include? 'name'
name = t 'printable_name.with_name', :name => object.tags['name'].to_s, :id => name
nametag = object.tags['name'].to_s
end

if nametag
if options[:type]
name = t 'printable_name.with_name_type', :name => nametag, :type => options[:type], :id => name
else
name = t 'printable_name.with_name', :name => nametag, :id => name
end
else
if options[:type]
name = t 'printable_name.with_type', :type => options[:type], :id => name
end
end
end

Expand Down
27 changes: 4 additions & 23 deletions app/views/browse/_changeset_details.html.erb
Original file line number Diff line number Diff line change
@@ -1,24 +1,5 @@
<div class='column-1'>

<div class='browse-section common'>
<div>
<h4><%= t 'browse.changeset_details.created_at' %></h4>
<p><%= l changeset_details.created_at %></p>
</div>

<div>
<h4><%= t 'browse.changeset_details.closed_at' %></h4>
<p><%= l changeset_details.closed_at %></p>
</div>

<% if changeset_details.user.data_public? %>
<div>
<h4><%= t 'browse.changeset_details.belongs_to' %></h4>
<p><%= link_to h(changeset_details.user.display_name), :controller => "user", :action => "view", :display_name => changeset_details.user.display_name %></p>
</div>
<% end %>
</div>

<%= render :partial => "tag_details", :object => changeset_details %>

<div class='browse-section clearfix'>
Expand All @@ -41,7 +22,7 @@
<h4><%= t 'browse.changeset_details.has_nodes', :count => @node_pages.item_count %></h4>
<ul>
<% @nodes.each do |node| %>
<li><%= link_to h(printable_name(node, true)), { :action => "node", :id => node.node_id.to_s }, :class => link_class('node', node), :title => link_title(node) %></li>
<li><%= link_to h(printable_name(node, {:version => true})), { :action => "node", :id => node.node_id.to_s }, :class => link_class('node', node), :title => link_title(node) %></li>
<% end %>
</ul>
</div>
Expand All @@ -53,7 +34,7 @@
<h4><%= t 'browse.changeset_details.has_ways', :count => @way_pages.item_count %></h4>
<ul>
<% @ways.each do |way| %>
<li><%= link_to h(printable_name(way, true)), { :action => "way", :id => way.way_id.to_s }, :class => link_class('way', way), :title => link_title(way) %></li>
<li><%= link_to h(printable_name(way, {:version => true})), { :action => "way", :id => way.way_id.to_s }, :class => link_class('way', way), :title => link_title(way) %></li>
<% end %>
<%=
#render :partial => "containing_relation", :collection => changeset_details.containing_relation_members
Expand All @@ -68,11 +49,11 @@
<h4><%= t 'browse.changeset_details.has_relations', :count => @relation_pages.item_count %></h4>
<ul>
<% @relations.each do |relation| %>
<li><%= link_to h(printable_name(relation, true)), { :action => "relation", :id => relation.relation_id.to_s }, :class => link_class('relation', relation), :title => link_title(relation) %></li>
<li><%= link_to h(printable_name(relation, {:version => true})), { :action => "relation", :id => relation.relation_id.to_s }, :class => link_class('relation', relation), :title => link_title(relation) %></li>
<% end %>
</ul>
</div>
<%= render :partial => 'paging_nav', :locals => { :pages => @relation_pages, :page_param => "relation_page" } %>
<% end %>

</div>
</div>
44 changes: 9 additions & 35 deletions app/views/browse/_common_details.html.erb
Original file line number Diff line number Diff line change
@@ -1,39 +1,13 @@
<div class='browse-section common'>
<div>
<% if common_details.visible? %>
<h4><%= t 'browse.common_details.edited_at' %></h4>
<% else %>
<h4><%= t 'browse.common_details.deleted_at' %></h4>
<% end %>
<p><%= l common_details.timestamp %></p>
</div>

<% if common_details.changeset.user.data_public? %>
<% if common_details.changeset.tags['comment'].present? or (not common_details.tags.empty?) %>
<div class='browse-section common'>
<div>
<% if common_details.visible? %>
<h4><%= t 'browse.common_details.edited_by' %></h4>
<% else %>
<h4><%= t 'browse.common_details.deleted_by' %></h4>
<%= render :partial => "tag_details", :object => common_details %>
<% if common_details.changeset.tags['comment'].present? %>
<div class='browse-section'>
<h4><%= t 'browse.common_details.changeset_comment' %></h4>
<p><%= linkify(h(common_details.changeset.tags['comment'])) %></p>
</div>
<% end %>
<p><%= link_to h(common_details.changeset.user.display_name), :controller => "user", :action => "view", :display_name => common_details.changeset.user.display_name %></p>
</div>
<% end %>

<div>
<h4><%= t 'browse.common_details.version' %></h4>
<p><%= h(common_details.version) %></p>
</div>

<div>
<h4><%= t 'browse.common_details.in_changeset' %></h4>
<p><%= link_to common_details.changeset_id, :action => :changeset, :id => common_details.changeset_id %></p>
</div>

<% if common_details.changeset.tags['comment'].present? %>
<div>
<h4><%= t 'browse.common_details.changeset_comment' %></h4>
<p><%= linkify(h(common_details.changeset.tags['comment'])) %></p>
</div>
<% end %>
</div>
<%= render :partial => "tag_details", :object => common_details %>
<% end %>
34 changes: 34 additions & 0 deletions app/views/browse/_common_editsummary.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<% if !common_editsummary.redacted? %>
<div class="edit_summary_chunk">
<%
@agohtml = "<abbr title='%s'>%s</abbr>" % [l(common_editsummary.timestamp), t('browse.common_details.ago', :time_in_words_ago => time_ago_in_words(common_editsummary.timestamp))]

if common_editsummary.changeset.user.data_public?
@userhtml = link_to h(common_editsummary.changeset.user.display_name), :controller => "user", :action => "view", :display_name => common_editsummary.changeset.user.display_name
if common_editsummary.visible? %>
<%= raw t 'browse.common_details.edited_ago_by', :time_in_words_ago => @agohtml, :user => @userhtml %>
<% else %>
<%= raw t 'browse.common_details.deleted_ago_by', :time_in_words_ago => @agohtml, :user => @userhtml %>
<% end %>
<% else %>
<% if common_editsummary.visible? %>
<%= raw t 'browse.common_details.edited_ago', :time_in_words_ago => @agohtml %>
<% else %>
<%= raw t 'browse.common_details.deleted_ago', :time_in_words_ago => @agohtml %>
<% end %>
<% end %>
</div>

&middot;

<% if defined? historyaction %>
<div class="edit_summary_chunk"><%= link_to(t('browse.common_details.version', :version => common_editsummary.version), url_for(:action => historyaction), :title => t('browse.common_details.view_history')) %></div>
<% else %>
<div class="edit_summary_chunk"><%= t 'browse.common_details.version', :version => common_editsummary.version %></div>
<% end %>

&middot;

<div class="edit_summary_chunk"><%= raw t 'browse.common_details.in_changeset', :changeset => link_to(common_editsummary.changeset_id, :action => :changeset, :id => common_editsummary.changeset_id) %></div>

<% end %>
2 changes: 1 addition & 1 deletion app/views/browse/_containing_relation.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
else
raw t 'browse.containing_relation.entry_role', :relation_name => linked_name, :relation_role => h(containing_relation.member_role)
end
%></li>
%></li>
35 changes: 35 additions & 0 deletions app/views/browse/_map.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,41 @@
</ul>
<% end %>

<%
if map.instance_of? Changeset
%>
<ul class='secondary-actions clearfix'>
<li><%= link_to(t('browse.changeset.changesetxml'), :controller => "changeset", :action => "read") %></li>
<li><%= link_to(t('browse.changeset.osmchangexml'), :controller => "changeset", :action => "download") %></li>
</ul>
<%
elsif map.instance_of? OldNode
%>
<ul class='secondary-actions clearfix'>
<li><%= link_to(t('browse.node.history.download_xml'), :controller => "old_node", :action => "history") %></li>
</ul>
<%
elsif map.instance_of? OldWay
%>
<ul class='secondary-actions clearfix'>
<li><%= link_to(t('browse.way_history.download_xml'), :controller => "old_way", :action => "history") %></li>
</ul>
<%
elsif map.instance_of? OldRelation
%>
<ul class='secondary-actions clearfix'>
<li><%= link_to(t('browse.relation_history.download_xml'), :controller => "old_relation", :action => "history") %></li>
</ul>
<%
elsif !(map.instance_of? Note)
%>
<ul class='secondary-actions clearfix'>
<li><%= link_to(t('browse.' + map.class.to_s.downcase + '.download_xml'), :controller => map.class.to_s.downcase, :action => "read") %></li>
</ul>
<%
end
%>

<% else %>
<%= t 'browse.map.deleted' %>
<% end %>
Expand Down
6 changes: 3 additions & 3 deletions app/views/browse/_node_details.html.erb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<div class="browse_details" id="<%= node_details.version %>">
<div class="browse_details common" id="<%= node_details.version %>">
<% if node_details.redacted? %>
<div class='browse-section'>
<div class='browse-section redacted'>
<%= t 'browse.redacted.message_html', :type => t('browse.redacted.type.node'), :redaction_link => link_to(t('browse.redacted.redaction', :id => node_details.redaction.id), node_details.redaction), :version => node_details.version %>
</div>
<% else %>
Expand All @@ -18,7 +18,7 @@
<h4><%= t 'browse.node_details.part_of' %></h4>
<ul>
<% node_details.ways.each do |way| %>
<li><%= link_to h(printable_name(way)), { :action => "way", :id => way.id.to_s }, :class => link_class('way', way), :title => link_title(way) %></li>
<li><%= link_to h(printable_name(way, {:type => t('browse.way.way')})), { :action => "way", :id => way.id.to_s }, :class => link_class('way', way), :title => link_title(way) %></li>
<% end %>
<%= render :partial => "containing_relation", :collection => node_details.containing_relation_members %>
</ul>
Expand Down
2 changes: 1 addition & 1 deletion app/views/browse/_relation_details.html.erb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<div class="browse_details" id="<%= relation_details.version %>">
<% if relation_details.redacted? %>
<div class='browse-section'>
<div class='browse-section redacted'>
<%= t 'browse.redacted.message_html', :type => t('browse.redacted.type.relation'), :redaction_link => link_to(t('browse.redacted.redaction', :id => relation_details.redaction.id), relation_details.redaction), :version => relation_details.version %><
</div>
<% else %>
Expand Down
2 changes: 1 addition & 1 deletion app/views/browse/_relation_member.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@
else
raw t'browse.relation_member.entry_role', :type => type_str, :name => linked_name, :role => h(relation_member.member_role)
end
%></li>
%></li>
2 changes: 1 addition & 1 deletion app/views/browse/_way_details.html.erb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<div class="browse_details" id="<%= way_details.version %>">
<% if way_details.redacted? %>
<div class='browse-section'>
<div class='browse-section redacted'>
<%= t 'browse.redacted.message_html', :type => t('browse.redacted.type.way'), :redaction_link => link_to(t('browse.redacted.redaction', :id => way_details.redaction.id), way_details.redaction), :version => way_details.version %>
</div>
<% else %>
Expand Down
22 changes: 16 additions & 6 deletions app/views/browse/changeset.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,25 @@

<% content_for :heading do %>
<h2><%= t 'browse.changeset.changeset', :id => @changeset.id %></h2>
<ul class='secondary-actions clearfix'>
<li><%= link_to(t('browse.changeset.changesetxml'), :controller => "changeset", :action => "read") %></li>
<li><%= link_to(t('browse.changeset.osmchangexml'), :controller => "changeset", :action => "download") %></li>
</ul>
<%= render :partial => "navigation" %>

<div class="edit_summary_chunk"><%
# this div is analogous to _common_editsummary.html.erb
@createdagohtml = "<abbr title='%s'>%s</abbr>" % [l(@changeset.created_at), t('browse.common_details.ago', :time_in_words_ago => time_ago_in_words(@changeset.created_at))]
@closedagohtml = "<abbr title='%s'>%s</abbr>" % [l(@changeset.closed_at), t('browse.common_details.ago', :time_in_words_ago => time_ago_in_words(@changeset.closed_at ))]

if @changeset.user.data_public?
@userhtml = link_to h(@changeset.user.display_name), :controller => "user", :action => "view", :display_name => @changeset.user.display_name %>
<%= raw t 'browse.changeset.created_closed_ago_by', :created_in_words_ago => @createdagohtml, :closed_in_words_ago => @closedagohtml, :user => @userhtml %>
<% else %>
<%= raw t 'browse.changeset.created_closed_ago', :created_in_words_ago => @createdagohtml, :closed_in_words_ago => @closedagohtml %>
<% end %>
</div>
<!-- end equiv to common_editsummary -->

<%= render :partial => "navigation" %>
<% end %>

<% if @changeset.has_valid_bbox? %>
<%= render :partial => "map", :object => @changeset %>
<% end %>
<%= render :partial => "changeset_details", :object => @changeset %>
<%= render :partial => "changeset_details", :object => @changeset %>
Loading