Skip to content

Commit

Permalink
Merge pull request #3 from seek4science/master
Browse files Browse the repository at this point in the history
Update to latest master version
  • Loading branch information
abecam authored May 10, 2021
2 parents 1b8135f + d20cc46 commit 4e3b06d
Show file tree
Hide file tree
Showing 521 changed files with 254,853 additions and 241 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ tmp/testing-seek-cache
tmp/rubycritic
tmp/fleximage
tmp/performance
tmp/user_uuid_studies_upload
*.tmp*
*~

Expand Down
13 changes: 0 additions & 13 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,6 @@ gem "doorkeeper", ">= 5.2.5"

gem 'request_store'

# javascript assets from https://rails-assets.org
gem 'bundler', '>= 1.8.4'

gem 'ro-crate-ruby', git: 'https://github.com/ResearchObject/ro-crate-ruby.git', ref: '70804d34264481e70d0fe83ecc6ad76eda164e74'
Expand All @@ -141,18 +140,6 @@ gem 'redcarpet'
gem 'i18n-js'
gem 'whenever', '~> 1.0.0', require: false

source 'https://rails-assets.org' do
gem 'rails-assets-bootstrap-multiselect', '~> 0.9.13'
gem 'rails-assets-bootstrap-tagsinput', '~> 0.8.0'
gem 'rails-assets-typeahead.js', '~> 0.10.5'
gem 'rails-assets-clipboard', '~> 1.5.12'
gem 'rails-assets-vue', '~> 2.1.8'
gem 'rails-assets-eonasdan-bootstrap-datetimepicker', '~> 4.17.42'
gem 'rails-assets-x-editable', '~> 1.5.1'
gem 'rails-assets-chartjs', '~> 2.7.2'
gem 'rails-assets-lightbox2', '~> 2.10.0'
end

group :production do
gem 'passenger'
end
Expand Down
40 changes: 5 additions & 35 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ GIT

GEM
remote: https://rubygems.org/
remote: https://rails-assets.org/
specs:
RedCloth (4.3.2)
actioncable (5.2.4.5)
Expand Down Expand Up @@ -377,8 +376,9 @@ GEM
mime-types (3.3.1)
mime-types-data (~> 3.2015)
mime-types-data (3.2021.0225)
mimemagic (0.3.7)
nokogiri (~> 1.11.2)
mimemagic (0.3.10)
nokogiri (~> 1)
rake
mini_mime (1.0.2)
mini_portile2 (2.5.0)
minitest (5.14.4)
Expand All @@ -402,7 +402,7 @@ GEM
net-ldap (0.16.0)
netrc (0.11.0)
nio4r (2.5.5)
nokogiri (1.11.2)
nokogiri (1.11.3)
mini_portile2 (~> 2.5.0)
racc (~> 1.4)
nokogumbo (1.5.0)
Expand Down Expand Up @@ -502,27 +502,6 @@ GEM
bundler (>= 1.3.0)
railties (= 5.2.4.5)
sprockets-rails (>= 2.0.0)
rails-assets-bootstrap (3.3.7)
rails-assets-jquery (>= 1.9.1, < 4)
rails-assets-bootstrap-multiselect (0.9.13)
rails-assets-bootstrap (>= 2.3.2)
rails-assets-jquery (>= 1.11.0)
rails-assets-bootstrap-tagsinput (0.8.0)
rails-assets-jquery (~> 2.1.1)
rails-assets-chartjs (2.7.2)
rails-assets-clipboard (1.5.16)
rails-assets-eonasdan-bootstrap-datetimepicker (4.17.47)
rails-assets-jquery (>= 1.8.3)
rails-assets-moment (>= 2.10.5)
rails-assets-jquery (2.1.4)
rails-assets-lightbox2 (2.10.0)
rails-assets-jquery (> 2)
rails-assets-moment (2.18.1)
rails-assets-typeahead.js (0.10.5)
rails-assets-jquery (>= 1.7)
rails-assets-vue (2.1.10)
rails-assets-x-editable (1.5.1)
rails-assets-jquery (>= 1.6)
rails-controller-testing (1.0.2)
actionpack (~> 5.x, >= 5.0.1)
actionview (~> 5.x, >= 5.0.1)
Expand Down Expand Up @@ -634,7 +613,7 @@ GEM
http-cookie (>= 1.0.2, < 2.0)
mime-types (>= 1.16, < 4.0)
netrc (~> 0.8)
rexml (3.2.4)
rexml (3.2.5)
rfc-822 (0.4.1)
rmagick (2.15.2)
ro-bundle (0.2.5)
Expand Down Expand Up @@ -903,15 +882,6 @@ DEPENDENCIES
puma (>= 3.12.6)
rack-attack (~> 5.0.1)
rails (~> 5.2.4)
rails-assets-bootstrap-multiselect (~> 0.9.13)!
rails-assets-bootstrap-tagsinput (~> 0.8.0)!
rails-assets-chartjs (~> 2.7.2)!
rails-assets-clipboard (~> 1.5.12)!
rails-assets-eonasdan-bootstrap-datetimepicker (~> 4.17.42)!
rails-assets-lightbox2 (~> 2.10.0)!
rails-assets-typeahead.js (~> 0.10.5)!
rails-assets-vue (~> 2.1.8)!
rails-assets-x-editable (~> 1.5.1)!
rails-controller-testing
rails-html-sanitizer
rails-observers
Expand Down
2 changes: 1 addition & 1 deletion app/assets/javascripts/sharing.js.erb
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ var Sharing = {
},

requestInstitutionsUrl: '<%= Rails.application.routes.url_helpers.request_institutions_projects_path %>',
requestAllInstitutionsUrl: '<%= Rails.application.routes.url_helpers.request_all_institutions_path %>',
requestAllInstitutionsUrl: '<%= Rails.application.routes.url_helpers.request_all_sharing_form_institutions_path %>',

accessTypes: {
noAccess: <%= Policy::NO_ACCESS %>,
Expand Down
2 changes: 2 additions & 0 deletions app/controllers/admin_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ def update_features_enabled
Seek::Config.models_enabled = string_to_boolean params[:models_enabled]
Seek::Config.organisms_enabled = string_to_boolean params[:organisms_enabled]
Seek::Config.programmes_enabled = string_to_boolean params[:programmes_enabled]
Seek::Config.programmes_open_for_projects_enabled = string_to_boolean params[:programmes_open_for_projects_enabled]
Seek::Config.publications_enabled = string_to_boolean params[:publications_enabled]
Seek::Config.samples_enabled = string_to_boolean params[:samples_enabled]
Seek::Config.workflows_enabled = string_to_boolean params[:workflows_enabled]
Expand Down Expand Up @@ -186,6 +187,7 @@ def update_rebrand

Seek::Config.dm_project_name = params[:dm_project_name]
Seek::Config.dm_project_link = params[:dm_project_link]
Seek::Config.issue_tracker = params[:issue_tracker]

Seek::Config.application_name = params[:application_name]

Expand Down
8 changes: 7 additions & 1 deletion app/controllers/homes_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ class HomesController < ApplicationController
helper HumanDiseasesHelper

before_action :redirect_to_sign_up_when_no_user
before_action :login_required, only: %i[feedback send_feedback create_or_join_project]
before_action :login_required, only: %i[feedback send_feedback create_or_join_project report_issue]
before_action :redirect_to_create_or_join_if_no_member, only: %i[index]

respond_to :html, only: [:index]
Expand All @@ -25,6 +25,12 @@ def feedback
end
end

def report_issue
respond_to do |format|
format.html
end
end

def isa_colours
respond_to do |format|
format.html
Expand Down
10 changes: 10 additions & 0 deletions app/controllers/institutions_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,16 @@ def request_all
end
end

# request all institutions, but specific to the sharing form which expects an array
def request_all_sharing_form
institution_list = Institution.order(:id).collect{ |institution| [institution.title, institution.id] }
respond_to do |format|
format.json do
render json: { status: 200, institution_list: institution_list }
end
end
end

private

def institution_params
Expand Down
15 changes: 12 additions & 3 deletions app/controllers/projects_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,12 @@ def administer_join_request
details = JSON.parse(@message_log.details)
@comments = details['comments']
@institution = Institution.new(details['institution'])
@institution = Institution.find(@institution.id) unless @institution.id.nil?
if @institution.id
@institution = Institution.find(@institution.id)
else
# override with existing institution if already exists with same title, it could have been created since the request was made
@institution = Institution.find_by(title: @institution.title) if Institution.find_by(title: @institution.title)
end

respond_to do |format|
format.html
Expand Down Expand Up @@ -726,9 +731,13 @@ def parse_message_log_details
@project = Project.find(@project.id) unless @project.id.nil?

@institution = Institution.new(details['institution'])
@institution = Institution.find(@institution.id) unless @institution.id.nil?


if @institution.id
@institution = Institution.find(@institution.id)
else
# override with existing institution if already exists with same title, it could have been created since the request was made
@institution = Institution.find_by(title: @institution.title) if Institution.find_by(title: @institution.title)
end
end

# check programme permissions for responding to a MesasgeLog
Expand Down
7 changes: 7 additions & 0 deletions app/controllers/sessions_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,13 @@ def create
password_authentication
end

def omniauth_failure
flash[:error] = "#{t("login.#{params[:strategy]}")} authentication failure (Invalid username/password?)"
respond_to do |format|
format.html { render :new }
end
end

def destroy
logout_user
flash[:notice] = 'You have been logged out.'
Expand Down
2 changes: 1 addition & 1 deletion app/helpers/sessions_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def show_omniauth_login?
Seek::Config.omniauth_enabled && Seek::Config.omniauth_providers.any?
end

def show_elixir_login?
def show_elixir_aai_login?
Seek::Config.omniauth_elixir_aai_enabled
end

Expand Down
2 changes: 0 additions & 2 deletions app/jobs/auth_lookup_update_job.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@ def perform_job(item)
end

def gather_items
# including item_type in the order, encourages assets to be processed before users (since they are much quicker), due to the happy coincidence
# that User falls last alphabetically. Its not that important if a new authorized type is added after User in the future.
AuthLookupUpdateQueue.dequeue(Seek::Config.auth_lookup_update_batch_size)
end

Expand Down
2 changes: 1 addition & 1 deletion app/jobs/reindexing_job.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def perform_job(item)
end

def gather_items
ReindexingQueue.dequeue(BATCHSIZE)
ReindexingQueue.dequeue(BATCHSIZE).compact
end

def follow_on_job?
Expand Down
3 changes: 3 additions & 0 deletions app/models/concerns/resource_queue.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ def queue_enabled?
end

def prioritized
# including item_type in the order, encourages assets to be processed before users
# (since they are much quicker, in the case of auth lookup processing), due to the happy coincidence that User
# falls last alphabetically. Its not that important if a new authorized type is added after User in the future.
order(:priority, :item_type, :id)
end

Expand Down
2 changes: 1 addition & 1 deletion app/models/programme.rb
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ def can_activate?(user = User.current_user)
end

def allows_user_projects?
open_for_projects?
open_for_projects? && Seek::Config.programmes_open_for_projects_enabled
end

def self.can_create?
Expand Down
2 changes: 1 addition & 1 deletion app/models/user.rb
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ def queue_update_auth_table

def remove_from_auth_tables
Seek::Util.authorized_types.each do |type|
type.lookup_class.where(user: id).delete_all
type.lookup_class.where(user: id).in_batches(of:1000).delete_all
end
end

Expand Down
2 changes: 1 addition & 1 deletion app/views/admin/_doi_settings.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@


<%= admin_text_setting(:datacite_url, Seek::Config.datacite_url,
'Datacite URL', "The root URL for the Datacite rest service. If it is not set, #{Seek::Config.default_datacite_url} will be used. You can also set the test url, https://test.datacite.org/mds/, for generating test DOIs.") %>
'Datacite URL', "The root URL for the Datacite rest service. If it is not set, #{Seek::Config.default_datacite_url} will be used. You can also set the test url, https://mds.test.datacite.org/, for generating test DOIs.") %>

<%= admin_text_setting(:doi_prefix, Seek::Config.doi_prefix,
'DOI prefix', 'The DOI prefix that will have been provided to you by DataCite for your organization.') %>
Expand Down
3 changes: 3 additions & 0 deletions app/views/admin/features_enabled.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@
"Site mananaged #{t('programme')}",
"The #{t('programme')} the users can request to have a #{t('project')} created and associated with, without the need to create and manage their own",
include_blank:'None') %>
<%= admin_checkbox_setting(:programmes_open_for_projects_enabled, 1, Seek::Config.programmes_open_for_projects_enabled,
"#{t('programme').pluralize} open for #{t(:project).pluralize} enabled",
"When enabled, gives the ability for individual #{t(:programme).pluralize} to be configured to allow any other registered user to create a #{t(:project)} linked to that #{t(:programme)} without requiring approval or admin rights. Use with care if open user registration is enabled, as it could allow any user to register, create a project and start adding content to that Programme.") %>
</div>
<%= admin_checkbox_setting(:samples_enabled, 1, Seek::Config.samples_enabled,
"Samples enabled", "Whether the Samples framework is enabled. The framework allows users to create their own custom Sample types to describe their biological samples and other metadata.",:onchange=>toggle_appear_javascript('sample_type_pa_only')) %>
Expand Down
3 changes: 3 additions & 0 deletions app/views/admin/rebrand.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@
<%= admin_text_setting(:dm_project_link, Seek::Config.dm_project_link,
"Data management #{t('project')} link", "A URL that is used in links to the data management #{t('project')}.") %>

<%= admin_text_setting(:issue_tracker, Seek::Config.issue_tracker,
"Issue tracker link", "A URL for an issue tracker, which users can use to report bugs or other issues. Leave blank if not required") %>

<%= admin_checkbox_setting(:header_image_enabled, 1, Seek::Config.header_image_enabled,
"Header logo image enabled", "Whether a header logo image appears on the right in the header.",
:onchange => toggle_appear_javascript('header_image_details')) %>
Expand Down
7 changes: 4 additions & 3 deletions app/views/assays/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,7 @@

<% if Seek::Config.organisms_enabled %>
<%= list_assay_organisms("Organisms", @assay.assay_organisms,{:id=>"organism"}) %>
<% end %>

<%= render partial: 'custom_metadata/custom_metadata_attribute_values', locals: {resource: @assay} %>
<% end %>

<% if Seek::Config.human_diseases_enabled %>
<%= list_assay_human_diseases("Human Diseases", @assay.assay_human_diseases,{:id=>"human_disease"}) %>
Expand All @@ -74,6 +72,9 @@
</div>
</div>
<% end %>

<%= render partial: 'custom_metadata/custom_metadata_attribute_values', locals: {resource: @assay} %>

<% if ((@assay.is_modelling?) && !@assay.models.empty? && !@assay.data_files.empty?) %><%#MODELLING ASSAY %>
<div class="data_model_relationship">
<% unless @assay.models.empty? %>
Expand Down
Loading

0 comments on commit 4e3b06d

Please sign in to comment.