changeset 1166:eb0175fc12ba cannam

Merge from branch "issue_540"
author Chris Cannam <chris.cannam@soundsoftware.ac.uk>
date Mon, 21 Jan 2013 14:17:46 +0000
parents 6a10e5fbf8b2 (diff) a9311b2d850f (current diff)
children 54a92921cf09
files
diffstat 11 files changed, 46 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
--- a/app/controllers/my_controller.rb	Fri Nov 23 17:53:51 2012 +0000
+++ b/app/controllers/my_controller.rb	Mon Jan 21 14:17:46 2013 +0000
@@ -21,6 +21,7 @@
   helper :issues
   helper :users
   helper :custom_fields
+  helper :projects
 
   BLOCKS = { 'issuesassignedtome' => :label_assigned_to_me_issues,
              'issuesreportedbyme' => :label_reported_issues,
@@ -30,11 +31,12 @@
              'tipoftheday' => :label_tipoftheday,
              'calendar' => :label_calendar,
              'documents' => :label_document_plural,
-             'timelog' => :label_spent_time
+             'timelog' => :label_spent_time,
+             'myprojects' => :label_my_projects
            }.merge(Redmine::Views::MyPage::Block.additional_blocks).freeze
 
-  DEFAULT_LAYOUT = {  'left' => ['tipoftheday', 'activitymyprojects'], 
-                      'right' => ['issueswatched'] 
+  DEFAULT_LAYOUT = {  'left' => ['myprojects', 'activitymyprojects'], 
+                      'right' => ['tipoftheday', 'issueswatched'] 
                    }.freeze
 
   verify :xhr => true,
--- a/app/controllers/repositories_controller.rb	Fri Nov 23 17:53:51 2012 +0000
+++ b/app/controllers/repositories_controller.rb	Mon Jan 21 14:17:46 2013 +0000
@@ -143,15 +143,14 @@
 
     @content = @repository.cat(@path, @rev)
     (show_error_not_found; return) unless @content
-    if 'raw' == params[:format] ||
-         (@content.size && @content.size > Setting.file_max_size_displayed.to_i.kilobyte) ||
-         ! is_entry_text_data?(@content, @path)
+    if 'raw' == params[:format]
       # Force the download
       send_opt = { :filename => filename_for_content_disposition(@path.split('/').last) }
       send_type = Redmine::MimeType.of(@path)
       send_opt[:type] = send_type.to_s if send_type
       send_data @content, send_opt
     else
+      @display_raw = ((@content.size && @content.size > Setting.file_max_size_displayed.to_i.kilobyte) || !is_entry_text_data?(@content, @path))
       # Prevent empty lines when displaying a file with Windows style eol
       # TODO: UTF-16
       # Is this needs? AttachmentsController reads file simply.
--- a/app/views/activities/_busy.html.erb	Fri Nov 23 17:53:51 2012 +0000
+++ b/app/views/activities/_busy.html.erb	Mon Jan 21 14:17:46 2013 +0000
@@ -1,7 +1,7 @@
 <% events = @events_by_day %>
 <% if (events.nil?) 
      activity = Redmine::Activity::Fetcher.new(User.anonymous)
-     events = activity.events(Date.today - 14, Date.today + 1)
+     events = activity.events(Date.today - 140, Date.today + 1)
    end
 %>
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/app/views/my/blocks/_myprojects.html.erb	Mon Jan 21 14:17:46 2013 +0000
@@ -0,0 +1,16 @@
+<%  @user_projects = User.current.projects.all(:order => :name) %>
+
+<% if @user_projects.empty? %>
+<h3><%=l(:label_my_projects)%></h3>
+<div class="box">
+  <p><%= l(:label_have_no_projects)%> <%= link_to(l(:label_project_new), {:controller => 'projects', :action => 'new'}) if User.current.allowed_to?(:add_project, nil, :global => true) %></p>
+</div>
+<% else %>
+<h3><%=l(:label_my_projects)%> (<%= @user_projects.count %>)</h3>
+<div class="box">
+<%=
+   render :partial => 'projects/my', :locals => { :user => User.current }
+ %>
+</div>
+<% end %>
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/app/views/projects/_my.html.erb	Mon Jan 21 14:17:46 2013 +0000
@@ -0,0 +1,1 @@
+<%= render_my_project_hierarchy(@user_projects) %>
--- a/app/views/repositories/_dir_list_content.html.erb	Fri Nov 23 17:53:51 2012 +0000
+++ b/app/views/repositories/_dir_list_content.html.erb	Mon Jan 21 14:17:46 2013 +0000
@@ -24,7 +24,7 @@
                 ) %>">&nbsp</span>
 <% end %>
 <%=  link_to h(ent_name),
-          {:action => (entry.is_dir? ? 'show' : 'changes'), :id => @project, :path => to_path_param(ent_path), :rev => @rev},
+          {:action => (entry.is_dir? ? 'show' : 'entry'), :id => @project, :path => to_path_param(ent_path), :rev => @rev},
           :class => (entry.is_dir? ? 'icon icon-folder' : "icon icon-file #{Redmine::MimeType.css_class_of(ent_name)}")%>
 </td>
 <td class="size"><%= (entry.size ? number_to_human_size(entry.size) : "?") unless entry.is_dir? %></td>
--- a/app/views/repositories/entry.html.erb	Fri Nov 23 17:53:51 2012 +0000
+++ b/app/views/repositories/entry.html.erb	Mon Jan 21 14:17:46 2013 +0000
@@ -8,7 +8,15 @@
 
 <p><%= render :partial => 'link_to_functions' %></p>
 
-<%= render :partial => 'common/file', :locals => {:filename => @path, :content => @content} %>
+<% if @display_raw %>
+   <% if @content.size && @content.size > Setting.file_max_size_displayed.to_i.kilobyte %>
+     <em><%= l(:text_data_too_large) %></em>
+   <% else %>
+     <em><%= l(:text_binary_data) %></em>
+   <% end %>
+<% else %>
+  <%= render :partial => 'common/file', :locals => {:filename => @path, :content => @content} %>
+<% end %>
 
 <% content_for :header_tags do %>
 <%= stylesheet_link_tag "scm" %>
--- a/config/environment.rb	Fri Nov 23 17:53:51 2012 +0000
+++ b/config/environment.rb	Mon Jan 21 14:17:46 2013 +0000
@@ -36,7 +36,10 @@
 
   # Enable page/fragment caching by setting a file-based store
   # (remember to create the caching directory and make it readable to the application)
-  # config.action_controller.cache_store = :file_store, "#{RAILS_ROOT}/tmp/cache"
+  config.action_controller.cache_store = :file_store, "#{RAILS_ROOT}/tmp/cache"
+
+  # And for direct uses of the cache
+  config.cache_store = :file_store, "#{RAILS_ROOT}/tmp/cache"
 
   # Activate observers that should always be running
   # config.active_record.observers = :cacher, :garbage_collector
--- a/config/locales/en.yml	Fri Nov 23 17:53:51 2012 +0000
+++ b/config/locales/en.yml	Mon Jan 21 14:17:46 2013 +0000
@@ -485,6 +485,7 @@
   label_project_plural: Projects
   label_my_project_plural: My Projects
   label_other_project_plural: Other Projects
+  label_have_no_projects: Not a member of any projects.
   label_x_projects:
     zero:  no projects
     one:   1 project
@@ -1032,7 +1033,8 @@
   text_settings_repo_need_help: Please <a href="/projects/soundsoftware-site/wiki/Help">contact us</a> if you need help deciding how best to set this up.<br>We can also import complete revision history from other systems into a new primary repository for you if you wish.
   text_has_welcome_page_info: <b>Welcome page</b><p>You can replace the standard {{overview_link}} page for this project with your own welcome page.<br>This page will be editable using the project Wiki.
   text_has_welcome_page_wiki_disabled: <b>Note:</b> You must enable the Wiki module in the {{modules_link}} tab before you can create or edit this page.
-
+  text_binary_data: Binary data
+  text_data_too_large: Binary data, or file too large to display
 
   default_role_manager: Manager
   default_role_developer: Developer
--- a/public/stylesheets/application.css	Fri Nov 23 17:53:51 2012 +0000
+++ b/public/stylesheets/application.css	Mon Jan 21 14:17:46 2013 +0000
@@ -414,10 +414,10 @@
 
 ul.projects { margin: 0; padding-left: 1em; }
 ul.projects.root { margin: 0;  padding: 0; }
-ul.projects ul.projects { border-left: 3px solid #e0e0e0; }
+/*ul.projects ul.projects { border-left: 3px solid #e0e0e0; } */
 ul.projects li.root { list-style-type:none; margin-bottom: 1em; }
-ul.projects li.child { list-style-type:none; margin-top: 1em;}
-ul.projects div.root a.project { font-weight: bold; font-size: 16px; margin: 0 0 10px 0; }
+ul.projects li.child { list-style-type:none; }
+ul.projects div.root a.project { font-weight: bold; }
 
 li.latest { margin-bottom: 0.5em; }
 
--- a/public/themes/soundsoftware/stylesheets/application.css	Fri Nov 23 17:53:51 2012 +0000
+++ b/public/themes/soundsoftware/stylesheets/application.css	Mon Jan 21 14:17:46 2013 +0000
@@ -96,7 +96,7 @@
 table.projects .level2 .firstcol { padding-left: 2em; }
 table.projects .level3 .firstcol { padding-left: 3em; }
 
-ul.projects .public, ul.projects .private { padding-left: 0.5em; color: #3e442c; font-size: 0.95em }
+ul.projects .public, ul.projects .private { padding-left: 0.5em; color: #3e442c; font-size: 0.9em }
 
 table.files tr.active td { padding-top: 0.5em; padding-bottom: 0.5em; }
 table.files .file .active { font-weight: bold; }