mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-01-01 05:02:50 +08:00
Cover all use cases for updating protocol status bar
This commit is contained in:
parent
c26489acdc
commit
b479a6a145
4 changed files with 11 additions and 16 deletions
|
@ -15,7 +15,7 @@ function init() {
|
||||||
initCopyToRepository();
|
initCopyToRepository();
|
||||||
initLinkUpdate();
|
initLinkUpdate();
|
||||||
initLoadFromRepository();
|
initLoadFromRepository();
|
||||||
initRefreshStatusBar();
|
refreshProtocolStatusBar();
|
||||||
initImport();
|
initImport();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -384,20 +384,6 @@ function loadFromRepository() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function initRefreshStatusBar() {
|
|
||||||
// The following actions need a refresh of status bar:
|
|
||||||
// - Edit protocol description
|
|
||||||
// - Create new step
|
|
||||||
// - Edit existing step
|
|
||||||
// - Move steps up/down
|
|
||||||
// - Delete step
|
|
||||||
// - New Office file
|
|
||||||
// - Edit image
|
|
||||||
// - Office Online edit file (???)
|
|
||||||
|
|
||||||
// TODO - this function will probably become reduntant
|
|
||||||
}
|
|
||||||
|
|
||||||
function refreshProtocolStatusBar() {
|
function refreshProtocolStatusBar() {
|
||||||
// Get the status bar URL
|
// Get the status bar URL
|
||||||
var url = $("[data-role='protocol-status-bar-url']").attr("data-url");
|
var url = $("[data-role='protocol-status-bar-url']").attr("data-url");
|
||||||
|
|
|
@ -162,7 +162,7 @@
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set callback for click on edit button
|
// Set callback for click on move step
|
||||||
function applyMoveStepCallBack() {
|
function applyMoveStepCallBack() {
|
||||||
$("[data-action='move-step']").off("ajax:success");
|
$("[data-action='move-step']").off("ajax:success");
|
||||||
$("[data-action='move-step']")
|
$("[data-action='move-step']")
|
||||||
|
@ -188,6 +188,8 @@
|
||||||
$stepUp.find(".badge").html(stepUpPosition+1);
|
$stepUp.find(".badge").html(stepUpPosition+1);
|
||||||
$("html, body").animate({ scrollTop: $step.offset().top - window.innerHeight / 2 });
|
$("html, body").animate({ scrollTop: $step.offset().top - window.innerHeight / 2 });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
refreshProtocolStatusBar();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -605,6 +607,7 @@
|
||||||
DragNDropSteps.clearFiles();
|
DragNDropSteps.clearFiles();
|
||||||
FilePreviewModal.init();
|
FilePreviewModal.init();
|
||||||
$.initTooltips();
|
$.initTooltips();
|
||||||
|
refreshProtocolStatusBar();
|
||||||
},
|
},
|
||||||
error: function(xhr) {
|
error: function(xhr) {
|
||||||
if (xhr.responseJSON['assets.file']) {
|
if (xhr.responseJSON['assets.file']) {
|
||||||
|
|
|
@ -404,6 +404,7 @@ var FilePreviewModal = (function() {
|
||||||
imageEditor = {};
|
imageEditor = {};
|
||||||
$('#tui-image-editor').html('');
|
$('#tui-image-editor').html('');
|
||||||
$('#fileEditModal').modal('hide');
|
$('#fileEditModal').modal('hide');
|
||||||
|
refreshProtocolStatusBar();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -466,6 +467,7 @@ var FilePreviewModal = (function() {
|
||||||
modal.find('.file-name').text(name);
|
modal.find('.file-name').text(name);
|
||||||
modal.find('.preview-close').click(function() {
|
modal.find('.preview-close').click(function() {
|
||||||
modal.modal('hide');
|
modal.modal('hide');
|
||||||
|
refreshProtocolStatusBar();
|
||||||
});
|
});
|
||||||
modal.modal();
|
modal.modal();
|
||||||
modal.find('a[disabled=disabled]').click(function(ev) {
|
modal.find('a[disabled=disabled]').click(function(ev) {
|
||||||
|
|
|
@ -156,6 +156,8 @@ class AssetsController < ApplicationController
|
||||||
tkn = current_user.get_wopi_token
|
tkn = current_user.get_wopi_token
|
||||||
@token = tkn.token
|
@token = tkn.token
|
||||||
@ttl = (tkn.ttl * 1000).to_s
|
@ttl = (tkn.ttl * 1000).to_s
|
||||||
|
@asset.step&.protocol&.update(updated_at: Time.now)
|
||||||
|
|
||||||
create_wopi_file_activity(current_user, true)
|
create_wopi_file_activity(current_user, true)
|
||||||
|
|
||||||
render layout: false
|
render layout: false
|
||||||
|
@ -185,6 +187,7 @@ class AssetsController < ApplicationController
|
||||||
@asset.team.release_space(orig_file_size)
|
@asset.team.release_space(orig_file_size)
|
||||||
# Post process file here
|
# Post process file here
|
||||||
@asset.post_process_file(@asset.team)
|
@asset.post_process_file(@asset.team)
|
||||||
|
@asset.step&.protocol&.update(updated_at: Time.now)
|
||||||
|
|
||||||
render_html = if @asset.step
|
render_html = if @asset.step
|
||||||
asset_position = @asset.step.asset_position(@asset)
|
asset_position = @asset.step.asset_position(@asset)
|
||||||
|
@ -239,6 +242,7 @@ class AssetsController < ApplicationController
|
||||||
render_403 && return unless can_manage_protocol_in_module?(step.protocol) ||
|
render_403 && return unless can_manage_protocol_in_module?(step.protocol) ||
|
||||||
can_manage_protocol_in_repository?(step.protocol)
|
can_manage_protocol_in_repository?(step.protocol)
|
||||||
step_asset = StepAsset.create!(step: step, asset: asset)
|
step_asset = StepAsset.create!(step: step, asset: asset)
|
||||||
|
step.protocol&.update(updated_at: Time.now)
|
||||||
|
|
||||||
edit_url = edit_asset_url(step_asset.asset_id)
|
edit_url = edit_asset_url(step_asset.asset_id)
|
||||||
elsif params[:element_type] == 'Result'
|
elsif params[:element_type] == 'Result'
|
||||||
|
|
Loading…
Reference in a new issue