diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2007-06-12 20:12:05 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2007-06-12 20:12:05 +0000 |
commit | 438161ad1fd37aadbfa3f5a875540730fd6d70c3 (patch) | |
tree | b396b2379835a6f768023cdc0f7042259f560875 /app/views/repositories | |
parent | 4dddb606a6d24c7f95e52f08e689464ab6f8b5b8 (diff) | |
download | redmine-438161ad1fd37aadbfa3f5a875540730fd6d70c3.tar.gz redmine-438161ad1fd37aadbfa3f5a875540730fd6d70c3.zip |
Added basic support for CVS and Mercurial SCMs.
Browsing, changesets fetching and diff viewing are implemented.
Only tested with local repositories.
Thanks to Ralph Vater for CVS specific code.
git-svn-id: http://redmine.rubyforge.org/svn/trunk@559 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/views/repositories')
-rw-r--r-- | app/views/repositories/_dir_list.rhtml | 14 | ||||
-rw-r--r-- | app/views/repositories/_navigation.rhtml | 5 | ||||
-rw-r--r-- | app/views/repositories/_revisions.rhtml | 9 | ||||
-rw-r--r-- | app/views/repositories/changes.rhtml | 13 | ||||
-rw-r--r-- | app/views/repositories/revision.rhtml | 6 | ||||
-rw-r--r-- | app/views/repositories/revisions.rhtml | 18 | ||||
-rw-r--r-- | app/views/repositories/show.rhtml | 8 |
7 files changed, 40 insertions, 33 deletions
diff --git a/app/views/repositories/_dir_list.rhtml b/app/views/repositories/_dir_list.rhtml index 0e5b712bf..5555ee87e 100644 --- a/app/views/repositories/_dir_list.rhtml +++ b/app/views/repositories/_dir_list.rhtml @@ -11,15 +11,15 @@ <% total_size = 0 @entries.each do |entry| %> <tr class="<%= cycle 'odd', 'even' %>"> -<td><%= link_to h(entry.name), { :action => (entry.is_dir? ? 'browse' : 'revisions'), :id => @project, :path => entry.path, :rev => @rev }, :class => ("icon " + (entry.is_dir? ? 'icon-folder' : 'icon-file')) %></td> -<td align="right"><%= number_to_human_size(entry.size) unless entry.is_dir? %></td> -<td align="right"><%= link_to entry.lastrev.identifier, :action => 'revision', :id => @project, :rev => entry.lastrev.identifier %></td> -<td align="center"><%= format_time(entry.lastrev.time) %></td> -<td align="center"><em><%=h entry.lastrev.author %></em></td> -<% changeset = @project.repository.changesets.find_by_revision(entry.lastrev.identifier) %> +<td><%= link_to h(entry.name), { :action => (entry.is_dir? ? 'browse' : 'changes'), :id => @project, :path => entry.path, :rev => @rev }, :class => ("icon " + (entry.is_dir? ? 'icon-folder' : 'icon-file')) %></td> +<td align="right"><%= (entry.size ? number_to_human_size(entry.size) : "?") unless entry.is_dir? %></td> +<td align="right"><%= link_to(entry.lastrev.name, :action => 'revision', :id => @project, :rev => entry.lastrev.identifier) if entry.lastrev && entry.lastrev.identifier %></td> +<td align="center"><%= format_time(entry.lastrev.time) if entry.lastrev %></td> +<td align="center"><em><%=h(entry.lastrev.author) if entry.lastrev %></em></td> +<% changeset = @project.repository.changesets.find_by_revision(entry.lastrev.identifier) if entry.lastrev %> <td><%=h truncate(changeset.comments, 100) unless changeset.nil? %></td> </tr> -<% total_size += entry.size +<% total_size += entry.size if entry.size end %> </tbody> </table> diff --git a/app/views/repositories/_navigation.rhtml b/app/views/repositories/_navigation.rhtml index efc0b9ff9..823b4f44f 100644 --- a/app/views/repositories/_navigation.rhtml +++ b/app/views/repositories/_navigation.rhtml @@ -5,7 +5,8 @@ if 'file' == kind filename = dirs.pop end link_path = '' -dirs.each do |dir| +dirs.each do |dir| + next if dir.blank? link_path << '/' unless link_path.empty? link_path << "#{dir}" %> @@ -15,4 +16,4 @@ dirs.each do |dir| / <%= link_to h(filename), :action => 'revisions', :id => @project, :path => "#{link_path}/#{filename}", :rev => @rev %> <% end %> -<%= "@ #{revision}" if revision %>
\ No newline at end of file +<%= "@ #{revision}" if revision %> diff --git a/app/views/repositories/_revisions.rhtml b/app/views/repositories/_revisions.rhtml index faec16662..b2bdb6c7f 100644 --- a/app/views/repositories/_revisions.rhtml +++ b/app/views/repositories/_revisions.rhtml @@ -9,12 +9,13 @@ <th><%= l(:field_comments) %></th> </tr></thead> <tbody> -<% show_diff = entry && entry.is_file? && changesets.size > 1 %> +<% show_diff = entry && entry.is_file? && revisions.size > 1 %> <% line_num = 1 %> -<% changesets.each do |changeset| %> +<% revisions.each do |revision| %> +<% changeset = revision.is_a?(Change) ? revision.changeset : revision %> <tr class="<%= cycle 'odd', 'even' %>"> -<th align="center" style="width:3em;"><%= link_to changeset.revision, :action => 'revision', :id => project, :rev => changeset.revision %></th> -<td align="center" style="width:1em;"><%= 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 < changesets.size) %></td> +<th align="center" style="width:3em;"><%= link_to (revision.revision || changeset.revision), :action => 'revision', :id => project, :rev => changeset.revision %></th> +<td align="center" style="width:1em;"><%= 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 align="center" style="width:1em;"><%= 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 align="center" style="width:15%"><%= format_time(changeset.committed_on) %></td> <td align="center" style="width:15%"><em><%=h changeset.committer %></em></td> diff --git a/app/views/repositories/changes.rhtml b/app/views/repositories/changes.rhtml new file mode 100644 index 000000000..35ce939fc --- /dev/null +++ b/app/views/repositories/changes.rhtml @@ -0,0 +1,13 @@ +<h2><%= render :partial => 'navigation', :locals => { :path => @path, :kind => (@entry ? @entry.kind : nil), :revision => @rev } %></h2> + +<h3><%=h @entry.name %></h3> + +<p> +<% if @entry.is_text? %> +<%= link_to l(:button_view), {:action => 'entry', :id => @project, :path => @path, :rev => @rev } %> | +<% end %> +<%= link_to l(:button_download), {:action => 'entry', :id => @project, :path => @path, :rev => @rev, :format => 'raw' } %> +<%= "(#{number_to_human_size(@entry.size)})" if @entry.size %> +</p> + +<%= render :partial => 'revisions', :locals => {:project => @project, :path => @path, :revisions => @changes, :entry => @entry }%> diff --git a/app/views/repositories/revision.rhtml b/app/views/repositories/revision.rhtml index 5cf5c2e41..b484becce 100644 --- a/app/views/repositories/revision.rhtml +++ b/app/views/repositories/revision.rhtml @@ -7,7 +7,9 @@ <h2><%= l(:label_revision) %> <%= @changeset.revision %></h2> -<p><em><%= @changeset.committer %>, <%= format_time(@changeset.committed_on) %></em></p> +<p><% if @changeset.scmid %>ID: <%= @changeset.scmid %><br /><% end %> +<em><%= @changeset.committer %>, <%= format_time(@changeset.committed_on) %></em></p> + <%= textilizable @changeset.comments %> <% if @changeset.issues.any? %> @@ -30,7 +32,7 @@ <tbody> <% @changes.each do |change| %> <tr class="<%= cycle 'odd', 'even' %>"> -<td><div class="square action_<%= change.action %>"></div> <%= change.path %></td> +<td><div class="square action_<%= change.action %>"></div> <%= change.path %> <%= "(#{change.revision})" unless change.revision.blank? %></td> <td align="right"> <% if change.action == "M" %> <%= link_to l(:label_view_diff), :action => 'diff', :id => @project, :path => change.path, :rev => @changeset.revision %> diff --git a/app/views/repositories/revisions.rhtml b/app/views/repositories/revisions.rhtml index 4a5b3766e..0c2655d5f 100644 --- a/app/views/repositories/revisions.rhtml +++ b/app/views/repositories/revisions.rhtml @@ -5,25 +5,13 @@ <% end %> </div> -<h2><%= render :partial => 'navigation', :locals => { :path => @path, :kind => (@entry ? @entry.kind : nil), :revision => @rev } %></h2> +<h2><%= l(:label_revision_plural) %></h2> -<% if @entry && @entry.is_file? %> -<h3><%=h @entry.name %></h3> -<p> -<% if @entry.is_text? %> -<%= link_to l(:button_view), {:action => 'entry', :id => @project, :path => @path, :rev => @rev } %> | -<% end %> -<%= link_to l(:button_download), {:action => 'entry', :id => @project, :path => @path, :rev => @rev, :format => 'raw' } %> -(<%= number_to_human_size @entry.size %>)</p> -<% end %> - -<h3><%= l(:label_revision_plural) %></h3> - -<%= render :partial => 'revisions', :locals => {:project => @project, :path => @path, :changesets => @changesets, :entry => @entry }%> +<%= render :partial => 'revisions', :locals => {:project => @project, :path => '', :revisions => @changesets, :entry => nil }%> <p><%= pagination_links_full @changeset_pages %> [ <%= @changeset_pages.current.first_item %> - <%= @changeset_pages.current.last_item %> / <%= @changeset_count %> ]</p> <% content_for :header_tags do %> <%= stylesheet_link_tag "scm" %> -<% end %>
\ No newline at end of file +<% end %> diff --git a/app/views/repositories/show.rhtml b/app/views/repositories/show.rhtml index 04a58b4c9..fcf954473 100644 --- a/app/views/repositories/show.rhtml +++ b/app/views/repositories/show.rhtml @@ -2,17 +2,19 @@ <%= link_to l(:label_statistics), {:action => 'stats', :id => @project}, :class => 'icon icon-stats' %> </div> -<h2><%= l(:label_repository) %></h2> +<h2><%= l(:label_repository) %> (<%= @repository.scm_name %>)</h2> +<% unless @entries.nil? %> <h3><%= l(:label_browse) %></h3> <%= render :partial => 'dir_list' %> +<% end %> <% unless @changesets.empty? %> <h3><%= l(:label_latest_revision_plural) %></h3> -<%= render :partial => 'revisions', :locals => {:project => @project, :path => '', :changesets => @changesets, :entry => nil }%> +<%= render :partial => 'revisions', :locals => {:project => @project, :path => '', :revisions => @changesets, :entry => nil }%> <p><%= link_to l(:label_view_revisions), :action => 'revisions', :id => @project %></p> <% end %> <% content_for :header_tags do %> <%= stylesheet_link_tag "scm" %> -<% end %>
\ No newline at end of file +<% end %> |