mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-01-01 21:21:50 +08:00
Merge pull request #371 from okriuchykhin/ok_SCI_819
Fix an issue with sample editing and type/group dropdowns [SCI-819]
This commit is contained in:
commit
7f99449f63
3 changed files with 6 additions and 48 deletions
|
@ -780,9 +780,11 @@ function createSampleTypeSelect(data, selected) {
|
|||
$.each(data, function(i, val) {
|
||||
var $option = $('<option></option>')
|
||||
.attr('value', val.id).text(val.name);
|
||||
if((i + 1) === selected) {
|
||||
$option.attr('selected', true);
|
||||
}
|
||||
$selectType.append($option);
|
||||
});
|
||||
$selectType.makeDropdownOptionsLinks(selected, 'add-mode');
|
||||
return $selectType;
|
||||
}
|
||||
|
||||
|
@ -807,10 +809,11 @@ function createSampleGroupSelect(data, selected) {
|
|||
var $option = $('<option></option>')
|
||||
.attr('value', val.id).text(val.name)
|
||||
.attr('data-content', $span.prop('outerHTML') + ' ' + val.name);
|
||||
|
||||
if((i + 1) === selected) {
|
||||
$option.attr('selected', true);
|
||||
}
|
||||
$selectGroup.append($option);
|
||||
});
|
||||
$selectGroup.makeDropdownOptionsLinks(selected, 'add-mode');
|
||||
return $selectGroup;
|
||||
}
|
||||
|
||||
|
|
|
@ -215,36 +215,3 @@ function initPageTutorialSteps(pageFirstStepN, pageLastStepN, nextPagePath,
|
|||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add redirection links on dropdown elements. You must specify 'href'
|
||||
* 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, urlParam) {
|
||||
selectedIdx = _.isUndefined(selectedIdx) ? -1 : selectedIdx;
|
||||
|
||||
$(this).change(function() {
|
||||
window.location.href = addParam($(this).find('option:selected')
|
||||
.attr('href'), urlParam);
|
||||
});
|
||||
|
||||
$(this).find('option')
|
||||
.each(function() {
|
||||
if ($(this).is('[href]')) {
|
||||
$(this).addClass('link-look');
|
||||
} else {
|
||||
$(this).attr('href', '#');
|
||||
}
|
||||
});
|
||||
var selectedOpt = $(this).find('option[value="' + selectedIdx + '"]');
|
||||
if (!selectedOpt.length) {
|
||||
selectedOpt = $(this).find('option').eq(0);
|
||||
}
|
||||
selectedOpt.attr('selected', true);
|
||||
|
||||
return this;
|
||||
};
|
||||
|
|
|
@ -235,18 +235,6 @@ body {
|
|||
|
||||
a {
|
||||
color: $color-theme-primary;
|
||||
|
||||
// Override to make link look and behave as a normal link (e.g. used for
|
||||
// elements which have links)
|
||||
&.link-look {
|
||||
color: $color-theme-primary !important;
|
||||
|
||||
:hover,
|
||||
:focus {
|
||||
color: $color-visited-link !important;
|
||||
text-decoration: underline !important;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.jumbotron {
|
||||
|
|
Loading…
Reference in a new issue