##// END OF EJS Templates
Adds mime type specific css classes to the SCM browser....
Jean-Philippe Lang -
r2580:43200e21220d
parent child
Show More
1 NO CONTENT: new file 100644, binary diff hidden
1 NO CONTENT: new file 100644, binary diff hidden
1 NO CONTENT: new file 100644, binary diff hidden
1 NO CONTENT: new file 100644, binary diff hidden
1 NO CONTENT: new file 100644, binary diff hidden
1 NO CONTENT: new file 100644, binary diff hidden
1 NO CONTENT: new file 100644, binary diff hidden
1 NO CONTENT: new file 100644, binary diff hidden
1 NO CONTENT: new file 100644, binary diff hidden
1 NO CONTENT: new file 100644, binary diff hidden
@@ -0,0 +1,61
1 # Redmine - project management software
2 # Copyright (C) 2006-2009 Jean-Philippe Lang
3 #
4 # This program is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU General Public License
6 # as published by the Free Software Foundation; either version 2
7 # of the License, or (at your option) any later version.
8 #
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
13 #
14 # You should have received a copy of the GNU General Public License
15 # along with this program; if not, write to the Free Software
16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17
18 require File.dirname(__FILE__) + '/../../../test_helper'
19
20 class Redmine::MimeTypeTest < Test::Unit::TestCase
21
22 def test_of
23 to_test = {'test.unk' => nil,
24 'test.txt' => 'text/plain',
25 'test.c' => 'text/x-c',
26 }
27 to_test.each do |name, expected|
28 assert_equal expected, Redmine::MimeType.of(name)
29 end
30 end
31
32 def test_css_class_of
33 to_test = {'test.unk' => nil,
34 'test.txt' => 'text-plain',
35 'test.c' => 'text-x-c',
36 }
37 to_test.each do |name, expected|
38 assert_equal expected, Redmine::MimeType.css_class_of(name)
39 end
40 end
41
42 def test_main_mimetype_of
43 to_test = {'test.unk' => nil,
44 'test.txt' => 'text',
45 'test.c' => 'text',
46 }
47 to_test.each do |name, expected|
48 assert_equal expected, Redmine::MimeType.main_mimetype_of(name)
49 end
50 end
51
52 def test_is_type
53 to_test = {['text', 'test.unk'] => false,
54 ['text', 'test.txt'] => true,
55 ['text', 'test.c'] => true,
56 }
57 to_test.each do |args, expected|
58 assert_equal expected, Redmine::MimeType.is_type?(*args)
59 end
60 end
61 end
@@ -1,25 +1,25
1 1 <% @entries.each do |entry| %>
2 2 <% tr_id = Digest::MD5.hexdigest(entry.path)
3 3 depth = params[:depth].to_i %>
4 4 <tr id="<%= tr_id %>" class="<%= params[:parent_id] %> entry <%= entry.kind %>">
5 5 <td style="padding-left: <%=18 * depth%>px;" class="filename">
6 6 <% if entry.is_dir? %>
7 7 <span class="expander" onclick="<%= remote_function :url => {:action => 'browse', :id => @project, :path => to_path_param(entry.path), :rev => @rev, :depth => (depth + 1), :parent_id => tr_id},
8 8 :method => :get,
9 9 :update => { :success => tr_id },
10 10 :position => :after,
11 11 :success => "scmEntryLoaded('#{tr_id}')",
12 12 :condition => "scmEntryClick('#{tr_id}')"%>">&nbsp</span>
13 13 <% end %>
14 14 <%= link_to h(entry.name),
15 15 {:action => (entry.is_dir? ? 'browse' : 'changes'), :id => @project, :path => to_path_param(entry.path), :rev => @rev},
16 :class => (entry.is_dir? ? 'icon icon-folder' : 'icon icon-file')%>
16 :class => (entry.is_dir? ? 'icon icon-folder' : "icon icon-file #{Redmine::MimeType.css_class_of(entry.name)}")%>
17 17 </td>
18 18 <td class="size"><%= (entry.size ? number_to_human_size(entry.size) : "?") unless entry.is_dir? %></td>
19 19 <% changeset = @project.repository.changesets.find_by_revision(entry.lastrev.identifier) if entry.lastrev && entry.lastrev.identifier %>
20 20 <td class="revision"><%= link_to(format_revision(entry.lastrev.name), :action => 'revision', :id => @project, :rev => entry.lastrev.identifier) if entry.lastrev && entry.lastrev.identifier %></td>
21 21 <td class="age"><%= distance_of_time_in_words(entry.lastrev.time, Time.now) if entry.lastrev && entry.lastrev.time %></td>
22 22 <td class="author"><%= changeset.nil? ? h(entry.lastrev.author.to_s.split('<').first) : changeset.author if entry.lastrev %></td>
23 23 <td class="comments"><%=h truncate(changeset.comments, :length => 50) unless changeset.nil? %></td>
24 24 </tr>
25 25 <% end %>
@@ -1,70 +1,81
1 1 # redMine - project management software
2 2 # Copyright (C) 2006-2007 Jean-Philippe Lang
3 3 #
4 4 # This program is free software; you can redistribute it and/or
5 5 # modify it under the terms of the GNU General Public License
6 6 # as published by the Free Software Foundation; either version 2
7 7 # of the License, or (at your option) any later version.
8 8 #
9 9 # This program is distributed in the hope that it will be useful,
10 10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 12 # GNU General Public License for more details.
13 13 #
14 14 # You should have received a copy of the GNU General Public License
15 15 # along with this program; if not, write to the Free Software
16 16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 17
18 18 module Redmine
19 19 module MimeType
20 20
21 21 MIME_TYPES = {
22 22 'text/plain' => 'txt,tpl,properties,patch,diff,ini,readme,install,upgrade',
23 23 'text/css' => 'css',
24 24 'text/html' => 'html,htm,xhtml',
25 25 'text/jsp' => 'jsp',
26 26 'text/x-c' => 'c,cpp,cc,h,hh',
27 'text/x-csharp' => 'cs',
27 28 'text/x-java' => 'java',
28 29 'text/x-javascript' => 'js',
29 30 'text/x-html-template' => 'rhtml',
30 31 'text/x-perl' => 'pl,pm',
31 32 'text/x-php' => 'php,php3,php4,php5',
32 33 'text/x-python' => 'py',
33 34 'text/x-ruby' => 'rb,rbw,ruby,rake',
34 35 'text/x-csh' => 'csh',
35 36 'text/x-sh' => 'sh',
36 37 'text/xml' => 'xml,xsd,mxml',
37 38 'text/yaml' => 'yml,yaml',
38 39 'image/gif' => 'gif',
39 40 'image/jpeg' => 'jpg,jpeg,jpe',
40 41 'image/png' => 'png',
41 42 'image/tiff' => 'tiff,tif',
42 43 'image/x-ms-bmp' => 'bmp',
43 44 'image/x-xpixmap' => 'xpm',
45 'application/pdf' => 'pdf',
46 'application/zip' => 'zip',
47 'application/x-gzip' => 'gz',
44 48 }.freeze
45 49
46 50 EXTENSIONS = MIME_TYPES.inject({}) do |map, (type, exts)|
47 51 exts.split(',').each {|ext| map[ext.strip] = type}
48 52 map
49 53 end
50 54
51 55 # returns mime type for name or nil if unknown
52 56 def self.of(name)
53 57 return nil unless name
54 58 m = name.to_s.match(/(^|\.)([^\.]+)$/)
55 59 EXTENSIONS[m[2].downcase] if m
56 60 end
57 61
62 # Returns the css class associated to
63 # the mime type of name
64 def self.css_class_of(name)
65 mime = of(name)
66 mime && mime.gsub('/', '-')
67 end
68
58 69 def self.main_mimetype_of(name)
59 70 mimetype = of(name)
60 71 mimetype.split('/').first if mimetype
61 72 end
62 73
63 74 # return true if mime-type for name is type/*
64 75 # otherwise false
65 76 def self.is_type?(type, name)
66 77 main_mimetype = main_mimetype_of(name)
67 78 type.to_s == main_mimetype
68 79 end
69 80 end
70 81 end
@@ -1,759 +1,773
1 1 body { font-family: Verdana, sans-serif; font-size: 12px; color:#484848; margin: 0; padding: 0; min-width: 900px; }
2 2
3 3 h1, h2, h3, h4 { font-family: "Trebuchet MS", Verdana, sans-serif;}
4 4 h1 {margin:0; padding:0; font-size: 24px;}
5 5 h2, .wiki h1 {font-size: 20px;padding: 2px 10px 1px 0px;margin: 0 0 10px 0; border-bottom: 1px solid #bbbbbb; color: #444;}
6 6 h3, .wiki h2 {font-size: 16px;padding: 2px 10px 1px 0px;margin: 0 0 10px 0; border-bottom: 1px solid #bbbbbb; color: #444;}
7 7 h4, .wiki h3 {font-size: 13px;padding: 2px 10px 1px 0px;margin-bottom: 5px; border-bottom: 1px dotted #bbbbbb; color: #444;}
8 8
9 9 /***** Layout *****/
10 10 #wrapper {background: white;}
11 11
12 12 #top-menu {background: #2C4056; color: #fff; height:1.8em; font-size: 0.8em; padding: 2px 2px 0px 6px;}
13 13 #top-menu ul {margin: 0; padding: 0;}
14 14 #top-menu li {
15 15 float:left;
16 16 list-style-type:none;
17 17 margin: 0px 0px 0px 0px;
18 18 padding: 0px 0px 0px 0px;
19 19 white-space:nowrap;
20 20 }
21 21 #top-menu a {color: #fff; margin-right: 8px; font-weight: bold;}
22 22 #top-menu #loggedas { float: right; margin-right: 0.5em; color: #fff; }
23 23
24 24 #account {float:right;}
25 25
26 26 #header {height:5.3em;margin:0;background-color:#507AAA;color:#f8f8f8; padding: 4px 8px 0px 6px; position:relative;}
27 27 #header a {color:#f8f8f8;}
28 28 #header h1 a.ancestor { font-size: 80%; }
29 29 #quick-search {float:right;}
30 30
31 31 #main-menu {position: absolute; bottom: 0px; left:6px; margin-right: -500px;}
32 32 #main-menu ul {margin: 0; padding: 0;}
33 33 #main-menu li {
34 34 float:left;
35 35 list-style-type:none;
36 36 margin: 0px 2px 0px 0px;
37 37 padding: 0px 0px 0px 0px;
38 38 white-space:nowrap;
39 39 }
40 40 #main-menu li a {
41 41 display: block;
42 42 color: #fff;
43 43 text-decoration: none;
44 44 font-weight: bold;
45 45 margin: 0;
46 46 padding: 4px 10px 4px 10px;
47 47 }
48 48 #main-menu li a:hover {background:#759FCF; color:#fff;}
49 49 #main-menu li a.selected, #main-menu li a.selected:hover {background:#fff; color:#555;}
50 50
51 51 #main {background-color:#EEEEEE;}
52 52
53 53 #sidebar{ float: right; width: 17%; position: relative; z-index: 9; min-height: 600px; padding: 0; margin: 0;}
54 54 * html #sidebar{ width: 17%; }
55 55 #sidebar h3{ font-size: 14px; margin-top:14px; color: #666; }
56 56 #sidebar hr{ width: 100%; margin: 0 auto; height: 1px; background: #ccc; border: 0; }
57 57 * html #sidebar hr{ width: 95%; position: relative; left: -6px; color: #ccc; }
58 58
59 59 #content { width: 80%; background-color: #fff; margin: 0px; border-right: 1px solid #ddd; padding: 6px 10px 10px 10px; z-index: 10; }
60 60 * html #content{ width: 80%; padding-left: 0; margin-top: 0px; padding: 6px 10px 10px 10px;}
61 61 html>body #content { min-height: 600px; }
62 62 * html body #content { height: 600px; } /* IE */
63 63
64 64 #main.nosidebar #sidebar{ display: none; }
65 65 #main.nosidebar #content{ width: auto; border-right: 0; }
66 66
67 67 #footer {clear: both; border-top: 1px solid #bbb; font-size: 0.9em; color: #aaa; padding: 5px; text-align:center; background:#fff;}
68 68
69 69 #login-form table {margin-top:5em; padding:1em; margin-left: auto; margin-right: auto; border: 2px solid #FDBF3B; background-color:#FFEBC1; }
70 70 #login-form table td {padding: 6px;}
71 71 #login-form label {font-weight: bold;}
72 72
73 73 input#openid_url { background: url(../images/openid-bg.gif) no-repeat; background-color: #fff; background-position: 0 50%; padding-left: 18px; }
74 74
75 75 .clear:after{ content: "."; display: block; height: 0; clear: both; visibility: hidden; }
76 76
77 77 /***** Links *****/
78 78 a, a:link, a:visited{ color: #2A5685; text-decoration: none; }
79 79 a:hover, a:active{ color: #c61a1a; text-decoration: underline;}
80 80 a img{ border: 0; }
81 81
82 82 a.issue.closed, a.issue.closed:link, a.issue.closed:visited { text-decoration: line-through; }
83 83
84 84 /***** Tables *****/
85 85 table.list { border: 1px solid #e4e4e4; border-collapse: collapse; width: 100%; margin-bottom: 4px; }
86 86 table.list th { background-color:#EEEEEE; padding: 4px; white-space:nowrap; }
87 87 table.list td { vertical-align: top; }
88 88 table.list td.id { width: 2%; text-align: center;}
89 89 table.list td.checkbox { width: 15px; padding: 0px;}
90 90
91 91 tr.project td.name a { padding-left: 16px; white-space:nowrap; }
92 92 tr.project.parent td.name a { background: url('../images/bullet_toggle_minus.png') no-repeat; }
93 93
94 94 tr.issue { text-align: center; white-space: nowrap; }
95 95 tr.issue td.subject, tr.issue td.category, td.assigned_to { white-space: normal; }
96 96 tr.issue td.subject { text-align: left; }
97 97 tr.issue td.done_ratio table.progress { margin-left:auto; margin-right: auto;}
98 98
99 99 tr.entry { border: 1px solid #f8f8f8; }
100 100 tr.entry td { white-space: nowrap; }
101 101 tr.entry td.filename { width: 30%; }
102 102 tr.entry td.size { text-align: right; font-size: 90%; }
103 103 tr.entry td.revision, tr.entry td.author { text-align: center; }
104 104 tr.entry td.age { text-align: right; }
105 105
106 106 tr.entry span.expander {background-image: url(../images/bullet_toggle_plus.png); padding-left: 8px; margin-left: 0; cursor: pointer;}
107 107 tr.entry.open span.expander {background-image: url(../images/bullet_toggle_minus.png);}
108 108 tr.entry.file td.filename a { margin-left: 16px; }
109 109
110 110 tr.changeset td.author { text-align: center; width: 15%; }
111 111 tr.changeset td.committed_on { text-align: center; width: 15%; }
112 112
113 113 table.files tr.file td { text-align: center; }
114 114 table.files tr.file td.filename { text-align: left; padding-left: 24px; }
115 115 table.files tr.file td.digest { font-size: 80%; }
116 116
117 117 tr.message { height: 2.6em; }
118 118 tr.message td.last_message { font-size: 80%; }
119 119 tr.message.locked td.subject a { background-image: url(../images/locked.png); }
120 120 tr.message.sticky td.subject a { background-image: url(../images/sticky.png); font-weight: bold; }
121 121
122 122 tr.user td { width:13%; }
123 123 tr.user td.email { width:18%; }
124 124 tr.user td { white-space: nowrap; }
125 125 tr.user.locked, tr.user.registered { color: #aaa; }
126 126 tr.user.locked a, tr.user.registered a { color: #aaa; }
127 127
128 128 tr.time-entry { text-align: center; white-space: nowrap; }
129 129 tr.time-entry td.subject, tr.time-entry td.comments { text-align: left; white-space: normal; }
130 130 td.hours { text-align: right; font-weight: bold; padding-right: 0.5em; }
131 131 td.hours .hours-dec { font-size: 0.9em; }
132 132
133 133 table.plugins td { vertical-align: middle; }
134 134 table.plugins td.configure { text-align: right; padding-right: 1em; }
135 135 table.plugins span.name { font-weight: bold; display: block; margin-bottom: 6px; }
136 136 table.plugins span.description { display: block; font-size: 0.9em; }
137 137 table.plugins span.url { display: block; font-size: 0.9em; }
138 138
139 139 table.list tbody tr:hover { background-color:#ffffdd; }
140 140 table td {padding:2px;}
141 141 table p {margin:0;}
142 142 .odd {background-color:#f6f7f8;}
143 143 .even {background-color: #fff;}
144 144
145 145 a.sort { padding-right: 16px; background-position: 100% 50%; background-repeat: no-repeat; }
146 146 a.sort.asc { background-image: url(../images/sort_asc.png); }
147 147 a.sort.desc { background-image: url(../images/sort_desc.png); }
148 148
149 149 .highlight { background-color: #FCFD8D;}
150 150 .highlight.token-1 { background-color: #faa;}
151 151 .highlight.token-2 { background-color: #afa;}
152 152 .highlight.token-3 { background-color: #aaf;}
153 153
154 154 .box{
155 155 padding:6px;
156 156 margin-bottom: 10px;
157 157 background-color:#f6f6f6;
158 158 color:#505050;
159 159 line-height:1.5em;
160 160 border: 1px solid #e4e4e4;
161 161 }
162 162
163 163 div.square {
164 164 border: 1px solid #999;
165 165 float: left;
166 166 margin: .3em .4em 0 .4em;
167 167 overflow: hidden;
168 168 width: .6em; height: .6em;
169 169 }
170 170 .contextual {float:right; white-space: nowrap; line-height:1.4em;margin-top:5px; padding-left: 10px; font-size:0.9em;}
171 171 .contextual input {font-size:0.9em;}
172 172 .message .contextual { margin-top: 0; }
173 173
174 174 .splitcontentleft{float:left; width:49%;}
175 175 .splitcontentright{float:right; width:49%;}
176 176 form {display: inline;}
177 177 input, select {vertical-align: middle; margin-top: 1px; margin-bottom: 1px;}
178 178 fieldset {border: 1px solid #e4e4e4; margin:0;}
179 179 legend {color: #484848;}
180 180 hr { width: 100%; height: 1px; background: #ccc; border: 0;}
181 181 blockquote { font-style: italic; border-left: 3px solid #e0e0e0; padding-left: 0.6em; margin-left: 2.4em;}
182 182 blockquote blockquote { margin-left: 0;}
183 183 textarea.wiki-edit { width: 99%; }
184 184 li p {margin-top: 0;}
185 185 div.issue {background:#ffffdd; padding:6px; margin-bottom:6px;border: 1px solid #d7d7d7;}
186 186 p.breadcrumb { font-size: 0.9em; margin: 4px 0 4px 0;}
187 187 p.subtitle { font-size: 0.9em; margin: -6px 0 12px 0; font-style: italic; }
188 188 p.footnote { font-size: 0.9em; margin-top: 0px; margin-bottom: 0px; }
189 189
190 190 fieldset#filters, fieldset#date-range { padding: 0.7em; margin-bottom: 8px; }
191 191 fieldset#filters p { margin: 1.2em 0 0.8em 2px; }
192 192 fieldset#filters table { border-collapse: collapse; }
193 193 fieldset#filters table td { padding: 0; vertical-align: middle; }
194 194 fieldset#filters tr.filter { height: 2em; }
195 195 fieldset#filters td.add-filter { text-align: right; vertical-align: top; }
196 196 .buttons { font-size: 0.9em; }
197 197
198 198 div#issue-changesets {float:right; width:45%; margin-left: 1em; margin-bottom: 1em; background: #fff; padding-left: 1em; font-size: 90%;}
199 199 div#issue-changesets .changeset { padding: 4px;}
200 200 div#issue-changesets .changeset { border-bottom: 1px solid #ddd; }
201 201 div#issue-changesets p { margin-top: 0; margin-bottom: 1em;}
202 202
203 203 div#activity dl, #search-results { margin-left: 2em; }
204 204 div#activity dd, #search-results dd { margin-bottom: 1em; padding-left: 18px; font-size: 0.9em; }
205 205 div#activity dt, #search-results dt { margin-bottom: 0px; padding-left: 20px; line-height: 18px; background-position: 0 50%; background-repeat: no-repeat; }
206 206 div#activity dt.me .time { border-bottom: 1px solid #999; }
207 207 div#activity dt .time { color: #777; font-size: 80%; }
208 208 div#activity dd .description, #search-results dd .description { font-style: italic; }
209 209 div#activity span.project:after, #search-results span.project:after { content: " -"; }
210 210 div#activity dd span.description, #search-results dd span.description { display:block; color: #808080; }
211 211
212 212 #search-results dd { margin-bottom: 1em; padding-left: 20px; margin-left:0px; }
213 213
214 214 div#search-results-counts {float:right;}
215 215 div#search-results-counts ul { margin-top: 0.5em; }
216 216 div#search-results-counts li { list-style-type:none; float: left; margin-left: 1em; }
217 217
218 218 dt.issue { background-image: url(../images/ticket.png); }
219 219 dt.issue-edit { background-image: url(../images/ticket_edit.png); }
220 220 dt.issue-closed { background-image: url(../images/ticket_checked.png); }
221 221 dt.issue-note { background-image: url(../images/ticket_note.png); }
222 222 dt.changeset { background-image: url(../images/changeset.png); }
223 223 dt.news { background-image: url(../images/news.png); }
224 224 dt.message { background-image: url(../images/message.png); }
225 225 dt.reply { background-image: url(../images/comments.png); }
226 226 dt.wiki-page { background-image: url(../images/wiki_edit.png); }
227 227 dt.attachment { background-image: url(../images/attachment.png); }
228 228 dt.document { background-image: url(../images/document.png); }
229 229 dt.project { background-image: url(../images/projects.png); }
230 230
231 231 #search-results dt.issue.closed { background-image: url(../images/ticket_checked.png); }
232 232
233 233 div#roadmap fieldset.related-issues { margin-bottom: 1em; }
234 234 div#roadmap fieldset.related-issues ul { margin-top: 0.3em; margin-bottom: 0.3em; }
235 235 div#roadmap .wiki h1:first-child { display: none; }
236 236 div#roadmap .wiki h1 { font-size: 120%; }
237 237 div#roadmap .wiki h2 { font-size: 110%; }
238 238
239 239 div#version-summary { float:right; width:380px; margin-left: 16px; margin-bottom: 16px; background-color: #fff; }
240 240 div#version-summary fieldset { margin-bottom: 1em; }
241 241 div#version-summary .total-hours { text-align: right; }
242 242
243 243 table#time-report td.hours, table#time-report th.period, table#time-report th.total { text-align: right; padding-right: 0.5em; }
244 244 table#time-report tbody tr { font-style: italic; color: #777; }
245 245 table#time-report tbody tr.last-level { font-style: normal; color: #555; }
246 246 table#time-report tbody tr.total { font-style: normal; font-weight: bold; color: #555; background-color:#EEEEEE; }
247 247 table#time-report .hours-dec { font-size: 0.9em; }
248 248
249 249 form#issue-form .attributes { margin-bottom: 8px; }
250 250 form#issue-form .attributes p { padding-top: 1px; padding-bottom: 2px; }
251 251 form#issue-form .attributes select { min-width: 30%; }
252 252
253 253 ul.projects { margin: 0; padding-left: 1em; }
254 254 ul.projects.root { margin: 0; padding: 0; }
255 255 ul.projects ul { border-left: 3px solid #e0e0e0; }
256 256 ul.projects li { list-style-type:none; }
257 257 ul.projects li.root { margin-bottom: 1em; }
258 258 ul.projects li.child { margin-top: 1em;}
259 259 ul.projects div.root a.project { font-family: "Trebuchet MS", Verdana, sans-serif; font-weight: bold; font-size: 16px; margin: 0 0 10px 0; }
260 260 .my-project { padding-left: 18px; background: url(../images/fav.png) no-repeat 0 50%; }
261 261
262 262 #tracker_project_ids ul { margin: 0; padding-left: 1em; }
263 263 #tracker_project_ids li { list-style-type:none; }
264 264
265 265 ul.properties {padding:0; font-size: 0.9em; color: #777;}
266 266 ul.properties li {list-style-type:none;}
267 267 ul.properties li span {font-style:italic;}
268 268
269 269 .total-hours { font-size: 110%; font-weight: bold; }
270 270 .total-hours span.hours-int { font-size: 120%; }
271 271
272 272 .autoscroll {overflow-x: auto; padding:1px; margin-bottom: 1.2em;}
273 273 #user_firstname, #user_lastname, #user_mail, #my_account_form select { width: 90%; }
274 274
275 275 .pagination {font-size: 90%}
276 276 p.pagination {margin-top:8px;}
277 277
278 278 /***** Tabular forms ******/
279 279 .tabular p{
280 280 margin: 0;
281 281 padding: 5px 0 8px 0;
282 282 padding-left: 180px; /*width of left column containing the label elements*/
283 283 height: 1%;
284 284 clear:left;
285 285 }
286 286
287 287 html>body .tabular p {overflow:hidden;}
288 288
289 289 .tabular label{
290 290 font-weight: bold;
291 291 float: left;
292 292 text-align: right;
293 293 margin-left: -180px; /*width of left column*/
294 294 width: 175px; /*width of labels. Should be smaller than left column to create some right
295 295 margin*/
296 296 }
297 297
298 298 .tabular label.floating{
299 299 font-weight: normal;
300 300 margin-left: 0px;
301 301 text-align: left;
302 302 width: 270px;
303 303 }
304 304
305 305 input#time_entry_comments { width: 90%;}
306 306
307 307 #preview fieldset {margin-top: 1em; background: url(../images/draft.png)}
308 308
309 309 .tabular.settings p{ padding-left: 300px; }
310 310 .tabular.settings label{ margin-left: -300px; width: 295px; }
311 311
312 312 .required {color: #bb0000;}
313 313 .summary {font-style: italic;}
314 314
315 315 #attachments_fields input[type=text] {margin-left: 8px; }
316 316
317 317 div.attachments { margin-top: 12px; }
318 318 div.attachments p { margin:4px 0 2px 0; }
319 319 div.attachments img { vertical-align: middle; }
320 320 div.attachments span.author { font-size: 0.9em; color: #888; }
321 321
322 322 p.other-formats { text-align: right; font-size:0.9em; color: #666; }
323 323 .other-formats span + span:before { content: "| "; }
324 324
325 325 a.atom { background: url(../images/feed.png) no-repeat 1px 50%; padding: 2px 0px 3px 16px; }
326 326
327 327 /* Project members tab */
328 328 div#tab-content-members .splitcontentleft { width: 64% }
329 329 div#tab-content-members .splitcontentright { width: 34% }
330 330 div#tab-content-members fieldset { padding:1em; margin-bottom: 1em; }
331 331 div#tab-content-members fieldset legend { font-weight: bold; }
332 332 div#tab-content-members fieldset label { display: block; }
333 333 div#tab-content-members fieldset div { max-height: 400px; overflow:auto; }
334 334
335 335 * html div#tab-content-members fieldset div { height: 450px; }
336 336
337 337 /***** Flash & error messages ****/
338 338 #errorExplanation, div.flash, .nodata, .warning {
339 339 padding: 4px 4px 4px 30px;
340 340 margin-bottom: 12px;
341 341 font-size: 1.1em;
342 342 border: 2px solid;
343 343 }
344 344
345 345 div.flash {margin-top: 8px;}
346 346
347 347 div.flash.error, #errorExplanation {
348 348 background: url(../images/false.png) 8px 5px no-repeat;
349 349 background-color: #ffe3e3;
350 350 border-color: #dd0000;
351 351 color: #550000;
352 352 }
353 353
354 354 div.flash.notice {
355 355 background: url(../images/true.png) 8px 5px no-repeat;
356 356 background-color: #dfffdf;
357 357 border-color: #9fcf9f;
358 358 color: #005f00;
359 359 }
360 360
361 361 div.flash.warning {
362 362 background: url(../images/warning.png) 8px 5px no-repeat;
363 363 background-color: #FFEBC1;
364 364 border-color: #FDBF3B;
365 365 color: #A6750C;
366 366 text-align: left;
367 367 }
368 368
369 369 .nodata, .warning {
370 370 text-align: center;
371 371 background-color: #FFEBC1;
372 372 border-color: #FDBF3B;
373 373 color: #A6750C;
374 374 }
375 375
376 376 #errorExplanation ul { font-size: 0.9em;}
377 377 #errorExplanation h2, #errorExplanation p { display: none; }
378 378
379 379 /***** Ajax indicator ******/
380 380 #ajax-indicator {
381 381 position: absolute; /* fixed not supported by IE */
382 382 background-color:#eee;
383 383 border: 1px solid #bbb;
384 384 top:35%;
385 385 left:40%;
386 386 width:20%;
387 387 font-weight:bold;
388 388 text-align:center;
389 389 padding:0.6em;
390 390 z-index:100;
391 391 filter:alpha(opacity=50);
392 392 opacity: 0.5;
393 393 }
394 394
395 395 html>body #ajax-indicator { position: fixed; }
396 396
397 397 #ajax-indicator span {
398 398 background-position: 0% 40%;
399 399 background-repeat: no-repeat;
400 400 background-image: url(../images/loading.gif);
401 401 padding-left: 26px;
402 402 vertical-align: bottom;
403 403 }
404 404
405 405 /***** Calendar *****/
406 406 table.cal {border-collapse: collapse; width: 100%; margin: 0px 0 6px 0;border: 1px solid #d7d7d7;}
407 407 table.cal thead th {width: 14%;}
408 408 table.cal tbody tr {height: 100px;}
409 409 table.cal th { background-color:#EEEEEE; padding: 4px; }
410 410 table.cal td {border: 1px solid #d7d7d7; vertical-align: top; font-size: 0.9em;}
411 411 table.cal td p.day-num {font-size: 1.1em; text-align:right;}
412 412 table.cal td.odd p.day-num {color: #bbb;}
413 413 table.cal td.today {background:#ffffdd;}
414 414 table.cal td.today p.day-num {font-weight: bold;}
415 415
416 416 /***** Tooltips ******/
417 417 .tooltip{position:relative;z-index:24;}
418 418 .tooltip:hover{z-index:25;color:#000;}
419 419 .tooltip span.tip{display: none; text-align:left;}
420 420
421 421 div.tooltip:hover span.tip{
422 422 display:block;
423 423 position:absolute;
424 424 top:12px; left:24px; width:270px;
425 425 border:1px solid #555;
426 426 background-color:#fff;
427 427 padding: 4px;
428 428 font-size: 0.8em;
429 429 color:#505050;
430 430 }
431 431
432 432 /***** Progress bar *****/
433 433 table.progress {
434 434 border: 1px solid #D7D7D7;
435 435 border-collapse: collapse;
436 436 border-spacing: 0pt;
437 437 empty-cells: show;
438 438 text-align: center;
439 439 float:left;
440 440 margin: 1px 6px 1px 0px;
441 441 }
442 442
443 443 table.progress td { height: 0.9em; }
444 444 table.progress td.closed { background: #BAE0BA none repeat scroll 0%; }
445 445 table.progress td.done { background: #DEF0DE none repeat scroll 0%; }
446 446 table.progress td.open { background: #FFF none repeat scroll 0%; }
447 447 p.pourcent {font-size: 80%;}
448 448 p.progress-info {clear: left; font-style: italic; font-size: 80%;}
449 449
450 450 /***** Tabs *****/
451 451 #content .tabs {height: 2.6em; border-bottom: 1px solid #bbbbbb; margin-bottom:1.2em; position:relative;}
452 452 #content .tabs ul {margin:0; position:absolute; bottom:-2px; padding-left:1em;}
453 453 #content .tabs>ul { bottom:-1px; } /* others */
454 454 #content .tabs ul li {
455 455 float:left;
456 456 list-style-type:none;
457 457 white-space:nowrap;
458 458 margin-right:8px;
459 459 background:#fff;
460 460 }
461 461 #content .tabs ul li a{
462 462 display:block;
463 463 font-size: 0.9em;
464 464 text-decoration:none;
465 465 line-height:1.3em;
466 466 padding:4px 6px 4px 6px;
467 467 border: 1px solid #ccc;
468 468 border-bottom: 1px solid #bbbbbb;
469 469 background-color: #eeeeee;
470 470 color:#777;
471 471 font-weight:bold;
472 472 }
473 473
474 474 #content .tabs ul li a:hover {
475 475 background-color: #ffffdd;
476 476 text-decoration:none;
477 477 }
478 478
479 479 #content .tabs ul li a.selected {
480 480 background-color: #fff;
481 481 border: 1px solid #bbbbbb;
482 482 border-bottom: 1px solid #fff;
483 483 }
484 484
485 485 #content .tabs ul li a.selected:hover {
486 486 background-color: #fff;
487 487 }
488 488
489 489 /***** Auto-complete *****/
490 490 div.autocomplete {
491 491 position:absolute;
492 492 width:250px;
493 493 background-color:white;
494 494 margin:0;
495 495 padding:0;
496 496 }
497 497 div.autocomplete ul {
498 498 list-style-type:none;
499 499 margin:0;
500 500 padding:0;
501 501 }
502 502 div.autocomplete ul li.selected { background-color: #ffb;}
503 503 div.autocomplete ul li {
504 504 list-style-type:none;
505 505 display:block;
506 506 margin:0;
507 507 padding:2px;
508 508 cursor:pointer;
509 509 font-size: 90%;
510 510 border-bottom: 1px solid #ccc;
511 511 border-left: 1px solid #ccc;
512 512 border-right: 1px solid #ccc;
513 513 }
514 514 div.autocomplete ul li span.informal {
515 515 font-size: 80%;
516 516 color: #aaa;
517 517 }
518 518
519 519 /***** Diff *****/
520 520 .diff_out { background: #fcc; }
521 521 .diff_in { background: #cfc; }
522 522
523 523 /***** Wiki *****/
524 524 div.wiki table {
525 525 border: 1px solid #505050;
526 526 border-collapse: collapse;
527 527 margin-bottom: 1em;
528 528 }
529 529
530 530 div.wiki table, div.wiki td, div.wiki th {
531 531 border: 1px solid #bbb;
532 532 padding: 4px;
533 533 }
534 534
535 535 div.wiki .external {
536 536 background-position: 0% 60%;
537 537 background-repeat: no-repeat;
538 538 padding-left: 12px;
539 539 background-image: url(../images/external.png);
540 540 }
541 541
542 542 div.wiki a.new {
543 543 color: #b73535;
544 544 }
545 545
546 546 div.wiki pre {
547 547 margin: 1em 1em 1em 1.6em;
548 548 padding: 2px;
549 549 background-color: #fafafa;
550 550 border: 1px solid #dadada;
551 551 width:95%;
552 552 overflow-x: auto;
553 553 }
554 554
555 555 div.wiki ul.toc {
556 556 background-color: #ffffdd;
557 557 border: 1px solid #e4e4e4;
558 558 padding: 4px;
559 559 line-height: 1.2em;
560 560 margin-bottom: 12px;
561 561 margin-right: 12px;
562 562 margin-left: 0;
563 563 display: table
564 564 }
565 565 * html div.wiki ul.toc { width: 50%; } /* IE6 doesn't autosize div */
566 566
567 567 div.wiki ul.toc.right { float: right; margin-left: 12px; margin-right: 0; width: auto; }
568 568 div.wiki ul.toc.left { float: left; margin-right: 12px; margin-left: 0; width: auto; }
569 569 div.wiki ul.toc li { list-style-type:none;}
570 570 div.wiki ul.toc li.heading2 { margin-left: 6px; }
571 571 div.wiki ul.toc li.heading3 { margin-left: 12px; font-size: 0.8em; }
572 572
573 573 div.wiki ul.toc a {
574 574 font-size: 0.9em;
575 575 font-weight: normal;
576 576 text-decoration: none;
577 577 color: #606060;
578 578 }
579 579 div.wiki ul.toc a:hover { color: #c61a1a; text-decoration: underline;}
580 580
581 581 a.wiki-anchor { display: none; margin-left: 6px; text-decoration: none; }
582 582 a.wiki-anchor:hover { color: #aaa !important; text-decoration: none; }
583 583 h1:hover a.wiki-anchor, h2:hover a.wiki-anchor, h3:hover a.wiki-anchor { display: inline; color: #ddd; }
584 584
585 585 /***** My page layout *****/
586 586 .block-receiver {
587 587 border:1px dashed #c0c0c0;
588 588 margin-bottom: 20px;
589 589 padding: 15px 0 15px 0;
590 590 }
591 591
592 592 .mypage-box {
593 593 margin:0 0 20px 0;
594 594 color:#505050;
595 595 line-height:1.5em;
596 596 }
597 597
598 598 .handle {
599 599 cursor: move;
600 600 }
601 601
602 602 a.close-icon {
603 603 display:block;
604 604 margin-top:3px;
605 605 overflow:hidden;
606 606 width:12px;
607 607 height:12px;
608 608 background-repeat: no-repeat;
609 609 cursor:pointer;
610 610 background-image:url('../images/close.png');
611 611 }
612 612
613 613 a.close-icon:hover {
614 614 background-image:url('../images/close_hl.png');
615 615 }
616 616
617 617 /***** Gantt chart *****/
618 618 .gantt_hdr {
619 619 position:absolute;
620 620 top:0;
621 621 height:16px;
622 622 border-top: 1px solid #c0c0c0;
623 623 border-bottom: 1px solid #c0c0c0;
624 624 border-right: 1px solid #c0c0c0;
625 625 text-align: center;
626 626 overflow: hidden;
627 627 }
628 628
629 629 .task {
630 630 position: absolute;
631 631 height:8px;
632 632 font-size:0.8em;
633 633 color:#888;
634 634 padding:0;
635 635 margin:0;
636 636 line-height:0.8em;
637 637 }
638 638
639 639 .task_late { background:#f66 url(../images/task_late.png); border: 1px solid #f66; }
640 640 .task_done { background:#66f url(../images/task_done.png); border: 1px solid #66f; }
641 641 .task_todo { background:#aaa url(../images/task_todo.png); border: 1px solid #aaa; }
642 642 .milestone { background-image:url(../images/milestone.png); background-repeat: no-repeat; border: 0; }
643 643
644 644 /***** Icons *****/
645 645 .icon {
646 646 background-position: 0% 40%;
647 647 background-repeat: no-repeat;
648 648 padding-left: 20px;
649 649 padding-top: 2px;
650 650 padding-bottom: 3px;
651 651 }
652 652
653 653 .icon22 {
654 654 background-position: 0% 40%;
655 655 background-repeat: no-repeat;
656 656 padding-left: 26px;
657 657 line-height: 22px;
658 658 vertical-align: middle;
659 659 }
660 660
661 661 .icon-add { background-image: url(../images/add.png); }
662 662 .icon-edit { background-image: url(../images/edit.png); }
663 663 .icon-copy { background-image: url(../images/copy.png); }
664 664 .icon-del { background-image: url(../images/delete.png); }
665 665 .icon-move { background-image: url(../images/move.png); }
666 666 .icon-save { background-image: url(../images/save.png); }
667 667 .icon-cancel { background-image: url(../images/cancel.png); }
668 .icon-file { background-image: url(../images/file.png); }
669 668 .icon-folder { background-image: url(../images/folder.png); }
670 669 .open .icon-folder { background-image: url(../images/folder_open.png); }
671 670 .icon-package { background-image: url(../images/package.png); }
672 671 .icon-home { background-image: url(../images/home.png); }
673 672 .icon-user { background-image: url(../images/user.png); }
674 673 .icon-mypage { background-image: url(../images/user_page.png); }
675 674 .icon-admin { background-image: url(../images/admin.png); }
676 675 .icon-projects { background-image: url(../images/projects.png); }
677 676 .icon-help { background-image: url(../images/help.png); }
678 677 .icon-attachment { background-image: url(../images/attachment.png); }
679 678 .icon-index { background-image: url(../images/index.png); }
680 679 .icon-history { background-image: url(../images/history.png); }
681 680 .icon-time { background-image: url(../images/time.png); }
682 681 .icon-time-add { background-image: url(../images/time_add.png); }
683 682 .icon-stats { background-image: url(../images/stats.png); }
684 683 .icon-warning { background-image: url(../images/warning.png); }
685 684 .icon-fav { background-image: url(../images/fav.png); }
686 685 .icon-fav-off { background-image: url(../images/fav_off.png); }
687 686 .icon-reload { background-image: url(../images/reload.png); }
688 687 .icon-lock { background-image: url(../images/locked.png); }
689 688 .icon-unlock { background-image: url(../images/unlock.png); }
690 689 .icon-checked { background-image: url(../images/true.png); }
691 690 .icon-details { background-image: url(../images/zoom_in.png); }
692 691 .icon-report { background-image: url(../images/report.png); }
693 692 .icon-comment { background-image: url(../images/comment.png); }
694 693
694 .icon-file { background-image: url(../images/files/default.png); }
695 .icon-file.text-plain { background-image: url(../images/files/text.png); }
696 .icon-file.text-x-c { background-image: url(../images/files/c.png); }
697 .icon-file.text-x-csharp { background-image: url(../images/files/csharp.png); }
698 .icon-file.text-x-php { background-image: url(../images/files/php.png); }
699 .icon-file.text-x-ruby { background-image: url(../images/files/ruby.png); }
700 .icon-file.text-xml { background-image: url(../images/files/xml.png); }
701 .icon-file.image-gif { background-image: url(../images/files/image.png); }
702 .icon-file.image-jpeg { background-image: url(../images/files/image.png); }
703 .icon-file.image-png { background-image: url(../images/files/image.png); }
704 .icon-file.image-tiff { background-image: url(../images/files/image.png); }
705 .icon-file.application-pdf { background-image: url(../images/files/pdf.png); }
706 .icon-file.application-zip { background-image: url(../images/files/zip.png); }
707 .icon-file.application-x-gzip { background-image: url(../images/files/zip.png); }
708
695 709 .icon22-projects { background-image: url(../images/22x22/projects.png); }
696 710 .icon22-users { background-image: url(../images/22x22/users.png); }
697 711 .icon22-tracker { background-image: url(../images/22x22/tracker.png); }
698 712 .icon22-role { background-image: url(../images/22x22/role.png); }
699 713 .icon22-workflow { background-image: url(../images/22x22/workflow.png); }
700 714 .icon22-options { background-image: url(../images/22x22/options.png); }
701 715 .icon22-notifications { background-image: url(../images/22x22/notifications.png); }
702 716 .icon22-authent { background-image: url(../images/22x22/authent.png); }
703 717 .icon22-info { background-image: url(../images/22x22/info.png); }
704 718 .icon22-comment { background-image: url(../images/22x22/comment.png); }
705 719 .icon22-package { background-image: url(../images/22x22/package.png); }
706 720 .icon22-settings { background-image: url(../images/22x22/settings.png); }
707 721 .icon22-plugin { background-image: url(../images/22x22/plugin.png); }
708 722
709 723 img.gravatar {
710 724 padding: 2px;
711 725 border: solid 1px #d5d5d5;
712 726 background: #fff;
713 727 }
714 728
715 729 div.issue img.gravatar {
716 730 float: right;
717 731 margin: 0 0 0 1em;
718 732 padding: 5px;
719 733 }
720 734
721 735 div.issue table img.gravatar {
722 736 height: 14px;
723 737 width: 14px;
724 738 padding: 2px;
725 739 float: left;
726 740 margin: 0 0.5em 0 0;
727 741 }
728 742
729 743 #history img.gravatar {
730 744 padding: 3px;
731 745 margin: 0 1.5em 1em 0;
732 746 float: left;
733 747 }
734 748
735 749 td.username img.gravatar {
736 750 float: left;
737 751 margin: 0 1em 0 0;
738 752 }
739 753
740 754 #activity dt img.gravatar {
741 755 float: left;
742 756 margin: 0 1em 1em 0;
743 757 }
744 758
745 759 #activity dt,
746 760 .journal {
747 761 clear: left;
748 762 }
749 763
750 764 h2 img { vertical-align:middle; }
751 765
752 766
753 767 /***** Media print specific styles *****/
754 768 @media print {
755 769 #top-menu, #header, #main-menu, #sidebar, #footer, .contextual, .other-formats { display:none; }
756 770 #main { background: #fff; }
757 771 #content { width: 99%; margin: 0; padding: 0; border: 0; background: #fff; overflow: visible !important;}
758 772 #wiki_add_attachment { display:none; }
759 773 }
@@ -1,193 +1,194
1 1 # redMine - project management software
2 2 # Copyright (C) 2006-2008 Jean-Philippe Lang
3 3 #
4 4 # This program is free software; you can redistribute it and/or
5 5 # modify it under the terms of the GNU General Public License
6 6 # as published by the Free Software Foundation; either version 2
7 7 # of the License, or (at your option) any later version.
8 8 #
9 9 # This program is distributed in the hope that it will be useful,
10 10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 12 # GNU General Public License for more details.
13 13 #
14 14 # You should have received a copy of the GNU General Public License
15 15 # along with this program; if not, write to the Free Software
16 16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 17
18 18 require File.dirname(__FILE__) + '/../test_helper'
19 19 require 'repositories_controller'
20 20
21 21 # Re-raise errors caught by the controller.
22 22 class RepositoriesController; def rescue_action(e) raise e end; end
23 23
24 24 class RepositoriesSubversionControllerTest < Test::Unit::TestCase
25 25 fixtures :projects, :users, :roles, :members, :enabled_modules,
26 26 :repositories, :issues, :issue_statuses, :changesets, :changes,
27 27 :issue_categories, :enumerations, :custom_fields, :custom_values, :trackers
28 28
29 29 # No '..' in the repository path for svn
30 30 REPOSITORY_PATH = RAILS_ROOT.gsub(%r{config\/\.\.}, '') + '/tmp/test/subversion_repository'
31 31
32 32 def setup
33 33 @controller = RepositoriesController.new
34 34 @request = ActionController::TestRequest.new
35 35 @response = ActionController::TestResponse.new
36 36 Setting.default_language = 'en'
37 37 User.current = nil
38 38 end
39 39
40 40 if File.directory?(REPOSITORY_PATH)
41 41 def test_show
42 42 get :show, :id => 1
43 43 assert_response :success
44 44 assert_template 'show'
45 45 assert_not_nil assigns(:entries)
46 46 assert_not_nil assigns(:changesets)
47 47 end
48 48
49 49 def test_browse_root
50 50 get :browse, :id => 1
51 51 assert_response :success
52 52 assert_template 'browse'
53 53 assert_not_nil assigns(:entries)
54 54 entry = assigns(:entries).detect {|e| e.name == 'subversion_test'}
55 55 assert_equal 'dir', entry.kind
56 56 end
57 57
58 58 def test_browse_directory
59 59 get :browse, :id => 1, :path => ['subversion_test']
60 60 assert_response :success
61 61 assert_template 'browse'
62 62 assert_not_nil assigns(:entries)
63 63 assert_equal ['folder', '.project', 'helloworld.c', 'textfile.txt'], assigns(:entries).collect(&:name)
64 64 entry = assigns(:entries).detect {|e| e.name == 'helloworld.c'}
65 65 assert_equal 'file', entry.kind
66 66 assert_equal 'subversion_test/helloworld.c', entry.path
67 assert_tag :a, :content => 'helloworld.c', :attributes => { :class => /text\-x\-c/ }
67 68 end
68 69
69 70 def test_browse_at_given_revision
70 71 get :browse, :id => 1, :path => ['subversion_test'], :rev => 4
71 72 assert_response :success
72 73 assert_template 'browse'
73 74 assert_not_nil assigns(:entries)
74 75 assert_equal ['folder', '.project', 'helloworld.c', 'helloworld.rb', 'textfile.txt'], assigns(:entries).collect(&:name)
75 76 end
76 77
77 78 def test_changes
78 79 get :changes, :id => 1, :path => ['subversion_test', 'folder', 'helloworld.rb' ]
79 80 assert_response :success
80 81 assert_template 'changes'
81 82 # svn properties displayed with svn >= 1.5 only
82 83 if Redmine::Scm::Adapters::SubversionAdapter.client_version_above?([1, 5, 0])
83 84 assert_not_nil assigns(:properties)
84 85 assert_equal 'native', assigns(:properties)['svn:eol-style']
85 86 assert_tag :ul,
86 87 :child => { :tag => 'li',
87 88 :child => { :tag => 'b', :content => 'svn:eol-style' },
88 89 :child => { :tag => 'span', :content => 'native' } }
89 90 end
90 91 end
91 92
92 93 def test_entry
93 94 get :entry, :id => 1, :path => ['subversion_test', 'helloworld.c']
94 95 assert_response :success
95 96 assert_template 'entry'
96 97 end
97 98
98 99 def test_entry_should_send_if_too_big
99 100 # no files in the test repo is larger than 1KB...
100 101 with_settings :file_max_size_displayed => 0 do
101 102 get :entry, :id => 1, :path => ['subversion_test', 'helloworld.c']
102 103 assert_response :success
103 104 assert_template ''
104 105 assert_equal 'attachment; filename="helloworld.c"', @response.headers['Content-Disposition']
105 106 end
106 107 end
107 108
108 109 def test_entry_at_given_revision
109 110 get :entry, :id => 1, :path => ['subversion_test', 'helloworld.rb'], :rev => 2
110 111 assert_response :success
111 112 assert_template 'entry'
112 113 # this line was removed in r3 and file was moved in r6
113 114 assert_tag :tag => 'td', :attributes => { :class => /line-code/},
114 115 :content => /Here's the code/
115 116 end
116 117
117 118 def test_entry_not_found
118 119 get :entry, :id => 1, :path => ['subversion_test', 'zzz.c']
119 120 assert_tag :tag => 'div', :attributes => { :class => /error/ },
120 121 :content => /The entry or revision was not found in the repository/
121 122 end
122 123
123 124 def test_entry_download
124 125 get :entry, :id => 1, :path => ['subversion_test', 'helloworld.c'], :format => 'raw'
125 126 assert_response :success
126 127 assert_template ''
127 128 assert_equal 'attachment; filename="helloworld.c"', @response.headers['Content-Disposition']
128 129 end
129 130
130 131 def test_directory_entry
131 132 get :entry, :id => 1, :path => ['subversion_test', 'folder']
132 133 assert_response :success
133 134 assert_template 'browse'
134 135 assert_not_nil assigns(:entry)
135 136 assert_equal 'folder', assigns(:entry).name
136 137 end
137 138
138 139 def test_revision
139 140 get :revision, :id => 1, :rev => 2
140 141 assert_response :success
141 142 assert_template 'revision'
142 143 assert_tag :tag => 'ul',
143 144 :child => { :tag => 'li',
144 145 # link to the entry at rev 2
145 146 :child => { :tag => 'a',
146 147 :attributes => {:href => '/projects/ecookbook/repository/revisions/2/entry/test/some/path/in/the/repo'},
147 148 :content => 'repo',
148 149 # link to partial diff
149 150 :sibling => { :tag => 'a',
150 151 :attributes => { :href => '/projects/ecookbook/repository/revisions/2/diff/test/some/path/in/the/repo' }
151 152 }
152 153 }
153 154 }
154 155 end
155 156
156 157 def test_revision_with_repository_pointing_to_a_subdirectory
157 158 r = Project.find(1).repository
158 159 # Changes repository url to a subdirectory
159 160 r.update_attribute :url, (r.url + '/test/some')
160 161
161 162 get :revision, :id => 1, :rev => 2
162 163 assert_response :success
163 164 assert_template 'revision'
164 165 assert_tag :tag => 'ul',
165 166 :child => { :tag => 'li',
166 167 # link to the entry at rev 2
167 168 :child => { :tag => 'a',
168 169 :attributes => {:href => '/projects/ecookbook/repository/revisions/2/entry/path/in/the/repo'},
169 170 :content => 'repo',
170 171 # link to partial diff
171 172 :sibling => { :tag => 'a',
172 173 :attributes => { :href => '/projects/ecookbook/repository/revisions/2/diff/path/in/the/repo' }
173 174 }
174 175 }
175 176 }
176 177 end
177 178
178 179 def test_diff
179 180 get :diff, :id => 1, :rev => 3
180 181 assert_response :success
181 182 assert_template 'diff'
182 183 end
183 184
184 185 def test_annotate
185 186 get :annotate, :id => 1, :path => ['subversion_test', 'helloworld.c']
186 187 assert_response :success
187 188 assert_template 'annotate'
188 189 end
189 190 else
190 191 puts "Subversion test repository NOT FOUND. Skipping functional tests !!!"
191 192 def test_fake; assert true end
192 193 end
193 194 end
1 NO CONTENT: file was removed, binary diff hidden
1 NO CONTENT: file was removed, binary diff hidden
General Comments 0
You need to be logged in to leave comments. Login now