mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-02-01 12:38:30 +08:00
Implemented popover tooltips in all specified places, and fixed a bug where old popovers were open on page switch with ajax
This commit is contained in:
parent
91f112dc38
commit
36cca3d6aa
6 changed files with 22 additions and 7 deletions
|
@ -244,6 +244,7 @@ function initializeEdit() {
|
|||
{ color: 'white', shadow: true }
|
||||
);
|
||||
});
|
||||
$.init_popover_v2();
|
||||
}
|
||||
|
||||
function destroyEdit() {
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
function init(location) {
|
||||
LOCATION = location;
|
||||
global.addEventListener('paste', _listener, false);
|
||||
$.init_popover_v2();
|
||||
};
|
||||
|
||||
function destroy() {
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
(function() {
|
||||
'use strict';
|
||||
|
||||
$(document).ready(function() {
|
||||
//if( user has popovers turned on from settings ){
|
||||
$.init_popover_v2 = function() {
|
||||
if ($(document.body).data("popover_v2_enabled")===true || $(document.body).data("popover_v2_enabled")== null ){
|
||||
var popovers_array = [];
|
||||
|
||||
$('.popover_open').remove() // Destroy all (if any) old open popovers
|
||||
$('.popover_v2').each(function(i,obj) {
|
||||
var popover_object = obj;
|
||||
popovers_array.push(popover_object);
|
||||
|
@ -19,7 +19,7 @@
|
|||
placement: 'auto right',
|
||||
trigger: 'manual',
|
||||
content: 'popovers will not display if empty',
|
||||
template: '<div class="popover popover_'+i+'_window" role="tooltip" style="background-color:#F0F0F0;font-family:Lato;font-size:14px;" color="#000000" >' +
|
||||
template: '<div class="popover popover_'+i+'_window popover_open" role="tooltip" style="background-color:#F0F0F0;font-family:Lato;font-size:14px;" color="#000000" >' +
|
||||
'<div class="popover-body" >' + text_data + '</div>' +
|
||||
'<br><br><br>' +
|
||||
'<div class="popover-footer" style="position:absolute;bottom:5px;right:5px;background-color:#E8E8E8;border-radius: 3px;">' +
|
||||
|
@ -51,7 +51,7 @@
|
|||
if (!$(".popover_"+i+"_window:hover").length) {
|
||||
$(obj).popover("hide")
|
||||
}
|
||||
}, 500);
|
||||
}, 300);
|
||||
}).on("shown.bs.popover", function(){
|
||||
// hide all other popovers
|
||||
popovers_array.forEach(function (arrayItem) {
|
||||
|
@ -61,8 +61,13 @@
|
|||
});
|
||||
});
|
||||
})
|
||||
//}
|
||||
}
|
||||
}
|
||||
|
||||
$(document).ready(function() {
|
||||
$.init_popover_v2();
|
||||
});
|
||||
|
||||
}());
|
||||
|
||||
/* copy and paste shortcut
|
||||
|
|
|
@ -10,7 +10,9 @@
|
|||
>
|
||||
<%= bootstrap_form_tag url: canvas_experiment_url, method: "post" do |f| %>
|
||||
<% if can_manage_experiment?(@experiment) %>
|
||||
<%=link_to "", type: "button", class: "btn btn-primary", id: "canvas-new-module" do %>
|
||||
<%=link_to "", type: "button", class: "btn btn-primary popover_v2", id: "canvas-new-module",
|
||||
data: { popoverlink: I18n.t('popover_test.link.task.new'),
|
||||
popovercontent: I18n.t('popover_test.text.task.new') } do %>
|
||||
<span class="hbtn-default">
|
||||
<span class="glyphicon glyphicon-credit-card"></span>
|
||||
<%= t("experiments.canvas.edit.new_module") %>
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
<div class="well">
|
||||
<div id="new-result-assets-select" class="text-center new-asset-box">
|
||||
<span class="popover_v2" data-popoverlink="<%= I18n.t('popover_test.link.protocol.step_add_files') %>"
|
||||
data-popovercontent="<%= I18n.t('popover_test.text.protocol.step_add_files') %>">
|
||||
<%=t 'assets.drag_n_drop.label_html' %>
|
||||
<label>
|
||||
<span class="btn btn-primary">
|
||||
|
@ -11,6 +13,7 @@
|
|||
id="drag-n-drop-assets"
|
||||
style="display: none" multiple>
|
||||
</label>
|
||||
</span>
|
||||
</div>
|
||||
<br />
|
||||
<div class="align-right">
|
||||
|
|
|
@ -43,6 +43,8 @@
|
|||
</div>
|
||||
<div class="tab-pane" role="tabpanel" id="new-step-assets">
|
||||
<div class="text-center new-asset-box">
|
||||
<span class="popover_v2" data-popoverlink="<%= I18n.t('popover_test.link.protocol.step_add_files') %>"
|
||||
data-popovercontent="<%= I18n.t('popover_test.text.protocol.step_add_files') %>">
|
||||
<%=t 'assets.drag_n_drop.label_html' %>
|
||||
<label>
|
||||
<span class="btn btn-primary">
|
||||
|
@ -54,6 +56,7 @@
|
|||
id="drag-n-drop-assets"
|
||||
style="display: none" multiple>
|
||||
</label>
|
||||
</span>
|
||||
</div>
|
||||
<div id="new-step-assets-group" class="form-group">
|
||||
<%= f.nested_fields_for :assets do |ff| %>
|
||||
|
|
Loading…
Reference in a new issue