Mercurial > hg > soundsoftware-site
comparison app/helpers/application_helper.rb @ 3:7c48bad7d85d yuya
* Import Mercurial overhaul patches from Yuya Nishihara (see http://www.redmine.org/issues/4455)
author | Chris Cannam |
---|---|
date | Wed, 28 Jul 2010 12:40:01 +0100 |
parents | 513646585e45 |
children | 9c6c72729d91 |
comparison
equal
deleted
inserted
replaced
2:b940d200fbd2 | 3:7c48bad7d85d |
---|---|
97 # Generates a link to a SCM revision | 97 # Generates a link to a SCM revision |
98 # Options: | 98 # Options: |
99 # * :text - Link text (default to the formatted revision) | 99 # * :text - Link text (default to the formatted revision) |
100 def link_to_revision(revision, project, options={}) | 100 def link_to_revision(revision, project, options={}) |
101 text = options.delete(:text) || format_revision(revision) | 101 text = options.delete(:text) || format_revision(revision) |
102 | 102 rev = revision.respond_to?(:identifier) ? revision.identifier : revision |
103 link_to(text, {:controller => 'repositories', :action => 'revision', :id => project, :rev => revision}, :title => l(:label_revision_id, revision)) | 103 |
104 link_to(text, {:controller => 'repositories', :action => 'revision', :id => project, :rev => rev}, | |
105 :title => l(:label_revision_id, format_revision(revision))) | |
104 end | 106 end |
105 | 107 |
106 def toggle_link(name, id, options={}) | 108 def toggle_link(name, id, options={}) |
107 onclick = "Element.toggle('#{id}'); " | 109 onclick = "Element.toggle('#{id}'); " |
108 onclick << (options[:focus] ? "Form.Element.focus('#{options[:focus]}'); " : "this.blur(); ") | 110 onclick << (options[:focus] ? "Form.Element.focus('#{options[:focus]}'); " : "this.blur(); ") |
610 link = link_to h(version.name), {:only_path => only_path, :controller => 'versions', :action => 'show', :id => version}, | 612 link = link_to h(version.name), {:only_path => only_path, :controller => 'versions', :action => 'show', :id => version}, |
611 :class => 'version' | 613 :class => 'version' |
612 end | 614 end |
613 when 'commit' | 615 when 'commit' |
614 if project && (changeset = project.changesets.find(:first, :conditions => ["scmid LIKE ?", "#{name}%"])) | 616 if project && (changeset = project.changesets.find(:first, :conditions => ["scmid LIKE ?", "#{name}%"])) |
615 link = link_to h("#{name}"), {:only_path => only_path, :controller => 'repositories', :action => 'revision', :id => project, :rev => changeset.revision}, | 617 link = link_to h("#{name}"), {:only_path => only_path, :controller => 'repositories', :action => 'revision', :id => project, :rev => changeset.identifier}, |
616 :class => 'changeset', | 618 :class => 'changeset', |
617 :title => truncate_single_line(changeset.comments, :length => 100) | 619 :title => truncate_single_line(changeset.comments, :length => 100) |
618 end | 620 end |
619 when 'source', 'export' | 621 when 'source', 'export' |
620 if project && project.repository | 622 if project && project.repository |