Browse Source

Merged r1473, r1476, r1477, r1478, r1481, r1482, r1484 to r1487, r1491 from trunk.

git-svn-id: http://redmine.rubyforge.org/svn/branches/0.7-stable@1528 e93f8b46-1217-0410-a6f0-8f06a7374b81
tags/0.7.2
Jean-Philippe Lang 16 years ago
parent
commit
15ecbbf928

+ 3
- 3
app/controllers/application.rb View File

@@ -61,11 +61,11 @@ class ApplicationController < ActionController::Base
def set_localization
User.current.language = nil unless User.current.logged?
lang = begin
if !User.current.language.blank? and GLoc.valid_languages.include? User.current.language.to_sym
if !User.current.language.blank? && GLoc.valid_language?(User.current.language)
User.current.language
elsif request.env['HTTP_ACCEPT_LANGUAGE']
accept_lang = parse_qvalues(request.env['HTTP_ACCEPT_LANGUAGE']).first.split('-').first
if accept_lang and !accept_lang.empty? and GLoc.valid_languages.include? accept_lang.to_sym
accept_lang = parse_qvalues(request.env['HTTP_ACCEPT_LANGUAGE']).first.downcase
if !accept_lang.blank? && (GLoc.valid_language?(accept_lang) || GLoc.valid_language?(accept_lang = accept_lang.split('-').first))
User.current.language = accept_lang
end
end

+ 1
- 1
app/controllers/issues_controller.rb View File

@@ -149,7 +149,7 @@ class IssuesController < ApplicationController
attach_files(@issue, params[:attachments])
flash[:notice] = l(:notice_successful_create)
Mailer.deliver_issue_add(@issue) if Setting.notified_events.include?('issue_added')
redirect_to :controller => 'issues', :action => 'show', :id => @issue, :project_id => @project
redirect_to :controller => 'issues', :action => 'show', :id => @issue
return
end
end

+ 9
- 2
app/helpers/application_helper.rb View File

@@ -90,6 +90,11 @@ module ApplicationHelper
include_date ? local.strftime("#{@date_format} #{@time_format}") : local.strftime(@time_format)
end
# Truncates and returns the string as a single line
def truncate_single_line(string, *args)
truncate(string, *args).gsub(%r{[\r\n]+}m, ' ')
end
def html_hours(text)
text.gsub(%r{(\d+)\.(\d+)}, '<span class="hours hours-int">\1</span><span class="hours hours-dec">.\2</span>')
end
@@ -301,7 +306,7 @@ module ApplicationHelper
if project && (changeset = project.changesets.find_by_revision(oid))
link = link_to("r#{oid}", {:only_path => only_path, :controller => 'repositories', :action => 'revision', :id => project, :rev => oid},
:class => 'changeset',
:title => truncate(changeset.comments, 100))
:title => truncate_single_line(changeset.comments, 100))
end
elsif sep == '#'
oid = oid.to_i
@@ -340,7 +345,9 @@ module ApplicationHelper
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(changeset.comments, 100)
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)
end
when 'source', 'export'
if project && project.repository

+ 4
- 0
app/helpers/projects_helper.rb View File

@@ -21,6 +21,10 @@ module ProjectsHelper
link_to h(version.name), { :controller => 'versions', :action => 'show', :id => version }, options
end
def format_activity_title(text)
h(truncate_single_line(text, 100))
end
def format_activity_day(date)
date == Date.today ? l(:label_today).titleize : format_date(date)
end

+ 2
- 1
app/models/project.rb View File

@@ -144,7 +144,8 @@ class Project < ActiveRecord::Base
end
def to_param
identifier
# id is used for projects with a numeric identifier (compatibility)
@to_param ||= (identifier.to_s =~ %r{^\d*$} ? id : identifier)
end
def active?

+ 3
- 3
app/views/common/feed.atom.rxml View File

@@ -1,6 +1,6 @@
xml.instruct!
xml.feed "xmlns" => "http://www.w3.org/2005/Atom" do
xml.title @title
xml.title truncate_single_line(@title, 100)
xml.link "rel" => "self", "href" => url_for(params.merge({:format => nil, :only_path => false}))
xml.link "rel" => "alternate", "href" => url_for(:controller => 'welcome', :only_path => false)
xml.id url_for(:controller => 'welcome', :only_path => false)
@@ -10,11 +10,11 @@ xml.feed "xmlns" => "http://www.w3.org/2005/Atom" do
@items.each do |item|
xml.entry do
url = url_for(item.event_url(:only_path => false))
xml.title truncate(item.event_title, 100)
xml.title truncate_single_line(item.event_title, 100)
xml.link "rel" => "alternate", "href" => url
xml.id url
xml.updated item.event_datetime.xmlschema
author = item.event_author if item.respond_to?(:author)
author = item.event_author if item.respond_to?(:event_author)
xml.author do
xml.name(author)
xml.email(author.mail) if author.respond_to?(:mail) && !author.mail.blank?

+ 2
- 1
app/views/projects/activity.rhtml View File

@@ -7,7 +7,8 @@
<dl>
<% @events_by_day[day].sort {|x,y| y.event_datetime <=> x.event_datetime }.each do |e| -%>
<dt class="<%= e.event_type %>"><span class="time"><%= format_time(e.event_datetime, false) %></span>
<%= content_tag('span', h(e.project), :class => 'project') if @project.nil? || @project != e.project %> <%= link_to h(truncate(e.event_title, 100)), e.event_url %></dt>
<%= content_tag('span', h(e.project), :class => 'project') if @project.nil? || @project != e.project %>
<%= link_to format_activity_title(e.event_title), e.event_url %></dt>
<dd><% unless e.event_description.blank? -%>
<span class="description"><%= format_activity_description(e.event_description) %></span><br />
<% end %>

+ 69
- 73
app/views/repositories/diff.rhtml View File

@@ -11,82 +11,78 @@
<%= select_tag 'type', options_for_select([[l(:label_diff_inline), "inline"], [l(:label_diff_side_by_side), "sbs"]], @diff_type), :onchange => "if (this.value != '') {this.form.submit()}" %></p>
<% end %>

<% cache(@cache_key) do %>
<% @diff.each do |table_file| %>
<% cache(@cache_key) do -%>
<% @diff.each do |table_file| -%>
<div class="autoscroll">
<% if @diff_type == 'sbs' %>
<table class="filecontent CodeRay">
<thead>
<tr>
<th colspan="4" class="filename">
<%= table_file.file_name %>
</th>
</tr>
<tr>
<th colspan="2">@<%= format_revision @rev %></th>
<th colspan="2">@<%= format_revision @rev_to %></th>
</tr>
</thead>
<tbody>
<% table_file.keys.sort.each do |key| %>
<tr>
<th class="line-num">
<%= table_file[key].nb_line_left %>
</th>
<td class="line-code <%= table_file[key].type_diff_left %>">
<pre><%=to_utf8 table_file[key].line_left %></pre>
</td>
<th class="line-num">
<%= table_file[key].nb_line_right %>
</th>
<td class="line-code <%= table_file[key].type_diff_right %>">
<pre><%=to_utf8 table_file[key].line_right %></pre>
</td>
</tr>
<% end %>
</tbody>
</table>
<% if @diff_type == 'sbs' -%>
<table class="filecontent CodeRay">
<thead>
<tr><th colspan="4" class="filename"><%= table_file.file_name %></th></tr>
<tr>
<th colspan="2">@<%= format_revision @rev %></th>
<th colspan="2">@<%= format_revision @rev_to %></th>
</tr>
</thead>
<tbody>
<% prev_line_left, prev_line_right = nil, nil -%>
<% table_file.keys.sort.each do |key| -%>
<% if prev_line_left && prev_line_right && (table_file[key].nb_line_left != prev_line_left+1) && (table_file[key].nb_line_right != prev_line_right+1) -%>
<tr class="spacing"><td colspan="4"></td></tr>
<% end -%>
<tr>
<th class="line-num"><%= table_file[key].nb_line_left %></th>
<td class="line-code <%= table_file[key].type_diff_left %>">
<pre><%=to_utf8 table_file[key].line_left %></pre>
</td>
<th class="line-num"><%= table_file[key].nb_line_right %></th>
<td class="line-code <%= table_file[key].type_diff_right %>">
<pre><%=to_utf8 table_file[key].line_right %></pre>
</td>
</tr>
<% prev_line_left, prev_line_right = table_file[key].nb_line_left.to_i, table_file[key].nb_line_right.to_i -%>
<% end -%>
</tbody>
</table>

<% else -%>
<table class="filecontent CodeRay">
<thead>
<tr><th colspan="3" class="filename"><%= table_file.file_name %></th></tr>
<tr>
<th>@<%= format_revision @rev %></th>
<th>@<%= format_revision @rev_to %></th>
<th></th>
</tr>
</thead>
<tbody>
<% prev_line_left, prev_line_right = nil, nil -%>
<% table_file.keys.sort.each do |key, line| %>
<% if prev_line_left && prev_line_right && (table_file[key].nb_line_left != prev_line_left+1) && (table_file[key].nb_line_right != prev_line_right+1) -%>
<tr class="spacing"><td colspan="3"></td></tr>
<% end -%>
<tr>
<th class="line-num"><%= table_file[key].nb_line_left %></th>
<th class="line-num"><%= table_file[key].nb_line_right %></th>
<% if table_file[key].line_left.empty? -%>
<td class="line-code <%= table_file[key].type_diff_right %>">
<pre><%=to_utf8 table_file[key].line_right %></pre>
</td>
<% else -%>
<td class="line-code <%= table_file[key].type_diff_left %>">
<pre><%=to_utf8 table_file[key].line_left %></pre>
</td>
<% end -%>
</tr>
<% prev_line_left = table_file[key].nb_line_left.to_i if table_file[key].nb_line_left.to_i > 0 -%>
<% prev_line_right = table_file[key].nb_line_right.to_i if table_file[key].nb_line_right.to_i > 0 -%>
<% end -%>
</tbody>
</table>
<% end -%>

<% else %>
<table class="filecontent CodeRay">
<thead>
<tr>
<th colspan="3" class="filename">
<%= table_file.file_name %>
</th>
</tr>
<tr>
<th>@<%= format_revision @rev %></th>
<th>@<%= format_revision @rev_to %></th>
<th></th>
</tr>
</thead>
<tbody>
<% table_file.keys.sort.each do |key, line| %>
<tr>
<th class="line-num">
<%= table_file[key].nb_line_left %>
</th>
<th class="line-num">
<%= table_file[key].nb_line_right %>
</th>
<% if table_file[key].line_left.empty? %>
<td class="line-code <%= table_file[key].type_diff_right %>">
<pre><%=to_utf8 table_file[key].line_right %></pre>
</td>
<% else %>
<td class="line-code <%= table_file[key].type_diff_left %>">
<pre><%=to_utf8 table_file[key].line_left %></pre>
</td>
<% end %>
</tr>
<% end %>
</tbody>
</table>
<% end %>
</div>
<% end %>
<% end %>
<% end -%>
<% end -%>

<% html_title(with_leading_slash(@path), 'Diff') -%>


+ 0
- 1
lib/redmine/scm/adapters/abstract_adapter.rb View File

@@ -279,7 +279,6 @@ module Redmine
end
else
if line =~ /^[^\+\-\s@\\]/
self.delete(self.keys.sort.last)
@parsing = false
return false
elsif line =~ /^@@ (\+|\-)(\d+)(,\d+)? (\+|\-)(\d+)(,\d+)? @@/

+ 6
- 0
lib/tasks/migrate_from_trac.rake View File

@@ -126,6 +126,10 @@ namespace :redmine do
File.open("#{trac_fullpath}", 'rb').read
end
def description
read_attribute(:description).to_s.slice(0,255)
end
private
def trac_fullpath
attachment_type = read_attribute(:type)
@@ -408,6 +412,7 @@ namespace :redmine do
a.file = attachment
a.author = find_or_create_user(attachment.author)
a.container = i
a.description = attachment.description
migrated_ticket_attachments += 1 if a.save
end
@@ -456,6 +461,7 @@ namespace :redmine do
a = Attachment.new :created_on => attachment.time
a.file = attachment
a.author = find_or_create_user(attachment.author)
a.description = attachment.description
a.container = p
migrated_wiki_attachments += 1 if a.save
end

+ 1
- 1
public/javascripts/calendar/lang/calendar-he.js View File

@@ -113,7 +113,7 @@ Calendar._TT["DAY_FIRST"] = "הצג %s קודם";
// This may be locale-dependent. It specifies the week-end days, as an array
// of comma-separated numbers. The numbers are from 0 to 6: 0 means Sunday, 1
// means Monday, etc.
Calendar._TT["WEEKEND"] = "6,7";
Calendar._TT["WEEKEND"] = "5,6";

Calendar._TT["CLOSE"] = "סגור";
Calendar._TT["TODAY"] = "היום";

+ 1
- 1
public/stylesheets/scm.css View File

@@ -2,7 +2,7 @@
table.filecontent { border: 1px solid #ccc; border-collapse: collapse; width:98%; }
table.filecontent th { border: 1px solid #ccc; background-color: #eee; }
table.filecontent th.filename { background-color: #ddc; text-align: left; }
table.filecontent tr.spacing { border: 1px solid #d7d7d7; }
table.filecontent tr.spacing td { border: 1px solid #d7d7d7; height: 0.4em; }
table.filecontent th.line-num {
border: 1px solid #d7d7d7;
font-size: 0.8em;

+ 14
- 0
test/functional/welcome_controller_test.rb View File

@@ -46,4 +46,18 @@ class WelcomeControllerTest < Test::Unit::TestCase
get :index
assert_equal :fr, @controller.current_language
end
def test_browser_language_alternate
Setting.default_language = 'en'
@request.env['HTTP_ACCEPT_LANGUAGE'] = 'zh-TW'
get :index
assert_equal :"zh-tw", @controller.current_language
end
def test_browser_language_alternate_not_valid
Setting.default_language = 'en'
@request.env['HTTP_ACCEPT_LANGUAGE'] = 'fr-CA'
get :index
assert_equal :fr, @controller.current_language
end
end

+ 1
- 1
vendor/plugins/coderay-0.7.6.227/lib/coderay/scanners/c.rb View File

@@ -122,7 +122,7 @@ module Scanners
end

when :include_expected
if scan(/<[^>\n]+>?|"[^"\n\\]*(?:\\.[^"\n\\]*)*"?/)
if scan(/[^\n]+/)
kind = :include
state = :initial


Loading…
Cancel
Save