Don't wrap watcher link with span.

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@11334 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang 2013-02-07 20:13:15 +00:00
parent 1d71bd598f
commit 8b205052a9
9 changed files with 12 additions and 11 deletions

View File

@ -20,19 +20,20 @@
module WatchersHelper
def watcher_tag(object, user, options={})
content_tag("span", watcher_link(object, user), :class => watcher_css(object))
ActiveSupport::Deprecation.warn "#watcher_tag is deprecated and will be removed in Redmine 3.0. Use #watcher_link instead."
watcher_link(object, user)
end
def watcher_link(object, user)
return '' unless user && user.logged? && object.respond_to?('watched_by?')
watched = object.watched_by?(user)
css = [watcher_css(object), watched ? 'icon icon-fav' : 'icon icon-fav-off'].join(' ')
url = {:controller => 'watchers',
:action => (watched ? 'unwatch' : 'watch'),
:object_type => object.class.to_s.underscore,
:object_id => object.id}
link_to((watched ? l(:button_unwatch) : l(:button_watch)), url,
:remote => true, :method => 'post', :class => (watched ? 'icon icon-fav' : 'icon icon-fav-off'))
:remote => true, :method => 'post', :class => css)
end
# Returns the css class used to identify watch links for a given +object+

View File

@ -5,7 +5,7 @@
new_board_message_path(@board),
:class => 'icon icon-add',
:onclick => 'showAndScrollTo("add-message", "message_subject"); return false;' if User.current.allowed_to?(:add_messages, @board.project) %>
<%= watcher_tag(@board, User.current) %>
<%= watcher_link(@board, User.current) %>
</div>
<div id="add-message" style="display:none;">

View File

@ -1,7 +1,7 @@
<div class="contextual">
<%= link_to l(:button_update), edit_issue_path(@issue), :onclick => 'showAndScrollTo("update", "issue_notes"); return false;', :class => 'icon icon-edit', :accesskey => accesskey(:edit) if @issue.editable? %>
<%= link_to l(:button_log_time), new_issue_time_entry_path(@issue), :class => 'icon icon-time-add' if User.current.allowed_to?(:log_time, @project) %>
<%= watcher_tag(@issue, User.current) %>
<%= watcher_link(@issue, User.current) %>
<%= link_to l(:button_copy), project_copy_issue_path(@project, @issue), :class => 'icon icon-copy' if User.current.allowed_to?(:add_issues, @project) %>
<%= link_to l(:button_delete), issue_path(@issue), :data => {:confirm => issues_destroy_confirmation_message(@issue)}, :method => :delete, :class => 'icon icon-del' if User.current.allowed_to?(:delete_issues, @project) %>
</div>

View File

@ -1,7 +1,7 @@
<%= board_breadcrumb(@message) %>
<div class="contextual">
<%= watcher_tag(@topic, User.current) %>
<%= watcher_link(@topic, User.current) %>
<%= link_to(
l(:button_quote),
{:action => 'quote', :id => @topic},

View File

@ -1,5 +1,5 @@
<div class="contextual">
<%= watcher_tag(@news, User.current) %>
<%= watcher_link(@news, User.current) %>
<%= link_to(l(:button_edit),
edit_news_path(@news),
:class => 'icon icon-edit',

View File

@ -1,2 +1,2 @@
<% selector = ".#{watcher_css(watched)}" %>
$("<%= selector %>").each(function(){$(this).html("<%= escape_javascript watcher_link(watched, user) %>")});
$("<%= selector %>").each(function(){$(this).replaceWith("<%= escape_javascript watcher_link(watched, user) %>")});

View File

@ -1,5 +1,5 @@
<div class="contextual">
<%= watcher_tag(@wiki, User.current) %>
<%= watcher_link(@wiki, User.current) %>
</div>
<h2><%= l(:label_index_by_date) %></h2>

View File

@ -1,5 +1,5 @@
<div class="contextual">
<%= watcher_tag(@wiki, User.current) %>
<%= watcher_link(@wiki, User.current) %>
</div>
<h2><%= l(:label_index_by_title) %></h2>

View File

@ -2,7 +2,7 @@
<% if @editable %>
<% if @content.current_version? %>
<%= link_to_if_authorized(l(:button_edit), {:action => 'edit', :id => @page.title}, :class => 'icon icon-edit', :accesskey => accesskey(:edit)) %>
<%= watcher_tag(@page, User.current) %>
<%= watcher_link(@page, User.current) %>
<%= link_to_if_authorized(l(:button_lock), {:action => 'protect', :id => @page.title, :protected => 1}, :method => :post, :class => 'icon icon-lock') if !@page.protected? %>
<%= link_to_if_authorized(l(:button_unlock), {:action => 'protect', :id => @page.title, :protected => 0}, :method => :post, :class => 'icon icon-unlock') if @page.protected? %>
<%= link_to_if_authorized(l(:button_rename), {:action => 'rename', :id => @page.title}, :class => 'icon icon-move') %>