changeset 1519:afce8026aaeb redmine-2.4-integration

Merge from branch "live"
author Chris Cannam
date Tue, 09 Sep 2014 09:34:53 +0100
parents 2e8063097240 (current diff) d98d22a98252 (diff)
children a1bdbf8a87d5
files Gemfile app/controllers/projects_controller.rb app/helpers/activities_helper.rb app/helpers/projects_helper.rb app/models/project.rb app/views/projects/show.html.erb config/locales/en.yml plugins/redmine_bibliography/app/views/projects/show.html.erb plugins/redmine_tags/lib/redmine_tags/patches/projects_controller_patch.rb
diffstat 15 files changed, 67 insertions(+), 55 deletions(-) [+]
line wrap: on
line diff
--- a/Gemfile	Tue Sep 09 09:32:11 2014 +0100
+++ b/Gemfile	Tue Sep 09 09:34:53 2014 +0100
@@ -7,6 +7,10 @@
 gem "fastercsv", "~> 1.5.0", :platforms => [:mri_18, :mingw_18, :jruby]
 gem "builder", "3.0.0"
 
+#cc -- CiteProc v1.0.0 broke our citations (CiteProc.process returns nil).
+# Until I've managed to work out what's up and fix that...
+gem "citeproc", "0.0.6"
+
 # Optional gem for LDAP authentication
 group :ldap do
   gem "net-ldap", "~> 0.3.1"
--- a/app/controllers/projects_controller.rb	Tue Sep 09 09:32:11 2014 +0100
+++ b/app/controllers/projects_controller.rb	Tue Sep 09 09:34:53 2014 +0100
@@ -59,7 +59,7 @@
         @project_pages = Paginator.new self, @project_count, @limit, params['page']
         @offset ||= @project_pages.current.offset
         @projects = Project.visible_roots.all(:offset => @offset, :limit => @limit, :order => sort_clause)
-        render :template => 'projects/index.html.erb', :layout => !request.xhr?
+        render :template => 'projects/index', :layout => !request.xhr?
 
 ## Redmine 2.2:
 #        scope = Project
@@ -85,7 +85,7 @@
     respond_to do |format|
       format.html {
         @projects = Project.visible
-        render :template => 'projects/explore.html.erb', :layout => !request.xhr?
+        render :template => 'projects/explore', :layout => !request.xhr?
       }
     end
   end
--- a/app/helpers/activities_helper.rb	Tue Sep 09 09:32:11 2014 +0100
+++ b/app/helpers/activities_helper.rb	Tue Sep 09 09:34:53 2014 +0100
@@ -168,7 +168,7 @@
       e.event_author unless !e.respond_to?(:event_author) 
     end.compact
     institutions = authors.map do |a|
-      if a.respond_to?(:ssamr_user_detail) and !a.ssamr_user_detail.nil?
+      if a.respond_to?(:ssamr_user_detail) and !a.ssamr_user_detail.nil? and a.ssamr_user_detail.institution_name != "none"
         a.ssamr_user_detail.institution_name
       end
     end
--- a/app/helpers/projects_helper.rb	Tue Sep 09 09:32:11 2014 +0100
+++ b/app/helpers/projects_helper.rb	Tue Sep 09 09:34:53 2014 +0100
@@ -279,7 +279,7 @@
       Math.log(1 + nr_downloadables) +
       Math.log(1 + nr_downloads) +
       Math.sqrt(nr_members > 1 ? (nr_members - 1) : 0) +
-      Math.sqrt(nr_publications)
+      Math.sqrt(nr_publications * 2)
   end
 
   def all_maturity_scores()
@@ -291,6 +291,15 @@
     phash
   end
 
+  def top_level_maturity_scores()
+    phash = Hash.new
+    pp = Project.visible_roots(User.anonymous)
+    pp.each do |p| 
+      phash[p] = score_maturity p
+    end
+    phash
+  end
+
   def mature_projects(count)
     phash = all_maturity_scores
     scores = phash.values.sort
@@ -298,4 +307,29 @@
     if threshold == 0 then threshold = 1 end
     phash.keys.select { |k| phash[k] > threshold }.sample(count)
   end
+
+  def varied_mature_projects(count)
+    phash = top_level_maturity_scores
+    scores = phash.values.sort
+    threshold = scores[scores.length / 2]
+    if threshold == 0 then threshold = 1 end
+    mhash = Hash.new
+    phash.keys.shuffle.select do |k|
+      if phash[k] < threshold or k.description == "" then
+        false
+      else
+        u = k.users_by_role
+        mgrs = []
+        u.keys.each do |r|
+          if r.allowed_to?(:edit_project)
+            u[r].each { |m| mgrs << m }
+          end
+        end
+        novel = (mhash.keys & mgrs).empty?
+        mgrs.each { |m| mhash[m] = 1 }
+        novel and not mgrs.empty?
+      end
+    end.sample(count)
+  end
+
 end
--- a/app/models/project.rb	Tue Sep 09 09:32:11 2014 +0100
+++ b/app/models/project.rb	Tue Sep 09 09:34:53 2014 +0100
@@ -163,8 +163,8 @@
     allowed_to_condition(user, :view_project, options)
   end
 
-  def self.root_visible_by(user=nil)
-    return "#{Project.table_name}.parent_id IS NULL AND " + visible_condition(user)
+  def self.root_visible_by(user, options={})
+    return "#{Project.table_name}.parent_id IS NULL AND " + visible_condition(user, options)
   end
   
   # Returns a SQL conditions string used to find all projects for which +user+ has the given +permission+
--- a/app/views/activities/_busy.html.erb	Tue Sep 09 09:32:11 2014 +0100
+++ b/app/views/activities/_busy.html.erb	Tue Sep 09 09:34:53 2014 +0100
@@ -13,7 +13,7 @@
    <ul>
 
    <% 
-      for project in busy_projects(events, 7)
+      for project in busy_projects(events, 5)
    %>
 
    <li class="busy">
--- a/app/views/projects/_mature.html.erb	Tue Sep 09 09:32:11 2014 +0100
+++ b/app/views/projects/_mature.html.erb	Tue Sep 09 09:34:53 2014 +0100
@@ -2,7 +2,7 @@
    <ul>
 
    <% 
-      for project in mature_projects(5)
+      for project in varied_mature_projects(7)
    %>
 
    <li class="busy">
--- a/app/views/projects/explore.html.erb	Tue Sep 09 09:32:11 2014 +0100
+++ b/app/views/projects/explore.html.erb	Tue Sep 09 09:34:53 2014 +0100
@@ -37,7 +37,7 @@
   <% end %>
 </div>
 
-<div class="threecolumnmid">
+<div class="threecolumnright">
   <% cache(:action => 'explore', :action_suffix => 'busy_projects') do %>
   <div class="projects box">
   <h3><%=l(:label_projects_busy)%></h3>
@@ -47,4 +47,14 @@
   <% end %>
 </div>
 
+<div class="threecolumnmid">
+  <% cache(:action => 'explore', :action_suffix => 'mature_projects') do %>
+  <div class="projects box">
+  <h3><%=l(:label_projects_mature)%></h3>
+    <%= render :partial => 'projects/mature' %>
+    <%= link_to l(:label_projects_more), { :controller => 'projects' }, :class => 'more' %>
+  </div>
+  <% end %>
+</div>
+
 <% html_title(l(:label_explore_projects)) -%>
--- a/app/views/projects/show.html.erb	Tue Sep 09 09:32:11 2014 +0100
+++ b/app/views/projects/show.html.erb	Tue Sep 09 09:34:53 2014 +0100
@@ -131,4 +131,4 @@
 <%= auto_discovery_link_tag(:atom, {:controller => 'activities', :action => 'index', :id => @project, :format => 'atom', :key => User.current.rss_key}) %>
 <% end %>
 
-<% html_title(l(:label_overview)) -%>
+<% html_title('') -%>
--- a/config/locales/en.yml	Tue Sep 09 09:32:11 2014 +0100
+++ b/config/locales/en.yml	Tue Sep 09 09:34:53 2014 +0100
@@ -537,7 +537,7 @@
   label_projects_more: More projects
   label_project_tags_all: Popular tags
   label_projects_busy: Busy projects
-  label_projects_mature: Mature projects
+  label_projects_mature: Featured
   label_search_projects: Search projects
   label_institutions_busy: Active institutions
   label_managers: Managed by
--- a/plugins/redmine_bibliography/app/helpers/publications_helper.rb	Tue Sep 09 09:32:11 2014 +0100
+++ b/plugins/redmine_bibliography/app/helpers/publications_helper.rb	Tue Sep 09 09:34:53 2014 +0100
@@ -96,7 +96,10 @@
 
   def print_ieee_format(publication)
     Rails.cache.fetch("publication-#{publication.id}-ieee") do
-      publication.print_entry(:ieee).html_safe
+      entry = publication.print_entry(:ieee)
+      if entry
+        entry.html_safe
+      end
     end
   end
 
--- a/plugins/redmine_bibliography/app/views/projects/show.html.erb	Tue Sep 09 09:32:11 2014 +0100
+++ b/plugins/redmine_bibliography/app/views/projects/show.html.erb	Tue Sep 09 09:34:53 2014 +0100
@@ -137,4 +137,4 @@
 <%= auto_discovery_link_tag(:atom, {:controller => 'activities', :action => 'index', :id => @project, :format => 'atom', :key => User.current.rss_key}) %>
 <% end %>
 
-<% html_title(l(:label_overview)) -%>
+<% html_title('') -%>
--- a/plugins/redmine_bibliography/lib/bibliography/mailer_patch.rb	Tue Sep 09 09:32:11 2014 +0100
+++ b/plugins/redmine_bibliography/lib/bibliography/mailer_patch.rb	Tue Sep 09 09:34:53 2014 +0100
@@ -18,7 +18,7 @@
           set_language_if_valid user.language
 
           mail :to => user.mail,
-          :subject => l(:mail_subject_register, Setting.app_title)
+          :subject => l(:mail_subject_publication_added, Setting.app_title)
 
           @publication_url = url_for( :controller => 'publications', :action => 'show', :id => publication.id )
           @publication_title = publication.title
--- a/plugins/redmine_checkout/config/locales/en-GB.yml	Tue Sep 09 09:32:11 2014 +0100
+++ b/plugins/redmine_checkout/config/locales/en-GB.yml	Tue Sep 09 09:34:53 2014 +0100
@@ -1,41 +1,2 @@
 en-GB:
-  label_checkout: "Checkout"
-
-  setting_checkout_display_checkout_info: "Display checkout information"
-  setting_checkout_fixed_url: "Checkout URL"
-  setting_checkout_url_regex: "Regular expression"
-  setting_checkout_url_regex_replacement: "Replacement text"
-  setting_checkout_display_login: "Display Login"
-  setting_checkout_command: "Checkout command"
-  setting_checkout_use_zero_clipboard: "Display clipboard helper"
-
-  setting_checkout_overwrite_description: "Overwrite default description"
-  field_checkout_overwrite: "Overwrite default settings for checkout protocols"
-  field_checkout_display_command: "Display checkout command"
-
-  label_protocol_plural: "Protocols"
-  button_add_protocol: "Add Protocol"
-
-  label_access_type: 'You have <span id="checkout_access">{{type}}</span> access to this URL.'
-  label_access_read_only: 'Read Only'
-  label_access_read_write: "Read and Write"
-  label_access_permission: "Depending on user's permissions"
-
-  label_append_path: "Append path"
-
-  label_display_login_none: "Do not show login or password"
-  label_display_login_username: "Show login but no password"
-  label_display_login_password: "Show login and password"
-
-  label_copy_to_clipboard: "Copy to clipboard"
-
-  help_checkout_protocols: |
-    The URLs in protocols are generated from applying the regular expression
-    and the replacement text to the original URL. The replacement text
-    supports back-references to braced expressions using the \1 notation.
-  help_repository_checkout_protocols: |
-    Leave the Checkout URL field empty to use the defined repository URL.
-  help_moved_settings: "The settings page has been moved to {{link}}."
-  label_settings_location: "Administration -> Settings -> Checkout"
-
-  text_repository_external: "The primary repository for this project is hosted at <code>{{location}}</code> .<br>This repository is a read-only copy which is updated automatically."
+  dummy_translation_key: Dummy translation value
--- a/plugins/redmine_tags/lib/redmine_tags/patches/projects_controller_patch.rb	Tue Sep 09 09:32:11 2014 +0100
+++ b/plugins/redmine_tags/lib/redmine_tags/patches/projects_controller_patch.rb	Tue Sep 09 09:34:53 2014 +0100
@@ -47,7 +47,7 @@
               # todo: check ordering ~luisf.14/Jan/2013
               @projects = @projects[@offset, @limit]
 
-              render :template => 'projects/index.html.erb', :layout => !request.xhr?
+              render :template => 'projects/index', :layout => !request.xhr?
             }
             format.api {
               @offset, @limit = api_offset_and_limit