Merge branch 'master' into notes-search
This commit is contained in:
commit
083500f056
333 changed files with 24215 additions and 11784 deletions
|
@ -12,7 +12,7 @@
|
|||
//= require leaflet.map
|
||||
//= require leaflet.zoom
|
||||
//= require leaflet.locationfilter
|
||||
//= require i18n/translations
|
||||
//= require i18n
|
||||
//= require oauth
|
||||
//= require piwik
|
||||
//= require richtext
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
//= require leaflet
|
||||
//= require leaflet.osm
|
||||
//= require i18n/translations
|
||||
//= require i18n
|
||||
//= require i18n/embed
|
||||
|
||||
window.onload = function () {
|
||||
if (navigator.languages) {
|
||||
|
|
|
@ -187,12 +187,12 @@ $(document).ready(function () {
|
|||
$.cookie('_osm_location', OSM.locationCookie(map), { expires: expiry, path: '/' });
|
||||
});
|
||||
|
||||
if ($.cookie('_osm_welcome') === 'hide') {
|
||||
$('.welcome').hide();
|
||||
if ($.cookie('_osm_welcome') !== 'hide') {
|
||||
$('.welcome').addClass('visible');
|
||||
}
|
||||
|
||||
$('.welcome .close-wrap').on('click', function() {
|
||||
$('.welcome').hide();
|
||||
$('.welcome').removeClass('visible');
|
||||
$.cookie('_osm_welcome', 'hide', { expires: expiry, path: '/' });
|
||||
});
|
||||
|
||||
|
|
|
@ -49,7 +49,7 @@ OSM.initializeContextMenu = function (map) {
|
|||
lat = latlng.lat.toFixed(precision),
|
||||
lng = latlng.lng.toFixed(precision);
|
||||
|
||||
OSM.router.route("/search?query=" + encodeURIComponent(lat + "," + lng));
|
||||
OSM.router.route("/search?whereami=1&query=" + encodeURIComponent(lat + "," + lng));
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
@ -97,9 +97,25 @@ OSM.History = function(map) {
|
|||
$("[data-changeset]").each(function () {
|
||||
var changeset = $(this).data('changeset');
|
||||
if (changeset.bbox) {
|
||||
changeset.bounds = L.latLngBounds(
|
||||
[changeset.bbox.minlat, changeset.bbox.minlon],
|
||||
[changeset.bbox.maxlat, changeset.bbox.maxlon]);
|
||||
var latWidth = changeset.bbox.maxlat - changeset.bbox.minlat,
|
||||
lonWidth = changeset.bbox.maxlon - changeset.bbox.minlon,
|
||||
minLatWidth = 0.0004,
|
||||
minLonWidth = 0.0008;
|
||||
|
||||
var bounds = [[changeset.bbox.minlat, changeset.bbox.minlon],
|
||||
[changeset.bbox.maxlat, changeset.bbox.maxlon]];
|
||||
|
||||
if (latWidth < minLatWidth) {
|
||||
bounds[0][0] -= ((minLatWidth - latWidth) / 2);
|
||||
bounds[1][0] += ((minLatWidth - latWidth) / 2);
|
||||
}
|
||||
|
||||
if (lonWidth < minLonWidth) {
|
||||
bounds[0][1] -= ((minLonWidth - lonWidth) / 2);
|
||||
bounds[1][1] += ((minLonWidth - lonWidth) / 2);
|
||||
}
|
||||
|
||||
changeset.bounds = L.latLngBounds(bounds);
|
||||
changesets.push(changeset);
|
||||
}
|
||||
});
|
||||
|
|
|
@ -34,7 +34,7 @@ OSM.Search = function(map) {
|
|||
e.preventDefault();
|
||||
var center = map.getCenter().wrap(),
|
||||
precision = OSM.zoomPrecision(map.getZoom());
|
||||
OSM.router.route("/search?query=" + encodeURIComponent(
|
||||
OSM.router.route("/search?whereami=1&query=" + encodeURIComponent(
|
||||
center.lat.toFixed(precision) + "," + center.lng.toFixed(precision)
|
||||
));
|
||||
});
|
||||
|
|
|
@ -61,6 +61,12 @@ L.OSM.Map = L.Map.extend({
|
|||
code: "G",
|
||||
name: I18n.t("javascripts.map.base.gps")
|
||||
});
|
||||
|
||||
this.on("layeradd", function (event) {
|
||||
if (this.baseLayers.indexOf(event.layer) >= 0) {
|
||||
this.setMaxZoom(event.layer.options.maxZoom);
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
updateLayers: function(layerParam) {
|
||||
|
|
|
@ -611,11 +611,18 @@ body.compact {
|
|||
height: auto;
|
||||
overflow: hidden;
|
||||
|
||||
#banner,
|
||||
.welcome {
|
||||
#banner {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.welcome {
|
||||
display: none;
|
||||
|
||||
&.visible {
|
||||
display: block;
|
||||
}
|
||||
}
|
||||
|
||||
#sidebar_content {
|
||||
display: none;
|
||||
}
|
||||
|
@ -971,6 +978,8 @@ header .search_forms,
|
|||
|
||||
img.button {
|
||||
display: block;
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
}
|
||||
|
||||
span.force_width {
|
||||
|
@ -1393,9 +1402,9 @@ tr.turn:hover {
|
|||
|
||||
/* Overrides for pages that use new layout conventions */
|
||||
|
||||
.user-new,
|
||||
.user-create,
|
||||
.user-terms {
|
||||
.users-new,
|
||||
.users-create,
|
||||
.users-terms {
|
||||
.content-body .content-inner {
|
||||
padding: 0;
|
||||
|
||||
|
@ -1406,10 +1415,10 @@ tr.turn:hover {
|
|||
}
|
||||
}
|
||||
|
||||
.user-new,
|
||||
.user-create,
|
||||
.user-terms,
|
||||
.user-confirm {
|
||||
.users-new,
|
||||
.users-create,
|
||||
.users-terms,
|
||||
.users-confirm {
|
||||
.content-heading .content-inner {
|
||||
height: 200px;
|
||||
}
|
||||
|
@ -1501,7 +1510,7 @@ tr.turn:hover {
|
|||
|
||||
/* Rules for the trace view */
|
||||
|
||||
.trace-view {
|
||||
.trace-show {
|
||||
.trace_pending {
|
||||
color: red;
|
||||
}
|
||||
|
@ -1585,7 +1594,7 @@ tr.turn:hover {
|
|||
margin-left: 70px;
|
||||
}
|
||||
|
||||
.user-view {
|
||||
.users-show {
|
||||
// Silly exception; remove when user page is redesigned.
|
||||
.content-inner {
|
||||
max-width: none;
|
||||
|
@ -1712,7 +1721,7 @@ tr.turn:hover {
|
|||
}
|
||||
}
|
||||
|
||||
.diary_entry-view img.user_thumbnail {
|
||||
.diary_entry-show img.user_thumbnail {
|
||||
float: left;
|
||||
}
|
||||
|
||||
|
@ -1736,7 +1745,7 @@ tr.turn:hover {
|
|||
|
||||
/* Rules for the account confirmation page */
|
||||
|
||||
.user-terms {
|
||||
.users-terms {
|
||||
.legale {
|
||||
border: 1px solid #ccc;
|
||||
padding: $lineheight;
|
||||
|
|
|
@ -126,9 +126,12 @@ body.small {
|
|||
}
|
||||
}
|
||||
|
||||
#sidebar .welcome,
|
||||
#sidebar #banner {
|
||||
display: none !important;
|
||||
.overlay-sidebar #sidebar .welcome.visible {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.overlay-sidebar #sidebar #banner {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.leaflet-top.leaflet-right {
|
||||
|
|
|
@ -143,6 +143,7 @@ class AmfController < ApplicationController
|
|||
|
||||
if cstags
|
||||
return -1, "One of the tags is invalid. Linux users may need to upgrade to Flash Player 10.1." unless tags_ok(cstags)
|
||||
|
||||
cstags = strip_non_xml_chars cstags
|
||||
end
|
||||
|
||||
|
@ -471,7 +472,7 @@ class AmfController < ApplicationController
|
|||
return -1, t("application.setup_user_auth.blocked") if user.blocks.active.exists?
|
||||
|
||||
query = Trace.visible_to(user)
|
||||
query = if searchterm.to_i > 0
|
||||
query = if searchterm.to_i.positive?
|
||||
query.where(:id => searchterm.to_i)
|
||||
else
|
||||
query.where("MATCH(name) AGAINST (?)", searchterm).limit(21)
|
||||
|
@ -497,6 +498,7 @@ class AmfController < ApplicationController
|
|||
rel = Relation.where(:id => relid).first
|
||||
|
||||
return [-4, "relation", relid] if rel.nil? || !rel.visible
|
||||
|
||||
[0, "", relid, rel.tags, rel.members, rel.version]
|
||||
end
|
||||
end
|
||||
|
@ -506,9 +508,9 @@ class AmfController < ApplicationController
|
|||
|
||||
def findrelations(searchterm)
|
||||
rels = []
|
||||
if searchterm.to_i > 0
|
||||
if searchterm.to_i.positive?
|
||||
rel = Relation.where(:id => searchterm.to_i).first
|
||||
rels.push([rel.id, rel.tags, rel.members, rel.version]) if rel && rel.visible
|
||||
rels.push([rel.id, rel.tags, rel.members, rel.version]) if rel&.visible
|
||||
else
|
||||
RelationTag.where("v like ?", "%#{searchterm}%").limit(11).each do |t|
|
||||
rels.push([t.relation.id, t.relation.tags, t.relation.members, t.relation.version]) if t.relation.visible
|
||||
|
@ -533,6 +535,7 @@ class AmfController < ApplicationController
|
|||
return -1, "You must accept the contributor terms before you can edit." if REQUIRE_TERMS_AGREED && user.terms_agreed.nil?
|
||||
|
||||
return -1, "One of the tags is invalid. Linux users may need to upgrade to Flash Player 10.1." unless tags_ok(tags)
|
||||
|
||||
tags = strip_non_xml_chars tags
|
||||
|
||||
relid = relid.to_i
|
||||
|
@ -542,7 +545,7 @@ class AmfController < ApplicationController
|
|||
relation = nil
|
||||
Relation.transaction do
|
||||
# create a new relation, or find the existing one
|
||||
relation = Relation.find(relid) if relid > 0
|
||||
relation = Relation.find(relid) if relid.positive?
|
||||
# We always need a new node, based on the data that has been sent to us
|
||||
new_relation = Relation.new
|
||||
|
||||
|
@ -550,7 +553,7 @@ class AmfController < ApplicationController
|
|||
typedmembers = []
|
||||
members.each do |m|
|
||||
mid = m[1].to_i
|
||||
if mid < 0
|
||||
if mid.negative?
|
||||
mid = renumberednodes[mid] if m[0] == "Node"
|
||||
mid = renumberedways[mid] if m[0] == "Way"
|
||||
end
|
||||
|
@ -622,6 +625,7 @@ class AmfController < ApplicationController
|
|||
return -2, "Server error - way is only #{pointlist.length} points long." if pointlist.length < 2
|
||||
|
||||
return -1, "One of the tags is invalid. Linux users may need to upgrade to Flash Player 10.1." unless tags_ok(attributes)
|
||||
|
||||
attributes = strip_non_xml_chars attributes
|
||||
|
||||
originalway = originalway.to_i
|
||||
|
@ -651,6 +655,7 @@ class AmfController < ApplicationController
|
|||
|
||||
# fixup node tags in a way as well
|
||||
return -1, "One of the tags is invalid. Linux users may need to upgrade to Flash Player 10.1." unless tags_ok(node.tags)
|
||||
|
||||
node.tags = strip_non_xml_chars node.tags
|
||||
|
||||
node.tags.delete("created_by")
|
||||
|
@ -728,6 +733,7 @@ class AmfController < ApplicationController
|
|||
return -1, "You must accept the contributor terms before you can edit." if REQUIRE_TERMS_AGREED && user.terms_agreed.nil?
|
||||
|
||||
return -1, "One of the tags is invalid. Linux users may need to upgrade to Flash Player 10.1." unless tags_ok(tags)
|
||||
|
||||
tags = strip_non_xml_chars tags
|
||||
|
||||
id = id.to_i
|
||||
|
@ -735,7 +741,7 @@ class AmfController < ApplicationController
|
|||
node = nil
|
||||
new_node = nil
|
||||
Node.transaction do
|
||||
if id > 0
|
||||
if id.positive?
|
||||
begin
|
||||
node = Node.find(id)
|
||||
rescue ActiveRecord::RecordNotFound
|
||||
|
@ -883,12 +889,10 @@ class AmfController < ApplicationController
|
|||
# in the +tags+ hash.
|
||||
def strip_non_xml_chars(tags)
|
||||
new_tags = {}
|
||||
unless tags.nil?
|
||||
tags.each do |k, v|
|
||||
new_k = k.delete "\000-\037\ufffe\uffff", "^\011\012\015"
|
||||
new_v = v.delete "\000-\037\ufffe\uffff", "^\011\012\015"
|
||||
new_tags[new_k] = new_v
|
||||
end
|
||||
tags&.each do |k, v|
|
||||
new_k = k.delete "\000-\037\ufffe\uffff", "^\011\012\015"
|
||||
new_v = v.delete "\000-\037\ufffe\uffff", "^\011\012\015"
|
||||
new_tags[new_k] = new_v
|
||||
end
|
||||
new_tags
|
||||
end
|
||||
|
|
|
@ -67,7 +67,7 @@ class ApiController < ApplicationController
|
|||
if gpx_file.identifiable?
|
||||
track << (XML::Node.new("name") << gpx_file.name)
|
||||
track << (XML::Node.new("desc") << gpx_file.description)
|
||||
track << (XML::Node.new("url") << url_for(:controller => "traces", :action => "view", :display_name => gpx_file.user.display_name, :id => gpx_file.id))
|
||||
track << (XML::Node.new("url") << url_for(:controller => "traces", :action => "show", :display_name => gpx_file.user.display_name, :id => gpx_file.id))
|
||||
end
|
||||
else
|
||||
# use the anonymous track segment if the user hasn't allowed
|
||||
|
|
|
@ -17,16 +17,16 @@ class ApplicationController < ActionController::Base
|
|||
session.delete(:user)
|
||||
session_expires_automatically
|
||||
|
||||
redirect_to :controller => "user", :action => "suspended"
|
||||
redirect_to :controller => "users", :action => "suspended"
|
||||
|
||||
# don't allow access to any auth-requiring part of the site unless
|
||||
# the new CTs have been seen (and accept/decline chosen).
|
||||
elsif !current_user.terms_seen && flash[:skip_terms].nil?
|
||||
flash[:notice] = t "user.terms.you need to accept or decline"
|
||||
if params[:referer]
|
||||
redirect_to :controller => "user", :action => "terms", :referer => params[:referer]
|
||||
redirect_to :controller => "users", :action => "terms", :referer => params[:referer]
|
||||
else
|
||||
redirect_to :controller => "user", :action => "terms", :referer => request.fullpath
|
||||
redirect_to :controller => "users", :action => "terms", :referer => request.fullpath
|
||||
end
|
||||
end
|
||||
elsif session[:token]
|
||||
|
@ -41,7 +41,7 @@ class ApplicationController < ActionController::Base
|
|||
def require_user
|
||||
unless current_user
|
||||
if request.get?
|
||||
redirect_to :controller => "user", :action => "login", :referer => request.fullpath
|
||||
redirect_to :controller => "users", :action => "login", :referer => request.fullpath
|
||||
else
|
||||
head :forbidden
|
||||
end
|
||||
|
@ -283,8 +283,7 @@ class ApplicationController < ActionController::Base
|
|||
# TODO: some sort of escaping of problem characters in the message
|
||||
response.headers["Error"] = message
|
||||
|
||||
if request.headers["X-Error-Format"] &&
|
||||
request.headers["X-Error-Format"].casecmp("xml").zero?
|
||||
if request.headers["X-Error-Format"]&.casecmp("xml")&.zero?
|
||||
result = OSM::API.new.get_xml_doc
|
||||
result.root.name = "osmError"
|
||||
result.root << (XML::Node.new("status") << "#{Rack::Utils.status_code(status)} #{Rack::Utils::HTTP_STATUS_CODES[status]}")
|
||||
|
@ -310,7 +309,7 @@ class ApplicationController < ActionController::Base
|
|||
helper_method :preferred_languages
|
||||
|
||||
def set_locale(reset = false)
|
||||
if current_user && current_user.languages.empty? && !http_accept_language.user_preferred_languages.empty?
|
||||
if current_user&.languages&.empty? && !http_accept_language.user_preferred_languages.empty?
|
||||
current_user.languages = http_accept_language.user_preferred_languages
|
||||
current_user.save
|
||||
end
|
||||
|
@ -387,11 +386,11 @@ class ApplicationController < ActionController::Base
|
|||
##
|
||||
# render a "no such user" page
|
||||
def render_unknown_user(name)
|
||||
@title = t "user.no_such_user.title"
|
||||
@title = t "users.no_such_user.title"
|
||||
@not_found_user = name
|
||||
|
||||
respond_to do |format|
|
||||
format.html { render :template => "user/no_such_user", :status => :not_found }
|
||||
format.html { render :template => "users/no_such_user", :status => :not_found }
|
||||
format.all { head :not_found }
|
||||
end
|
||||
end
|
||||
|
@ -435,7 +434,7 @@ class ApplicationController < ActionController::Base
|
|||
def preferred_editor
|
||||
editor = if params[:editor]
|
||||
params[:editor]
|
||||
elsif current_user && current_user.preferred_editor
|
||||
elsif current_user&.preferred_editor
|
||||
current_user.preferred_editor
|
||||
else
|
||||
DEFAULT_EDITOR
|
||||
|
|
|
@ -58,7 +58,7 @@ class BrowseController < ApplicationController
|
|||
def changeset
|
||||
@type = "changeset"
|
||||
@changeset = Changeset.find(params[:id])
|
||||
@comments = if current_user && current_user.moderator?
|
||||
@comments = if current_user&.moderator?
|
||||
@changeset.comments.unscope(:where => :visible).includes(:author)
|
||||
else
|
||||
@changeset.comments.includes(:author)
|
||||
|
@ -77,7 +77,7 @@ class BrowseController < ApplicationController
|
|||
def note
|
||||
@type = "note"
|
||||
|
||||
if current_user && current_user.moderator?
|
||||
if current_user&.moderator?
|
||||
@note = Note.find(params[:id])
|
||||
@note_comments = @note.comments.unscope(:where => :visible)
|
||||
else
|
||||
|
|
|
@ -4,19 +4,19 @@ class ChangesetController < ApplicationController
|
|||
layout "site"
|
||||
require "xml/libxml"
|
||||
|
||||
skip_before_action :verify_authenticity_token, :except => [:list]
|
||||
before_action :authorize_web, :only => [:list, :feed, :comments_feed]
|
||||
before_action :set_locale, :only => [:list, :feed, :comments_feed]
|
||||
skip_before_action :verify_authenticity_token, :except => [:index]
|
||||
before_action :authorize_web, :only => [:index, :feed, :comments_feed]
|
||||
before_action :set_locale, :only => [:index, :feed, :comments_feed]
|
||||
before_action :authorize, :only => [:create, :update, :upload, :close, :comment, :subscribe, :unsubscribe, :hide_comment, :unhide_comment]
|
||||
before_action :require_moderator, :only => [:hide_comment, :unhide_comment]
|
||||
before_action :require_allow_write_api, :only => [:create, :update, :upload, :close, :comment, :subscribe, :unsubscribe, :hide_comment, :unhide_comment]
|
||||
before_action :require_public_data, :only => [:create, :update, :upload, :close, :comment, :subscribe, :unsubscribe]
|
||||
before_action :check_api_writable, :only => [:create, :update, :upload, :comment, :subscribe, :unsubscribe, :hide_comment, :unhide_comment]
|
||||
before_action :check_api_readable, :except => [:create, :update, :upload, :download, :query, :list, :feed, :comment, :subscribe, :unsubscribe, :comments_feed]
|
||||
before_action(:only => [:list, :feed, :comments_feed]) { |c| c.check_database_readable(true) }
|
||||
around_action :api_call_handle_error, :except => [:list, :feed, :comments_feed]
|
||||
around_action :api_call_timeout, :except => [:list, :feed, :comments_feed, :upload]
|
||||
around_action :web_timeout, :only => [:list, :feed, :comments_feed]
|
||||
before_action :check_api_readable, :except => [:create, :update, :upload, :download, :query, :index, :feed, :comment, :subscribe, :unsubscribe, :comments_feed]
|
||||
before_action(:only => [:index, :feed, :comments_feed]) { |c| c.check_database_readable(true) }
|
||||
around_action :api_call_handle_error, :except => [:index, :feed, :comments_feed]
|
||||
around_action :api_call_timeout, :except => [:index, :feed, :comments_feed, :upload]
|
||||
around_action :web_timeout, :only => [:index, :feed, :comments_feed]
|
||||
|
||||
# Helper methods for checking consistency
|
||||
include ConsistencyValidations
|
||||
|
@ -255,7 +255,7 @@ class ChangesetController < ApplicationController
|
|||
|
||||
##
|
||||
# list non-empty changesets in reverse chronological order
|
||||
def list
|
||||
def index
|
||||
@params = params.permit(:display_name, :bbox, :friends, :nearby, :max_id, :list)
|
||||
|
||||
if request.format == :atom && @params[:max_id]
|
||||
|
@ -300,14 +300,14 @@ class ChangesetController < ApplicationController
|
|||
|
||||
@edits = changesets.order("changesets.id DESC").limit(20).preload(:user, :changeset_tags, :comments)
|
||||
|
||||
render :action => :list, :layout => false
|
||||
render :action => :index, :layout => false
|
||||
end
|
||||
end
|
||||
|
||||
##
|
||||
# list edits as an atom feed
|
||||
def feed
|
||||
list
|
||||
index
|
||||
end
|
||||
|
||||
##
|
||||
|
@ -481,6 +481,7 @@ class ChangesetController < ApplicationController
|
|||
u = if name.nil?
|
||||
# user input checking, we don't have any UIDs < 1
|
||||
raise OSM::APIBadUserInput, "invalid user ID" if user.to_i < 1
|
||||
|
||||
u = User.find(user.to_i)
|
||||
else
|
||||
u = User.find_by(:display_name => name)
|
||||
|
@ -581,7 +582,7 @@ class ChangesetController < ApplicationController
|
|||
# Get the maximum number of comments to return
|
||||
def comments_limit
|
||||
if params[:limit]
|
||||
if params[:limit].to_i > 0 && params[:limit].to_i <= 10000
|
||||
if params[:limit].to_i.positive? && params[:limit].to_i <= 10000
|
||||
params[:limit].to_i
|
||||
else
|
||||
raise OSM::APIBadUserInput, "Comments limit must be between 1 and 10000"
|
||||
|
|
|
@ -4,11 +4,11 @@ class DiaryEntryController < ApplicationController
|
|||
before_action :authorize_web
|
||||
before_action :set_locale
|
||||
before_action :require_user, :only => [:new, :edit, :comment, :hide, :hidecomment, :subscribe, :unsubscribe]
|
||||
before_action :lookup_user, :only => [:view, :comments]
|
||||
before_action :lookup_user, :only => [:show, :comments]
|
||||
before_action :check_database_readable
|
||||
before_action :check_database_writable, :only => [:new, :edit, :comment, :hide, :hidecomment, :subscribe, :unsubscribe]
|
||||
before_action :require_administrator, :only => [:hide, :hidecomment]
|
||||
before_action :allow_thirdparty_images, :only => [:new, :edit, :list, :view, :comments]
|
||||
before_action :allow_thirdparty_images, :only => [:new, :edit, :index, :show, :comments]
|
||||
|
||||
def new
|
||||
@title = t "diary_entry.new.title"
|
||||
|
@ -29,7 +29,7 @@ class DiaryEntryController < ApplicationController
|
|||
# Subscribe user to diary comments
|
||||
@diary_entry.subscriptions.create(:user => current_user)
|
||||
|
||||
redirect_to :action => "list", :display_name => current_user.display_name
|
||||
redirect_to :action => "index", :display_name => current_user.display_name
|
||||
else
|
||||
render :action => "edit"
|
||||
end
|
||||
|
@ -47,9 +47,9 @@ class DiaryEntryController < ApplicationController
|
|||
@diary_entry = DiaryEntry.find(params[:id])
|
||||
|
||||
if current_user != @diary_entry.user
|
||||
redirect_to :action => "view", :id => params[:id]
|
||||
redirect_to diary_entry_path(@diary_entry.user, @diary_entry)
|
||||
elsif params[:diary_entry] && @diary_entry.update(entry_params)
|
||||
redirect_to :action => "view", :id => params[:id]
|
||||
redirect_to diary_entry_path(@diary_entry.user, @diary_entry)
|
||||
end
|
||||
|
||||
set_map_location
|
||||
|
@ -71,9 +71,9 @@ class DiaryEntryController < ApplicationController
|
|||
# Add the commenter to the subscribers if necessary
|
||||
@entry.subscriptions.create(:user => current_user) unless @entry.subscribers.exists?(current_user.id)
|
||||
|
||||
redirect_to :action => "view", :display_name => @entry.user.display_name, :id => @entry.id
|
||||
redirect_to diary_entry_path(@entry.user, @entry)
|
||||
else
|
||||
render :action => "view"
|
||||
render :action => "show"
|
||||
end
|
||||
rescue ActiveRecord::RecordNotFound
|
||||
render :action => "no_such_entry", :status => :not_found
|
||||
|
@ -84,7 +84,7 @@ class DiaryEntryController < ApplicationController
|
|||
|
||||
diary_entry.subscriptions.create(:user => current_user) unless diary_entry.subscribers.exists?(current_user.id)
|
||||
|
||||
redirect_to :action => "view", :display_name => diary_entry.user.display_name, :id => diary_entry.id
|
||||
redirect_to diary_entry_path(diary_entry.user, diary_entry)
|
||||
rescue ActiveRecord::RecordNotFound
|
||||
render :action => "no_such_entry", :status => :not_found
|
||||
end
|
||||
|
@ -94,17 +94,17 @@ class DiaryEntryController < ApplicationController
|
|||
|
||||
diary_entry.subscriptions.where(:user => current_user).delete_all if diary_entry.subscribers.exists?(current_user.id)
|
||||
|
||||
redirect_to :action => "view", :display_name => diary_entry.user.display_name, :id => diary_entry.id
|
||||
redirect_to diary_entry_path(diary_entry.user, diary_entry)
|
||||
rescue ActiveRecord::RecordNotFound
|
||||
render :action => "no_such_entry", :status => :not_found
|
||||
end
|
||||
|
||||
def list
|
||||
def index
|
||||
if params[:display_name]
|
||||
@user = User.active.find_by(:display_name => params[:display_name])
|
||||
|
||||
if @user
|
||||
@title = t "diary_entry.list.user_title", :user => @user.display_name
|
||||
@title = t "diary_entry.index.user_title", :user => @user.display_name
|
||||
@entries = @user.diary_entries
|
||||
else
|
||||
render_unknown_user params[:display_name]
|
||||
|
@ -112,7 +112,7 @@ class DiaryEntryController < ApplicationController
|
|||
end
|
||||
elsif params[:friends]
|
||||
if current_user
|
||||
@title = t "diary_entry.list.title_friends"
|
||||
@title = t "diary_entry.index.title_friends"
|
||||
@entries = DiaryEntry.where(:user_id => current_user.friend_users)
|
||||
else
|
||||
require_user
|
||||
|
@ -120,7 +120,7 @@ class DiaryEntryController < ApplicationController
|
|||
end
|
||||
elsif params[:nearby]
|
||||
if current_user
|
||||
@title = t "diary_entry.list.title_nearby"
|
||||
@title = t "diary_entry.index.title_nearby"
|
||||
@entries = DiaryEntry.where(:user_id => current_user.nearby)
|
||||
else
|
||||
require_user
|
||||
|
@ -130,10 +130,10 @@ class DiaryEntryController < ApplicationController
|
|||
@entries = DiaryEntry.joins(:user).where(:users => { :status => %w[active confirmed] })
|
||||
|
||||
if params[:language]
|
||||
@title = t "diary_entry.list.in_language_title", :language => Language.find(params[:language]).english_name
|
||||
@title = t "diary_entry.index.in_language_title", :language => Language.find(params[:language]).english_name
|
||||
@entries = @entries.where(:language_code => params[:language])
|
||||
else
|
||||
@title = t "diary_entry.list.title"
|
||||
@title = t "diary_entry.index.title"
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -157,7 +157,7 @@ class DiaryEntryController < ApplicationController
|
|||
@entries = user.diary_entries
|
||||
@title = t("diary_entry.feed.user.title", :user => user.display_name)
|
||||
@description = t("diary_entry.feed.user.description", :user => user.display_name)
|
||||
@link = url_for :controller => "diary_entry", :action => "list", :display_name => user.display_name, :host => SERVER_URL, :protocol => SERVER_PROTOCOL
|
||||
@link = url_for :controller => "diary_entry", :action => "index", :display_name => user.display_name, :host => SERVER_URL, :protocol => SERVER_PROTOCOL
|
||||
else
|
||||
head :not_found
|
||||
return
|
||||
|
@ -169,21 +169,21 @@ class DiaryEntryController < ApplicationController
|
|||
@entries = @entries.where(:language_code => params[:language])
|
||||
@title = t("diary_entry.feed.language.title", :language_name => Language.find(params[:language]).english_name)
|
||||
@description = t("diary_entry.feed.language.description", :language_name => Language.find(params[:language]).english_name)
|
||||
@link = url_for :controller => "diary_entry", :action => "list", :language => params[:language], :host => SERVER_URL, :protocol => SERVER_PROTOCOL
|
||||
@link = url_for :controller => "diary_entry", :action => "index", :language => params[:language], :host => SERVER_URL, :protocol => SERVER_PROTOCOL
|
||||
else
|
||||
@title = t("diary_entry.feed.all.title")
|
||||
@description = t("diary_entry.feed.all.description")
|
||||
@link = url_for :controller => "diary_entry", :action => "list", :host => SERVER_URL, :protocol => SERVER_PROTOCOL
|
||||
@link = url_for :controller => "diary_entry", :action => "index", :host => SERVER_URL, :protocol => SERVER_PROTOCOL
|
||||
end
|
||||
end
|
||||
|
||||
@entries = @entries.visible.includes(:user).order("created_at DESC").limit(20)
|
||||
end
|
||||
|
||||
def view
|
||||
def show
|
||||
@entry = @user.diary_entries.visible.where(:id => params[:id]).first
|
||||
if @entry
|
||||
@title = t "diary_entry.view.title", :user => params[:display_name], :title => @entry.title
|
||||
@title = t "diary_entry.show.title", :user => params[:display_name], :title => @entry.title
|
||||
else
|
||||
@title = t "diary_entry.no_such_entry.title", :id => params[:id]
|
||||
render :action => "no_such_entry", :status => :not_found
|
||||
|
@ -193,13 +193,13 @@ class DiaryEntryController < ApplicationController
|
|||
def hide
|
||||
entry = DiaryEntry.find(params[:id])
|
||||
entry.update(:visible => false)
|
||||
redirect_to :action => "list", :display_name => entry.user.display_name
|
||||
redirect_to :action => "index", :display_name => entry.user.display_name
|
||||
end
|
||||
|
||||
def hidecomment
|
||||
comment = DiaryComment.find(params[:comment])
|
||||
comment.update(:visible => false)
|
||||
redirect_to :action => "view", :display_name => comment.diary_entry.user.display_name, :id => comment.diary_entry.id
|
||||
redirect_to diary_entry_path(comment.diary_entry.user, comment.diary_entry)
|
||||
end
|
||||
|
||||
def comments
|
||||
|
@ -235,7 +235,7 @@ class DiaryEntryController < ApplicationController
|
|||
def require_administrator
|
||||
unless current_user.administrator?
|
||||
flash[:error] = t("user.filter.not_an_administrator")
|
||||
redirect_to :action => "view"
|
||||
redirect_to :action => "show"
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -39,18 +39,44 @@ class GeocoderController < ApplicationController
|
|||
def search_latlon
|
||||
lat = params[:lat].to_f
|
||||
lon = params[:lon].to_f
|
||||
if lat < -90 || lat > 90
|
||||
@error = "Latitude #{lat} out of range"
|
||||
render :action => "error"
|
||||
elsif lon < -180 || lon > 180
|
||||
@error = "Longitude #{lon} out of range"
|
||||
render :action => "error"
|
||||
else
|
||||
@results = [{ :lat => lat, :lon => lon,
|
||||
:zoom => params[:zoom],
|
||||
:name => "#{lat}, #{lon}" }]
|
||||
|
||||
render :action => "results"
|
||||
if params[:latlon_digits]
|
||||
# We've got two nondescript numbers for a query, which can mean both "lat, lon" or "lon, lat".
|
||||
@results = []
|
||||
|
||||
if lat >= -90 && lat <= 90 && lon >= -180 && lon <= 180
|
||||
@results.push(:lat => lat, :lon => lon,
|
||||
:zoom => params[:zoom],
|
||||
:name => "#{lat}, #{lon}")
|
||||
end
|
||||
|
||||
if lon >= -90 && lon <= 90 && lat >= -180 && lat <= 180
|
||||
@results.push(:lat => lon, :lon => lat,
|
||||
:zoom => params[:zoom],
|
||||
:name => "#{lon}, #{lat}")
|
||||
end
|
||||
|
||||
if @results.empty?
|
||||
@error = "Latitude or longitude are out of range"
|
||||
render :action => "error"
|
||||
else
|
||||
render :action => "results"
|
||||
end
|
||||
else
|
||||
# Coordinates in a query have come with markers for latitude and longitude.
|
||||
if lat < -90 || lat > 90
|
||||
@error = "Latitude #{lat} out of range"
|
||||
render :action => "error"
|
||||
elsif lon < -180 || lon > 180
|
||||
@error = "Longitude #{lon} out of range"
|
||||
render :action => "error"
|
||||
else
|
||||
@results = [{ :lat => lat, :lon => lon,
|
||||
:zoom => params[:zoom],
|
||||
:name => "#{lat}, #{lon}" }]
|
||||
|
||||
render :action => "results"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -280,10 +306,12 @@ class GeocoderController < ApplicationController
|
|||
|
||||
elsif latlon = query.match(/^\s*([+-]?\d+(\.\d*)?)\s*[\s,]\s*([+-]?\d+(\.\d*)?)\s*$/)
|
||||
params.merge!(:lat => latlon[1].to_f, :lon => latlon[3].to_f).delete(:query)
|
||||
|
||||
params[:latlon_digits] = true unless params[:whereami]
|
||||
end
|
||||
end
|
||||
|
||||
params.permit(:query, :lat, :lon, :zoom, :minlat, :minlon, :maxlat, :maxlon)
|
||||
params.permit(:query, :lat, :lon, :latlon_digits, :zoom, :minlat, :minlon, :maxlat, :maxlon)
|
||||
end
|
||||
|
||||
def nsew_to_decdeg(captures)
|
||||
|
|
|
@ -18,7 +18,7 @@ class IssuesController < ApplicationController
|
|||
@issues = Issue.visible_to(current_user)
|
||||
|
||||
# If search
|
||||
if params[:search_by_user] && params[:search_by_user].present?
|
||||
if params[:search_by_user]&.present?
|
||||
@find_user = User.find_by(:display_name => params[:search_by_user])
|
||||
if @find_user
|
||||
@issues = @issues.where(:reported_user_id => @find_user.id)
|
||||
|
@ -28,11 +28,11 @@ class IssuesController < ApplicationController
|
|||
end
|
||||
end
|
||||
|
||||
@issues = @issues.where(:status => params[:status]) if params[:status] && params[:status].present?
|
||||
@issues = @issues.where(:status => params[:status]) if params[:status]&.present?
|
||||
|
||||
@issues = @issues.where(:reportable_type => params[:issue_type]) if params[:issue_type] && params[:issue_type].present?
|
||||
@issues = @issues.where(:reportable_type => params[:issue_type]) if params[:issue_type]&.present?
|
||||
|
||||
if params[:last_updated_by] && params[:last_updated_by].present?
|
||||
if params[:last_updated_by]&.present?
|
||||
last_updated_by = params[:last_updated_by].to_s == "nil" ? nil : params[:last_updated_by].to_i
|
||||
@issues = @issues.where(:updated_by => last_updated_by)
|
||||
end
|
||||
|
|
|
@ -4,37 +4,38 @@ class MessagesController < ApplicationController
|
|||
before_action :authorize_web
|
||||
before_action :set_locale
|
||||
before_action :require_user
|
||||
before_action :lookup_user, :only => [:new]
|
||||
before_action :lookup_user, :only => [:new, :create]
|
||||
before_action :check_database_readable
|
||||
before_action :check_database_writable, :only => [:new, :reply, :mark, :destroy]
|
||||
before_action :allow_thirdparty_images, :only => [:new, :show]
|
||||
before_action :check_database_writable, :only => [:new, :create, :reply, :mark, :destroy]
|
||||
before_action :allow_thirdparty_images, :only => [:new, :create, :show]
|
||||
|
||||
# Allow the user to write a new message to another user. This action also
|
||||
# deals with the sending of that message to the other user when the user
|
||||
# clicks send.
|
||||
# The display_name param is the display name of the user that the message is being sent to.
|
||||
def new
|
||||
if request.post?
|
||||
if current_user.sent_messages.where("sent_on >= ?", Time.now.getutc - 1.hour).count >= MAX_MESSAGES_PER_HOUR
|
||||
flash[:error] = t ".limit_exceeded"
|
||||
else
|
||||
@message = Message.new(message_params)
|
||||
@message.recipient = @user
|
||||
@message.sender = current_user
|
||||
@message.sent_on = Time.now.getutc
|
||||
|
||||
if @message.save
|
||||
flash[:notice] = t ".message_sent"
|
||||
Notifier.message_notification(@message).deliver_now
|
||||
redirect_to :action => :inbox
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@message ||= Message.new(message_params.merge(:recipient => @user))
|
||||
@message = Message.new(message_params.merge(:recipient => @user))
|
||||
@title = t ".title"
|
||||
end
|
||||
|
||||
def create
|
||||
@message = Message.new(message_params)
|
||||
@message.recipient = @user
|
||||
@message.sender = current_user
|
||||
@message.sent_on = Time.now.getutc
|
||||
|
||||
if current_user.sent_messages.where("sent_on >= ?", Time.now.getutc - 1.hour).count >= MAX_MESSAGES_PER_HOUR
|
||||
flash[:error] = t ".limit_exceeded"
|
||||
render :action => "new"
|
||||
elsif @message.save
|
||||
flash[:notice] = t ".message_sent"
|
||||
Notifier.message_notification(@message).deliver_now
|
||||
redirect_to :action => :inbox
|
||||
else
|
||||
render :action => "new"
|
||||
end
|
||||
end
|
||||
|
||||
# Allow the user to reply to another message.
|
||||
def reply
|
||||
message = Message.find(params[:message_id])
|
||||
|
@ -53,7 +54,7 @@ class MessagesController < ApplicationController
|
|||
render :action => "new"
|
||||
else
|
||||
flash[:notice] = t ".wrong_user", :user => current_user.display_name
|
||||
redirect_to :controller => "user", :action => "login", :referer => request.fullpath
|
||||
redirect_to :controller => "users", :action => "login", :referer => request.fullpath
|
||||
end
|
||||
rescue ActiveRecord::RecordNotFound
|
||||
@title = t "messages.no_such_message.title"
|
||||
|
@ -70,7 +71,7 @@ class MessagesController < ApplicationController
|
|||
@message.save
|
||||
else
|
||||
flash[:notice] = t ".wrong_user", :user => current_user.display_name
|
||||
redirect_to :controller => "user", :action => "login", :referer => request.fullpath
|
||||
redirect_to :controller => "users", :action => "login", :referer => request.fullpath
|
||||
end
|
||||
rescue ActiveRecord::RecordNotFound
|
||||
@title = t "messages.no_such_message.title"
|
||||
|
@ -109,7 +110,7 @@ class MessagesController < ApplicationController
|
|||
|
||||
# Destroy the message.
|
||||
def destroy
|
||||
@message = Message.where("to_user_id = ? OR from_user_id = ?", current_user.id, current_user.id).find(params[:message_id])
|
||||
@message = Message.where("to_user_id = ? OR from_user_id = ?", current_user.id, current_user.id).find(params[:id])
|
||||
@message.from_user_visible = false if @message.sender == current_user
|
||||
@message.to_user_visible = false if @message.recipient == current_user
|
||||
if @message.save && !request.xhr?
|
||||
|
|
|
@ -54,6 +54,7 @@ class NodeController < ApplicationController
|
|||
new_node = Node.from_xml(request.raw_post)
|
||||
|
||||
raise OSM::APIBadUserInput, "The id in the url (#{node.id}) is not the same as provided in the xml (#{new_node.id})" unless new_node && new_node.id == node.id
|
||||
|
||||
node.delete_with_history!(new_node, current_user)
|
||||
render :plain => node.version.to_s
|
||||
end
|
||||
|
@ -65,6 +66,7 @@ class NodeController < ApplicationController
|
|||
ids = params["nodes"].split(",").collect(&:to_i)
|
||||
|
||||
raise OSM::APIBadUserInput, "No nodes were given to search for" if ids.empty?
|
||||
|
||||
doc = OSM::API.new.get_xml_doc
|
||||
|
||||
Node.find(ids).each do |node|
|
||||
|
|
|
@ -211,7 +211,7 @@ class NotesController < ApplicationController
|
|||
# Find the note and check it is valid
|
||||
@note = Note.find(params[:id])
|
||||
raise OSM::APINotFoundError unless @note
|
||||
raise OSM::APIAlreadyDeletedError.new("note", @note.id) unless @note.visible? || (current_user && current_user.moderator?)
|
||||
raise OSM::APIAlreadyDeletedError.new("note", @note.id) unless @note.visible? || current_user&.moderator?
|
||||
|
||||
# Render the result
|
||||
respond_to do |format|
|
||||
|
@ -319,13 +319,13 @@ class NotesController < ApplicationController
|
|||
@page = (params[:page] || 1).to_i
|
||||
@page_size = 10
|
||||
@notes = @user.notes
|
||||
@notes = @notes.visible unless current_user && current_user.moderator?
|
||||
@notes = @notes.visible unless current_user&.moderator?
|
||||
@notes = @notes.order("updated_at DESC, id").distinct.offset((@page - 1) * @page_size).limit(@page_size).preload(:comments => :author).to_a
|
||||
else
|
||||
@title = t "user.no_such_user.title"
|
||||
@title = t "users.no_such_user.title"
|
||||
@not_found_user = params[:display_name]
|
||||
|
||||
render :template => "user/no_such_user", :status => :not_found
|
||||
render :template => "users/no_such_user", :status => :not_found
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -340,7 +340,7 @@ class NotesController < ApplicationController
|
|||
# Get the maximum number of results to return
|
||||
def result_limit
|
||||
if params[:limit]
|
||||
if params[:limit].to_i > 0 && params[:limit].to_i <= 10000
|
||||
if params[:limit].to_i.positive? && params[:limit].to_i <= 10000
|
||||
params[:limit].to_i
|
||||
else
|
||||
raise OSM::APIBadUserInput, "Note limit must be between 1 and 10000"
|
||||
|
@ -360,12 +360,14 @@ class NotesController < ApplicationController
|
|||
7
|
||||
end
|
||||
|
||||
if closed_since < 0
|
||||
notes.where("status != 'hidden'")
|
||||
elsif closed_since > 0
|
||||
notes.where("(status = 'open' OR (status = 'closed' AND closed_at > '#{Time.now - closed_since.days}'))")
|
||||
if closed_since.negative?
|
||||
notes.where.not(:status => "hidden")
|
||||
elsif closed_since.positive?
|
||||
notes.where(:status => "open")
|
||||
.or(notes.where(:status => "closed")
|
||||
.where(notes.arel_table[:closed_at].gt(Time.now - closed_since.days)))
|
||||
else
|
||||
notes.where("status = 'open'")
|
||||
notes.where(:status => "open")
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -70,6 +70,6 @@ class OldController < ApplicationController
|
|||
private
|
||||
|
||||
def show_redactions?
|
||||
current_user && current_user.moderator? && params[:show_redactions] == "true"
|
||||
current_user&.moderator? && params[:show_redactions] == "true"
|
||||
end
|
||||
end
|
||||
|
|
|
@ -12,13 +12,13 @@ class TracesController < ApplicationController
|
|||
before_action :check_api_writable, :only => [:api_create, :api_update, :api_delete]
|
||||
before_action :require_allow_read_gpx, :only => [:api_read, :api_data]
|
||||
before_action :require_allow_write_gpx, :only => [:api_create, :api_update, :api_delete]
|
||||
before_action :offline_warning, :only => [:mine, :view]
|
||||
before_action :offline_warning, :only => [:mine, :show]
|
||||
before_action :offline_redirect, :only => [:new, :create, :edit, :delete, :data, :api_create, :api_delete, :api_data]
|
||||
around_action :api_call_handle_error, :only => [:api_create, :api_read, :api_update, :api_delete, :api_data]
|
||||
|
||||
# Counts and selects pages of GPX traces for various criteria (by user, tags, public etc.).
|
||||
# target_user - if set, specifies the user to fetch traces for. if not set will fetch all traces
|
||||
def list
|
||||
def index
|
||||
# from display name, pick up user id if one user's traces only
|
||||
display_name = params[:display_name]
|
||||
if display_name.present?
|
||||
|
@ -86,22 +86,22 @@ class TracesController < ApplicationController
|
|||
end
|
||||
|
||||
def mine
|
||||
redirect_to :action => :list, :display_name => current_user.display_name
|
||||
redirect_to :action => :index, :display_name => current_user.display_name
|
||||
end
|
||||
|
||||
def view
|
||||
def show
|
||||
@trace = Trace.find(params[:id])
|
||||
|
||||
if @trace && @trace.visible? &&
|
||||
(@trace.public? || @trace.user == current_user)
|
||||
if @trace&.visible? &&
|
||||
(@trace&.public? || @trace&.user == current_user)
|
||||
@title = t ".title", :name => @trace.name
|
||||
else
|
||||
flash[:error] = t ".trace_not_found"
|
||||
redirect_to :action => "list"
|
||||
redirect_to :action => "index"
|
||||
end
|
||||
rescue ActiveRecord::RecordNotFound
|
||||
flash[:error] = t ".trace_not_found"
|
||||
redirect_to :action => "list"
|
||||
redirect_to :action => "index"
|
||||
end
|
||||
|
||||
def new
|
||||
|
@ -110,12 +110,14 @@ class TracesController < ApplicationController
|
|||
end
|
||||
|
||||
def create
|
||||
@title = t ".upload_trace"
|
||||
|
||||
logger.info(params[:trace][:gpx_file].class.name)
|
||||
|
||||
if params[:trace][:gpx_file].respond_to?(:read)
|
||||
begin
|
||||
do_create(params[:trace][:gpx_file], params[:trace][:tagstring],
|
||||
params[:trace][:description], params[:trace][:visibility])
|
||||
@trace = do_create(params[:trace][:gpx_file], params[:trace][:tagstring],
|
||||
params[:trace][:description], params[:trace][:visibility])
|
||||
rescue StandardError => ex
|
||||
logger.debug ex
|
||||
end
|
||||
|
@ -124,7 +126,11 @@ class TracesController < ApplicationController
|
|||
flash[:notice] = t ".trace_uploaded"
|
||||
flash[:warning] = t ".traces_waiting", :count => current_user.traces.where(:inserted => false).count if current_user.traces.where(:inserted => false).count > 4
|
||||
|
||||
redirect_to :action => :list, :display_name => current_user.display_name
|
||||
redirect_to :action => :index, :display_name => current_user.display_name
|
||||
else
|
||||
flash[:error] = t("traces.create.upload_failed") if @trace.valid?
|
||||
|
||||
render :action => "new"
|
||||
end
|
||||
else
|
||||
@trace = Trace.new(:name => "Dummy",
|
||||
|
@ -135,7 +141,7 @@ class TracesController < ApplicationController
|
|||
:timestamp => Time.now.getutc)
|
||||
@trace.valid?
|
||||
@trace.errors.add(:gpx_file, "can't be blank")
|
||||
@title = t ".upload_trace"
|
||||
|
||||
render :action => "new"
|
||||
end
|
||||
end
|
||||
|
@ -169,13 +175,24 @@ class TracesController < ApplicationController
|
|||
head :forbidden
|
||||
else
|
||||
@title = t ".title", :name => @trace.name
|
||||
end
|
||||
rescue ActiveRecord::RecordNotFound
|
||||
head :not_found
|
||||
end
|
||||
|
||||
if request.post? && params[:trace]
|
||||
@trace.description = params[:trace][:description]
|
||||
@trace.tagstring = params[:trace][:tagstring]
|
||||
@trace.visibility = params[:trace][:visibility]
|
||||
redirect_to :action => "view", :display_name => current_user.display_name if @trace.save
|
||||
end
|
||||
def update
|
||||
@trace = Trace.find(params[:id])
|
||||
|
||||
if !@trace.visible?
|
||||
head :not_found
|
||||
elsif current_user.nil? || @trace.user != current_user
|
||||
head :forbidden
|
||||
elsif @trace.update(trace_params)
|
||||
flash[:notice] = t ".updated"
|
||||
redirect_to :action => "show", :display_name => current_user.display_name
|
||||
else
|
||||
@title = t ".title", :name => @trace.name
|
||||
render :action => "edit"
|
||||
end
|
||||
rescue ActiveRecord::RecordNotFound
|
||||
head :not_found
|
||||
|
@ -192,7 +209,7 @@ class TracesController < ApplicationController
|
|||
trace.visible = false
|
||||
trace.save
|
||||
flash[:notice] = t ".scheduled_for_deletion"
|
||||
redirect_to :action => :list, :display_name => trace.user.display_name
|
||||
redirect_to :action => :index, :display_name => trace.user.display_name
|
||||
end
|
||||
rescue ActiveRecord::RecordNotFound
|
||||
head :not_found
|
||||
|
@ -301,7 +318,7 @@ class TracesController < ApplicationController
|
|||
visibility = params[:visibility]
|
||||
|
||||
if visibility.nil?
|
||||
visibility = if params[:public] && params[:public].to_i.nonzero?
|
||||
visibility = if params[:public]&.to_i&.nonzero?
|
||||
"public"
|
||||
else
|
||||
"private"
|
||||
|
@ -309,11 +326,11 @@ class TracesController < ApplicationController
|
|||
end
|
||||
|
||||
if params[:file].respond_to?(:read)
|
||||
do_create(params[:file], tags, description, visibility)
|
||||
trace = do_create(params[:file], tags, description, visibility)
|
||||
|
||||
if @trace.id
|
||||
render :plain => @trace.id.to_s
|
||||
elsif @trace.valid?
|
||||
if trace.id
|
||||
render :plain => trace.id.to_s
|
||||
elsif trace.valid?
|
||||
head :internal_server_error
|
||||
else
|
||||
head :bad_request
|
||||
|
@ -337,7 +354,7 @@ class TracesController < ApplicationController
|
|||
|
||||
# Create the trace object, falsely marked as already
|
||||
# inserted to stop the import daemon trying to load it
|
||||
@trace = Trace.new(
|
||||
trace = Trace.new(
|
||||
:name => name,
|
||||
:tagstring => tags,
|
||||
:description => description,
|
||||
|
@ -347,31 +364,33 @@ class TracesController < ApplicationController
|
|||
:timestamp => Time.now.getutc
|
||||
)
|
||||
|
||||
Trace.transaction do
|
||||
begin
|
||||
# Save the trace object
|
||||
@trace.save!
|
||||
if trace.valid?
|
||||
Trace.transaction do
|
||||
begin
|
||||
# Save the trace object
|
||||
trace.save!
|
||||
|
||||
# Rename the temporary file to the final name
|
||||
FileUtils.mv(filename, @trace.trace_name)
|
||||
rescue StandardError
|
||||
# Remove the file as we have failed to update the database
|
||||
FileUtils.rm_f(filename)
|
||||
# Rename the temporary file to the final name
|
||||
FileUtils.mv(filename, trace.trace_name)
|
||||
rescue StandardError
|
||||
# Remove the file as we have failed to update the database
|
||||
FileUtils.rm_f(filename)
|
||||
|
||||
# Pass the exception on
|
||||
raise
|
||||
end
|
||||
# Pass the exception on
|
||||
raise
|
||||
end
|
||||
|
||||
begin
|
||||
# Clear the inserted flag to make the import daemon load the trace
|
||||
@trace.inserted = false
|
||||
@trace.save!
|
||||
rescue StandardError
|
||||
# Remove the file as we have failed to update the database
|
||||
FileUtils.rm_f(@trace.trace_name)
|
||||
begin
|
||||
# Clear the inserted flag to make the import daemon load the trace
|
||||
trace.inserted = false
|
||||
trace.save!
|
||||
rescue StandardError
|
||||
# Remove the file as we have failed to update the database
|
||||
FileUtils.rm_f(trace.trace_name)
|
||||
|
||||
# Pass the exception on
|
||||
raise
|
||||
# Pass the exception on
|
||||
raise
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -382,6 +401,8 @@ class TracesController < ApplicationController
|
|||
else
|
||||
current_user.preferences.create(:k => "gps.trace.visibility", :v => visibility)
|
||||
end
|
||||
|
||||
trace
|
||||
end
|
||||
|
||||
def offline_warning
|
||||
|
@ -403,4 +424,8 @@ class TracesController < ApplicationController
|
|||
"public"
|
||||
end
|
||||
end
|
||||
|
||||
def trace_params
|
||||
params.require(:trace).permit(:description, :tagstring, :visibility)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
class UserController < ApplicationController
|
||||
class UsersController < ApplicationController
|
||||
layout "site", :except => [:api_details]
|
||||
|
||||
skip_before_action :verify_authenticity_token, :only => [:api_read, :api_users, :api_details, :api_gpx_files, :auth_success]
|
||||
|
@ -14,11 +14,11 @@ class UserController < ApplicationController
|
|||
before_action :require_allow_read_prefs, :only => [:api_details]
|
||||
before_action :require_allow_read_gpx, :only => [:api_gpx_files]
|
||||
before_action :require_cookies, :only => [:new, :login, :confirm]
|
||||
before_action :require_administrator, :only => [:set_status, :delete, :list]
|
||||
before_action :require_administrator, :only => [:set_status, :delete, :index]
|
||||
around_action :api_call_handle_error, :only => [:api_read, :api_users, :api_details, :api_gpx_files]
|
||||
before_action :lookup_user_by_id, :only => [:api_read]
|
||||
before_action :lookup_user_by_name, :only => [:set_status, :delete]
|
||||
before_action :allow_thirdparty_images, :only => [:view, :account]
|
||||
before_action :allow_thirdparty_images, :only => [:show, :account]
|
||||
|
||||
def terms
|
||||
@legale = params[:legale] || OSM.ip_to_country(request.remote_ip) || DEFAULT_LEGALE
|
||||
|
@ -27,9 +27,9 @@ class UserController < ApplicationController
|
|||
if request.xhr?
|
||||
render :partial => "terms"
|
||||
else
|
||||
@title = t "user.terms.title"
|
||||
@title = t "users.terms.title"
|
||||
|
||||
if current_user && current_user.terms_agreed?
|
||||
if current_user&.terms_agreed?
|
||||
# Already agreed to terms, so just show settings
|
||||
redirect_to :action => :account, :display_name => current_user.display_name
|
||||
elsif current_user.nil? && session[:new_user].nil?
|
||||
|
@ -39,13 +39,13 @@ class UserController < ApplicationController
|
|||
end
|
||||
|
||||
def save
|
||||
@title = t "user.new.title"
|
||||
@title = t "users.new.title"
|
||||
|
||||
if params[:decline]
|
||||
if current_user
|
||||
current_user.terms_seen = true
|
||||
|
||||
flash[:notice] = t("user.new.terms declined", :url => t("user.new.terms declined url")).html_safe if current_user.save
|
||||
flash[:notice] = t("users.new.terms declined", :url => t("users.new.terms declined url")).html_safe if current_user.save
|
||||
|
||||
if params[:referer]
|
||||
redirect_to params[:referer]
|
||||
|
@ -53,7 +53,7 @@ class UserController < ApplicationController
|
|||
redirect_to :action => :account, :display_name => current_user.display_name
|
||||
end
|
||||
else
|
||||
redirect_to t("user.terms.declined")
|
||||
redirect_to t("users.terms.declined")
|
||||
end
|
||||
elsif current_user
|
||||
unless current_user.terms_agreed?
|
||||
|
@ -61,7 +61,7 @@ class UserController < ApplicationController
|
|||
current_user.terms_agreed = Time.now.getutc
|
||||
current_user.terms_seen = true
|
||||
|
||||
flash[:notice] = t "user.new.terms accepted" if current_user.save
|
||||
flash[:notice] = t "users.new.terms accepted" if current_user.save
|
||||
end
|
||||
|
||||
if params[:referer]
|
||||
|
@ -134,18 +134,18 @@ class UserController < ApplicationController
|
|||
current_user.errors.add(attribute, error)
|
||||
end
|
||||
end
|
||||
@title = t "user.account.title"
|
||||
@title = t "users.account.title"
|
||||
end
|
||||
|
||||
def go_public
|
||||
current_user.data_public = true
|
||||
current_user.save
|
||||
flash[:notice] = t "user.go_public.flash success"
|
||||
flash[:notice] = t "users.go_public.flash success"
|
||||
redirect_to :action => "account", :display_name => current_user.display_name
|
||||
end
|
||||
|
||||
def lost_password
|
||||
@title = t "user.lost_password.title"
|
||||
@title = t "users.lost_password.title"
|
||||
|
||||
if params[:user] && params[:user][:email]
|
||||
user = User.visible.find_by(:email => params[:user][:email])
|
||||
|
@ -159,16 +159,16 @@ class UserController < ApplicationController
|
|||
if user
|
||||
token = user.tokens.create
|
||||
Notifier.lost_password(user, token).deliver_now
|
||||
flash[:notice] = t "user.lost_password.notice email on way"
|
||||
flash[:notice] = t "users.lost_password.notice email on way"
|
||||
redirect_to :action => "login"
|
||||
else
|
||||
flash.now[:error] = t "user.lost_password.notice email cannot find"
|
||||
flash.now[:error] = t "users.lost_password.notice email cannot find"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def reset_password
|
||||
@title = t "user.reset_password.title"
|
||||
@title = t "users.reset_password.title"
|
||||
|
||||
if params[:token]
|
||||
token = UserToken.find_by(:token => params[:token])
|
||||
|
@ -184,12 +184,12 @@ class UserController < ApplicationController
|
|||
|
||||
if current_user.save
|
||||
token.destroy
|
||||
flash[:notice] = t "user.reset_password.flash changed"
|
||||
flash[:notice] = t "users.reset_password.flash changed"
|
||||
successful_login(current_user)
|
||||
end
|
||||
end
|
||||
else
|
||||
flash[:error] = t "user.reset_password.flash token bad"
|
||||
flash[:error] = t "users.reset_password.flash token bad"
|
||||
redirect_to :action => "lost_password"
|
||||
end
|
||||
else
|
||||
|
@ -198,7 +198,7 @@ class UserController < ApplicationController
|
|||
end
|
||||
|
||||
def new
|
||||
@title = t "user.new.title"
|
||||
@title = t "users.new.title"
|
||||
@referer = params[:referer] || session[:referer]
|
||||
|
||||
append_content_security_policy_directives(
|
||||
|
@ -271,12 +271,12 @@ class UserController < ApplicationController
|
|||
end
|
||||
|
||||
def logout
|
||||
@title = t "user.logout.title"
|
||||
@title = t "users.logout.title"
|
||||
|
||||
if params[:session] == session.id
|
||||
if session[:token]
|
||||
token = UserToken.find_by(:token => session[:token])
|
||||
token.destroy if token
|
||||
token&.destroy
|
||||
session.delete(:token)
|
||||
end
|
||||
session.delete(:user)
|
||||
|
@ -292,11 +292,11 @@ class UserController < ApplicationController
|
|||
def confirm
|
||||
if request.post?
|
||||
token = UserToken.find_by(:token => params[:confirm_string])
|
||||
if token && token.user.active?
|
||||
flash[:error] = t("user.confirm.already active")
|
||||
if token&.user&.active?
|
||||
flash[:error] = t("users.confirm.already active")
|
||||
redirect_to :action => "login"
|
||||
elsif !token || token.expired?
|
||||
flash[:error] = t("user.confirm.unknown token")
|
||||
flash[:error] = t("users.confirm.unknown token")
|
||||
redirect_to :action => "confirm"
|
||||
else
|
||||
user = token.user
|
||||
|
@ -315,7 +315,7 @@ class UserController < ApplicationController
|
|||
end
|
||||
|
||||
if token.nil? || token.user != user
|
||||
flash[:notice] = t("user.confirm.success")
|
||||
flash[:notice] = t("users.confirm.success")
|
||||
redirect_to :action => :login, :referer => referer
|
||||
else
|
||||
token.destroy
|
||||
|
@ -337,10 +337,10 @@ class UserController < ApplicationController
|
|||
token = UserToken.find_by(:token => session[:token])
|
||||
|
||||
if user.nil? || token.nil? || token.user != user
|
||||
flash[:error] = t "user.confirm_resend.failure", :name => params[:display_name]
|
||||
flash[:error] = t "users.confirm_resend.failure", :name => params[:display_name]
|
||||
else
|
||||
Notifier.signup_confirm(user, user.tokens.create).deliver_now
|
||||
flash[:notice] = t("user.confirm_resend.success", :email => user.email, :sender => SUPPORT_EMAIL).html_safe
|
||||
flash[:notice] = t("users.confirm_resend.success", :email => user.email, :sender => SUPPORT_EMAIL).html_safe
|
||||
end
|
||||
|
||||
redirect_to :action => "login"
|
||||
|
@ -349,7 +349,7 @@ class UserController < ApplicationController
|
|||
def confirm_email
|
||||
if request.post?
|
||||
token = UserToken.find_by(:token => params[:confirm_string])
|
||||
if token && token.user.new_email?
|
||||
if token&.user&.new_email?
|
||||
self.current_user = token.user
|
||||
current_user.email = current_user.new_email
|
||||
current_user.new_email = nil
|
||||
|
@ -357,9 +357,9 @@ class UserController < ApplicationController
|
|||
gravatar_enabled = gravatar_enable(current_user)
|
||||
if current_user.save
|
||||
flash[:notice] = if gravatar_enabled
|
||||
t("user.confirm_email.success") + " " + gravatar_status_message(current_user)
|
||||
t("users.confirm_email.success") + " " + gravatar_status_message(current_user)
|
||||
else
|
||||
t("user.confirm_email.success")
|
||||
t("users.confirm_email.success")
|
||||
end
|
||||
else
|
||||
flash[:errors] = current_user.errors
|
||||
|
@ -368,10 +368,10 @@ class UserController < ApplicationController
|
|||
session[:user] = current_user.id
|
||||
redirect_to :action => "account", :display_name => current_user.display_name
|
||||
elsif token
|
||||
flash[:error] = t "user.confirm_email.failure"
|
||||
flash[:error] = t "users.confirm_email.failure"
|
||||
redirect_to :action => "account", :display_name => token.user.display_name
|
||||
else
|
||||
flash[:error] = t "user.confirm_email.unknown_token"
|
||||
flash[:error] = t "users.confirm_email.unknown_token"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -409,11 +409,11 @@ class UserController < ApplicationController
|
|||
render :xml => doc.to_s
|
||||
end
|
||||
|
||||
def view
|
||||
def show
|
||||
@user = User.find_by(:display_name => params[:display_name])
|
||||
|
||||
if @user &&
|
||||
(@user.visible? || (current_user && current_user.administrator?))
|
||||
(@user.visible? || (current_user&.administrator?))
|
||||
@title = @user.display_name
|
||||
else
|
||||
render_unknown_user params[:display_name]
|
||||
|
@ -429,18 +429,18 @@ class UserController < ApplicationController
|
|||
friend.befriender = current_user
|
||||
friend.befriendee = @new_friend
|
||||
if current_user.is_friends_with?(@new_friend)
|
||||
flash[:warning] = t "user.make_friend.already_a_friend", :name => @new_friend.display_name
|
||||
flash[:warning] = t "users.make_friend.already_a_friend", :name => @new_friend.display_name
|
||||
elsif friend.save
|
||||
flash[:notice] = t "user.make_friend.success", :name => @new_friend.display_name
|
||||
flash[:notice] = t "users.make_friend.success", :name => @new_friend.display_name
|
||||
Notifier.friend_notification(friend).deliver_now
|
||||
else
|
||||
friend.add_error(t("user.make_friend.failed", :name => @new_friend.display_name))
|
||||
friend.add_error(t("users.make_friend.failed", :name => @new_friend.display_name))
|
||||
end
|
||||
|
||||
if params[:referer]
|
||||
redirect_to params[:referer]
|
||||
else
|
||||
redirect_to :action => "view"
|
||||
redirect_to :action => "show"
|
||||
end
|
||||
end
|
||||
else
|
||||
|
@ -455,15 +455,15 @@ class UserController < ApplicationController
|
|||
if request.post?
|
||||
if current_user.is_friends_with?(@friend)
|
||||
Friend.where(:user_id => current_user.id, :friend_user_id => @friend.id).delete_all
|
||||
flash[:notice] = t "user.remove_friend.success", :name => @friend.display_name
|
||||
flash[:notice] = t "users.remove_friend.success", :name => @friend.display_name
|
||||
else
|
||||
flash[:error] = t "user.remove_friend.not_a_friend", :name => @friend.display_name
|
||||
flash[:error] = t "users.remove_friend.not_a_friend", :name => @friend.display_name
|
||||
end
|
||||
|
||||
if params[:referer]
|
||||
redirect_to params[:referer]
|
||||
else
|
||||
redirect_to :action => "view"
|
||||
redirect_to :action => "show"
|
||||
end
|
||||
end
|
||||
else
|
||||
|
@ -476,19 +476,19 @@ class UserController < ApplicationController
|
|||
def set_status
|
||||
@user.status = params[:status]
|
||||
@user.save
|
||||
redirect_to :action => "view", :display_name => params[:display_name]
|
||||
redirect_to user_path(:display_name => params[:display_name])
|
||||
end
|
||||
|
||||
##
|
||||
# delete a user, marking them as deleted and removing personal data
|
||||
def delete
|
||||
@user.delete
|
||||
redirect_to :action => "view", :display_name => params[:display_name]
|
||||
redirect_to user_path(:display_name => params[:display_name])
|
||||
end
|
||||
|
||||
##
|
||||
# display a list of users matching specified criteria
|
||||
def list
|
||||
def index
|
||||
if request.post?
|
||||
ids = params[:user].keys.collect(&:to_i)
|
||||
|
||||
|
@ -552,7 +552,7 @@ class UserController < ApplicationController
|
|||
if user.nil? && provider == "google"
|
||||
openid_url = auth_info[:extra][:id_info]["openid_id"]
|
||||
user = User.find_by(:auth_provider => "openid", :auth_uid => openid_url) if openid_url
|
||||
user.update(:auth_provider => provider, :auth_uid => uid) if user
|
||||
user&.update(:auth_provider => provider, :auth_uid => uid)
|
||||
end
|
||||
|
||||
if user
|
||||
|
@ -562,9 +562,9 @@ class UserController < ApplicationController
|
|||
when "active", "confirmed" then
|
||||
successful_login(user, request.env["omniauth.params"]["referer"])
|
||||
when "suspended" then
|
||||
failed_login t("user.login.account is suspended", :webmaster => "mailto:#{SUPPORT_EMAIL}").html_safe
|
||||
failed_login t("users.login.account is suspended", :webmaster => "mailto:#{SUPPORT_EMAIL}").html_safe
|
||||
else
|
||||
failed_login t("user.login.auth failure")
|
||||
failed_login t("users.login.auth failure")
|
||||
end
|
||||
else
|
||||
redirect_to :action => "new", :nickname => name, :email => email,
|
||||
|
@ -576,7 +576,7 @@ class UserController < ApplicationController
|
|||
##
|
||||
# omniauth failure callback
|
||||
def auth_failure
|
||||
flash[:error] = t("user.auth_failure." + params[:message])
|
||||
flash[:error] = t("users.auth_failure." + params[:message])
|
||||
redirect_to params[:origin] || login_url
|
||||
end
|
||||
|
||||
|
@ -590,9 +590,9 @@ class UserController < ApplicationController
|
|||
elsif user = User.authenticate(:username => username, :password => password, :pending => true)
|
||||
unconfirmed_login(user)
|
||||
elsif User.authenticate(:username => username, :password => password, :suspended => true)
|
||||
failed_login t("user.login.account is suspended", :webmaster => "mailto:#{SUPPORT_EMAIL}").html_safe, username
|
||||
failed_login t("users.login.account is suspended", :webmaster => "mailto:#{SUPPORT_EMAIL}").html_safe, username
|
||||
else
|
||||
failed_login t("user.login.auth failure"), username
|
||||
failed_login t("users.login.auth failure"), username
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -727,12 +727,12 @@ class UserController < ApplicationController
|
|||
set_locale(true)
|
||||
|
||||
if user.new_email.blank? || user.new_email == user.email
|
||||
flash.now[:notice] = t "user.account.flash update success"
|
||||
flash.now[:notice] = t "users.account.flash update success"
|
||||
else
|
||||
user.email = user.new_email
|
||||
|
||||
if user.valid?
|
||||
flash.now[:notice] = t "user.account.flash update success confirm needed"
|
||||
flash.now[:notice] = t "users.account.flash update success confirm needed"
|
||||
|
||||
begin
|
||||
Notifier.email_confirm(user, user.tokens.create).deliver_now
|
||||
|
@ -754,10 +754,10 @@ class UserController < ApplicationController
|
|||
# and return them to the user page.
|
||||
def require_administrator
|
||||
if current_user && !current_user.administrator?
|
||||
flash[:error] = t("user.filter.not_an_administrator")
|
||||
flash[:error] = t("users.filter.not_an_administrator")
|
||||
|
||||
if params[:display_name]
|
||||
redirect_to :action => "view", :display_name => params[:display_name]
|
||||
redirect_to user_path(:display_name => params[:display_name])
|
||||
else
|
||||
redirect_to :action => "login", :referer => request.fullpath
|
||||
end
|
||||
|
@ -826,6 +826,7 @@ class UserController < ApplicationController
|
|||
def gravatar_enable(user)
|
||||
# code from example https://en.gravatar.com/site/implement/images/ruby/
|
||||
return false if user.image.present?
|
||||
|
||||
hash = Digest::MD5.hexdigest(user.email.downcase)
|
||||
url = "https://www.gravatar.com/avatar/#{hash}?d=404" # without d=404 we will always get an image back
|
||||
response = OSM.http_client.get(URI.parse(url))
|
||||
|
@ -838,9 +839,9 @@ class UserController < ApplicationController
|
|||
# display a message about th current status of the gravatar setting
|
||||
def gravatar_status_message(user)
|
||||
if user.image_use_gravatar
|
||||
t "user.account.gravatar.enabled"
|
||||
t "users.account.gravatar.enabled"
|
||||
else
|
||||
t "user.account.gravatar.disabled"
|
||||
t "users.account.gravatar.disabled"
|
||||
end
|
||||
end
|
||||
end
|
|
@ -26,7 +26,7 @@ module BannerHelper
|
|||
|
||||
# rotate all banner queue positions
|
||||
index = cval.to_i
|
||||
cookies[ckey] = index - 1 if index > 0
|
||||
cookies[ckey] = index - 1 if index.positive?
|
||||
|
||||
# pick banner with mininum queue position
|
||||
next if index > min_index
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
module ChangesetHelper
|
||||
def changeset_user_link(changeset)
|
||||
if changeset.user.status == "deleted"
|
||||
t("user.no_such_user.deleted")
|
||||
t("users.no_such_user.deleted")
|
||||
elsif changeset.user.data_public?
|
||||
link_to(changeset.user.display_name, user_path(changeset.user.display_name))
|
||||
link_to(changeset.user.display_name, user_path(changeset.user))
|
||||
else
|
||||
t("browse.anonymous")
|
||||
end
|
||||
|
@ -32,15 +32,15 @@ module ChangesetHelper
|
|||
end
|
||||
end
|
||||
|
||||
def changeset_list_title(params, user)
|
||||
def changeset_index_title(params, user)
|
||||
if params[:friends] && user
|
||||
t "changeset.list.title_friend"
|
||||
t "changeset.index.title_friend"
|
||||
elsif params[:nearby] && user
|
||||
t "changeset.list.title_nearby"
|
||||
t "changeset.index.title_nearby"
|
||||
elsif params[:display_name]
|
||||
t "changeset.list.title_user", :user => params[:display_name]
|
||||
t "changeset.index.title_user", :user => params[:display_name]
|
||||
else
|
||||
t "changeset.list.title"
|
||||
t "changeset.index.title"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -2,11 +2,11 @@ module IssuesHelper
|
|||
def reportable_url(reportable)
|
||||
case reportable
|
||||
when DiaryEntry
|
||||
url_for(:controller => reportable.class.name.underscore, :action => :view, :display_name => reportable.user.display_name, :id => reportable.id)
|
||||
diary_entry_url(reportable.user, reportable)
|
||||
when User
|
||||
url_for(:controller => reportable.class.name.underscore, :action => :view, :display_name => reportable.display_name)
|
||||
user_url(reportable)
|
||||
when DiaryComment
|
||||
url_for(:controller => reportable.diary_entry.class.name.underscore, :action => :view, :display_name => reportable.diary_entry.user.display_name, :id => reportable.diary_entry.id, :anchor => "comment#{reportable.id}")
|
||||
diary_entry_url(reportable.diary_entry.user, reportable.diary_entry, :anchor => "comment#{reportable.id}")
|
||||
when Note
|
||||
url_for(:controller => :browse, :action => :note, :id => reportable.id)
|
||||
end
|
||||
|
@ -29,7 +29,7 @@ module IssuesHelper
|
|||
count = Issue.visible_to(current_user).open.limit(100).size
|
||||
if count > 99
|
||||
content_tag(:span, "99+", :class => "count-number")
|
||||
elsif count > 0
|
||||
elsif count.positive?
|
||||
content_tag(:span, count, :class => "count-number")
|
||||
end
|
||||
end
|
||||
|
|
|
@ -16,9 +16,9 @@ module NoteHelper
|
|||
if author.nil?
|
||||
""
|
||||
elsif author.status == "deleted"
|
||||
t("user.no_such_user.deleted")
|
||||
t("users.no_such_user.deleted")
|
||||
else
|
||||
link_to h(author.display_name), link_options.merge(:controller => "user", :action => "view", :display_name => author.display_name)
|
||||
link_to h(author.display_name), link_options.merge(:controller => "users", :action => "show", :display_name => author.display_name)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -29,6 +29,6 @@ module NotifierHelper
|
|||
# Because we can't use stylesheets in HTML emails, we need to inline the
|
||||
# styles. Rather than copy-paste the same string of CSS into every message,
|
||||
# we apply it once here, after the message has been composed.
|
||||
html.gsub /<p>/, '<p style="color: black; margin: 0.75em 0; font-family: \'Helvetica Neue\', Arial, Sans-Serif">'
|
||||
html.gsub(/<p>/, '<p style="color: black; margin: 0.75em 0; font-family: \'Helvetica Neue\', Arial, Sans-Serif">')
|
||||
end
|
||||
end
|
||||
|
|
|
@ -45,15 +45,15 @@ module UserHelper
|
|||
# External authentication support
|
||||
|
||||
def openid_logo
|
||||
image_tag "openid_small.png", :alt => t("user.login.openid_logo_alt"), :class => "openid_logo"
|
||||
image_tag "openid_small.png", :alt => t("users.login.openid_logo_alt"), :class => "openid_logo"
|
||||
end
|
||||
|
||||
def auth_button(name, provider, options = {})
|
||||
link_to(
|
||||
image_tag("#{name}.png", :alt => t("user.login.auth_providers.#{name}.alt")),
|
||||
image_tag("#{name}.png", :alt => t("users.login.auth_providers.#{name}.alt")),
|
||||
auth_path(options.merge(:provider => provider)),
|
||||
:class => "auth_button",
|
||||
:title => t("user.login.auth_providers.#{name}.title")
|
||||
:title => t("users.login.auth_providers.#{name}.title")
|
||||
)
|
||||
end
|
||||
|
||||
|
|
|
@ -6,24 +6,24 @@ module UserRolesHelper
|
|||
end
|
||||
|
||||
def role_icon(user, role)
|
||||
if current_user && current_user.administrator?
|
||||
if current_user&.administrator?
|
||||
if user.has_role?(role)
|
||||
image = "roles/#{role}"
|
||||
alt = t("user.view.role.revoke.#{role}")
|
||||
title = t("user.view.role.revoke.#{role}")
|
||||
alt = t("users.show.role.revoke.#{role}")
|
||||
title = t("users.show.role.revoke.#{role}")
|
||||
url = revoke_role_path(:display_name => user.display_name, :role => role)
|
||||
confirm = t("user_role.revoke.are_you_sure", :name => user.display_name, :role => role)
|
||||
else
|
||||
image = "roles/blank_#{role}"
|
||||
alt = t("user.view.role.grant.#{role}")
|
||||
title = t("user.view.role.grant.#{role}")
|
||||
alt = t("users.show.role.grant.#{role}")
|
||||
title = t("users.show.role.grant.#{role}")
|
||||
url = grant_role_path(:display_name => user.display_name, :role => role)
|
||||
confirm = t("user_role.grant.are_you_sure", :name => user.display_name, :role => role)
|
||||
end
|
||||
elsif user.has_role?(role)
|
||||
image = "roles/#{role}"
|
||||
alt = t("user.view.role.#{role}")
|
||||
title = t("user.view.role.#{role}")
|
||||
alt = t("users.show.role.#{role}")
|
||||
title = t("users.show.role.#{role}")
|
||||
end
|
||||
|
||||
if image
|
||||
|
|
|
@ -106,6 +106,7 @@ class Changeset < ActiveRecord::Base
|
|||
pt.find("tag").each do |tag|
|
||||
raise OSM::APIBadXMLError.new("changeset", pt, "tag is missing key") if tag["k"].nil?
|
||||
raise OSM::APIBadXMLError.new("changeset", pt, "tag is missing value") if tag["v"].nil?
|
||||
|
||||
cs.add_tag_keyval(tag["k"], tag["v"])
|
||||
end
|
||||
|
||||
|
@ -207,7 +208,7 @@ class Changeset < ActiveRecord::Base
|
|||
|
||||
user_display_name_cache = {} if user_display_name_cache.nil?
|
||||
|
||||
if user_display_name_cache && user_display_name_cache.key?(user_id)
|
||||
if user_display_name_cache&.key?(user_id)
|
||||
# use the cache if available
|
||||
elsif user.data_public?
|
||||
user_display_name_cache[user_id] = user.display_name
|
||||
|
@ -232,6 +233,7 @@ class Changeset < ActiveRecord::Base
|
|||
bbox.to_unscaled.add_bounds_to(el1, "_") if bbox.complete?
|
||||
|
||||
el1["comments_count"] = comments.length.to_s
|
||||
el1["changes_count"] = num_changes.to_s
|
||||
|
||||
if include_discussion
|
||||
el2 = XML::Node.new("discussion")
|
||||
|
|
|
@ -51,12 +51,13 @@ class ClientApplication < ActiveRecord::Base
|
|||
|
||||
def self.find_token(token_key)
|
||||
token = OauthToken.includes(:client_application).find_by(:token => token_key)
|
||||
token if token && token.authorized?
|
||||
token if token&.authorized?
|
||||
end
|
||||
|
||||
def self.verify_request(request, options = {}, &block)
|
||||
signature = OAuth::Signature.build(request, options, &block)
|
||||
return false unless OauthNonce.remember(signature.request.nonce, signature.request.timestamp)
|
||||
|
||||
value = signature.verify
|
||||
value
|
||||
rescue OAuth::Signature::UnknownSignatureMethod
|
||||
|
|
|
@ -88,19 +88,23 @@ class Node < ActiveRecord::Base
|
|||
|
||||
raise OSM::APIBadXMLError.new("node", pt, "lat missing") if pt["lat"].nil?
|
||||
raise OSM::APIBadXMLError.new("node", pt, "lon missing") if pt["lon"].nil?
|
||||
|
||||
node.lat = OSM.parse_float(pt["lat"], OSM::APIBadXMLError, "node", pt, "lat not a number")
|
||||
node.lon = OSM.parse_float(pt["lon"], OSM::APIBadXMLError, "node", pt, "lon not a number")
|
||||
raise OSM::APIBadXMLError.new("node", pt, "Changeset id is missing") if pt["changeset"].nil?
|
||||
|
||||
node.changeset_id = pt["changeset"].to_i
|
||||
|
||||
raise OSM::APIBadUserInput, "The node is outside this world" unless node.in_world?
|
||||
|
||||
# version must be present unless creating
|
||||
raise OSM::APIBadXMLError.new("node", pt, "Version is required when updating") unless create || !pt["version"].nil?
|
||||
|
||||
node.version = create ? 0 : pt["version"].to_i
|
||||
|
||||
unless create
|
||||
raise OSM::APIBadXMLError.new("node", pt, "ID is required when updating.") if pt["id"].nil?
|
||||
|
||||
node.id = pt["id"].to_i
|
||||
# .to_i will return 0 if there is no number that can be parsed.
|
||||
# We want to make sure that there is no id with zero anyway
|
||||
|
@ -119,6 +123,7 @@ class Node < ActiveRecord::Base
|
|||
pt.find("tag").each do |tag|
|
||||
raise OSM::APIBadXMLError.new("node", pt, "tag is missing key") if tag["k"].nil?
|
||||
raise OSM::APIBadXMLError.new("node", pt, "tag is missing value") if tag["v"].nil?
|
||||
|
||||
node.add_tag_key_val(tag["k"], tag["v"])
|
||||
end
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
class Note < ActiveRecord::Base
|
||||
include GeoRecord
|
||||
|
||||
has_many :comments, -> { where(:visible => true).order(:created_at) }, :class_name => "NoteComment", :foreign_key => :note_id
|
||||
has_many :comments, -> { left_joins(:author).where(:visible => true, :users => { :status => [nil, "active", "confirmed"] }).order(:created_at) }, :class_name => "NoteComment", :foreign_key => :note_id
|
||||
|
||||
validates :id, :uniqueness => true, :presence => { :on => :update },
|
||||
:numericality => { :on => :update, :integer_only => true }
|
||||
|
@ -31,8 +31,8 @@ class Note < ActiveRecord::Base
|
|||
|
||||
validate :validate_position
|
||||
|
||||
scope :visible, -> { where("status != 'hidden'") }
|
||||
scope :invisible, -> { where("status = 'hidden'") }
|
||||
scope :visible, -> { where.not(:status => "hidden") }
|
||||
scope :invisible, -> { where(:status => "hidden") }
|
||||
|
||||
after_initialize :set_defaults
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ class Notifier < ActionMailer::Base
|
|||
|
||||
def signup_confirm(user, token)
|
||||
with_recipient_locale user do
|
||||
@url = url_for(:controller => "user", :action => "confirm",
|
||||
@url = url_for(:controller => "users", :action => "confirm",
|
||||
:display_name => user.display_name,
|
||||
:confirm_string => token.token)
|
||||
|
||||
|
@ -20,7 +20,7 @@ class Notifier < ActionMailer::Base
|
|||
def email_confirm(user, token)
|
||||
with_recipient_locale user do
|
||||
@address = user.new_email
|
||||
@url = url_for(:controller => "user", :action => "confirm_email",
|
||||
@url = url_for(:controller => "users", :action => "confirm_email",
|
||||
:confirm_string => token.token)
|
||||
|
||||
mail :to => user.new_email,
|
||||
|
@ -30,7 +30,7 @@ class Notifier < ActionMailer::Base
|
|||
|
||||
def lost_password(user, token)
|
||||
with_recipient_locale user do
|
||||
@url = url_for(:controller => "user", :action => "reset_password",
|
||||
@url = url_for(:controller => "users", :action => "reset_password",
|
||||
:token => token.token)
|
||||
|
||||
mail :to => user.email,
|
||||
|
@ -70,7 +70,7 @@ class Notifier < ActionMailer::Base
|
|||
@text = message.body
|
||||
@title = message.title
|
||||
@readurl = message_url(message)
|
||||
@replyurl = reply_message_url(message)
|
||||
@replyurl = message_reply_url(message)
|
||||
@author = @from_user
|
||||
|
||||
attach_user_avatar(message.sender)
|
||||
|
@ -87,16 +87,8 @@ class Notifier < ActionMailer::Base
|
|||
@from_user = comment.user.display_name
|
||||
@text = comment.body
|
||||
@title = comment.diary_entry.title
|
||||
@readurl = url_for(:controller => "diary_entry",
|
||||
:action => "view",
|
||||
:display_name => comment.diary_entry.user.display_name,
|
||||
:id => comment.diary_entry.id,
|
||||
:anchor => "comment#{comment.id}")
|
||||
@commenturl = url_for(:controller => "diary_entry",
|
||||
:action => "view",
|
||||
:display_name => comment.diary_entry.user.display_name,
|
||||
:id => comment.diary_entry.id,
|
||||
:anchor => "newcomment")
|
||||
@readurl = diary_entry_url(comment.diary_entry.user, comment.diary_entry, :anchor => "comment#{comment.id}")
|
||||
@commenturl = diary_entry_url(comment.diary_entry.user, comment.diary_entry, :anchor => "newcomment")
|
||||
@replyurl = new_message_url(comment.user, :message => { :title => "Re: #{comment.diary_entry.title}" })
|
||||
|
||||
@author = @from_user
|
||||
|
@ -112,9 +104,8 @@ class Notifier < ActionMailer::Base
|
|||
def friend_notification(friend)
|
||||
with_recipient_locale friend.befriendee do
|
||||
@friend = friend
|
||||
@viewurl = url_for(:controller => "user", :action => "view",
|
||||
:display_name => @friend.befriender.display_name)
|
||||
@friendurl = url_for(:controller => "user", :action => "make_friend",
|
||||
@viewurl = user_url(@friend.befriender)
|
||||
@friendurl = url_for(:controller => "users", :action => "make_friend",
|
||||
:display_name => @friend.befriender.display_name)
|
||||
@author = @friend.befriender.display_name
|
||||
|
||||
|
@ -190,8 +181,8 @@ class Notifier < ActionMailer::Base
|
|||
end
|
||||
|
||||
def user_avatar_file_path(user)
|
||||
image = user && user.image
|
||||
if image && image.file?
|
||||
image = user&.image
|
||||
if image&.file?
|
||||
return image.path(:small)
|
||||
else
|
||||
return Rails.root.join("app", "assets", "images", "users", "images", "small.png")
|
||||
|
|
|
@ -22,8 +22,10 @@ class OauthNonce < ActiveRecord::Base
|
|||
# Remembers a nonce and it's associated timestamp. It returns false if it has already been used
|
||||
def self.remember(nonce, timestamp)
|
||||
return false if Time.now.to_i - timestamp.to_i > 86400
|
||||
|
||||
oauth_nonce = OauthNonce.create(:nonce => nonce, :timestamp => timestamp.to_i)
|
||||
return false if oauth_nonce.new_record?
|
||||
|
||||
oauth_nonce
|
||||
end
|
||||
end
|
||||
|
|
|
@ -70,12 +70,15 @@ class Relation < ActiveRecord::Base
|
|||
relation = Relation.new
|
||||
|
||||
raise OSM::APIBadXMLError.new("relation", pt, "Version is required when updating") unless create || !pt["version"].nil?
|
||||
|
||||
relation.version = pt["version"]
|
||||
raise OSM::APIBadXMLError.new("relation", pt, "Changeset id is missing") if pt["changeset"].nil?
|
||||
|
||||
relation.changeset_id = pt["changeset"]
|
||||
|
||||
unless create
|
||||
raise OSM::APIBadXMLError.new("relation", pt, "ID is required when updating") if pt["id"].nil?
|
||||
|
||||
relation.id = pt["id"].to_i
|
||||
# .to_i will return 0 if there is no number that can be parsed.
|
||||
# We want to make sure that there is no id with zero anyway
|
||||
|
@ -94,6 +97,7 @@ class Relation < ActiveRecord::Base
|
|||
pt.find("tag").each do |tag|
|
||||
raise OSM::APIBadXMLError.new("relation", pt, "tag is missing key") if tag["k"].nil?
|
||||
raise OSM::APIBadXMLError.new("relation", pt, "tag is missing value") if tag["v"].nil?
|
||||
|
||||
relation.add_tag_keyval(tag["k"], tag["v"])
|
||||
end
|
||||
|
||||
|
@ -106,6 +110,7 @@ class Relation < ActiveRecord::Base
|
|||
pt.find("member").each do |member|
|
||||
# member_type =
|
||||
raise OSM::APIBadXMLError.new("relation", pt, "The #{member['type']} is not allowed only, #{TYPES.inspect} allowed") unless TYPES.include? member["type"]
|
||||
|
||||
# member_ref = member['ref']
|
||||
# member_role
|
||||
member["role"] ||= "" # Allow the upload to not include this, in which case we default to an empty string.
|
||||
|
@ -207,6 +212,7 @@ class Relation < ActiveRecord::Base
|
|||
lock!
|
||||
check_consistency(self, new_relation, user)
|
||||
raise OSM::APIPreconditionFailedError, "Cannot update relation #{id}: data or member data is invalid." unless new_relation.preconditions_ok?(members)
|
||||
|
||||
self.changeset_id = new_relation.changeset_id
|
||||
self.changeset = new_relation.changeset
|
||||
self.tags = new_relation.tags
|
||||
|
@ -219,6 +225,7 @@ class Relation < ActiveRecord::Base
|
|||
def create_with_history(user)
|
||||
check_create_consistency(self, user)
|
||||
raise OSM::APIPreconditionFailedError, "Cannot create relation: data or member data is invalid." unless preconditions_ok?
|
||||
|
||||
self.version = 0
|
||||
self.visible = true
|
||||
save_with_history!
|
||||
|
@ -253,7 +260,8 @@ class Relation < ActiveRecord::Base
|
|||
element = model.lock("for share").find_by(:id => m[1])
|
||||
|
||||
# and check that it is OK to use.
|
||||
raise OSM::APIPreconditionFailedError, "Relation with id #{id} cannot be saved due to #{m[0]} with id #{m[1]}" unless element && element.visible? && element.preconditions_ok?
|
||||
raise OSM::APIPreconditionFailedError, "Relation with id #{id} cannot be saved due to #{m[0]} with id #{m[1]}" unless element&.visible? && element&.preconditions_ok?
|
||||
|
||||
hash[m[1]] = true
|
||||
end
|
||||
|
||||
|
@ -267,9 +275,10 @@ class Relation < ActiveRecord::Base
|
|||
def fix_placeholders!(id_map, placeholder_id = nil)
|
||||
members.map! do |type, id, role|
|
||||
old_id = id.to_i
|
||||
if old_id < 0
|
||||
if old_id.negative?
|
||||
new_id = id_map[type.downcase.to_sym][old_id]
|
||||
raise OSM::APIBadUserInput, "Placeholder #{type} not found for reference #{old_id} in relation #{self.id.nil? ? placeholder_id : self.id}." if new_id.nil?
|
||||
|
||||
[type, new_id, role]
|
||||
else
|
||||
[type, id, role]
|
||||
|
@ -372,7 +381,7 @@ class Relation < ActiveRecord::Base
|
|||
# reasonable on the assumption that adding or removing members doesn't
|
||||
# materially change the rest of the relation.
|
||||
any_relations =
|
||||
changed_members.collect { |_id, type| type == "relation" }
|
||||
changed_members.collect { |type, _id, _role| type == "Relation" }
|
||||
.inject(false) { |acc, elem| acc || elem }
|
||||
|
||||
update_members = if tags_changed || any_relations
|
||||
|
|
|
@ -40,6 +40,7 @@ class RequestToken < OauthToken
|
|||
|
||||
def authorize!(user)
|
||||
return false if authorized?
|
||||
|
||||
self.user = user
|
||||
self.authorized_at = Time.now
|
||||
self.verifier = OAuth::Helper.generate_key(20)[0, 20] unless oauth10?
|
||||
|
|
|
@ -214,10 +214,12 @@ class Trace < ActiveRecord::Base
|
|||
|
||||
def update_from_xml_node(pt, create = false)
|
||||
raise OSM::APIBadXMLError.new("trace", pt, "visibility missing") if pt["visibility"].nil?
|
||||
|
||||
self.visibility = pt["visibility"]
|
||||
|
||||
unless create
|
||||
raise OSM::APIBadXMLError.new("trace", pt, "ID is required when updating.") if pt["id"].nil?
|
||||
|
||||
id = pt["id"].to_i
|
||||
# .to_i will return 0 if there is no number that can be parsed.
|
||||
# We want to make sure that there is no id with zero anyway
|
||||
|
@ -232,6 +234,7 @@ class Trace < ActiveRecord::Base
|
|||
|
||||
description = pt.find("description").first
|
||||
raise OSM::APIBadXMLError.new("trace", pt, "description missing") if description.nil?
|
||||
|
||||
self.description = description.content
|
||||
|
||||
self.tags = pt.find("tag").collect do |tag|
|
||||
|
@ -303,7 +306,7 @@ class Trace < ActiveRecord::Base
|
|||
tp.save!
|
||||
end
|
||||
|
||||
if gpx.actual_points > 0
|
||||
if gpx.actual_points.positive?
|
||||
max_lat = Tracepoint.where(:gpx_id => id).maximum(:latitude)
|
||||
min_lat = Tracepoint.where(:gpx_id => id).minimum(:latitude)
|
||||
max_lon = Tracepoint.where(:gpx_id => id).maximum(:longitude)
|
||||
|
|
|
@ -68,12 +68,15 @@ class Way < ActiveRecord::Base
|
|||
way = Way.new
|
||||
|
||||
raise OSM::APIBadXMLError.new("way", pt, "Version is required when updating") unless create || !pt["version"].nil?
|
||||
|
||||
way.version = pt["version"]
|
||||
raise OSM::APIBadXMLError.new("way", pt, "Changeset id is missing") if pt["changeset"].nil?
|
||||
|
||||
way.changeset_id = pt["changeset"]
|
||||
|
||||
unless create
|
||||
raise OSM::APIBadXMLError.new("way", pt, "ID is required when updating") if pt["id"].nil?
|
||||
|
||||
way.id = pt["id"].to_i
|
||||
# .to_i will return 0 if there is no number that can be parsed.
|
||||
# We want to make sure that there is no id with zero anyway
|
||||
|
@ -92,6 +95,7 @@ class Way < ActiveRecord::Base
|
|||
pt.find("tag").each do |tag|
|
||||
raise OSM::APIBadXMLError.new("way", pt, "tag is missing key") if tag["k"].nil?
|
||||
raise OSM::APIBadXMLError.new("way", pt, "tag is missing value") if tag["v"].nil?
|
||||
|
||||
way.add_tag_keyval(tag["k"], tag["v"])
|
||||
end
|
||||
|
||||
|
@ -123,7 +127,7 @@ class Way < ActiveRecord::Base
|
|||
ordered_nodes[nd.sequence_id] = nd.node_id.to_s if visible_nodes[nd.node_id]
|
||||
else
|
||||
# otherwise, manually go to the db to check things
|
||||
ordered_nodes[nd.sequence_id] = nd.node_id.to_s if nd.node && nd.node.visible?
|
||||
ordered_nodes[nd.sequence_id] = nd.node_id.to_s if nd.node&.visible?
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -194,6 +198,7 @@ class Way < ActiveRecord::Base
|
|||
def create_with_history(user)
|
||||
check_create_consistency(self, user)
|
||||
raise OSM::APIPreconditionFailedError, "Cannot create way: data is invalid." unless preconditions_ok?
|
||||
|
||||
self.version = 0
|
||||
self.visible = true
|
||||
save_with_history!
|
||||
|
@ -249,9 +254,10 @@ class Way < ActiveRecord::Base
|
|||
# to IDs +id_map+.
|
||||
def fix_placeholders!(id_map, placeholder_id = nil)
|
||||
nds.map! do |node_id|
|
||||
if node_id < 0
|
||||
if node_id.negative?
|
||||
new_id = id_map[:node][node_id]
|
||||
raise OSM::APIBadUserInput, "Placeholder node not found for reference #{node_id} in way #{id.nil? ? placeholder_id : id}" if new_id.nil?
|
||||
|
||||
new_id
|
||||
else
|
||||
node_id
|
||||
|
|
|
@ -63,7 +63,7 @@
|
|||
|
||||
<% unless current_user %>
|
||||
<div class="notice">
|
||||
<%= link_to(t(".join_discussion"), :controller => 'user', :action => 'login', :referer => request.fullpath) %>
|
||||
<%= link_to(t(".join_discussion"), :controller => 'users', :action => 'login', :referer => request.fullpath) %>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
|
@ -127,7 +127,7 @@
|
|||
<% end %>
|
||||
<%=
|
||||
user = (@prev_by_user || @next_by_user).user.display_name
|
||||
link_to content_tag(:bdi, user), :controller => "changeset", :action => "list", :display_name => user
|
||||
link_to content_tag(:bdi, user), :controller => "changeset", :action => "index", :display_name => user
|
||||
%>
|
||||
<% if @next_by_user %>
|
||||
·
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
|
||||
<%= content_tag "li", :id => "changeset_#{changeset.id}", :data => {:changeset => changeset_data} do %>
|
||||
<h4>
|
||||
<a class="changeset_id" href="<%= changeset_path(changeset.id) %>">
|
||||
<a class="changeset_id" href="<%= changeset_path(changeset) %>">
|
||||
<%= changeset.tags['comment'].to_s.presence || t('browse.no_comment') %>
|
||||
</a>
|
||||
</h4>
|
||||
|
|
|
@ -1 +1 @@
|
|||
xml.a(user.display_name, :href => url_for(:controller => "user", :action => "view", :display_name => user.display_name))
|
||||
xml.a(user.display_name, :href => url_for(:controller => "users", :action => "view", :display_name => user.display_name))
|
||||
|
|
|
@ -5,9 +5,9 @@
|
|||
<% end -%>
|
||||
|
||||
<%
|
||||
set_title(changeset_list_title(params, current_user))
|
||||
set_title(changeset_index_title(params, current_user))
|
||||
if params[:display_name]
|
||||
@heading = t('changeset.list.title_user', :user => link_to(params[:display_name], :controller => "user", :action => "view", :display_name => params[:display_name])).html_safe
|
||||
@heading = t('changeset.index.title_user', :user => link_to(params[:display_name], user_path(:display_name => params[:display_name]))).html_safe
|
||||
else
|
||||
@heading = @title
|
||||
end
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
atom_feed(:language => I18n.locale, :schema_date => 2009,
|
||||
:id => url_for(@params.merge(:only_path => false)),
|
||||
:root_url => url_for(@params.merge(:action => :list, :format => nil, :only_path => false)),
|
||||
:root_url => url_for(@params.merge(:action => :index, :format => nil, :only_path => false)),
|
||||
"xmlns:georss" => "http://www.georss.org/georss") do |feed|
|
||||
feed.title changeset_list_title(params, current_user)
|
||||
feed.title changeset_index_title(params, current_user)
|
||||
|
||||
feed.updated @edits.map { |e| [e.created_at, e.closed_at].max }.max
|
||||
feed.icon image_url("favicon.ico")
|
||||
|
@ -32,7 +32,7 @@ atom_feed(:language => I18n.locale, :schema_date => 2009,
|
|||
if changeset.user.data_public?
|
||||
entry.author do |author|
|
||||
author.name changeset.user.display_name
|
||||
author.uri url_for(:controller => "user", :action => "view", :display_name => changeset.user.display_name, :only_path => false)
|
||||
author.uri user_url(changeset.user, :only_path => false)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -51,7 +51,7 @@ atom_feed(:language => I18n.locale, :schema_date => 2009,
|
|||
table.tr do |tr|
|
||||
tr.th t("browse.changeset.belongs_to")
|
||||
tr.td do |td|
|
||||
td.a h(changeset.user.display_name), :href => url_for(:controller => "user", :action => "view", :display_name => changeset.user.display_name, :only_path => false)
|
||||
td.a h(changeset.user.display_name), :href => user_url(changeset.user, :only_path => false)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -59,10 +59,10 @@ atom_feed(:language => I18n.locale, :schema_date => 2009,
|
|||
table.tr do |tr|
|
||||
tr.th t("browse.tag_details.tags")
|
||||
tr.td do |td|
|
||||
td.table :cellpadding => "0" do |table|
|
||||
td.table :cellpadding => "0" do |tag_table|
|
||||
changeset.tags.sort.each do |tag|
|
||||
table.tr do |tr|
|
||||
tr.td << "#{h(tag[0])} = #{linkify(h(tag[1]))}"
|
||||
tag_table.tr do |tag_tr|
|
||||
tag_tr.td << "#{h(tag[0])} = #{linkify(h(tag[1]))}"
|
||||
end
|
||||
end
|
||||
end
|
|
@ -4,10 +4,10 @@
|
|||
<%= user_thumbnail diary_entry.user %>
|
||||
<% end %>
|
||||
|
||||
<h2><%= link_to h(diary_entry.title), :action => 'view', :display_name => diary_entry.user.display_name, :id => diary_entry.id %></h2>
|
||||
<h2><%= link_to h(diary_entry.title), diary_entry_path(diary_entry.user, diary_entry) %></h2>
|
||||
|
||||
<small class='deemphasize'>
|
||||
<%= raw(t '.posted_by', :link_user => (link_to h(diary_entry.user.display_name), user_path(diary_entry.user)), :created => l(diary_entry.created_at, :format => :blog), :language_link => (link_to h(diary_entry.language.name), :controller => 'diary_entry', :action => 'list', :display_name => nil, :language => diary_entry.language_code)) %>
|
||||
<%= raw(t '.posted_by', :link_user => (link_to h(diary_entry.user.display_name), user_path(diary_entry.user)), :created => l(diary_entry.created_at, :format => :blog), :language_link => (link_to h(diary_entry.language.name), :controller => 'diary_entry', :action => 'index', :display_name => nil, :language => diary_entry.language_code)) %>
|
||||
</small>
|
||||
|
||||
</div>
|
||||
|
@ -21,10 +21,10 @@
|
|||
<% end %>
|
||||
|
||||
<ul class='secondary-actions clearfix'>
|
||||
<% if params[:action] == 'list' %>
|
||||
<li><%= link_to t('.comment_link'), :action => 'view', :display_name => diary_entry.user.display_name, :id => diary_entry.id, :anchor => 'newcomment' %></li>
|
||||
<% if params[:action] == 'index' %>
|
||||
<li><%= link_to t('.comment_link'), diary_entry_path(diary_entry.user, diary_entry, :anchor => 'newcomment') %></li>
|
||||
<li><%= link_to t('.reply_link'), new_message_path(diary_entry.user, :message => { :title => "Re: #{diary_entry.title}" }) %></li>
|
||||
<li><%= link_to t('.comment_count', :count => diary_entry.visible_comments.count), :action => 'view', :display_name => diary_entry.user.display_name, :id => diary_entry.id, :anchor => 'comments' %></li>
|
||||
<li><%= link_to t('.comment_count', :count => diary_entry.visible_comments.count), diary_entry_path(diary_entry.user, diary_entry, :anchor => 'comments') %></li>
|
||||
<% end %>
|
||||
|
||||
<% if current_user && current_user == diary_entry.user %>
|
||||
|
|
1
app/views/diary_entry/_diary_index_entry.html.erb
Normal file
1
app/views/diary_entry/_diary_index_entry.html.erb
Normal file
|
@ -0,0 +1 @@
|
|||
<%= render :partial => "diary_entry", :object => diary_index_entry %>
|
|
@ -1 +0,0 @@
|
|||
<%= render :partial => "diary_entry", :object => diary_list_entry %>
|
|
@ -11,7 +11,7 @@
|
|||
<% @comments.each do |comment| -%>
|
||||
<% cl = cycle('table0', 'table1') %>
|
||||
<tr class="<%= cl %>">
|
||||
<td width="25%"><%= link_to comment.diary_entry.title, :action => :view, :display_name => comment.diary_entry.user.display_name, :id => comment.diary_entry.id %></td>
|
||||
<td width="25%"><%= link_to comment.diary_entry.title, diary_entry_path(comment.diary_entry.user, comment.diary_entry) %></td>
|
||||
<td width="25%"><span title="<%= l comment.created_at, :format => :friendly %>"><%= t '.ago', :ago => time_ago_in_words(comment.created_at) %></span></td>
|
||||
<td width="50%" class="richtext"><%= comment.body.to_html %></td>
|
||||
</tr>
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
<% if @user %>
|
||||
<%= render :partial => 'diary_entry', :collection => @entries %>
|
||||
<% else %>
|
||||
<%= render :partial => 'diary_list_entry', :collection => @entries %>
|
||||
<%= render :partial => 'diary_index_entry', :collection => @entries %>
|
||||
<% end %>
|
||||
|
||||
<div class="pagination">
|
|
@ -7,24 +7,24 @@ xml.rss("version" => "2.0",
|
|||
xml.channel do
|
||||
xml.title @title
|
||||
xml.description @description
|
||||
xml.link url_for(:action => "list", :only_path => false)
|
||||
xml.link url_for(:action => "index", :only_path => false)
|
||||
xml.image do
|
||||
xml.url image_url("mag_map-rss2.0.png")
|
||||
xml.title @title
|
||||
xml.width "100"
|
||||
xml.height "100"
|
||||
xml.link url_for(:action => "list", :only_path => false)
|
||||
xml.link url_for(:action => "index", :only_path => false)
|
||||
end
|
||||
|
||||
@entries.each do |entry|
|
||||
xml.item do
|
||||
xml.title entry.title
|
||||
xml.link url_for(:action => "view", :id => entry.id, :display_name => entry.user.display_name, :only_path => false)
|
||||
xml.guid url_for(:action => "view", :id => entry.id, :display_name => entry.user.display_name, :only_path => false)
|
||||
xml.link diary_entry_url(entry.user, entry, :only_path => false)
|
||||
xml.guid diary_entry_url(entry.user, entry, :only_path => false)
|
||||
xml.description entry.body.to_html
|
||||
xml.dc :creator, entry.user.display_name
|
||||
xml.pubDate entry.created_at.to_s(:rfc822)
|
||||
xml.comments url_for(:action => "view", :id => entry.id, :display_name => entry.user.display_name, :anchor => "comments", :only_path => false)
|
||||
xml.comments diary_entry_url(entry.user, entry, :anchor => "comments", :only_path => false)
|
||||
|
||||
if entry.latitude && entry.longitude
|
||||
xml.geo :lat, entry.latitude.to_s
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<% content_for :heading do %>
|
||||
<div id="userinformation" >
|
||||
<%= user_image @entry.user %>
|
||||
<h2><%= link_to t('.user_title', :user => h(@entry.user.display_name)), :action => :list %></h2>
|
||||
<h2><%= link_to t('.user_title', :user => h(@entry.user.display_name)), :action => :index %></h2>
|
||||
<p><%= rss_link_to :action => :rss, :display_name => @entry.user.display_name %></p>
|
||||
</div>
|
||||
<% end %>
|
||||
|
@ -30,7 +30,7 @@
|
|||
<div class="diary-subscribe-buttons"><%= link_to t('javascripts.changesets.show.subscribe'), diary_entry_subscribe_path(:display_name => @entry.user.display_name, :id => @entry.id), :method => :post, :class => :button %></div>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<h3 id="newcomment"><%= raw t(".login_to_leave_a_comment", :login_link => link_to(t(".login"), :controller => 'user', :action => 'login', :referer => request.fullpath)) %></h3>
|
||||
<h3 id="newcomment"><%= raw t(".login_to_leave_a_comment", :login_link => link_to(t(".login"), :controller => 'users', :action => 'login', :referer => request.fullpath)) %></h3>
|
||||
<% end %>
|
||||
</div>
|
||||
|
|
@ -2,9 +2,9 @@
|
|||
<% comments.each do |comment| %>
|
||||
<div class="comment">
|
||||
<div style="float:left">
|
||||
<%= link_to user_thumbnail(comment.user), user_path(comment.user.display_name) %>
|
||||
<%= link_to user_thumbnail(comment.user), user_path(comment.user) %>
|
||||
</div>
|
||||
<b> <%= link_to comment.user.display_name, user_path(comment.user.display_name) %> </b> <br/>
|
||||
<b> <%= link_to comment.user.display_name, user_path(comment.user) %> </b> <br/>
|
||||
<%= comment.body %>
|
||||
</div>
|
||||
<span class="deemphasize">
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
<% reports.each do |report| %>
|
||||
<div class="report">
|
||||
<div style="float:left">
|
||||
<%= link_to user_thumbnail(report.user), user_path(report.user.display_name) %>
|
||||
<%= link_to user_thumbnail(report.user), user_path(report.user) %>
|
||||
</div>
|
||||
<%= t ".reported_by_html", :category => report.category, :user => link_to(report.user.display_name, user_path(report.user.display_name)) %>
|
||||
<%= t ".reported_by_html", :category => report.category, :user => link_to(report.user.display_name, user_path(report.user)) %>
|
||||
<br/>
|
||||
<span class="deemphasize">
|
||||
<%= t(".updated_at", :datetime => l(report.updated_at.to_datetime, :format => :friendly)) %>
|
||||
|
|
|
@ -34,10 +34,10 @@
|
|||
<td><%= t ".states.#{issue.status}" %></td>
|
||||
<td><%= link_to t(".reports_count", :count => issue.reports_count), issue %></td>
|
||||
<td><%= link_to reportable_title(issue.reportable), reportable_url(issue.reportable) %></td>
|
||||
<td><%= link_to issue.reported_user.display_name, user_path(issue.reported_user.display_name) if issue.reported_user %></td>
|
||||
<td><%= link_to issue.reported_user.display_name, user_path(issue.reported_user) if issue.reported_user %></td>
|
||||
<td>
|
||||
<% if issue.user_updated %>
|
||||
<%= t ".last_updated_time_user_html", :user => link_to(issue.user_updated.display_name, user_path(issue.user_updated.display_name)),
|
||||
<%= t ".last_updated_time_user_html", :user => link_to(issue.user_updated.display_name, user_path(issue.user_updated)),
|
||||
:time => distance_of_time_in_words_to_now(issue.updated_at),
|
||||
:title => l(issue.updated_at) %>
|
||||
<% else %>
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
<meta name="viewport" content="width=device-width, minimum-scale=1.0, maximum-scale=1.0"/>
|
||||
<!--[if lt IE 9]><%= javascript_include_tag "html5shiv" %><![endif]-->
|
||||
<%= javascript_include_tag "application" %>
|
||||
<%= javascript_include_tag "i18n/" + I18n.locale.to_s %>
|
||||
<%= stylesheet_link_tag "screen-#{dir}", :media => "screen" %>
|
||||
<%= stylesheet_link_tag "print-#{dir}", :media => "print" %>
|
||||
<%= stylesheet_link_tag "leaflet-all", :media => "screen, print" %>
|
||||
|
|
|
@ -82,14 +82,14 @@
|
|||
<li>
|
||||
<%= link_to inbox_messages_path do %>
|
||||
<span class='count-number'><%= number_with_delimiter(current_user.new_messages.size) %></span>
|
||||
<%= t('user.view.my messages') %>
|
||||
<%= t('users.show.my messages') %>
|
||||
<% end %>
|
||||
</li>
|
||||
<li>
|
||||
<%= link_to t('user.view.my profile'), user_path(:display_name => current_user.display_name) %>
|
||||
<%= link_to t('users.show.my profile'), user_path(current_user) %>
|
||||
</li>
|
||||
<li>
|
||||
<%= link_to t('user.view.my settings'), :controller => 'user', :action => 'account', :display_name => current_user.display_name %>
|
||||
<%= link_to t('users.show.my settings'), :controller => 'users', :action => 'account', :display_name => current_user.display_name %>
|
||||
</li>
|
||||
<li class="divider"></li>
|
||||
<li>
|
||||
|
|
|
@ -43,9 +43,8 @@
|
|||
<h2><%= t 'layouts.intro_header' %></h2>
|
||||
<div class="close-wrap"><span class="icon close"></span></div>
|
||||
<p><%= t 'layouts.intro_text' %></p>
|
||||
<p><%= t 'layouts.partners_html',
|
||||
<p><%= t 'layouts.hosting_partners_html',
|
||||
:ucl => link_to(t('layouts.partners_ucl'), "https://www.ucl.ac.uk"),
|
||||
:ic => link_to(t('layouts.partners_ic'), "https://www.imperial.ac.uk/"),
|
||||
:bytemark => link_to(t('layouts.partners_bytemark'), "https://www.bytemark.co.uk"),
|
||||
:partners => link_to(t('layouts.partners_partners'), "https://hardware.openstreetmap.org/thanks/") %>
|
||||
</p>
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<td class="inbox-sender"><%= link_to h(message_summary.sender.display_name), user_path(message_summary.sender) %></td>
|
||||
<td class="inbox-subject"><%= link_to h(message_summary.title), message_path(message_summary) %></td>
|
||||
<td class="inbox-sent"><%= l message_summary.sent_on, :format => :friendly %></td>
|
||||
<td class="inbox-mark-unread"><%= button_to t('.unread_button'), mark_message_path(message_summary, :mark => 'unread'), { :remote => true } %></td>
|
||||
<td class="inbox-mark-read"><%= button_to t('.read_button'), mark_message_path(message_summary, :mark => 'read'), { :remote => true } %></td>
|
||||
<td class="inbox-destroy"><%= button_to t('.destroy_button'), destroy_message_path(message_summary, :referer => request.fullpath), { :remote => true } %></td>
|
||||
<td class="inbox-mark-unread"><%= button_to t('.unread_button'), message_mark_path(message_summary, :mark => 'unread'), { :remote => true } %></td>
|
||||
<td class="inbox-mark-read"><%= button_to t('.read_button'), message_mark_path(message_summary, :mark => 'read'), { :remote => true } %></td>
|
||||
<td class="inbox-destroy"><%= button_to t('.destroy_button'), message_path(message_summary, :referer => request.fullpath), { :method => :delete, :remote => true } %></td>
|
||||
</tr>
|
||||
|
|
|
@ -2,5 +2,5 @@
|
|||
<td class="inbox-sender"><%= link_to h(sent_message_summary.recipient.display_name), user_path(sent_message_summary.recipient) %></td>
|
||||
<td class="inbox-subject"><%= link_to h(sent_message_summary.title), message_path(sent_message_summary) %></td>
|
||||
<td class="inbox-sent"><%= l sent_message_summary.sent_on, :format => :friendly %></td>
|
||||
<td class="inbox-destroy"><%= button_to t('.destroy_button'), destroy_message_path(sent_message_summary, :referer => request.fullpath), { :remote => true } %></td>
|
||||
<td class="inbox-destroy"><%= button_to t('.destroy_button'), message_path(sent_message_summary, :referer => request.fullpath), { :method => :delete, :remote => true } %></td>
|
||||
</tr>
|
||||
|
|
|
@ -4,7 +4,8 @@
|
|||
|
||||
<%= error_messages_for 'message' %>
|
||||
|
||||
<%= form_for :message, :html => { :class => 'standard-form' }, :url => new_message_path(@message.recipient) do |f| %>
|
||||
<%= form_for @message, :html => { :class => 'standard-form' } do |f| %>
|
||||
<%= hidden_field_tag :display_name, @message.recipient.display_name %>
|
||||
<fieldset>
|
||||
<div class='form-row'>
|
||||
<label class="standard-label" for="message_title"><%= t '.subject' %></label>
|
||||
|
|
|
@ -14,9 +14,9 @@
|
|||
<div class="richtext"><%= @message.body.to_html %></div>
|
||||
|
||||
<div class='message-buttons buttons'>
|
||||
<%= button_to t('.reply_button'), reply_message_path(@message), :class => 'reply-button' %>
|
||||
<%= button_to t('.unread_button'), mark_message_path(@message, :mark => 'unread'), :class => 'mark-unread-button' %>
|
||||
<%= button_to t('.destroy_button'), destroy_message_path(@message), :class => 'destroy-button' %>
|
||||
<%= button_to t('.reply_button'), message_reply_path(@message), :class => 'reply-button' %>
|
||||
<%= button_to t('.unread_button'), message_mark_path(@message, :mark => 'unread'), :class => 'mark-unread-button' %>
|
||||
<%= button_to t('.destroy_button'), message_path(@message), :method => 'delete', :class => 'destroy-button' %>
|
||||
|
||||
<% else %>
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<h1><%= t ".title" %></h1>
|
||||
<% end %>
|
||||
|
||||
<p><%= raw t(".request_access", :app_name => link_to(@token.client_application.name, @token.client_application.url), :user => link_to(current_user.display_name, :controller => :user, :action => :view, :display_name => current_user.display_name)) %></p>
|
||||
<p><%= raw t(".request_access", :app_name => link_to(@token.client_application.name, @token.client_application.url), :user => link_to(current_user.display_name, user_path(current_user))) %></p>
|
||||
|
||||
<%= form_tag authorize_url do %>
|
||||
<%= hidden_field_tag "oauth_token", @token.token %>
|
||||
|
|
|
@ -32,9 +32,8 @@
|
|||
|
||||
<div class='section' id='partners'>
|
||||
<h2><div class='icon partners'></div><%= t ".partners_title" %></h2>
|
||||
<p><%= t 'layouts.partners_html',
|
||||
<p><%= t 'layouts.hosting_partners_html',
|
||||
:ucl => link_to(t('layouts.partners_ucl'), "https://www.ucl.ac.uk"),
|
||||
:ic => link_to(t('layouts.partners_ic'), "https://www.imperial.ac.uk/"),
|
||||
:bytemark => link_to(t('layouts.partners_bytemark'), "https://www.bytemark.co.uk"),
|
||||
:partners => link_to(t('layouts.partners_partners'), "https://hardware.openstreetmap.org/thanks/") %>
|
||||
</p>
|
||||
|
|
|
@ -3,13 +3,13 @@
|
|||
<td class="<%= cl %>">
|
||||
<% if STATUS != :gpx_offline %>
|
||||
<% if trace.inserted %>
|
||||
<a href="<%= url_for :controller => 'traces', :action => 'view', :id => trace.id, :display_name => trace.user.display_name %>"><img src="<%= url_for :controller => 'traces', :action => 'icon', :id => trace.id, :display_name => trace.user.display_name %>" border="0" alt="" /></a>
|
||||
<a href="<%= url_for :controller => 'traces', :action => 'show', :id => trace.id, :display_name => trace.user.display_name %>"><img src="<%= url_for :controller => 'traces', :action => 'icon', :id => trace.id, :display_name => trace.user.display_name %>" border="0" alt="" /></a>
|
||||
<% else %>
|
||||
<span class="trace_pending"><%= t '.pending' %></span>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</td>
|
||||
<td class="<%= cl %>"><%= link_to trace.name, { :controller => 'traces', :action => 'view', :display_name => trace.user.display_name, :id => trace.id } %>
|
||||
<td class="<%= cl %>"><%= link_to trace.name, { :controller => 'traces', :action => 'show', :display_name => trace.user.display_name, :id => trace.id } %>
|
||||
<span class="trace_summary" title="<%= trace.timestamp %>"> ...
|
||||
<% if trace.inserted %>
|
||||
(<%= t '.count_points', :count => trace.size.to_s.gsub(/(\d)(?=(\d{3})+$)/,'\1,') %>)
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
<img src="<%= url_for :controller => 'traces', :action => 'picture', :id => @trace.id, :display_name => @trace.user.display_name %>">
|
||||
|
||||
<%= form_for @trace, :method => :post, :url => { :action => "edit" } do |f| %>
|
||||
<%= form_for @trace do |f| %>
|
||||
|
||||
<div id='edit-trace-form' class='standard-form'>
|
||||
<fieldset>
|
||||
|
|
|
@ -7,22 +7,22 @@ xml.rss("version" => "2.0",
|
|||
xml.channel do
|
||||
xml.title t(".title")
|
||||
xml.description t(".title")
|
||||
xml.link url_for(:controller => :traces, :action => :list, :only_path => false)
|
||||
xml.link url_for(:controller => :traces, :action => :index, :only_path => false)
|
||||
|
||||
xml.image do
|
||||
xml.url image_url("mag_map-rss2.0.png")
|
||||
xml.title t(".title")
|
||||
xml.width 100
|
||||
xml.height 100
|
||||
xml.link url_for(:controller => :traces, :action => :list, :only_path => false)
|
||||
xml.link url_for(:controller => :traces, :action => :index, :only_path => false)
|
||||
end
|
||||
|
||||
@traces.each do |trace|
|
||||
xml.item do
|
||||
xml.title trace.name
|
||||
|
||||
xml.link url_for(:controller => :traces, :action => :view, :id => trace.id, :display_name => trace.user.display_name, :only_path => false)
|
||||
xml.guid url_for(:controller => :traces, :action => :view, :id => trace.id, :display_name => trace.user.display_name, :only_path => false)
|
||||
xml.link url_for(:controller => :traces, :action => :show, :id => trace.id, :display_name => trace.user.display_name, :only_path => false)
|
||||
xml.guid url_for(:controller => :traces, :action => :show, :id => trace.id, :display_name => trace.user.display_name, :only_path => false)
|
||||
|
||||
xml.description do
|
||||
xml.cdata! render(:partial => "description", :object => trace, :formats => [:html])
|
||||
|
|
|
@ -5,11 +5,11 @@
|
|||
<li><%= rss_link_to :action => 'georss', :display_name => @display_name, :tag => @tag %></li>
|
||||
<li><%= link_to t('.upload_trace'), new_trace_path %></li>
|
||||
<% if @tag %>
|
||||
<li><%= link_to t('.see_all_traces'), :controller => 'traces', :action => 'list', :display_name => nil, :tag => nil, :page => nil %></li>
|
||||
<li><%= link_to t('.see_all_traces'), :controller => 'traces', :action => 'index', :display_name => nil, :tag => nil, :page => nil %></li>
|
||||
<li><%= link_to t('.see_my_traces'), :action => 'mine', :tag => nil, :page => nil %></li>
|
||||
<% else %>
|
||||
<% if @display_name %>
|
||||
<li><%= link_to t('.see_all_traces'), :controller => 'traces', :action => 'list', :display_name => nil, :tag => nil, :page => nil %></li>
|
||||
<li><%= link_to t('.see_all_traces'), :controller => 'traces', :action => 'index', :display_name => nil, :tag => nil, :page => nil %></li>
|
||||
<% end %>
|
||||
<% if current_user && current_user != @target_user %>
|
||||
<li><%= link_to t('.see_my_traces'), :action => 'mine', :tag => nil, :page => nil %></li>
|
|
@ -40,7 +40,7 @@
|
|||
<td><%= t '.tags' %></td>
|
||||
<td>
|
||||
<% unless @trace.tags.empty? %>
|
||||
<%= raw(@trace.tags.collect { |tag| link_to tag.tag, { :controller => 'traces', :action => 'list', :tag => tag.tag, :id => nil } }.join(", ")) %>
|
||||
<%= raw(@trace.tags.collect { |tag| link_to tag.tag, { :controller => 'traces', :action => 'index', :tag => tag.tag, :id => nil } }.join(", ")) %>
|
||||
<% else %>
|
||||
<i><%= t '.none' %></i>
|
||||
<% end %>
|
||||
|
@ -57,10 +57,8 @@
|
|||
<% if current_user && (current_user==@trace.user || current_user.administrator? || current_user.moderator?)%>
|
||||
<div class="buttons">
|
||||
<% if current_user == @trace.user %>
|
||||
<div>
|
||||
<%= button_to t('.edit_track'), trace_edit_path(@trace) %>
|
||||
</div>
|
||||
<%= link_to t('.edit_trace'), edit_trace_path(@trace), :class => "button" %>
|
||||
<% end %>
|
||||
<%= button_to t('.delete_track'), { :controller => 'traces', :action => 'delete', :id => @trace.id }, :data => { :confirm => t('.confirm_delete') } %>
|
||||
<%= button_to t('.delete_trace'), { :controller => 'traces', :action => 'delete', :id => @trace.id }, :data => { :confirm => t('.confirm_delete') } %>
|
||||
</div>
|
||||
<% end %>
|
|
@ -14,16 +14,16 @@
|
|||
<% if @user.home_lon and @user.home_lat and contact.home_lon and contact.home_lat %>
|
||||
<% distance = @user.distance(contact) %>
|
||||
<% if distance < 1 %>
|
||||
(<%= t 'user.view.m away', :count => (distance * 1000).round %>)
|
||||
(<%= t 'user.show.m away', :count => (distance * 1000).round %>)
|
||||
<% else %>
|
||||
(<%= t 'user.view.km away', :count => distance.round %>)
|
||||
(<%= t 'user.show.km away', :count => distance.round %>)
|
||||
<% end %>
|
||||
<% end %>
|
||||
</p>
|
||||
<p>
|
||||
<% changeset = contact.changesets.first %>
|
||||
<% if changeset %>
|
||||
<%= t('user.view.latest edit', :ago => t('user.view.ago', :time_in_words_ago => time_ago_in_words(changeset.created_at))) %>
|
||||
<%= t('user.show.latest edit', :ago => t('user.show.ago', :time_in_words_ago => time_ago_in_words(changeset.created_at))) %>
|
||||
<% comment = changeset.tags['comment'].to_s != '' ? changeset.tags['comment'] : t('browse.no_comment') %>
|
||||
"<%= link_to(comment,
|
||||
{:controller => 'browse', :action => 'changeset', :id => changeset.id},
|
||||
|
@ -35,12 +35,12 @@
|
|||
</p>
|
||||
|
||||
<ul class='secondary-actions clearfix deemphasize'>
|
||||
<li><%= link_to t('user.view.send message'), new_message_path(contact) %></li>
|
||||
<li><%= link_to t('users.show.send message'), new_message_path(contact) %></li>
|
||||
<li>
|
||||
<% if current_user.is_friends_with?(contact) %>
|
||||
<%= link_to t('user.view.remove as friend'), remove_friend_path(:display_name => contact.display_name, :referer => request.fullpath), :method => :post %>
|
||||
<%= link_to t('users.show.remove as friend'), remove_friend_path(:display_name => contact.display_name, :referer => request.fullpath), :method => :post %>
|
||||
<% else %>
|
||||
<%= link_to t('user.view.add as friend'), make_friend_path(:display_name => contact.display_name, :referer => request.fullpath), :method => :post %>
|
||||
<%= link_to t('users.show.add as friend'), make_friend_path(:display_name => contact.display_name, :referer => request.fullpath), :method => :post %>
|
||||
<% end %>
|
||||
</li>
|
||||
</ul>
|
|
@ -7,14 +7,14 @@
|
|||
<td>
|
||||
<p>
|
||||
<% if user.creation_ip %>
|
||||
<%= raw t 'user.list.summary',
|
||||
:name => link_to(h(user.display_name), :action => "view", :display_name => user.display_name),
|
||||
<%= raw t 'users.index.summary',
|
||||
:name => link_to(h(user.display_name), user_path(user)),
|
||||
:ip_address => link_to(user.creation_ip, :ip => user.creation_ip),
|
||||
:date => l(user.creation_time, :format => :friendly)
|
||||
%>
|
||||
<% else %>
|
||||
<%= raw t 'user.list.summary_no_ip',
|
||||
:name => link_to(h(user.display_name), :action => "view", :display_name => user.display_name),
|
||||
<%= raw t 'users.index.summary_no_ip',
|
||||
:name => link_to(h(user.display_name), user_path(user)),
|
||||
:date => l(user.creation_time, :format => :friendly)
|
||||
%>
|
||||
<% end %>
|
|
@ -6,7 +6,7 @@
|
|||
<h1><%= t '.my settings' %></h1>
|
||||
<ul class='secondary-actions clearfix'>
|
||||
<li><%= link_to t('.return to profile'), user_path(current_user) %></li>
|
||||
<li><%= link_to t('user.view.oauth settings'), :controller => 'oauth_clients', :action => 'index' %></li>
|
||||
<li><%= link_to t('users.show.oauth settings'), :controller => 'oauth_clients', :action => 'index' %></li>
|
||||
</ul>
|
||||
<% end %>
|
||||
|
||||
|
@ -14,7 +14,7 @@
|
|||
<%= form_for current_user, :url => { :action => :account }, :method => :post, :html => { :multipart => true, :id => 'accountForm', :class => 'standard-form', :autocomplete => :off } do |f| %>
|
||||
<fieldset>
|
||||
<div class="form-row">
|
||||
<label class="standard-label"><%= t 'user.new.display name' %></label>
|
||||
<label class="standard-label"><%= t 'users.new.display name' %></label>
|
||||
<%= f.text_field :display_name %>
|
||||
</div>
|
||||
</fieldset>
|
||||
|
@ -35,12 +35,12 @@
|
|||
|
||||
<fieldset>
|
||||
<div class="form-row">
|
||||
<label class="standard-label"><%= t 'user.new.password' %></label>
|
||||
<label class="standard-label"><%= t 'users.new.password' %></label>
|
||||
<%= f.password_field :pass_crypt, {:value => '', :autocomplete => :off} %>
|
||||
</div>
|
||||
|
||||
<div class="form-row">
|
||||
<label class="standard-label"><%= t 'user.new.confirm password' %></label>
|
||||
<label class="standard-label"><%= t 'users.new.confirm password' %></label>
|
||||
<%= f.password_field :pass_crypt_confirmation, {:value => '', :autocomplete => :off} %>
|
||||
</div>
|
||||
</fieldset>
|
||||
|
@ -79,7 +79,7 @@
|
|||
<% end %>
|
||||
<% else %>
|
||||
<%= t '.contributor terms.not yet agreed' %>
|
||||
<%= link_to t('.contributor terms.review link text'), :controller => 'user', :action => 'terms' %>
|
||||
<%= link_to t('.contributor terms.review link text'), :controller => 'users', :action => 'terms' %>
|
||||
<% end %>
|
||||
</span>
|
||||
</div>
|
|
@ -28,7 +28,7 @@
|
|||
<%= password_field_tag "password", "", :tabindex => 2 %>
|
||||
</div>
|
||||
<span class="form-help deemphasize">
|
||||
<%= link_to t('.lost password link'), :controller => 'user', :action => 'lost_password' %>
|
||||
<%= link_to t('.lost password link'), :controller => 'users', :action => 'lost_password' %>
|
||||
</span>
|
||||
</fieldset>
|
||||
|
||||
|
@ -69,7 +69,7 @@
|
|||
<div id='login_openid_url' class='form-row'>
|
||||
<label for='openid_url' class="standard-label"><%= raw t '.openid', :logo => openid_logo %></label>
|
||||
<%= text_field_tag("openid_url", "", { :tabindex => 3, :class => "openid_url" }) %>
|
||||
<span class="minorNote">(<a href="<%= t 'user.account.openid.link' %>" target="_new"><%= t 'user.account.openid.link text' %></a>)</span>
|
||||
<span class="minorNote">(<a href="<%= t 'users.account.openid.link' %>" target="_new"><%= t 'users.account.openid.link text' %></a>)</span>
|
||||
</div>
|
||||
|
||||
<div class='form-row'>
|
|
@ -7,7 +7,7 @@
|
|||
<!-- Displaying user's own profile page to themself -->
|
||||
<ul class='secondary-actions clearfix'>
|
||||
<li>
|
||||
<%= link_to t('.my edits'), :controller => 'changeset', :action => 'list', :display_name => current_user.display_name %>
|
||||
<%= link_to t('.my edits'), :controller => 'changeset', :action => 'index', :display_name => current_user.display_name %>
|
||||
<span class='count-number'><%= number_with_delimiter(current_user.changesets.size) %></span>
|
||||
</li>
|
||||
<li>
|
||||
|
@ -18,14 +18,14 @@
|
|||
<span class='count-number'><%= number_with_delimiter(current_user.traces.size) %></span>
|
||||
</li>
|
||||
<li>
|
||||
<%= link_to t('.my diary'), :controller => 'diary_entry', :action => 'list', :display_name => current_user.display_name %>
|
||||
<%= link_to t('.my diary'), :controller => 'diary_entry', :action => 'index', :display_name => current_user.display_name %>
|
||||
<span class='count-number'><%= number_with_delimiter(current_user.diary_entries.size) %></span>
|
||||
</li>
|
||||
<li>
|
||||
<%= link_to t('.my comments' ), :controller => 'diary_entry', :action => 'comments', :display_name => current_user.display_name %>
|
||||
</li>
|
||||
<li>
|
||||
<%= link_to t('.my settings'), :controller => 'user', :action => 'account', :display_name => current_user.display_name %>
|
||||
<%= link_to t('.my settings'), :controller => 'users', :action => 'account', :display_name => current_user.display_name %>
|
||||
</li>
|
||||
|
||||
<% if current_user.blocks.exists? %>
|
||||
|
@ -49,14 +49,14 @@
|
|||
<ul class='secondary-actions clearfix'>
|
||||
|
||||
<li>
|
||||
<%= link_to t('.edits'), :controller => 'changeset', :action => 'list', :display_name => @user.display_name %>
|
||||
<%= link_to t('.edits'), :controller => 'changeset', :action => 'index', :display_name => @user.display_name %>
|
||||
<span class='count-number'><%= number_with_delimiter(@user.changesets.size) %></span>
|
||||
</li>
|
||||
<li>
|
||||
<%= link_to t('.notes'), :controller => 'notes', :action=> 'mine' %>
|
||||
</li>
|
||||
<li>
|
||||
<%= link_to t('.traces'), :controller => 'traces', :action => 'list', :display_name => @user.display_name %>
|
||||
<%= link_to t('.traces'), :controller => 'traces', :action => 'index', :display_name => @user.display_name %>
|
||||
<span class='count-number'><%= number_with_delimiter(@user.traces.size) %></span>
|
||||
</li>
|
||||
|
||||
|
@ -66,7 +66,7 @@
|
|||
<%= link_to t('.send message'), new_message_path(@user) %>
|
||||
</li>
|
||||
<li>
|
||||
<%= link_to t('.diary'), :controller => 'diary_entry', :action => 'list', :display_name => @user.display_name %>
|
||||
<%= link_to t('.diary'), :controller => 'diary_entry', :action => 'index', :display_name => @user.display_name %>
|
||||
<span class='count-number'><%= number_with_delimiter(@user.diary_entries.size) %></span>
|
||||
</li>
|
||||
<li>
|
||||
|
@ -179,7 +179,7 @@
|
|||
<% if current_user and @user.id == current_user.id %>
|
||||
<% if @user.home_lat.nil? or @user.home_lon.nil? %>
|
||||
<div id="map" class="content_map">
|
||||
<p id="no_home_location"><%= raw(t '.if set location', :settings_link => (link_to t('.settings_link_text'), :controller => 'user', :action => 'account', :display_name => current_user.display_name)) %></p>
|
||||
<p id="no_home_location"><%= raw(t '.if set location', :settings_link => (link_to t('.settings_link_text'), :controller => 'users', :action => 'account', :display_name => current_user.display_name)) %></p>
|
||||
</div>
|
||||
<% else %>
|
||||
<% content_for :head do %>
|
Loading…
Add table
Add a link
Reference in a new issue