mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2024-12-27 02:04:33 +08:00
Implemented all except 2 tooltips, debbugging why they dont work now
This commit is contained in:
parent
8c492e1491
commit
1159a32ce2
13 changed files with 73 additions and 24 deletions
|
@ -3,10 +3,18 @@
|
|||
|
||||
$(document).ready(function() {
|
||||
//if( user has popovers turned on from settings ){
|
||||
var popovers_array = [];
|
||||
|
||||
$('.popover_v2').each(function(i,obj) {
|
||||
var popover_object = obj;
|
||||
popovers_array.push(popover_object);
|
||||
});
|
||||
$('.popover_v2').each(function(i,obj) {
|
||||
var link = $(obj).data('popoverlink')
|
||||
var text_data = $(obj).data('content')
|
||||
var text_data = $(obj).data('popovercontent')
|
||||
/* Testing
|
||||
var needed_attribute = $(obj).attr("data-content");
|
||||
|
||||
if (typeof needed_attribute !== typeof undefined && needed_attribute !== false && needed_attribute !== "") {
|
||||
// Do nothing, will negate the above logic later
|
||||
}else{
|
||||
|
@ -14,15 +22,22 @@
|
|||
// without a data-content attribute in its parent element, the popover will NEVER render
|
||||
// it assumes it is empty because I fill data trough the template.
|
||||
}
|
||||
*/
|
||||
$(obj).popover({
|
||||
html: true,
|
||||
container: 'body',
|
||||
placement: 'auto right',
|
||||
trigger: 'manual',
|
||||
template: '<div class="popover popover_'+i+'_window" 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;">' +
|
||||
'<a style="color:grey;" class="btn btn-link text-nowrap" href="'+link+'">Read more <i class="fas fa-external-link-alt"></i></a></div></div>'
|
||||
content: 'should never be empty',
|
||||
template: '<div class="popover popover_'+i+'_window" 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;">' +
|
||||
'<a style="color:grey;" class="btn btn-link text-nowrap" href="'+link+'" target="_blank" rel="noopener noreferrer" ">' +
|
||||
'Read more <i class="fas fa-external-link-alt"></i>' +
|
||||
'</a>' +
|
||||
'</div>' +
|
||||
'</div>'
|
||||
}).on("mouseenter", function () {
|
||||
setTimeout(function () {
|
||||
if ($(obj).hover().length) {
|
||||
|
@ -32,11 +47,11 @@
|
|||
top: (top) + 'px'
|
||||
});
|
||||
$(".popover_"+i+"_window").on("mouseleave", function () {
|
||||
$(obj).popover('hide');
|
||||
$(".popover_"+i+"_window").css("background-color","#F0F0F0");
|
||||
$(obj).popover('hide');
|
||||
});
|
||||
$(".popover_"+i+"_window").on("mouseenter", function () {
|
||||
$(".popover_"+i+"_window").css("background-color","#DADADA");
|
||||
$(".popover_"+i+"_window").css("background-color","#DADADA");
|
||||
});
|
||||
}
|
||||
}, 1000);
|
||||
|
@ -46,8 +61,13 @@
|
|||
$(obj).popover("hide")
|
||||
}
|
||||
}, 500);
|
||||
}).on('shown', function(){
|
||||
}).on("shown.bs.popover", function(){
|
||||
// hide all other popovers
|
||||
popovers_array.forEach(function (arrayItem) {
|
||||
if(obj !== arrayItem){
|
||||
$(arrayItem).popover("hide")
|
||||
}
|
||||
});
|
||||
});
|
||||
})
|
||||
//}
|
||||
|
|
|
@ -199,8 +199,12 @@ class ProtocolsDatatable < CustomDatatable
|
|||
end
|
||||
|
||||
def modules_html(record)
|
||||
"<a href='#' data-action='load-linked-children'" +
|
||||
" data-url='#{linked_children_protocol_path(record)}'>" +
|
||||
"<a href='#' data-action='load-linked-children' class='popover_v2' " +
|
||||
"data-popoverlink='" +
|
||||
I18n.t('popover_test.link.protocol.num_linked') +
|
||||
"' data-popovercontent='" +
|
||||
I18n.t('popover_test.text.protocol.num_linked') +
|
||||
"' data-url='#{linked_children_protocol_path(record)}'>" +
|
||||
"#{record.nr_of_linked_children}" +
|
||||
"</a>"
|
||||
end
|
||||
|
|
|
@ -10,12 +10,12 @@
|
|||
>
|
||||
<%= 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 %>
|
||||
<span class="hbtn-default">
|
||||
<%=link_to "", type: "button", class: "btn btn-primary popover_v2", id: "canvas-new-module" do %>
|
||||
<span class="hbtn-default popover_v2">
|
||||
<span class="glyphicon glyphicon-credit-card"></span>
|
||||
<%= t("experiments.canvas.edit.new_module") %>
|
||||
</span>
|
||||
<span class="hbtn-hover">
|
||||
<span class="hbtn-hover popover_v2">
|
||||
<span class="glyphicon glyphicon-credit-card"></span>
|
||||
<em class="hidden-xs"><%= t("experiments.canvas.edit.new_module_hover") %></em>
|
||||
<span class="visible-xs-inline"><%= t("experiments.canvas.edit.new_module") %></span>
|
||||
|
|
|
@ -30,7 +30,11 @@
|
|||
|
||||
<div class="panel-body">
|
||||
<% if can_manage_module?(my_module) %>
|
||||
<%= link_to due_date_my_module_path(my_module, format: :json), remote: true, class: "due-date-link due-date-refresh" do %>
|
||||
<%= link_to due_date_my_module_path(my_module, format: :json), remote: true, class: "due-date-link due-date-refresh popover_v2",
|
||||
data: {
|
||||
popoverlink: I18n.t('popover_test.link.task.due_date'),
|
||||
popovercontent: I18n.t('popover_test.text.task.due_date')
|
||||
} do %>
|
||||
<%= render partial: "my_modules/due_date_label.html.erb", locals: { my_module: my_module } %>
|
||||
<% end %>
|
||||
<% else %>
|
||||
|
|
|
@ -9,7 +9,9 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-xs-6 col-sm-6 col-md-4 popover_v2" data-popoverlink="<%= I18n.t('popover_test.link.task.due_date') %>" data-popovercontent="<%= I18n.t('popover_test.text.task.due_date') %>">
|
||||
<div class="col-xs-6 col-sm-6 col-md-4 popover_v2"
|
||||
data-popoverlink="<%= I18n.t('popover_test.link.task.due_date_specific') %>"
|
||||
data-popovercontent="<%= I18n.t('popover_test.text.task.due_date_specific') %>">
|
||||
<div class="badge-icon">
|
||||
<% if can_manage_module?(@my_module) %>
|
||||
<%= link_to due_date_my_module_path(@my_module, format: :json), remote: true, class: "due-date-link", style: "color: inherit" do %>
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
<div class="pull-right my_module-state-buttons">
|
||||
<% if can_complete_module?(@my_module) %>
|
||||
<div class="btn-group">
|
||||
<div class="btn-group popover_v2"
|
||||
data-popoverlink="<%= I18n.t('popover_test.link.protocol.complete') %>"
|
||||
data-popovercontent="<%= I18n.t('popover_test.text.protocol.complete') %>">
|
||||
<% if !@my_module.completed? %>
|
||||
<div data-action="complete-task" data-link-url="<%= toggle_task_state_my_module_path(@my_module) %>">
|
||||
<%= render 'my_modules/state_button_complete.html.erb' %>
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
<div class="panel panel-default panel-protocol-status">
|
||||
<div class="panel panel-default panel-protocol-status popover_v2"
|
||||
data-popoverlink="<%= I18n.t('popover_test.link.protocol.linking') %>"
|
||||
data-popovercontent="<%= I18n.t('popover_test.text.protocol.linking') %>">
|
||||
<div class="panel-body">
|
||||
<% if @protocol.linked? %>
|
||||
<%= protocol_status_href(@protocol) %>
|
||||
|
|
|
@ -15,6 +15,9 @@
|
|||
</div>
|
||||
|
||||
<% if can_manage_module?(@my_module) %>
|
||||
<div class="popover_v2" style="width:25%"
|
||||
data-popoverlink="<%= I18n.t('popover_test.link.task.results') %>"
|
||||
data-popovercontent="<%= I18n.t('popover_test.text.task.results') %>">
|
||||
<span class="hidden-xs"><%= t'my_modules.results.add_label' %></span>
|
||||
<a class="btn btn-primary"
|
||||
id="new-result-text"
|
||||
|
@ -37,6 +40,7 @@
|
|||
<span class="glyphicon glyphicon-picture"></span>
|
||||
<span class="hidden-xs"><%= t("my_modules.results.new_asset_result") %></span>
|
||||
</a>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
<div id="repository-columns-dropdown" class="dropdown">
|
||||
<div id="repository-columns-dropdown" class="dropdown popover_v2"
|
||||
data-popoverlink="<%= I18n.t('popover_test.link.inventory.visibility') %>"
|
||||
data-popovercontent="<%= I18n.t('popover_test.text.inventory.visibility') %>">
|
||||
<button class="btn btn-default dropdown-toggle" type="button" data-toggle="dropdown">
|
||||
<span class="fas fa-eye"></span>
|
||||
<span class="hidden-xs"><%= t('repositories.index.visibility') %></span>
|
||||
|
|
|
@ -9,7 +9,10 @@
|
|||
<div id="repository-toolbar">
|
||||
|
||||
<% if can_create_repository_rows?(@repository.team) %>
|
||||
<button type="button" class="btn btn-primary editAdd" id="addRepositoryRecord" onclick="onClickAddRecord()">
|
||||
<button type="button" class="btn btn-primary editAdd popover_v2"
|
||||
id="addRepositoryRecord" onclick="onClickAddRecord()"
|
||||
data-popoverlink="<%= I18n.t('popover_test.link.inventory.new') %>"
|
||||
data-popovercontent="<%= I18n.t('popover_test.text.inventory.new') %>">
|
||||
<span class="glyphicon glyphicon-plus"></span>
|
||||
<span class="hidden-xs"><%= t("repositories.add_new_record") %></span>
|
||||
</button>
|
||||
|
|
|
@ -14,9 +14,11 @@
|
|||
<h2><strong><%=t 'libraries.repository_columns.index.manage_column' %></strong></h2>
|
||||
</div>
|
||||
<div class="col-md-6 text-right">
|
||||
<button class="btn btn-primary"
|
||||
<button class="btn btn-primary popover_v2"
|
||||
data-modal-url="<%= repository_columns_create_html_path(@repository) %>"
|
||||
data-action="new-column-modal">
|
||||
data-action="new-column-modal"
|
||||
data-popoverlink="<%= I18n.t('popover_test.link.inventory.manage_columns') %>"
|
||||
data-popovercontent="<%= I18n.t('popover_test.text.inventory.manage_columns') %>">
|
||||
<span class="glyphicon glyphicon-plus"></span> <%=t 'libraries.repository_columns.index.new_column' %>
|
||||
</button>
|
||||
</div>
|
||||
|
|
|
@ -107,7 +107,9 @@
|
|||
<ul class="dropdown-menu repositories-dropdown-menu" aria-labelledby="repositoriesDropdownMenuLink">
|
||||
<% @my_module.experiment.project.team.repositories.order(created_at: :asc).each do |repository| %>
|
||||
<li>
|
||||
<a class="dropdown-item <%= "active-item" if module_repository_page? && @repository == repository %>"
|
||||
<a class="dropdown-item <%= "active-item" if module_repository_page? && @repository == repository %> popover_v2"
|
||||
data-popoverlink="<%= I18n.t('popover_test.link.protocol.inventories') %>"
|
||||
data-popovercontent="<%= I18n.t('popover_test.text.protocol.inventories') %>"
|
||||
href="<%= repository_my_module_url(id: @my_module, repository_id: repository) %>"
|
||||
title="<%= repository.name %>"
|
||||
data-no-turbolink="true">
|
||||
|
|
|
@ -20,10 +20,12 @@
|
|||
data-remote="true">
|
||||
<span class="glyphicon glyphicon-arrow-down"></a>
|
||||
<a data-action="edit-step"
|
||||
class="btn btn-link"
|
||||
class="btn btn-link popover_v2"
|
||||
title="<%= t("protocols.steps.options.edit_title") %>"
|
||||
href="<%= edit_step_path(step, format: :json) %>"
|
||||
data-remote="true">
|
||||
data-remote="true"
|
||||
data-popoverlink="<%= I18n.t('popover_test.link.protocol.step_edit') %>"
|
||||
data-popovercontent="<%= I18n.t('popover_test.text.protocol.step_edit') %>" >
|
||||
<span class="fas fa-pencil-alt">
|
||||
</a>
|
||||
<%= link_to(step_path(step), title: t("protocols.steps.options.delete_title"), method: "delete", class: "btn btn-link",
|
||||
|
|
Loading…
Reference in a new issue