mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-11-08 07:21:03 +08:00
Fix duplicate activtiy issue and fix link to inventory
This commit is contained in:
parent
063f02dc56
commit
dd8b3caf65
11 changed files with 36 additions and 64 deletions
|
|
@ -9,7 +9,6 @@ var selectedRow = null;
|
|||
* Initializes page
|
||||
*/
|
||||
function init() {
|
||||
bindEditDueDateAjax();
|
||||
initEditDescription();
|
||||
initCopyToRepository();
|
||||
initLinkUpdate();
|
||||
|
|
@ -60,57 +59,6 @@ function initEditDescription() {
|
|||
});
|
||||
}
|
||||
|
||||
function bindEditDueDateAjax() {
|
||||
var editDueDateModal = null;
|
||||
var editDueDateModalBody = null;
|
||||
var editDueDateModalTitle = null;
|
||||
var editDueDateModalSubmitBtn = null;
|
||||
|
||||
editDueDateModal = $("#manage-module-due-date-modal");
|
||||
editDueDateModalBody = editDueDateModal.find(".modal-body");
|
||||
editDueDateModalTitle = editDueDateModal.find("#manage-module-due-date-modal-label");
|
||||
editDueDateModalSubmitBtn = editDueDateModal.find("[data-action='submit']");
|
||||
|
||||
$(".due-date-link")
|
||||
.on("ajax:success", function(ev, data, status) {
|
||||
var dueDateLink = $(".task-due-date");
|
||||
|
||||
// Load contents
|
||||
editDueDateModalBody.html(data.html);
|
||||
editDueDateModalTitle.text(data.title);
|
||||
|
||||
// Add listener to form inside modal
|
||||
editDueDateModalBody.find("form")
|
||||
.on("ajax:success", function(ev2, data2, status2) {
|
||||
// Update module's due date
|
||||
dueDateLink.html(data2.module_header_due_date_label);
|
||||
|
||||
// Close modal
|
||||
editDueDateModal.modal("hide");
|
||||
})
|
||||
.on("ajax:error", function(ev2, data2, status2) {
|
||||
// Display errors if needed
|
||||
$(this).renderFormErrors("my_module", data2.responseJSON);
|
||||
});
|
||||
|
||||
// Open modal
|
||||
editDueDateModal.modal("show");
|
||||
})
|
||||
.on("ajax:error", function(ev, data, status) {
|
||||
// TODO
|
||||
});
|
||||
|
||||
editDueDateModalSubmitBtn.on("click", function() {
|
||||
// Submit the form inside the modal
|
||||
editDueDateModalBody.find("form").submit();
|
||||
});
|
||||
|
||||
editDueDateModal.on("hidden.bs.modal", function() {
|
||||
editDueDateModalBody.find("form").off("ajax:success ajax:error");
|
||||
editDueDateModalBody.html("");
|
||||
});
|
||||
}
|
||||
|
||||
function initCopyToRepository() {
|
||||
var link = $("[data-action='copy-to-repository']");
|
||||
var modal = $("#copy-to-repository-modal");
|
||||
|
|
|
|||
|
|
@ -47,9 +47,11 @@ module GlobalActivitiesHelper
|
|||
path = repository_path(obj)
|
||||
when RepositoryRow
|
||||
return current_value unless obj.repository
|
||||
|
||||
path = repository_path(obj.repository)
|
||||
when RepositoryColumn
|
||||
return current_value unless obj.repository
|
||||
|
||||
path = repository_path(obj.repository)
|
||||
when Project
|
||||
path = obj.archived? ? projects_path : project_path(obj)
|
||||
|
|
@ -60,7 +62,15 @@ module GlobalActivitiesHelper
|
|||
when MyModule
|
||||
return current_value unless obj.navigable?
|
||||
|
||||
path = obj.archived? ? module_archive_experiment_path(obj.experiment) : protocols_my_module_path(obj)
|
||||
path = if obj.archived?
|
||||
module_archive_experiment_path(obj.experiment)
|
||||
else
|
||||
path = if %w(assign_repository_record unassign_repository_record).include? activity.type_of
|
||||
repository_my_module_path(obj, activity.values['message_items']['repository']['id'])
|
||||
else
|
||||
protocols_my_module_path(obj)
|
||||
end
|
||||
end
|
||||
when Protocol
|
||||
if obj.in_repository?
|
||||
path = protocols_path
|
||||
|
|
|
|||
|
|
@ -13,7 +13,13 @@
|
|||
<div class="row navigational-breadcrumbs">
|
||||
<% unless activity.old_activity? || !activity.subject_type.present?%>
|
||||
<%= render partial: "global_activities/references/#{activity.subject_type.underscore}.html.erb",
|
||||
locals: { team: activity.team, subject: activity.subject, breadcrumbs: activity.breadcrumbs } %>
|
||||
locals: {
|
||||
team: activity.team,
|
||||
subject: activity.subject,
|
||||
breadcrumbs: activity.breadcrumbs,
|
||||
values: activity.values,
|
||||
type_of: activity.type_of
|
||||
} %>
|
||||
<% else %>
|
||||
<div class="row"> </div>
|
||||
<% end %>
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
<%= render partial: "global_activities/references/project.html.erb",
|
||||
locals: { team: team, subject: subject&.project, breadcrumbs: breadcrumbs } %>
|
||||
locals: { team: team, subject: subject&.project, breadcrumbs: breadcrumbs, values: values, type_of: type_of } %>
|
||||
<div class="ga-breadcrumb">
|
||||
<%= image_tag 'icon_small/experiment.svg' %>
|
||||
<% if subject&.navigable? %>
|
||||
|
|
|
|||
|
|
@ -1,9 +1,17 @@
|
|||
<%= render partial: "global_activities/references/experiment.html.erb",
|
||||
locals: { team: team, subject: subject&.experiment, breadcrumbs: breadcrumbs } %>
|
||||
locals: { team: team, subject: subject&.experiment, breadcrumbs: breadcrumbs, values: values, type_of: type_of } %>
|
||||
<div class="ga-breadcrumb">
|
||||
<%= image_tag 'icon_small/task.svg' %>
|
||||
<% if subject&.navigable? %>
|
||||
<% path = subject.archived? ? module_archive_experiment_path(subject.experiment) : protocols_my_module_path(subject) %>
|
||||
<% if subject.archived?
|
||||
path = module_archive_experiment_path(subject.experiment)
|
||||
else
|
||||
if (['assign_repository_record','unassign_repository_record'].include? type_of)
|
||||
path = repository_my_module_path(subject,values["message_items"]["repository"]["id"])
|
||||
else
|
||||
path = protocols_my_module_path(subject)
|
||||
end
|
||||
end %>
|
||||
<%= route_to_other_team(path,
|
||||
team,
|
||||
subject.name&.truncate(Constants::NAME_TRUNCATION_LENGTH),
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
<%= render partial: "global_activities/references/team.html.erb",
|
||||
locals: { team: team, subject: subject&.team, breadcrumbs: breadcrumbs } %>
|
||||
locals: { team: team, subject: subject&.team, breadcrumbs: breadcrumbs, values: values, type_of: type_of } %>
|
||||
<div class="ga-breadcrumb">
|
||||
<%= image_tag 'icon_small/project.svg' %>
|
||||
<% if subject %>
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
<% if subject.in_repository? %>
|
||||
<%= render partial: "global_activities/references/team.html.erb",
|
||||
locals: { team: team, subject: subject&.team, breadcrumbs: breadcrumbs } %>
|
||||
locals: { team: team, subject: subject&.team, breadcrumbs: breadcrumbs, values: values, type_of: type_of } %>
|
||||
<% else %>
|
||||
<%= render partial: "global_activities/references/my_module.html.erb",
|
||||
locals: { team: team, subject: subject&.my_module, breadcrumbs: breadcrumbs } %>
|
||||
locals: { team: team, subject: subject&.my_module, breadcrumbs: breadcrumbs, values: values, type_of: type_of } %>
|
||||
<% end %>
|
||||
<% if subject %>
|
||||
<% if subject.in_repository? %>
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
<%= render partial: "global_activities/references/team.html.erb",
|
||||
locals: { team: team, subject: subject&.team, breadcrumbs: breadcrumbs } %>
|
||||
locals: { team: team, subject: subject&.team, breadcrumbs: breadcrumbs, values: values, type_of: type_of } %>
|
||||
<div class="ga-breadcrumb">
|
||||
<span class="fas fa-clipboard-check"></span>
|
||||
<% if subject %>
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
<%= render partial: "global_activities/references/team.html.erb",
|
||||
locals: { team: team, subject: subject&.team, breadcrumbs: breadcrumbs } %>
|
||||
locals: { team: team, subject: subject&.team, breadcrumbs: breadcrumbs, values: values, type_of: type_of } %>
|
||||
<div class="ga-breadcrumb">
|
||||
<span class="fas fa-list-alt"></span>
|
||||
<% if subject %>
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
<%= render partial: "global_activities/references/my_module.html.erb",
|
||||
locals: { team: team, subject: subject&.my_module, breadcrumbs: breadcrumbs } %>
|
||||
locals: { team: team, subject: subject&.my_module, breadcrumbs: breadcrumbs, values: values, type_of: type_of } %>
|
||||
<div class="ga-breadcrumb">
|
||||
|
||||
<span class="<%=result_icon_class(subject)%>"></span>
|
||||
|
|
|
|||
|
|
@ -238,7 +238,7 @@ en:
|
|||
team: "Team"
|
||||
exports: "Exports"
|
||||
subject_name:
|
||||
repository: "Repository"
|
||||
repository: "Inventory"
|
||||
project: "Project"
|
||||
experiment: "Experiment"
|
||||
mymodule: "Task"
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue