diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2008-07-04 17:58:14 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2008-07-04 17:58:14 +0000 |
commit | 7cdd88a6ce3632c801223b33e5ccc2b9fc13651e (patch) | |
tree | a270478d7d7626ac9970d69e32cac6c6807e6cf4 /app | |
parent | 22558f77094dce4d489dac410abd7b74e48cdcb0 (diff) | |
download | redmine-7cdd88a6ce3632c801223b33e5ccc2b9fc13651e.tar.gz redmine-7cdd88a6ce3632c801223b33e5ccc2b9fc13651e.zip |
Merged Rails 2.1 compatibility branch.
git-svn-id: http://redmine.rubyforge.org/svn/trunk@1623 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app')
-rw-r--r-- | app/controllers/projects_controller.rb | 2 | ||||
-rw-r--r-- | app/helpers/repositories_helper.rb | 4 | ||||
-rw-r--r-- | app/models/user_preference.rb | 6 | ||||
-rw-r--r-- | app/views/repositories/_dir_list_content.rhtml | 4 | ||||
-rw-r--r-- | app/views/repositories/_navigation.rhtml | 4 | ||||
-rw-r--r-- | app/views/repositories/_revisions.rhtml | 2 | ||||
-rw-r--r-- | app/views/repositories/changes.rhtml | 6 | ||||
-rw-r--r-- | app/views/repositories/revision.rhtml | 2 |
8 files changed, 18 insertions, 12 deletions
diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index a37ae09a8..87a93c815 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -52,7 +52,7 @@ class ProjectsController < ApplicationController respond_to do |format| format.html { @project_tree = projects.group_by {|p| p.parent || p} - @project_tree.each_key {|p| @project_tree[p] -= [p]} + @project_tree.keys.each {|p| @project_tree[p] -= [p]} } format.atom { render_feed(projects.sort_by(&:created_on).reverse.slice(0, Setting.feeds_limit.to_i), diff --git a/app/helpers/repositories_helper.rb b/app/helpers/repositories_helper.rb index e94ae2e7f..4ef337c26 100644 --- a/app/helpers/repositories_helper.rb +++ b/app/helpers/repositories_helper.rb @@ -22,6 +22,10 @@ module RepositoriesHelper txt.to_s[0,8] end + def to_path_param(path) + path.to_s.split(%r{[/\\]}).select {|p| !p.blank?} + end + def to_utf8(str) return str if /\A[\r\n\t\x20-\x7e]*\Z/n.match(str) # for us-ascii @encodings ||= Setting.repositories_encodings.split(',').collect(&:strip) diff --git a/app/models/user_preference.rb b/app/models/user_preference.rb index 73e4a50c6..3daa7a740 100644 --- a/app/models/user_preference.rb +++ b/app/models/user_preference.rb @@ -42,8 +42,10 @@ class UserPreference < ActiveRecord::Base if attribute_present? attr_name super else - self.others ||= {} - self.others.store attr_name, value + h = read_attribute(:others).dup || {} + h.update(attr_name => value) + write_attribute(:others, h) + value end end diff --git a/app/views/repositories/_dir_list_content.rhtml b/app/views/repositories/_dir_list_content.rhtml index c30216533..20473a264 100644 --- a/app/views/repositories/_dir_list_content.rhtml +++ b/app/views/repositories/_dir_list_content.rhtml @@ -4,14 +4,14 @@ <tr id="<%= tr_id %>" class="<%= params[:parent_id] %> entry <%= entry.kind %>"> <td style="padding-left: <%=18 * depth%>px;" class="filename"> <% if entry.is_dir? %> -<span class="expander" onclick="<%= remote_function :url => {:action => 'browse', :id => @project, :path => entry.path, :rev => @rev, :depth => (depth + 1), :parent_id => tr_id}, +<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}, :update => { :success => tr_id }, :position => :after, :success => "scmEntryLoaded('#{tr_id}')", :condition => "scmEntryClick('#{tr_id}')"%>"> </span> <% end %> <%= link_to h(entry.name), - {:action => (entry.is_dir? ? 'browse' : 'changes'), :id => @project, :path => entry.path, :rev => @rev}, + {:action => (entry.is_dir? ? 'browse' : 'changes'), :id => @project, :path => to_path_param(entry.path), :rev => @rev}, :class => (entry.is_dir? ? 'icon icon-folder' : 'icon icon-file')%> </td> <td class="size"><%= (entry.size ? number_to_human_size(entry.size) : "?") unless entry.is_dir? %></td> diff --git a/app/views/repositories/_navigation.rhtml b/app/views/repositories/_navigation.rhtml index b7ac989bc..25a15f496 100644 --- a/app/views/repositories/_navigation.rhtml +++ b/app/views/repositories/_navigation.rhtml @@ -10,10 +10,10 @@ 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 %> + / <%= link_to h(dir), :action => 'browse', :id => @project, :path => to_path_param(link_path), :rev => @rev %> <% end %> <% if filename %> - / <%= link_to h(filename), :action => 'changes', :id => @project, :path => "#{link_path}/#{filename}", :rev => @rev %> + / <%= link_to h(filename), :action => 'changes', :id => @project, :path => to_path_param("#{link_path}/#{filename}"), :rev => @rev %> <% end %> <%= "@ #{revision}" if revision %> diff --git a/app/views/repositories/_revisions.rhtml b/app/views/repositories/_revisions.rhtml index 1bcf0208c..a938fecb8 100644 --- a/app/views/repositories/_revisions.rhtml +++ b/app/views/repositories/_revisions.rhtml @@ -1,4 +1,4 @@ -<% form_tag({:controller => 'repositories', :action => 'diff', :id => @project, :path => path}, :method => :get) do %> +<% form_tag({:controller => 'repositories', :action => 'diff', :id => @project, :path => to_path_param(path)}, :method => :get) do %> <table class="list changesets"> <thead><tr> <th>#</th> diff --git a/app/views/repositories/changes.rhtml b/app/views/repositories/changes.rhtml index 341c6cba5..85695ec45 100644 --- a/app/views/repositories/changes.rhtml +++ b/app/views/repositories/changes.rhtml @@ -4,12 +4,12 @@ <p> <% if @repository.supports_cat? %> - <%= link_to l(:button_view), {:action => 'entry', :id => @project, :path => @path, :rev => @rev } %> | + <%= link_to l(:button_view), {:action => 'entry', :id => @project, :path => to_path_param(@path), :rev => @rev } %> | <% end %> <% if @repository.supports_annotate? %> - <%= link_to l(:button_annotate), {:action => 'annotate', :id => @project, :path => @path, :rev => @rev } %> | + <%= link_to l(:button_annotate), {:action => 'annotate', :id => @project, :path => to_path_param(@path), :rev => @rev } %> | <% end %> -<%= link_to(l(:button_download), {:action => 'entry', :id => @project, :path => @path, :rev => @rev, :format => 'raw' }) if @repository.supports_cat? %> +<%= link_to(l(:button_download), {:action => 'entry', :id => @project, :path => to_path_param(@path), :rev => @rev, :format => 'raw' }) if @repository.supports_cat? %> <%= "(#{number_to_human_size(@entry.size)})" if @entry.size %> </p> diff --git a/app/views/repositories/revision.rhtml b/app/views/repositories/revision.rhtml index d0ff1de6d..04c0e2108 100644 --- a/app/views/repositories/revision.rhtml +++ b/app/views/repositories/revision.rhtml @@ -55,7 +55,7 @@ <%= "(#{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 => without_leading_slash(change.relative_path), :rev => @changeset.revision %> +<%= link_to l(:label_view_diff), :action => 'diff', :id => @project, :path => to_path_param(change.relative_path), :rev => @changeset.revision %> <% end %> </td> </tr> |