Project

General

Profile

RE: Command line ticket creation/modification? ยป patch.diff

patch - Kazuyoshi Tlacaelel, 2009-03-31 15:56

View differences:

app/helpers/application_helper.rb (working copy)
end
when 'commit'
if project && (changeset = project.changesets.find(:first, :conditions => ["scmid LIKE ?", "#{name}%"]))
link = link_to h("#{name}"), {:only_path => only_path, :controller => 'repositories', :action => 'revision', :id => project, :rev => changeset.revision},
:class => 'changeset',
:title => truncate_single_line(changeset.comments, 100)
# Changes by Kazuyoshi Tlacaelel.
# Last edited on: Sun Mar 15 15:33:23 JST 2009
# Point users straight to the diff, rather than sending
# them to the revision and make them click again to see
# a diff and then again to see a diff side by side
#
my_hash = {:only_path => only_path, :controller => 'repositories',
:action => 'diff', :id => project, :type => 'sbs', :rev => changeset.revision}
link = link_to h("#{name}"), my_hash, :class => 'changeset',
:title => truncate_single_line(changeset.comments, 100)
#
#
#
end
when 'source', 'export'
if project && project.repository
app/controllers/issues_controller.rb (working copy)
@edit_allowed = User.current.allowed_to?(:edit_issues, @project)
@priorities = Enumeration::get_values('IPRI')
@time_entry = TimeEntry.new
my_query = "select * from changesets where comments like '%##{@issue.id} %' order by committed_on desc"
@related_changesets = Changeset.find_by_sql(my_query)
respond_to do |format|
format.html { render :template => 'issues/show.rhtml' }
format.atom { render :action => 'changes', :layout => false, :content_type => 'application/atom+xml' }
app/views/repositories/_revisions.rhtml (working copy)
<style>
thead[latest_header] th {
background:#507AAA;
color:white;
}
table[latest] {
border:solid 1px #111;
}
table caption {
background:#2C4056;
color:white;
padding:2mm;
font-size:5mm;
}
</style>
<% form_tag({:controller => 'repositories', :action => 'diff', :id => @project, :path => to_path_param(path)}, :method => :get) do %>
<table class="list changesets">
<thead><tr>
<th>#</th>
<th></th>
<th></th>
<th><%= l(:label_date) %></th>
<th><%= l(:field_author) %></th>
<th><%= l(:field_comments) %></th>
</tr></thead>
<br />
<br />
<table class="list changesets" latest_table>
<caption><%= l(:label_latest_revision_plural) %></caption>
<thead latest_header>
<tr>
<th style='text-align:right;'>Info</th>
<th>DIFF</th>
<th><%= l(:field_comments) %></th>
</tr>
</thead>
<tbody>
<% show_diff = entry && entry.is_file? && revisions.size > 1 %>
<% line_num = 1 %>
<% revisions.each do |changeset| %>
<tr class="changeset <%= cycle 'odd', 'even' %>">
<td class="id"><%= link_to format_revision(changeset.revision), :action => 'revision', :id => project, :rev => changeset.revision %></td>
<td class="checkbox"><%= radio_button_tag('rev', changeset.revision, (line_num==1), :id => "cb-#{line_num}", :onclick => "$('cbto-#{line_num+1}').checked=true;") if show_diff && (line_num < revisions.size) %></td>
<td class="checkbox"><%= radio_button_tag('rev_to', changeset.revision, (line_num==2), :id => "cbto-#{line_num}", :onclick => "if ($('cb-#{line_num}').checked==true) {$('cb-#{line_num-1}').checked=true;}") if show_diff && (line_num > 1) %></td>
<td class="committed_on"><%= format_time(changeset.committed_on) %></td>
<td class="author"><%=h changeset.author %></td>
<td class="comments"><%= textilizable(truncate_at_line_break(changeset.comments)) %></td>
<td class="committed_on" style='text-align:right;'>
<small>
<%= format_time(changeset.committed_on) %> <br />
<span class="author"><%=h changeset.author %></span> <br />
<%= format_revision(changeset.revision) %> <br />
<%= radio_button_tag('rev', changeset.revision, (line_num==1), :id => "cb-#{line_num}",:onclick => "$('cbto-#{line_num+1}').checked=true;") if show_diff && (line_num < revisions.size) %>
<%= radio_button_tag('rev_to', changeset.revision, (line_num==2), :id => "cbto-#{line_num}", :onclick => "if ($('cb-#{line_num}').checked==true) {$('cb-#{line_num-1}').checked=true;}") if show_diff && (line_num > 1) %>
</small>
</td>
<td class="id">
<%
my_hash = {:controller => 'repositories', :action => 'diff',
:id => project, :type => 'sbs', :rev => changeset.revision}
%>
<small><%= link_to 'DIFF', my_hash, :title => "Show DIFF: #{format_revision(changeset.revision)}" %></small>
</td>
<td class="comments" width='90%' style='color:#111;'>
<%= textilizable(truncate_at_line_break(changeset.comments)) %>
</td>
</tr>
<% line_num += 1 %>
<% end %>
app/views/repositories/show.rhtml (working copy)
<% end -%>
</div>
<h2><%= l(:label_repository) %> (<%= @repository.scm_name %>)</h2>
<% if !@entries.nil? && authorize_for('repositories', 'browse') %>
<%= render :partial => 'dir_list' %>
<% end %>
<% if !@changesets.empty? && authorize_for('repositories', 'revisions') %>
<h3><%= l(:label_latest_revision_plural) %></h3>
<%= render :partial => 'revisions', :locals => {:project => @project, :path => '', :revisions => @changesets, :entry => nil }%>
<p><%= link_to l(:label_view_revisions), :action => 'revisions', :id => @project %></p>
<p><%= link_to l(:label_latest_revision_plural), :action => 'revisions', :id => @project %></p>
<% content_for :header_tags do %>
<%= auto_discovery_link_tag(:atom, params.merge({:format => 'atom', :action => 'revisions', :id => @project, :page => nil, :key => User.current.rss_key})) %>
<% end %>
......
</p>
<% end %>
<h2><%= l(:label_repository) %> (<%= @repository.scm_name %>)</h2>
<% if !@entries.nil? && authorize_for('repositories', 'browse') %>
<%= render :partial => 'dir_list' %>
<% end %>
<% content_for :header_tags do %>
<%= stylesheet_link_tag "scm" %>
<% end %>
app/views/issues/show.rhtml (working copy)
</div>
<% end %>
<%= render :partial => 'related_changesets', :locals => {:related_changesets => @related_changesets} %>
<% if @journals.any? %>
<div id="history">
<h3><%=l(:label_history)%></h3>
......
<%= auto_discovery_link_tag(:atom, {:format => 'atom', :key => User.current.rss_key}, :title => "#{@issue.project} - #{@issue.tracker} ##{@issue.id}: #{@issue.subject}") %>
<%= stylesheet_link_tag 'scm' %>
<% end %>
public/stylesheets/application.css (working copy)
table.list tbody tr:hover { background-color:#ffffdd; }
table td {padding:2px;}
table p {margin:0;}
.odd {background-color:#f6f7f8;}
.even {background-color: #fff;}
.odd, .even {
padding: 5px 4px;
color: #333;
font-family: Verdana, sans-serif;
background-color: #E6F2FF;
border-bottom: solid 1px #C5DBF7;
border-left: solid 1px #C5DBF7;
}
.odd td, .even td {
border-right: solid 1px #ccc;
}
.even {
background-color: #fff;
border-left: solid 1px #ddd;
}
.highlight { background-color: #FCFD8D;}
.highlight.token-1 { background-color: #faa;}
.highlight.token-2 { background-color: #afa;}
    (1-1/1)