def grant
@this_user.roles.create(:role => @role, :granter => current_user)
- redirect_to :controller => "user", :action => "view", :display_name => @this_user.display_name
+ redirect_to user_path(@this_user)
end
def revoke
else
UserRole.where(:user_id => @this_user.id, :role => @role).delete_all
end
- redirect_to :controller => "user", :action => "view", :display_name => @this_user.display_name
+ redirect_to user_path(@this_user)
end
private
def require_administrator
unless current_user.administrator?
flash[:error] = t "user_role.filter.not_an_administrator"
- redirect_to :controller => "user", :action => "view", :display_name => @this_user.display_name
+ redirect_to user_path(@this_user)
end
end
@role = params[:role]
unless UserRole::ALL_ROLES.include?(@role)
flash[:error] = t("user_role.filter.not_a_role", :role => @role)
- redirect_to :controller => "user", :action => "view", :display_name => @this_user.display_name
+ redirect_to user_path(@this_user)
end
end
def not_in_role
if @this_user.has_role? @role
flash[:error] = t("user_role.filter.already_has_role", :role => @role)
- redirect_to :controller => "user", :action => "view", :display_name => @this_user.display_name
+ redirect_to user_path(@this_user)
end
end
def in_role
unless @this_user.has_role? @role
flash[:error] = t("user_role.filter.doesnt_have_role", :role => @role)
- redirect_to :controller => "user", :action => "view", :display_name => @this_user.display_name
+ redirect_to user_path(@this_user)
end
end
end
before_save :update_tile
after_save :spam_check
+ def to_param
+ display_name
+ end
+
def self.authenticate(options)
if options[:username] && options[:password]
user = find_by("email = ? OR display_name = ?", options[:username], options[:username])
<small class='deemphasize'>
<%= t("browse.changeset.commented_by",
: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 %>
+ :user => link_to(h(comment.author.display_name), user_path(comment.author))).html_safe %>
<% 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 class='deemphasize'>
<%= t("browse.changeset.hidden_commented_by",
: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 %>
+ :user => link_to(h(comment.author.display_name), user_path(comment.author))).html_safe %>
— <span class="action-button deemphasize" data-comment-id="<%= comment.id %>" data-method="POST" data-url="<%= changeset_comment_unhide_url(comment.id) %>"><%= t('javascripts.changesets.show.unhide_comment') %></span>
</small>
<%= comment.body.to_html %>
<div class="clearfix diary-comment">
<%= user_thumbnail diary_comment.user %>
- <p class="deemphasize comment-heading" id="comment<%= diary_comment.id %>"><%= raw(t('diary_entry.diary_comment.comment_from', :link_user => (link_to h(diary_comment.user.display_name), :controller => 'user', :action => 'view', :display_name => diary_comment.user.display_name), :comment_created_at => link_to(l(diary_comment.created_at, :format => :friendly), :anchor => "comment#{diary_comment.id}"))) %></p>
+ <p class="deemphasize comment-heading" id="comment<%= diary_comment.id %>"><%= raw(t('diary_entry.diary_comment.comment_from', :link_user => (link_to h(diary_comment.user.display_name), user_path(diary_comment.user)), :comment_created_at => link_to(l(diary_comment.created_at, :format => :friendly), :anchor => "comment#{diary_comment.id}"))) %></p>
<div class="richtext"><%= diary_comment.body.to_html %></div>
<%= if_administrator(:span) do %>
<%= link_to t('diary_entry.diary_comment.hide_link'), hide_diary_comment_path(:display_name => diary_comment.diary_entry.user.display_name, :id => diary_comment.diary_entry.id, :comment => diary_comment.id), :method => :post, :data=> { :confirm => t('diary_entry.diary_comment.confirm') } %>
<h2><%= link_to h(diary_entry.title), :action => 'view', :display_name => diary_entry.user.display_name, :id => diary_entry.id %></h2>
<small class='deemphasize'>
- <%= raw(t 'diary_entry.diary_entry.posted_by', :link_user => (link_to h(diary_entry.user.display_name), :controller => 'user', :action => 'view', :display_name => diary_entry.user.display_name), :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 'diary_entry.diary_entry.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)) %>
</small>
</div>
<tr id="inbox-<%= message_summary.id %>" class="inbox-row<%= "-unread" if not message_summary.message_read? %>">
- <td class="inbox-sender"><%= link_to h(message_summary.sender.display_name), :controller => 'user', :action => 'view', :display_name => message_summary.sender.display_name %></td>
+ <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), :controller => 'message', :action => 'read', :message_id => message_summary.id %></td>
<td class="inbox-sent"><%= l message_summary.sent_on, :format => :friendly %></td>
<td class="inbox-mark-unread"><%= button_to t('message.message_summary.unread_button'), {:controller => 'message', :action => 'mark', :message_id => message_summary.id, :mark => 'unread'}, { :remote => true } %></td>
<tr class="inbox-row">
- <td class="inbox-sender"><%= link_to h(sent_message_summary.recipient.display_name), :controller => 'user', :action => 'view', :display_name => sent_message_summary.recipient.display_name %></td>
+ <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), :controller => 'message', :action => 'read', :message_id => sent_message_summary.id %></td>
<td class="inbox-sent"><%= l sent_message_summary.sent_on, :format => :friendly %></td>
<td class="inbox-delete"><%= button_to t('message.sent_message_summary.delete_button'), :controller => 'message', :action => 'delete', :message_id => sent_message_summary.id, :referer => request.fullpath %></td>
</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 => current_user.display_name)) %></div>
+ <div><%= raw(t'message.inbox.no_messages_yet', :people_mapping_nearby_link => link_to(t('message.inbox.people_mapping_nearby'), user_path(current_user))) %></div>
<% end %>
<% content_for :heading do %>
- <h2><%= raw(t'message.new.send_message_to', :name => link_to(h(@message.recipient.display_name), {:controller => 'user', :action => 'view', :display_name => @message.recipient.display_name})) %></h2>
+ <h2><%= raw(t'message.new.send_message_to', :name => link_to(h(@message.recipient.display_name), user_path(@message.recipient))) %></h2>
<% end %>
<%= error_messages_for 'message' %>
</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 => current_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'), user_path(current_user))) %></div>
<% end %>
<div class='info-line clearfix'>
<%= user_thumbnail_tiny @message.sender %>
- <%= link_to h(@message.sender.display_name), :controller => 'user', :action => 'view', :display_name => @message.sender.display_name %></td>
+ <%= link_to h(@message.sender.display_name), user_path(@message.sender) %></td>
<div class='right'>
<%= l @message.sent_on, :format => :friendly %>
</div>
<div class='info-line clearfix'>
<%= user_thumbnail_tiny @message.recipient %>
- <%= link_to h(@message.recipient.display_name), :controller => 'user', :action => 'view', :display_name => @message.recipient.display_name %></td>
+ <%= link_to h(@message.recipient.display_name), user_path(@message.recipient) %></td>
<div class='right'>
<%= l @message.sent_on, :format => :friendly %>
</div>
-<%= link_to user.display_name, :controller => "user", :action => "view", :display_name => user.display_name %>
+<%= link_to user.display_name, user_path(user) %>
<p>
<b><%= t 'redaction.show.user' %></b>
- <%= link_to(@redaction.user.display_name, {:controller => 'user', :action => 'view', :display_name => @redaction.user.display_name}) %>
+ <%= link_to(@redaction.user.display_name, user_path(@redaction.user)) %>
</p>
<p class="richtext">
<b><%= t 'redaction.show.description' %></b>
<br />
<%= trace.description %>
<br />
- <%= t'trace.trace.by' %> <%=link_to h(trace.user.display_name), {:controller => 'user', :action => 'view', :display_name => trace.user.display_name} %>
+ <%= t'trace.trace.by' %> <%=link_to h(trace.user.display_name), user_path(trace.user) %>
<% if !trace.tags.empty? %>
<%= t'trace.trace.in' %>
<%= raw(trace.tags.collect { |tag| link_to_tag tag.tag }.join(", ")) %>
<% end %>
<div class='form-row'>
<label class='standard-label'><%= t'trace.edit.owner' %></label>
- <p class='deemphasize'><%= link_to h(@trace.user.display_name), {:controller => 'user', :action => 'view', :display_name => @trace.user.display_name} %></p>
+ <p class='deemphasize'><%= link_to h(@trace.user.display_name), user_path(@trace.user) %></p>
</div>
<div class='form-row'>
<label class='standard-label'><%= t'trace.edit.description' %></label>
<% end %>
<tr>
<td><%= t'trace.view.owner' %></td>
- <td><%= link_to h(@trace.user.display_name), {:controller => 'user', :action => 'view', :display_name => @trace.user.display_name} %></td>
+ <td><%= link_to h(@trace.user.display_name), user_path(@trace.user) %></td>
</tr>
<tr>
<td><%= t'trace.view.description' %></td>
<%= user_thumbnail contact %>
<div class='activity-details'>
<p class='deemphasize'>
- <%= link_to h(contact.display_name), :controller => 'user', :action => 'view', :display_name => contact.display_name %>
+ <%= link_to h(contact.display_name), user_path(contact) %>
<% if @this_user.home_lon and @this_user.home_lat and contact.home_lon and contact.home_lat %>
<% distance = @this_user.distance(contact) %>
<% if distance < 1 %>
<div class="user_popup">
<%= user_thumbnail popup %>
<p><%= t('user.popup.' + type) %></p>
- <p><%= link_to popup.display_name, :controller => "user", :action => "view", :display_name => popup.display_name %></p>
+ <p><%= link_to popup.display_name, user_path(popup) %></p>
</div>
<% 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 => current_user.display_name %></li>
+ <li><%= link_to t('user.account.return to profile'), user_path(current_user) %></li>
<li><%= link_to t('user.view.oauth settings'), :controller => 'oauth_clients', :action => 'index' %></li>
</ul>
<% end %>
<% c1 = cycle('table0', 'table1') %>
<% if show_user_name %>
- <td class="<%= c1 %>"><%= link_to h(block.user.display_name), :controller => 'user', :action => 'view', :display_name => block.user.display_name %></td>
+ <td class="<%= c1 %>"><%= link_to h(block.user.display_name), user_path(block.user) %></td>
<% end %>
<% if show_creator_name %>
- <td class="<%= c1 %>"><%= link_to h(block.creator.display_name), :controller => 'user', :action => 'view', :display_name => block.creator.display_name %></td>
+ <td class="<%= c1 %>"><%= link_to h(block.creator.display_name), user_path(block.creator) %></td>
<% end %>
<td class="<%= c1 %>"><%=h truncate(block.reason) %></td>
<td class="<%= c1 %>"><%=h block_status(block) %></td>
<% if block.revoker_id.nil? %>
<%= t('user_block.partial.not_revoked') %>
<% else %>
- <%= link_to h(block.revoker.display_name), :controller => 'user', :action => 'view', :display_name => block.revoker.display_name %>
+ <%= link_to h(block.revoker.display_name), user_path(block.revoker) %>
<% end %>
</td>
<td class="<%= c1 %>"><%= link_to t('user_block.partial.show'), block %></td>
<% @title = t('user_block.blocks_by.title', :name => h(@this_user.display_name)) %>
<% content_for :heading do %>
- <h1><%= raw(t('user_block.blocks_by.heading', :name => link_to(h(@this_user.display_name), {:controller => 'user', :action => 'view', :display_name => @this_user.display_name}))) %></h1>
+ <h1><%= raw(t('user_block.blocks_by.heading', :name => link_to(h(@this_user.display_name), user_path(@this_user)))) %></h1>
<% end %>
<% unless @user_blocks.empty? %>
<% @title = t('user_block.blocks_on.title', :name => h(@this_user.display_name)) %>
<% content_for :heading do %>
- <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>
+ <h1><%= raw(t('user_block.blocks_on.heading', :name => link_to(h(@this_user.display_name), user_path(@this_user)))) %></h1>
<% end %>
<% unless @user_blocks.empty? %>
<%= render :partial => 'blocks', :locals => { :show_revoke_link => (current_user and current_user.moderator?), :show_user_name => false, :show_creator_name => true } %>
<% @title = t 'user_block.edit.title', :name => h(@user_block.user.display_name) %>
<% content_for :heading do %>
<h1><%= raw t('user_block.edit.title',
- :name => link_to(
- h(@user_block.user.display_name),
- {:controller => 'user', :action => 'view', :display_name => @user_block.user.display_name})) %></h1>
+ :name => link_to(h(@user_block.user.display_name),
+ user_path(@user_block.user))) %></h1>
<ul class='secondary-actions clearfix'>
<li><%= link_to t('user_block.edit.show'), @user_block %></li>
<li><%= link_to t('user_block.edit.back'), user_blocks_path %></li>
<h1><%= raw t('user_block.new.heading',
:name => link_to(
h(@this_user.display_name),
- {:controller => 'user', :action => 'view', :display_name => @this_user.display_name})) %></h1>
+ user_path(@this_user))) %></h1>
<% end %>
<%= form_for(@user_block) do |f| %>
<%= f.error_messages %>
<h1><%= raw t('user_block.revoke.heading',
:block_on => link_to(
h(@user_block.user.display_name),
- {:controller => 'user', :action => 'view', :display_name => @user_block.user.display_name}),
+ user_path(@user_block.user)),
:block_by => link_to(
h(@user_block.creator.display_name),
- {:controller => 'user', :action => 'view', :display_name => @user_block.creator.display_name})) %></h1>
+ user_path(@user_block.creator))) %></h1>
<% end %>
<% if @user_block.ends_at > Time.now %>
<h1><%= raw t('user_block.show.heading',
:block_on => link_to(
h(@user_block.user.display_name),
- {:controller => 'user', :action => 'view', :display_name => @user_block.user.display_name}),
+ user_path(@user_block.user)),
:block_by => link_to(
h(@user_block.creator.display_name),
- {:controller => 'user', :action => 'view', :display_name => @user_block.creator.display_name})) %></h1>
+ user_path(@user_block.creator))) %></h1>
<ul class='secondary-actions clearfix'>
<% if @user_block.ends_at > Time.now.getutc %>
<% if current_user and current_user.id == @user_block.creator_id %>
<% if @user_block.revoker %>
<p>
<b><%= t'user_block.show.revoker' %></b>
- <%= link_to h(@user_block.revoker.display_name), :controller => 'user', :action => 'view', :display_name => @user_block.revoker.display_name %>
+ <%= link_to h(@user_block.revoker.display_name), user_path(@user_block.revoker) %>
</p>
<% end %>