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