Use a current_user helper for accessing the logged in user in all views.
This commit is contained in:
parent
41000078b9
commit
c819bec8b7
31 changed files with 99 additions and 97 deletions
|
@ -5,6 +5,8 @@ class ApplicationController < ActionController::Base
|
|||
|
||||
before_action :fetch_body
|
||||
|
||||
helper_method :current_user
|
||||
|
||||
def authorize_web
|
||||
if session[:user]
|
||||
self.current_user = User.where(:id => session[:user]).where("status IN ('active', 'confirmed', 'suspended')").first
|
||||
|
|
|
@ -12,10 +12,10 @@
|
|||
<%= render :partial => "tag_details", :object => @changeset.tags.except('comment') %>
|
||||
|
||||
<h4 class="comments-header"><%= t('browse.changeset.discussion') %></h4>
|
||||
|
||||
|
||||
<div class="buttons clearfix subscribe-buttons">
|
||||
<form action="#" class="hide_unless_logged_in">
|
||||
<% if @user and @changeset.subscribers.exists?(@user.id) %>
|
||||
<% if current_user and @changeset.subscribers.exists?(current_user.id) %>
|
||||
<input class="action-button" type="submit" name="unsubscribe" value="<%= t('javascripts.changesets.show.unsubscribe') %>" data-method="POST" data-url="<%= changeset_unsubscribe_url(@changeset) %>" />
|
||||
<% else %>
|
||||
<input class="action-button" type="submit" name="subscribe" value="<%= t('javascripts.changesets.show.subscribe') %>" data-method="POST" data-url="<%= changeset_subscribe_url(@changeset) %>" />
|
||||
|
@ -37,13 +37,13 @@
|
|||
:when => friendly_date(comment.created_at), :exact_time => l(comment.created_at),
|
||||
:user => link_to(h(comment.author.display_name), {:controller => "user", :action => "view",
|
||||
:display_name => comment.author.display_name})).html_safe %>
|
||||
<% if @user and @user.moderator? %>
|
||||
<% if current_user and current_user.moderator? %>
|
||||
— <span class="action-button deemphasize" data-comment-id="<%= comment.id %>" data-method="POST" data-url="<%= changeset_comment_hide_url(comment.id) %>"><%= t('javascripts.changesets.show.hide_comment') %></span>
|
||||
<% end %>
|
||||
</small>
|
||||
<%= comment.body.to_html %>
|
||||
</li>
|
||||
<% elsif @user and @user.moderator? %>
|
||||
<% elsif current_user and current_user.moderator? %>
|
||||
<li id="c<%= comment.id %>">
|
||||
<small class='deemphasize'>
|
||||
<%= t("browse.changeset.hidden_commented_by",
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<% end -%>
|
||||
|
||||
<%
|
||||
set_title(changeset_list_title(params, @user))
|
||||
set_title(changeset_list_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
|
||||
else
|
||||
|
|
|
@ -2,7 +2,7 @@ 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)),
|
||||
"xmlns:georss" => "http://www.georss.org/georss") do |feed|
|
||||
feed.title changeset_list_title(params, @user)
|
||||
feed.title changeset_list_title(params, current_user)
|
||||
|
||||
feed.updated @edits.map { |e| [e.created_at, e.closed_at].max }.max
|
||||
feed.icon image_url("favicon.ico")
|
||||
|
|
|
@ -21,9 +21,9 @@
|
|||
<%= richtext_area :diary_comment, :body, :cols => 80, :rows => 15 %>
|
||||
<%= submit_tag t('diary_entry.view.save_button') %>
|
||||
<% end %>
|
||||
<% if @user and @entry.subscribers.exists?(@user.id) %>
|
||||
<% if current_user and @entry.subscribers.exists?(current_user.id) %>
|
||||
<div class="diary-subscribe-buttons"><%= link_to t('javascripts.changesets.show.unsubscribe'), diary_entry_unsubscribe_path(:display_name => @entry.user.display_name, :id => @entry.id), :method => :post, :class => :button %></div>
|
||||
<% elsif @user %>
|
||||
<% elsif current_user %>
|
||||
<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 %>
|
||||
<% end %>
|
||||
|
|
|
@ -54,26 +54,26 @@
|
|||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
<% if @user && @user.id %>
|
||||
<% if current_user && current_user.id %>
|
||||
<div class='dropdown user-menu logged-in'>
|
||||
<a class='dropdown-toggle' data-toggle='dropdown' href="#">
|
||||
<%= user_thumbnail_tiny(@user, :width => 25, :height => 25)
|
||||
<%= user_thumbnail_tiny(current_user, :width => 25, :height => 25)
|
||||
%><%= render :partial => 'layouts/inbox'
|
||||
%><span class="user-button"><span class='username'><%= @user.display_name %></span>
|
||||
%><span class="user-button"><span class='username'><%= current_user.display_name %></span>
|
||||
<b class="caret"></b></span>
|
||||
</a>
|
||||
<ul class='dropdown-menu'>
|
||||
<li>
|
||||
<%= link_to inbox_path(:display_name => @user.display_name) do %>
|
||||
<span class='count-number'><%= number_with_delimiter(@user.new_messages.size) %></span>
|
||||
<%= link_to inbox_path(:display_name => current_user.display_name) do %>
|
||||
<span class='count-number'><%= number_with_delimiter(current_user.new_messages.size) %></span>
|
||||
<%= t('user.view.my messages') %>
|
||||
<% end %>
|
||||
</li>
|
||||
<li>
|
||||
<%= link_to t('user.view.my profile'), user_path(:display_name => @user.display_name) %>
|
||||
<%= link_to t('user.view.my profile'), user_path(:display_name => current_user.display_name) %>
|
||||
</li>
|
||||
<li>
|
||||
<%= link_to t('user.view.my settings'), :controller => 'user', :action => 'account', :display_name => @user.display_name %>
|
||||
<%= link_to t('user.view.my settings'), :controller => 'user', :action => 'account', :display_name => current_user.display_name %>
|
||||
</li>
|
||||
<li class="divider"></li>
|
||||
<li>
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
<% if @user.new_messages.size > 0 %>
|
||||
<span id="inboxanchor" class="count-number"><%= @user.new_messages.size %></span>
|
||||
<% if current_user.new_messages.size > 0 %>
|
||||
<span id="inboxanchor" class="count-number"><%= current_user.new_messages.size %></span>
|
||||
<% end %>
|
||||
|
|
|
@ -4,14 +4,14 @@
|
|||
|
||||
<% content_for(:body_class) { "map-layout" } %>
|
||||
|
||||
<% if @user and !@user.home_lon.nil? and !@user.home_lat.nil? %>
|
||||
<% if current_user and !current_user.home_lon.nil? and !current_user.home_lat.nil? %>
|
||||
<% content_for :greeting do %>
|
||||
<%= link_to t("layouts.home"),
|
||||
"#",
|
||||
:id => "homeanchor",
|
||||
:class => "set_position",
|
||||
:data => { :lat => @user.home_lat,
|
||||
:lon => @user.home_lon,
|
||||
:data => { :lat => current_user.home_lat,
|
||||
:lon => current_user.home_lon,
|
||||
:zoom => 15 } %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
@ -38,7 +38,7 @@
|
|||
<%= yield %>
|
||||
</div>
|
||||
|
||||
<% unless @user %>
|
||||
<% unless current_user %>
|
||||
<div class="welcome">
|
||||
<h2><%= t 'layouts.intro_header' %></h2>
|
||||
<div class="close-wrap"><span class="icon close"></span></div>
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
<p id="inbox-count">
|
||||
<%= t "message.inbox.messages",
|
||||
:new_messages => t("message.inbox.new_messages",
|
||||
:count => @user.new_messages.size),
|
||||
:old_messages => t("message.inbox.old_messages",
|
||||
:count => @user.messages.size - @user.new_messages.size)
|
||||
:new_messages => t("message.inbox.new_messages",
|
||||
:count => current_user.new_messages.size),
|
||||
:old_messages => t("message.inbox.old_messages",
|
||||
:count => current_user.messages.size - current_user.new_messages.size)
|
||||
%>
|
||||
</p>
|
||||
</p>
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
<% content_for :heading do %>
|
||||
<h2><%= t'message.inbox.my_inbox'%>/<%= link_to t('message.inbox.outbox'), outbox_path(@user.display_name) %></h2>
|
||||
<h2><%= t'message.inbox.my_inbox'%>/<%= link_to t('message.inbox.outbox'), outbox_path(current_user.display_name) %></h2>
|
||||
<% end %>
|
||||
|
||||
<h4><%= render :partial => "message_count" %></h4>
|
||||
|
||||
<% if @user.messages.size > 0 %>
|
||||
<% if current_user.messages.size > 0 %>
|
||||
<table class="messages">
|
||||
<thead>
|
||||
<tr>
|
||||
|
@ -16,9 +16,9 @@
|
|||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<%= render :partial => "message_summary", :collection => @user.messages %>
|
||||
<%= render :partial => "message_summary", :collection => current_user.messages %>
|
||||
</tbody>
|
||||
</table>
|
||||
<% else %>
|
||||
<div><%= raw(t'message.inbox.no_messages_yet', :people_mapping_nearby_link => link_to(t('message.inbox.people_mapping_nearby'), :controller => 'user', :action => 'view', :display_name => @user.display_name)) %></div>
|
||||
<div><%= raw(t'message.inbox.no_messages_yet', :people_mapping_nearby_link => link_to(t('message.inbox.people_mapping_nearby'), :controller => 'user', :action => 'view', :display_name => current_user.display_name)) %></div>
|
||||
<% end %>
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
</div>
|
||||
<div class='buttons'>
|
||||
<%= submit_tag t('message.new.send_button') %>
|
||||
<%= link_to t('message.new.back_to_inbox'), { :controller => 'message', :action => 'inbox', :display_name => @user.display_name }, :class => 'deemphasize button' %>
|
||||
<%= link_to t('message.new.back_to_inbox'), { :controller => 'message', :action => 'inbox', :display_name => current_user.display_name }, :class => 'deemphasize button' %>
|
||||
</div>
|
||||
</fieldset>
|
||||
<% end %>
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
<% content_for :heading do %>
|
||||
<h2><%= raw(t'message.outbox.my_inbox', :inbox_link => link_to(t('message.outbox.inbox'), inbox_path(@user.display_name))) %>/<%= t'message.outbox.outbox' %></h2>
|
||||
<h2><%= raw(t'message.outbox.my_inbox', :inbox_link => link_to(t('message.outbox.inbox'), inbox_path(current_user.display_name))) %>/<%= t'message.outbox.outbox' %></h2>
|
||||
<% end %>
|
||||
|
||||
<h4><%= t'message.outbox.messages', :count => @user.sent_messages.size %></h4>
|
||||
<h4><%= t'message.outbox.messages', :count => current_user.sent_messages.size %></h4>
|
||||
|
||||
<% if @user.sent_messages.size > 0 %>
|
||||
<% if current_user.sent_messages.size > 0 %>
|
||||
<table class="messages">
|
||||
<thead>
|
||||
<tr>
|
||||
|
@ -15,9 +15,9 @@
|
|||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<%= render :partial => "sent_message_summary", :collection => @user.sent_messages %>
|
||||
<%= render :partial => "sent_message_summary", :collection => current_user.sent_messages %>
|
||||
</tbody>
|
||||
</table>
|
||||
<% else %>
|
||||
<div class="messages"><%= raw(t'message.outbox.no_sent_messages', :people_mapping_nearby_link => link_to(t('message.outbox.people_mapping_nearby'), :controller => 'user', :action => 'view', :display_name => @user.display_name)) %></div>
|
||||
<div class="messages"><%= raw(t'message.outbox.no_sent_messages', :people_mapping_nearby_link => link_to(t('message.outbox.people_mapping_nearby'), :controller => 'user', :action => 'view', :display_name => current_user.display_name)) %></div>
|
||||
<% end %>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<% if @user == @message.recipient %>
|
||||
<% if current_user == @message.recipient %>
|
||||
<% content_for :heading do %>
|
||||
<h2><%= h(@message.title) %></h2>
|
||||
<% end %>
|
||||
|
@ -36,5 +36,5 @@
|
|||
|
||||
<% end %>
|
||||
|
||||
<%= link_to t('message.read.back'), {:controller => 'message', :action => 'outbox', :display_name => @user.display_name }, :class => "button deemphasize" %>
|
||||
<%= link_to t('message.read.back'), {:controller => 'message', :action => 'outbox', :display_name => current_user.display_name }, :class => "button deemphasize" %>
|
||||
</div>
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<h1><%= t "oauth.oauthorize.title" %></h1>
|
||||
<% end %>
|
||||
|
||||
<p><%= raw t("oauth.oauthorize.request_access", :app_name => link_to(@token.client_application.name, @token.client_application.url), :user => link_to(@user.display_name, :controller => :user, :action => :view, :display_name => @user.display_name)) %></p>
|
||||
<p><%= raw t("oauth.oauthorize.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>
|
||||
|
||||
<%= form_tag authorize_url do %>
|
||||
<%= hidden_field_tag "oauth_token", @token.token %>
|
||||
|
|
|
@ -12,8 +12,8 @@
|
|||
<%= @redaction.description.to_html %>
|
||||
</p>
|
||||
|
||||
<% if @user and @user.moderator? %>
|
||||
<div class="buttons">
|
||||
<% if current_user and current_user.moderator? %>
|
||||
<div class="buttons">
|
||||
<%= button_to t('redaction.show.edit'), edit_redaction_path(@redaction), :method => :get %></td>
|
||||
<%= button_to t('redaction.show.destroy'), @redaction, :method => "delete", :remote => true, :data => { :confirm => t('redaction.show.confirm') } %>
|
||||
</div>
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<%= javascript_include_tag "edit/potlatch" %>
|
||||
|
||||
<div id="map">
|
||||
<% session[:token] = @user.tokens.create.token unless session[:token] and UserToken.find_by_token(session[:token]) -%>
|
||||
<% session[:token] = current_user.tokens.create.token unless session[:token] and UserToken.find_by_token(session[:token]) -%>
|
||||
<% data = { :token => session[:token] } -%>
|
||||
<% data[:lat] = @lat if @lat -%>
|
||||
<% data[:lon] = @lon if @lon -%>
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
<%= javascript_include_tag "edit/potlatch2" %>
|
||||
|
||||
<div id="map">
|
||||
<% session[:token] = @user.tokens.create.token unless session[:token] and UserToken.find_by_token(session[:token]) -%>
|
||||
<% session[:token] = current_user.tokens.create.token unless session[:token] and UserToken.find_by_token(session[:token]) -%>
|
||||
<% data = { :token => session[:token] } -%>
|
||||
<% data[:lat] = @lat if @lat -%>
|
||||
<% data[:lon] = @lon if @lon -%>
|
||||
<% data[:zoom] = @zoom if @zoom -%>
|
||||
<% if defined? POTLATCH2_KEY %>
|
||||
<% token = @user.access_token(POTLATCH2_KEY) %>
|
||||
<% token = current_user.access_token(POTLATCH2_KEY) %>
|
||||
<% data[:token] = token.token -%>
|
||||
<% data[:token_secret] = token.secret -%>
|
||||
<% data[:consumer_key] = token.client_application.key -%>
|
||||
|
|
|
@ -3,9 +3,9 @@
|
|||
<p><%= t 'layouts.osm_offline' %></p>
|
||||
<% elsif STATUS == :database_readonly or STATUS == :api_readonly %>
|
||||
<p><%= t 'layouts.osm_read_only' %></p>
|
||||
<% elsif !@user.data_public? %>
|
||||
<% elsif !current_user.data_public? %>
|
||||
<p><%= t 'site.edit.not_public' %></p>
|
||||
<p><%= raw t 'site.edit.not_public_description', :user_page => (link_to t('site.edit.user_page_link'), {:controller => 'user', :action => 'account', :display_name => @user.display_name, :anchor => 'public'}) %></p>
|
||||
<p><%= raw t 'site.edit.not_public_description', :user_page => (link_to t('site.edit.user_page_link'), {:controller => 'user', :action => 'account', :display_name => current_user.display_name, :anchor => 'public'}) %></p>
|
||||
<p><%= raw t 'site.edit.anon_edits', :link => link_to(t('site.edit.anon_edits_link_text'), t('site.edit.anon_edits_link')) %></p>
|
||||
<% else %>
|
||||
<%= render :partial => preferred_editor %>
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<p class='introduction'><%= t "help_page.introduction" %></p>
|
||||
|
||||
<% ['welcome', 'beginners_guide', 'help', 'mailing_lists', 'forums', 'irc', 'switch2osm', 'wiki'].each do |site| %>
|
||||
<% unless site == 'welcome' && !@user %>
|
||||
<% unless site == 'welcome' && !current_user %>
|
||||
<div class='<%= site %> help-item'>
|
||||
<h3>
|
||||
<a href='<%= t "help_page.#{site}.url" %>'>
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
<body>
|
||||
<% data = {} -%>
|
||||
<% if defined? ID_KEY %>
|
||||
<% token = @user.access_token(ID_KEY) %>
|
||||
<% token = current_user.access_token(ID_KEY) %>
|
||||
<% data[:token] = token.token -%>
|
||||
<% data[:token_secret] = token.secret -%>
|
||||
<% data[:consumer_key] = token.client_application.key -%>
|
||||
|
|
|
@ -37,7 +37,7 @@
|
|||
<ul class='secondary-actions clearfix deemphasize'>
|
||||
<li><%= link_to t('user.view.send message'), :controller => 'message', :action => 'new', :display_name => contact.display_name %></li>
|
||||
<li>
|
||||
<% if @user.is_friends_with?(contact) %>
|
||||
<% 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 %>
|
||||
<% else %>
|
||||
<%= link_to t('user.view.add as friend'), make_friend_path(:display_name => contact.display_name, :referer => request.fullpath), :method => :post %>
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<% content_for :heading do %>
|
||||
<h1><%= t 'user.account.my settings' %></h1>
|
||||
<ul class='secondary-actions clearfix'>
|
||||
<li><%= link_to t('user.account.return to profile'), :controller => 'user', :action => 'view', :display_name => @user.display_name %></li>
|
||||
<li><%= link_to t('user.account.return to profile'), :controller => 'user', :action => 'view', :display_name => current_user.display_name %></li>
|
||||
<li><%= link_to t('user.view.oauth settings'), :controller => 'oauth_clients', :action => 'index' %></li>
|
||||
</ul>
|
||||
<% end %>
|
||||
|
@ -22,7 +22,7 @@
|
|||
<fieldset>
|
||||
<div class="form-row">
|
||||
<label class="standard-label"><%= t 'user.account.current email address' %></label>
|
||||
<input type="email" disabled value="<%= @user.email %>" />
|
||||
<input type="email" disabled value="<%= current_user.email %>" />
|
||||
<span class="form-help deemphasize"><%= t 'user.account.email never displayed publicly' %></span>
|
||||
</div>
|
||||
|
||||
|
@ -58,7 +58,7 @@
|
|||
<div class="form-row">
|
||||
<label class="standard-label"><%= t 'user.account.public editing.heading' %></label>
|
||||
<span class="form-help deemphasize">
|
||||
<% if @user.data_public? %>
|
||||
<% if current_user.data_public? %>
|
||||
<%= t 'user.account.public editing.enabled' %>
|
||||
(<a href="<%= t 'user.account.public editing.enabled link' %>" target="_new"><%= t 'user.account.public editing.enabled link text' %></a>)
|
||||
<% else %>
|
||||
|
@ -71,10 +71,10 @@
|
|||
<div class="form-row">
|
||||
<label class="standard-label"><%= t 'user.account.contributor terms.heading' %></label>
|
||||
<span class="form-help deemphasize">
|
||||
<% if @user.terms_agreed? %>
|
||||
<% if current_user.terms_agreed? %>
|
||||
<%= t 'user.account.contributor terms.agreed' %>
|
||||
(<a href="<%= t 'user.account.contributor terms.link' %>" target="_new"><%= t 'user.account.contributor terms.link text' %></a>)
|
||||
<% if @user.consider_pd? %>
|
||||
<% if current_user.consider_pd? %>
|
||||
<%= t 'user.account.contributor terms.agreed_with_pd' %>
|
||||
<% end %>
|
||||
<% else %>
|
||||
|
@ -102,21 +102,21 @@
|
|||
|
||||
<div class='form-row accountImage'>
|
||||
<label class="standard-label"><%= t 'user.account.image' %></label>
|
||||
<%= user_image @user %>
|
||||
<%= user_image current_user %>
|
||||
<ul class='form-list accountImage-options'>
|
||||
<% if @user.image.file? %>
|
||||
<% if current_user.image.file? %>
|
||||
<li>
|
||||
<%= radio_button_tag "image_action", "keep", !@user.image_use_gravatar %>
|
||||
<%= radio_button_tag "image_action", "keep", !current_user.image_use_gravatar %>
|
||||
<label class='standard-label' for='image_action_keep'><%= t 'user.account.keep image' %></label>
|
||||
</li>
|
||||
<% end %>
|
||||
<% if @user.image.file? || @user.image_use_gravatar? %>
|
||||
<% if current_user.image.file? || current_user.image_use_gravatar? %>
|
||||
<li>
|
||||
<%= radio_button_tag "image_action", "delete" %>
|
||||
<label class='standard-label' for='image_action_delete'><%= t 'user.account.delete image' %></label>
|
||||
</li>
|
||||
<% end %>
|
||||
<% if @user.image.file? %>
|
||||
<% if current_user.image.file? %>
|
||||
<li>
|
||||
<%= radio_button_tag "image_action", "new" %>
|
||||
<label class='standard-label' for='image_action_new'>
|
||||
|
@ -136,7 +136,7 @@
|
|||
</li>
|
||||
<% end %>
|
||||
<li>
|
||||
<%= radio_button_tag "image_action", "gravatar", @user.image_use_gravatar %>
|
||||
<%= radio_button_tag "image_action", "gravatar", current_user.image_use_gravatar %>
|
||||
<label class='standard-label' for='image_action_gravatar'>
|
||||
<%= t 'user.account.gravatar.gravatar' %>
|
||||
<span class='form-help deemphasize'> (<a href="<%= t 'user.account.gravatar.link' %>" target="_new"><%= t 'user.account.gravatar.link text' %></a>)</span>
|
||||
|
@ -149,7 +149,7 @@
|
|||
<fieldset class="form-divider">
|
||||
<div class='form-row location clearfix'>
|
||||
<label class="standard-label"><%= t 'user.account.home location' %></label>
|
||||
<div id="homerow" <% unless @user.home_lat and @user.home_lon %>class="nohome"<%end%> >
|
||||
<div id="homerow" <% unless current_user.home_lat and current_user.home_lon %>class="nohome"<%end%> >
|
||||
<p class="message form-help deemphasize"><%= t 'user.account.no home location' %></p>
|
||||
<div class='form-column'>
|
||||
<label class="standard-label secondary"><%= t 'user.account.latitude' %></label>
|
||||
|
@ -163,7 +163,7 @@
|
|||
</div>
|
||||
|
||||
<div class="form-row">
|
||||
<input type="checkbox" name="updatehome" value="1" <% unless @user.home_lat and @user.home_lon %> checked="checked" <% end %> id="updatehome" />
|
||||
<input type="checkbox" name="updatehome" value="1" <% unless current_user.home_lat and current_user.home_lon %> checked="checked" <% end %> id="updatehome" />
|
||||
<label class="standard-label" for="updatehome"><%= t 'user.account.update home location on click' %></label>
|
||||
</div>
|
||||
<%= content_tag "div", "", :id => "map", :class => "content_map settings_map set_location" %>
|
||||
|
@ -172,7 +172,7 @@
|
|||
<%= submit_tag t('user.account.save changes button') %>
|
||||
<% end %>
|
||||
|
||||
<% unless @user.data_public? %>
|
||||
<% unless current_user.data_public? %>
|
||||
<a name="public"></a>
|
||||
<h2><%= t 'user.account.public editing note.heading' %></h2>
|
||||
<%= raw t 'user.account.public editing note.text' %>
|
||||
|
|
|
@ -4,7 +4,7 @@ xml.osm("version" => API_VERSION, "generator" => GENERATOR) do
|
|||
:display_name => @this_user.display_name,
|
||||
:account_created => @this_user.creation_time.xmlschema do
|
||||
xml.tag! "description", @this_user.description if @this_user.description
|
||||
if @user && @user == @this_user
|
||||
if current_user && current_user == @this_user
|
||||
xml.tag! "contributor-terms", :agreed => @this_user.terms_agreed.present?,
|
||||
:pd => @this_user.consider_pd
|
||||
else
|
||||
|
@ -28,7 +28,7 @@ xml.osm("version" => API_VERSION, "generator" => GENERATOR) do
|
|||
:active => @this_user.blocks_created.active.size
|
||||
end
|
||||
end
|
||||
if @user && @user == @this_user
|
||||
if current_user && current_user == @this_user
|
||||
if @this_user.home_lat && @this_user.home_lon
|
||||
xml.tag! "home", :lat => @this_user.home_lat,
|
||||
:lon => @this_user.home_lon,
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<% content_for :heading do %>
|
||||
<h1><%= t 'user.reset_password.heading', :user => @user.display_name %></h1>
|
||||
<h1><%= t 'user.reset_password.heading', :user => current_user.display_name %></h1>
|
||||
<% end %>
|
||||
|
||||
<%= error_messages_for :user %>
|
||||
|
|
|
@ -1 +1 @@
|
|||
<%= @user.email %>
|
||||
<%= current_user.email %>
|
||||
|
|
|
@ -3,42 +3,42 @@
|
|||
<%= user_image @this_user %>
|
||||
<div class='userinformation-inner'>
|
||||
<h1><%= @this_user.display_name %><%= role_icons(@this_user) %></h1>
|
||||
<% if @user and @this_user.id == @user.id %>
|
||||
<% if current_user and @this_user.id == current_user.id %>
|
||||
<!-- Displaying user's own profile page to themself -->
|
||||
<ul class='secondary-actions clearfix'>
|
||||
<li>
|
||||
<%= link_to t('user.view.my edits'), :controller => 'changeset', :action => 'list', :display_name => @user.display_name %>
|
||||
<span class='count-number'><%= number_with_delimiter(@user.changesets.size) %></span>
|
||||
<%= link_to t('user.view.my edits'), :controller => 'changeset', :action => 'list', :display_name => current_user.display_name %>
|
||||
<span class='count-number'><%= number_with_delimiter(current_user.changesets.size) %></span>
|
||||
</li>
|
||||
<li>
|
||||
<%= link_to t('user.view.my notes'), :controller => 'notes', :action=> 'mine' %>
|
||||
</li>
|
||||
<li>
|
||||
<%= link_to t('user.view.my traces'), :controller => 'trace', :action=>'mine' %>
|
||||
<span class='count-number'><%= number_with_delimiter(@user.traces.size) %></span>
|
||||
<span class='count-number'><%= number_with_delimiter(current_user.traces.size) %></span>
|
||||
</li>
|
||||
<li>
|
||||
<%= link_to t('user.view.my diary'), :controller => 'diary_entry', :action => 'list', :display_name => @user.display_name %>
|
||||
<span class='count-number'><%= number_with_delimiter(@user.diary_entries.size) %></span>
|
||||
<%= link_to t('user.view.my diary'), :controller => 'diary_entry', :action => 'list', :display_name => current_user.display_name %>
|
||||
<span class='count-number'><%= number_with_delimiter(current_user.diary_entries.size) %></span>
|
||||
</li>
|
||||
<li>
|
||||
<%= link_to t('user.view.my comments' ), :controller => 'diary_entry', :action => 'comments', :display_name => @user.display_name %>
|
||||
<%= link_to t('user.view.my comments' ), :controller => 'diary_entry', :action => 'comments', :display_name => current_user.display_name %>
|
||||
</li>
|
||||
<li>
|
||||
<%= link_to t('user.view.my settings'), :controller => 'user', :action => 'account', :display_name => @user.display_name %>
|
||||
<%= link_to t('user.view.my settings'), :controller => 'user', :action => 'account', :display_name => current_user.display_name %>
|
||||
</li>
|
||||
|
||||
<% if @user.blocks.exists? %>
|
||||
<% if current_user.blocks.exists? %>
|
||||
<li>
|
||||
<%= link_to t('user.view.blocks on me'), :controller => 'user_blocks', :action => 'blocks_on', :display_name => @user.display_name %>
|
||||
<span class='count-number'><%= number_with_delimiter(@user.blocks.active.size) %></span>
|
||||
<%= link_to t('user.view.blocks on me'), :controller => 'user_blocks', :action => 'blocks_on', :display_name => current_user.display_name %>
|
||||
<span class='count-number'><%= number_with_delimiter(current_user.blocks.active.size) %></span>
|
||||
</li>
|
||||
<% end %>
|
||||
|
||||
<% if @user and @user.moderator? and @user.blocks_created.exists? %>
|
||||
<% if current_user and current_user.moderator? and current_user.blocks_created.exists? %>
|
||||
<li>
|
||||
<%= link_to t('user.view.blocks by me'), :controller => 'user_blocks', :action => 'blocks_by', :display_name => @user.display_name %>
|
||||
<span class='count-number'><%= number_with_delimiter(@user.blocks_created.active.size) %></span>
|
||||
<%= link_to t('user.view.blocks by me'), :controller => 'user_blocks', :action => 'blocks_by', :display_name => current_user.display_name %>
|
||||
<span class='count-number'><%= number_with_delimiter(current_user.blocks_created.active.size) %></span>
|
||||
</li>
|
||||
<% end %>
|
||||
|
||||
|
@ -73,9 +73,9 @@
|
|||
<%= link_to t('user.view.comments'), :controller => 'diary_entry', :action => 'comments', :display_name => @this_user.display_name %>
|
||||
</li>
|
||||
<li>
|
||||
<% if @user and @user.is_friends_with?(@this_user) %>
|
||||
<% if current_user and current_user.is_friends_with?(@this_user) %>
|
||||
<%= link_to t('user.view.remove as friend'), remove_friend_path(:display_name => @this_user.display_name), :method => :post %>
|
||||
<% elsif @user %>
|
||||
<% elsif current_user %>
|
||||
<%= link_to t('user.view.add as friend'), make_friend_path(:display_name => @this_user.display_name), :method => :post %>
|
||||
<% else %>
|
||||
<%= link_to t('user.view.add as friend'), make_friend_path(:display_name => @this_user.display_name) %>
|
||||
|
@ -96,7 +96,7 @@
|
|||
</li>
|
||||
<% end %>
|
||||
|
||||
<% if @user and @user.moderator? %>
|
||||
<% if current_user and current_user.moderator? %>
|
||||
<li>
|
||||
<%= link_to t('user.view.create_block'), :controller => 'user_blocks', :action => 'new', :display_name => @this_user.display_name %>
|
||||
</li>
|
||||
|
@ -106,7 +106,7 @@
|
|||
|
||||
<% end %>
|
||||
|
||||
<% if @user and @user.administrator? %>
|
||||
<% if current_user and current_user.administrator? %>
|
||||
|
||||
<ul class='secondary-actions clearfix'>
|
||||
<% if ["active", "confirmed"].include? @this_user.status %>
|
||||
|
@ -158,7 +158,7 @@
|
|||
|
||||
</div>
|
||||
|
||||
<% if @user and @user.administrator? -%>
|
||||
<% if current_user and current_user.administrator? -%>
|
||||
<div class='admin-user-info deemphasize'>
|
||||
<small><b><%= t 'user.view.email address' %></b> <%= @this_user.email %></small>
|
||||
<% unless @this_user.creation_ip.nil? -%>
|
||||
|
@ -171,10 +171,10 @@
|
|||
|
||||
<% end %>
|
||||
|
||||
<% if @user and @this_user.id == @user.id %>
|
||||
<% if current_user and @this_user.id == current_user.id %>
|
||||
<% if @this_user.home_lat.nil? or @this_user.home_lon.nil? %>
|
||||
<div id="map" class="content_map">
|
||||
<p id="no_home_location"><%= raw(t 'user.view.if set location', :settings_link => (link_to t('user.view.settings_link_text'), :controller => 'user', :action => 'account', :display_name => @user.display_name)) %></p>
|
||||
<p id="no_home_location"><%= raw(t 'user.view.if set location', :settings_link => (link_to t('user.view.settings_link_text'), :controller => 'user', :action => 'account', :display_name => current_user.display_name)) %></p>
|
||||
</div>
|
||||
<% else %>
|
||||
<% content_for :head do %>
|
||||
|
@ -182,10 +182,10 @@
|
|||
<% end %>
|
||||
<%
|
||||
user_data = {
|
||||
:lon => @user.home_lon,
|
||||
:lat => @user.home_lat,
|
||||
:lon => current_user.home_lon,
|
||||
:lat => current_user.home_lat,
|
||||
:icon => image_path("marker-red.png"),
|
||||
:description => render(:partial => "popup", :object => @user, :locals => {:type => "your location"})
|
||||
:description => render(:partial => "popup", :object => current_user, :locals => {:type => "your location"})
|
||||
}
|
||||
%>
|
||||
<%= content_tag "div", "", :id => "map", :class => "content_map", :data => {:user => user_data} %>
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
<% end %>
|
||||
</td>
|
||||
<td class="<%= c1 %>"><%= link_to t('user_block.partial.show'), block %></td>
|
||||
<td class="<%= c1 %>"><% if @user and @user.id == block.creator_id and block.active? %><%= link_to t('user_block.partial.edit'), edit_user_block_path(block) %><% end %></td>
|
||||
<td class="<%= c1 %>"><% if current_user and current_user.id == block.creator_id and block.active? %><%= link_to t('user_block.partial.edit'), edit_user_block_path(block) %><% end %></td>
|
||||
<% if show_revoke_link %>
|
||||
<td class="<%= c1 %>"><% if block.active? %><%= link_to t('user_block.partial.revoke'), :controller => 'user_blocks', :action => 'revoke', :id => block.id %><% end %></td>
|
||||
<% end %>
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
<% end %>
|
||||
|
||||
<% unless @user_blocks.empty? %>
|
||||
<%= render :partial => 'blocks', :locals => { :show_revoke_link => (@user and @user.moderator?), :show_user_name => true, :show_creator_name => false } %>
|
||||
<%= render :partial => 'blocks', :locals => { :show_revoke_link => (current_user and current_user.moderator?), :show_user_name => true, :show_creator_name => false } %>
|
||||
<% else %>
|
||||
<p><%= t "user_block.blocks_by.empty", :name => h(@this_user.display_name) %></p>
|
||||
<% end %>
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
<h1><%= raw(t('user_block.blocks_on.heading', :name => link_to(h(@this_user.display_name), {:controller => 'user', :action => 'view', :display_name => @this_user.display_name}))) %></h1>
|
||||
<% end %>
|
||||
<% unless @user_blocks.empty? %>
|
||||
<%= render :partial => 'blocks', :locals => { :show_revoke_link => (@user and @user.moderator?), :show_user_name => false, :show_creator_name => true } %>
|
||||
<%= render :partial => 'blocks', :locals => { :show_revoke_link => (current_user and current_user.moderator?), :show_user_name => false, :show_creator_name => true } %>
|
||||
<% else %>
|
||||
<p><%= t "user_block.blocks_on.empty", :name => h(@this_user.display_name) %></p>
|
||||
<% end %>
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
<% end %>
|
||||
|
||||
<% unless @user_blocks.empty? %>
|
||||
<%= render :partial => 'blocks', :locals => { :show_revoke_link => (@user and @user.moderator?), :show_user_name => true, :show_creator_name => true } %>
|
||||
<%= render :partial => 'blocks', :locals => { :show_revoke_link => (current_user and current_user.moderator?), :show_user_name => true, :show_creator_name => true } %>
|
||||
<% else %>
|
||||
<p><%= t "user_block.index.empty" %></p>
|
||||
<% end %>
|
||||
|
|
|
@ -12,10 +12,10 @@
|
|||
{:controller => 'user', :action => 'view', :display_name => @user_block.creator.display_name})) %></h1>
|
||||
<ul class='secondary-actions clearfix'>
|
||||
<% if @user_block.ends_at > Time.now.getutc %>
|
||||
<% if @user and @user.id == @user_block.creator_id %>
|
||||
<% if current_user and current_user.id == @user_block.creator_id %>
|
||||
<li><%= link_to t('user_block.show.edit'), edit_user_block_path(@user_block) %></li>
|
||||
<% end %>
|
||||
<% if @user and @user.moderator? %>
|
||||
<% if current_user and current_user.moderator? %>
|
||||
<li><%= link_to(t('user_block.show.revoke'),{:controller => 'user_blocks', :action => 'revoke', :id => @user_block.id}) %></li>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue