Project

General

Profile

Patch #670 » re-show-issue-links-at-bottom2.patch

Jon Moses, 2008-02-25 15:09

View differences:

app/helpers/watchers_helper.rb (working copy)
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
module WatchersHelper
def watcher_tag(object, user)
content_tag("span", watcher_link(object, user), :id => 'watcher')
def watcher_tag(object, user, opts = {})
suffix = ( opts[:id_suffix] or '' )
content_tag("span", watcher_link(object, user), :id => "watcher#{suffix}")
end
def watcher_link(object, user)
......
url = {:controller => 'watchers',
:action => (watched ? 'remove' : 'add'),
:object_type => object.class.to_s.underscore,
:object_id => object.id}
:object_id => object.id}
link_to_remote((watched ? l(:button_unwatch) : l(:button_watch)),
{:url => url},
:href => url_for(url),
app/controllers/watchers_controller.rb (working copy)
@watched.add_watcher(user)
respond_to do |format|
format.html { render :text => 'Watcher added.', :layout => true }
format.js { render(:update) {|page| page.replace_html 'watcher', watcher_link(@watched, user)} }
format.js { render(:update) {|page| page.replace_html 'watcher', watcher_link(@watched, user); page.replace_html 'watcher_bottom', watcher_link(@watched, user)} }
end
end
......
@watched.remove_watcher(user)
respond_to do |format|
format.html { render :text => 'Watcher removed.', :layout => true }
format.js { render(:update) {|page| page.replace_html 'watcher', watcher_link(@watched, user)} }
format.js { render(:update) {|page| page.replace_html 'watcher', watcher_link(@watched, user); page.replace_html 'watcher_bottom', watcher_link(@watched,user)} }
end
end
app/views/issues/_links.rhtml (revision 0)
<% id_suffix = ( ( defined?(id_suffix) and id_suffix ) ? id_suffix : '' ) %>
<%= show_and_goto_link(l(:button_update), 'update', :class => 'icon icon-edit', :accesskey => accesskey(:edit)) if authorize_for('issues', 'edit') %>
<%= link_to_if_authorized l(:button_log_time), {:controller => 'timelog', :action => 'edit', :issue_id => issue}, :class => 'icon icon-time' %>
<%= watcher_tag(issue, User.current, :id_suffix => id_suffix) %>
<%= link_to_if_authorized l(:button_copy), {:controller => 'issues', :action => 'new', :project_id => @project, :copy_from => issue }, :class => 'icon icon-copy' %>
<%= link_to_if_authorized l(:button_move), {:controller => 'issues', :action => 'move', :id => issue }, :class => 'icon icon-move' %>
<%= link_to_if_authorized l(:button_delete), {:controller => 'issues', :action => 'destroy', :id => issue}, :confirm => l(:text_are_you_sure), :method => :post, :class => 'icon icon-del' %>
app/views/issues/show.rhtml (working copy)
<div class="contextual">
<%= show_and_goto_link(l(:button_update), 'update', :class => 'icon icon-edit', :accesskey => accesskey(:edit)) if authorize_for('issues', 'edit') %>
<%= link_to_if_authorized l(:button_log_time), {:controller => 'timelog', :action => 'edit', :issue_id => @issue}, :class => 'icon icon-time' %>
<%= watcher_tag(@issue, User.current) %>
<%= link_to_if_authorized l(:button_copy), {:controller => 'issues', :action => 'new', :project_id => @project, :copy_from => @issue }, :class => 'icon icon-copy' %>
<%= link_to_if_authorized l(:button_move), {:controller => 'issues', :action => 'move', :id => @issue }, :class => 'icon icon-move' %>
<%= link_to_if_authorized l(:button_delete), {:controller => 'issues', :action => 'destroy', :id => @issue}, :confirm => l(:text_are_you_sure), :method => :post, :class => 'icon icon-del' %>
<%= render :partial => "links", :locals => {:issue => @issue} %>
</div>
<h2><%= @issue.tracker.name %> #<%= @issue.id %></h2>
......
<% end %>
<div class="contextual">
<%= render :partial => "links", :locals => {:issue => @issue, :id_suffix => "_bottom"} %>
|
<%= l(:label_export_to) %><%= link_to 'PDF', {:format => 'pdf'}, :class => 'icon icon-pdf' %>
</div>
&nbsp;
(2-2/2)