mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-02-10 17:03:56 +08:00
Upon redirection when clicking the new sample type or group link, you're automatically in adding mode. [Fixes SCI-701]
This commit is contained in:
parent
0b12c87b09
commit
54de13de82
3 changed files with 18 additions and 4 deletions
|
@ -759,7 +759,7 @@ function createSampleTypeSelect(data, selected) {
|
|||
.attr('value', val.id).text(val.name);
|
||||
$selectType.append($option);
|
||||
});
|
||||
$selectType.makeDropdownOptionsLinks(selected);
|
||||
$selectType.makeDropdownOptionsLinks(selected, 'add-mode');
|
||||
return $selectType;
|
||||
}
|
||||
|
||||
|
@ -791,7 +791,7 @@ function createSampleGroupSelect(data, selected) {
|
|||
|
||||
$selectGroup.append($option);
|
||||
});
|
||||
$selectGroup.makeDropdownOptionsLinks(selected);
|
||||
$selectGroup.makeDropdownOptionsLinks(selected, 'add-mode');
|
||||
return $selectGroup;
|
||||
}
|
||||
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
function showNewSampleTypeGroupForm() {
|
||||
$('#create-resource').on('click', function() {
|
||||
$('.new-resource-form').slideDown();
|
||||
$('#name-input').focus();
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -211,6 +212,16 @@
|
|||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Opens adding mode when redirected from samples page, when clicking link for
|
||||
* adding sample type or group link
|
||||
*/
|
||||
function sampleTypeGroupEditMode() {
|
||||
if (getParam('add-mode')) {
|
||||
$('#create-resource').click();
|
||||
}
|
||||
}
|
||||
|
||||
function initSampleTypesGroups() {
|
||||
showNewSampleTypeGroupForm();
|
||||
newSampleTypeFormCancel();
|
||||
|
@ -223,6 +234,7 @@
|
|||
initSampleGroupColor();
|
||||
bindNewSampleGroupAction();
|
||||
appendCarretToColorPickerDropdown();
|
||||
sampleTypeGroupEditMode();
|
||||
}
|
||||
|
||||
// initialize sample types/groups actions
|
||||
|
|
|
@ -221,13 +221,15 @@ function initPageTutorialSteps(pageFirstStepN, pageLastStepN, nextPagePath,
|
|||
* attribute yourself, and the dropdown elments which don't have them, will get
|
||||
* '#' by default.
|
||||
* @param {number} selectedIdx Index of element to be selected
|
||||
* @param {string} urlParam URL parameter to pass to the link URLs
|
||||
* @return {Object} This
|
||||
*/
|
||||
$.fn.makeDropdownOptionsLinks = function(selectedIdx) {
|
||||
$.fn.makeDropdownOptionsLinks = function(selectedIdx, urlParam) {
|
||||
selectedIdx = _.isUndefined(selectedIdx) ? 1 : selectedIdx;
|
||||
|
||||
$(this).change(function() {
|
||||
location = $(this).find('option:selected').attr('href');
|
||||
window.location.href = addParam($(this).find('option:selected')
|
||||
.attr('href'), urlParam);
|
||||
});
|
||||
|
||||
$(this).find('option')
|
||||
|
|
Loading…
Reference in a new issue