summaryrefslogtreecommitdiffstats
path: root/app/views/repositories
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2006-12-24 13:38:45 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2006-12-24 13:38:45 +0000
commitbc4415850105225b101cdea075b04d44b8700108 (patch)
treeff4711655b34aa5aca5528665d7c18db2583c879 /app/views/repositories
parent918123cd0663803a6e392c6c9ce209d10c8e5603 (diff)
downloadredmine-bc4415850105225b101cdea075b04d44b8700108.tar.gz
redmine-bc4415850105225b101cdea075b04d44b8700108.zip
svn browser merged in trunk
git-svn-id: http://redmine.rubyforge.org/svn/trunk@106 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/views/repositories')
-rw-r--r--app/views/repositories/_dir_list.rhtml23
-rw-r--r--app/views/repositories/_navigation.rhtml18
-rw-r--r--app/views/repositories/browse.rhtml11
-rw-r--r--app/views/repositories/diff.rhtml55
-rw-r--r--app/views/repositories/revision.rhtml35
-rw-r--r--app/views/repositories/revisions.rhtml38
-rw-r--r--app/views/repositories/show.rhtml15
7 files changed, 195 insertions, 0 deletions
diff --git a/app/views/repositories/_dir_list.rhtml b/app/views/repositories/_dir_list.rhtml
new file mode 100644
index 000000000..635fba528
--- /dev/null
+++ b/app/views/repositories/_dir_list.rhtml
@@ -0,0 +1,23 @@
+<table class="list">
+<thead><tr>
+<th><%= l(:field_name) %></th>
+<th><%= l(:field_filesize) %></th>
+<th><%= l(:label_revision) %></th>
+<th><%= l(:field_author) %></th>
+<th><%= l(:label_date) %></th>
+</tr></thead>
+<tbody>
+<% 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? ? 'folder' : 'file') %></td>
+<td align="right"><%= 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"><em><%=h entry.lastrev.author %></em></td>
+<td align="center"><%= format_time(entry.lastrev.time) %></td>
+</tr>
+<% total_size += entry.size
+end %>
+</tbody>
+</table>
+<p align="right"><em><%= l(:label_total) %>: <%= human_size(total_size) %></em></p> \ No newline at end of file
diff --git a/app/views/repositories/_navigation.rhtml b/app/views/repositories/_navigation.rhtml
new file mode 100644
index 000000000..3ae0f7612
--- /dev/null
+++ b/app/views/repositories/_navigation.rhtml
@@ -0,0 +1,18 @@
+<%= link_to 'root', :action => 'browse', :id => @project, :path => '', :rev => @rev %>
+<%
+dirs = path.split('/')
+if 'file' == kind
+ filename = dirs.pop
+end
+link_path = ''
+dirs.each do |dir|
+ link_path << '/' unless link_path.empty?
+ link_path << "#{dir}"
+ %>
+ / <%= link_to h(dir), :action => 'browse', :id => @project, :path => link_path, :rev => @rev %>
+<% end %>
+<% if filename %>
+ / <%= link_to h(filename), :action => 'revisions', :id => @project, :path => "#{link_path}/#{filename}", :rev => @rev %>
+<% end %>
+
+<%= "@ #{revision}" if revision %> \ No newline at end of file
diff --git a/app/views/repositories/browse.rhtml b/app/views/repositories/browse.rhtml
new file mode 100644
index 000000000..92ad8478b
--- /dev/null
+++ b/app/views/repositories/browse.rhtml
@@ -0,0 +1,11 @@
+<%= stylesheet_link_tag "scm" %>
+
+<div class="contextual">
+<%= start_form_tag %>
+<%= l(:label_revision) %>: <%= text_field_tag 'rev', @rev, :size => 5 %>
+<%= submit_tag 'OK' %>
+</div>
+
+<h2><%= render :partial => 'navigation', :locals => { :path => @path, :kind => 'dir', :revision => @rev } %></h2>
+
+<%= render :partial => 'dir_list' %> \ No newline at end of file
diff --git a/app/views/repositories/diff.rhtml b/app/views/repositories/diff.rhtml
new file mode 100644
index 000000000..d4350cb61
--- /dev/null
+++ b/app/views/repositories/diff.rhtml
@@ -0,0 +1,55 @@
+<h2><%= render :partial => 'navigation', :locals => { :path => @path, :kind => 'file', :revision => @rev } %></h2>
+
+<%= stylesheet_link_tag "scm" %>
+
+<table class="list">
+<thead><tr><th>@<%= @rev %></th><th>@<%= @rev_to %></th><th></th></tr></thead>
+<tbody>
+<% parsing = false
+line_num_l = 0
+line_num_r = 0 %>
+<% @diff.each do |line| %>
+<%
+ if line =~ /^@@ (\+|\-)(\d+),\d+ (\+|\-)(\d+),\d+ @@/
+ line_num_l = $2.to_i
+ line_num_r = $4.to_i
+ if parsing %>
+ <tr class="spacing"><td colspan="3">&nbsp;</td></tr>
+ <% end
+ parsing = true
+ next
+ end
+ next unless parsing
+%>
+
+<tr>
+
+<% case line[0, 1]
+ when " " %>
+<th class="line-num"><%= line_num_l %></th>
+<th class="line-num"><%= line_num_r %></th>
+<td class="line-code">
+<% line_num_l = line_num_l + 1
+ line_num_r = line_num_r + 1
+
+ when "-" %>
+<th class="line-num"></th>
+<th class="line-num"><%= line_num_r %></th>
+<td class="line-code" style="background: #fdd;">
+<% line_num_r = line_num_r + 1
+
+ when "+" %>
+<th class="line-num"><%= line_num_l %></th>
+<th class="line-num"></th>
+<td class="line-code" style="background: #dfd;">
+<% line_num_l = line_num_l + 1
+
+ else
+ next
+ end %>
+
+<%= h(line[1..-1]).gsub(/\s/, "&nbsp;") %></td></tr>
+
+<% end %>
+</tbody>
+</table> \ No newline at end of file
diff --git a/app/views/repositories/revision.rhtml b/app/views/repositories/revision.rhtml
new file mode 100644
index 000000000..6a5a20d97
--- /dev/null
+++ b/app/views/repositories/revision.rhtml
@@ -0,0 +1,35 @@
+<%= stylesheet_link_tag "scm" %>
+
+<div class="contextual">
+<%= start_form_tag %>
+<%= l(:label_revision) %>: <%= text_field_tag 'rev', @rev, :size => 5 %>
+<%= submit_tag 'OK' %>
+</div>
+
+<h2><%= l(:label_revision) %> <%= @revision.identifier %></h2>
+
+<p><em><%= @revision.author %>, <%= format_time(@revision.time) %></em></p>
+<%= simple_format @revision.message %>
+
+<div style="float:right;">
+<div class="square action_A"></div> <div style="float:left;"><%= l(:label_added) %>&nbsp;</div>
+<div class="square action_M"></div> <div style="float:left;"><%= l(:label_modified) %>&nbsp;</div>
+<div class="square action_D"></div> <div style="float:left;"><%= l(:label_deleted) %>&nbsp;</div>
+</div>
+
+<h3><%= l(:label_attachment_plural) %></h3>
+<table class="list">
+<tbody>
+<% @revision.paths.each do |path| %>
+<tr class="<%= cycle 'odd', 'even' %>">
+<td><div class="square action_<%= path[:action] %>"></div> <%= path[:path] %></td>
+<td>
+<% if path[:action] == "M" %>
+<%= link_to 'View diff', :action => 'diff', :id => @project, :path => path[:path].gsub(/^\//, ''), :rev => @revision.identifier %>
+<% end %>
+</td>
+</tr>
+<% end %>
+</tbody>
+</table>
+<p><%= lwr(:label_modification, @revision.paths.length) %></p> \ No newline at end of file
diff --git a/app/views/repositories/revisions.rhtml b/app/views/repositories/revisions.rhtml
new file mode 100644
index 000000000..c2e30d30c
--- /dev/null
+++ b/app/views/repositories/revisions.rhtml
@@ -0,0 +1,38 @@
+<%= stylesheet_link_tag "scm" %>
+
+<div class="contextual">
+<%= start_form_tag %>
+<%= l(:label_revision) %>: <%= text_field_tag 'rev', @rev, :size => 5 %>
+<%= submit_tag 'OK' %>
+</div>
+
+<h2><%= render :partial => 'navigation', :locals => { :path => @path, :kind => @entry.kind, :revision => @rev } %></h2>
+
+<% if @entry.is_file? %>
+<h3><%=h @entry.name %></h3>
+<p><%= link_to 'Download', {:action => 'entry', :id => @project, :path => @path, :rev => @rev, :format => 'raw' }, :class => "icon file" %> (<%= human_size @entry.size %>)</p>
+<% end %>
+
+<h3>Revisions</h3>
+
+<table class="list">
+<thead><tr>
+<th>#</th>
+<th><%= l(:field_author) %></th>
+<th><%= l(:label_date) %></th>
+<th><%= l(:field_description) %></th>
+<th></th>
+</tr></thead>
+<tbody>
+<% @revisions.each do |revision| %>
+<tr class="<%= cycle 'odd', 'even' %>">
+<th align="center"><%= link_to revision.identifier, :action => 'revision', :id => @project, :rev => revision.identifier %></th>
+<td align="center"><em><%=h revision.author %></em></td>
+<td align="center"><%= format_time(revision.time) %></td>
+<td width="70%"><%= simple_format(h(revision.message)) %></td>
+<td align="center"><%= link_to 'Diff', :action => 'diff', :id => @project, :path => @path, :rev => revision.identifier if @entry.is_file? && revision != @revisions.last %></td>
+</tr>
+<% end %>
+</tbody>
+</table>
+<p><%= lwr(:label_modification, @revisions.length) %></p> \ No newline at end of file
diff --git a/app/views/repositories/show.rhtml b/app/views/repositories/show.rhtml
new file mode 100644
index 000000000..4c95f8844
--- /dev/null
+++ b/app/views/repositories/show.rhtml
@@ -0,0 +1,15 @@
+<%= stylesheet_link_tag "scm" %>
+
+<h2><%= l(:label_repository) %></h2>
+
+<h3><%= l(:label_revision_plural) %></h3>
+<% if @latest_revision %>
+ <p><%= l(:label_latest_revision) %>:
+ <%= link_to @latest_revision.identifier, :action => 'revision', :id => @project, :rev => @latest_revision.identifier %><br />
+ <em><%= @latest_revision.author %>, <%= format_time(@latest_revision.time) %></em></p>
+<% end %>
+<p><%= link_to l(:label_view_revisions), :action => 'revisions', :id => @project %></p>
+
+
+<h3><%= l(:label_browse) %></h3>
+<%= render :partial => 'dir_list' %> \ No newline at end of file