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:
parent
1d71bd598f
commit
8b205052a9
|
@ -20,19 +20,20 @@
|
||||||
module WatchersHelper
|
module WatchersHelper
|
||||||
|
|
||||||
def watcher_tag(object, user, options={})
|
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
|
end
|
||||||
|
|
||||||
def watcher_link(object, user)
|
def watcher_link(object, user)
|
||||||
return '' unless user && user.logged? && object.respond_to?('watched_by?')
|
return '' unless user && user.logged? && object.respond_to?('watched_by?')
|
||||||
watched = object.watched_by?(user)
|
watched = object.watched_by?(user)
|
||||||
|
css = [watcher_css(object), watched ? 'icon icon-fav' : 'icon icon-fav-off'].join(' ')
|
||||||
url = {:controller => 'watchers',
|
url = {:controller => 'watchers',
|
||||||
:action => (watched ? 'unwatch' : 'watch'),
|
:action => (watched ? 'unwatch' : 'watch'),
|
||||||
:object_type => object.class.to_s.underscore,
|
:object_type => object.class.to_s.underscore,
|
||||||
:object_id => object.id}
|
:object_id => object.id}
|
||||||
link_to((watched ? l(:button_unwatch) : l(:button_watch)), url,
|
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
|
end
|
||||||
|
|
||||||
# Returns the css class used to identify watch links for a given +object+
|
# Returns the css class used to identify watch links for a given +object+
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
new_board_message_path(@board),
|
new_board_message_path(@board),
|
||||||
:class => 'icon icon-add',
|
:class => 'icon icon-add',
|
||||||
:onclick => 'showAndScrollTo("add-message", "message_subject"); return false;' if User.current.allowed_to?(:add_messages, @board.project) %>
|
: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>
|
||||||
|
|
||||||
<div id="add-message" style="display:none;">
|
<div id="add-message" style="display:none;">
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<div class="contextual">
|
<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_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) %>
|
<%= 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_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) %>
|
<%= 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>
|
</div>
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<%= board_breadcrumb(@message) %>
|
<%= board_breadcrumb(@message) %>
|
||||||
|
|
||||||
<div class="contextual">
|
<div class="contextual">
|
||||||
<%= watcher_tag(@topic, User.current) %>
|
<%= watcher_link(@topic, User.current) %>
|
||||||
<%= link_to(
|
<%= link_to(
|
||||||
l(:button_quote),
|
l(:button_quote),
|
||||||
{:action => 'quote', :id => @topic},
|
{:action => 'quote', :id => @topic},
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<div class="contextual">
|
<div class="contextual">
|
||||||
<%= watcher_tag(@news, User.current) %>
|
<%= watcher_link(@news, User.current) %>
|
||||||
<%= link_to(l(:button_edit),
|
<%= link_to(l(:button_edit),
|
||||||
edit_news_path(@news),
|
edit_news_path(@news),
|
||||||
:class => 'icon icon-edit',
|
:class => 'icon icon-edit',
|
||||||
|
|
|
@ -1,2 +1,2 @@
|
||||||
<% selector = ".#{watcher_css(watched)}" %>
|
<% 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) %>")});
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<div class="contextual">
|
<div class="contextual">
|
||||||
<%= watcher_tag(@wiki, User.current) %>
|
<%= watcher_link(@wiki, User.current) %>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<h2><%= l(:label_index_by_date) %></h2>
|
<h2><%= l(:label_index_by_date) %></h2>
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<div class="contextual">
|
<div class="contextual">
|
||||||
<%= watcher_tag(@wiki, User.current) %>
|
<%= watcher_link(@wiki, User.current) %>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<h2><%= l(:label_index_by_title) %></h2>
|
<h2><%= l(:label_index_by_title) %></h2>
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
<% if @editable %>
|
<% if @editable %>
|
||||||
<% if @content.current_version? %>
|
<% if @content.current_version? %>
|
||||||
<%= link_to_if_authorized(l(:button_edit), {:action => 'edit', :id => @page.title}, :class => 'icon icon-edit', :accesskey => accesskey(:edit)) %>
|
<%= 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_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_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') %>
|
<%= link_to_if_authorized(l(:button_rename), {:action => 'rename', :id => @page.title}, :class => 'icon icon-move') %>
|
||||||
|
|
Loading…
Reference in New Issue