mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-10-06 11:57:16 +08:00
fix new experiment creation
This commit is contained in:
parent
47cb1b31dc
commit
331a68e9b6
5 changed files with 14 additions and 6 deletions
|
@ -6,11 +6,14 @@
|
|||
ev.stopImmediatePropagation();
|
||||
ev.stopPropagation();
|
||||
ev.preventDefault();
|
||||
|
||||
animateSpinner();
|
||||
$.get(ev.currentTarget.getAttribute('href')).then(function({modal}) {
|
||||
$(modal).modal('show')
|
||||
.on("shown.bs.modal", function() {
|
||||
$(this).find(".selectpicker").selectpicker();
|
||||
});
|
||||
animateSpinner(null, false);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
|
|
@ -21,7 +21,7 @@ module PermissionCheckableModel
|
|||
end
|
||||
|
||||
if user_role_permissions.blank? && permission_parent.present?
|
||||
user_role_permissions = permission_parent.load_user_role_permissions(user)
|
||||
user_role_permissions = permission_parent.send :load_user_role_permissions, user
|
||||
end
|
||||
|
||||
user_role_permissions
|
||||
|
|
|
@ -25,9 +25,8 @@ class Experiment < ApplicationRecord
|
|||
has_many :activities, inverse_of: :experiment
|
||||
has_many :user_assignments, as: :assignable, dependent: :destroy
|
||||
has_many :users, through: :user_assignments
|
||||
has_one_attached :workflowimg
|
||||
|
||||
alias_attribute :project, :permission_parent
|
||||
has_one_attached :workflowimg
|
||||
|
||||
auto_strip_attributes :name, :description, nullify: false
|
||||
validates :name, length: { minimum: Constants::NAME_MIN_LENGTH, maximum: Constants::NAME_MAX_LENGTH }
|
||||
|
@ -239,6 +238,10 @@ class Experiment < ApplicationRecord
|
|||
projects - [project]
|
||||
end
|
||||
|
||||
def permission_parent
|
||||
project
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
# Archive all modules. Receives an array of module integer IDs
|
||||
|
|
|
@ -59,8 +59,6 @@ class MyModule < ApplicationRecord
|
|||
# Associations for old activity type
|
||||
has_many :activities, inverse_of: :my_module
|
||||
|
||||
alias_attribute :experiment, :permission_parent
|
||||
|
||||
default_scope { includes(user_assignments: :user_role) }
|
||||
|
||||
scope :overdue, -> { where('my_modules.due_date < ?', Time.current.utc) }
|
||||
|
@ -431,6 +429,10 @@ class MyModule < ApplicationRecord
|
|||
task_comments
|
||||
end
|
||||
|
||||
def permission_parent
|
||||
experiment
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def create_blank_protocol
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
data-moveable="<%= can_move_experiment?(experiment) %>"
|
||||
data-archivable="<%= experiment.active? && can_archive_experiment?(experiment) %>"
|
||||
data-restorable="<%= experiment.archived? && can_restore_experiment?(experiment) %>">
|
||||
>
|
||||
|
||||
<div class="checkbox-cell table-cell">
|
||||
<div class="sci-checkbox-container">
|
||||
<input value="1" type="checkbox" class="sci-checkbox experiment-card-selector">
|
||||
|
|
Loading…
Add table
Reference in a new issue