Skip to content

Commit

Permalink
Course home: Add icon to switch visibility for all tools in course #3301
Browse files Browse the repository at this point in the history


Code conventions
  • Loading branch information
carlangas159 committed Jun 18, 2020
1 parent f0ab9be commit 9433a7b
Showing 1 changed file with 24 additions and 24 deletions.
48 changes: 24 additions & 24 deletions main/course_home/course_home.php
Expand Up @@ -64,13 +64,13 @@ function buttomForAllShowHide()
$(function() {
buttomForAllShowHide();
/* option show/hide all*/
$(".show-hide-all-tools").on("click",function(){
$(".show-hide-all-tools").on("click" , function() {
$(".show-hide-all-tools").addClass("disabled");
tools_invisibles = [];
tools_visibles = [];
$.each($(".make_visible_and_invisible").parent(), function (index, item) {
var element = $(item).find("a");
image = $(element[0]).find("em")[0];
image = $(element[0]).find("em")[0];
image_id = $(image).attr("id").replace("linktool_","");
if (!$(image).hasClass("fa-eye-slash")) {
tools_invisibles.push(image_id)
Expand All @@ -82,7 +82,7 @@ function buttomForAllShowHide()
ids = tools_invisibles;
if (tools_invisibles.length == 0) {
ids = tools_visibles;
messaje_invisible = "'.get_lang('ToolIsNowVisible', '').'";
messaje_invisible = "'.get_lang('ToolIsNowVisible', '').'";
}
Expand All @@ -96,28 +96,28 @@ function buttomForAllShowHide()
url: "'.api_get_path(WEB_AJAX_PATH).'course_home.ajax.php?'.api_get_cidreq().'&a=set_visibility_for_all",
data: "tools_ids=" + JSON.stringify(ids) + "&sent_http_request=1",
success: function (data) {
data = JSON.parse(data);
$.each(data,function(index,item){
new_current_view = "'.api_get_path(WEB_IMG_PATH).'" + item.view;
//eyes
//$("#linktool_"+item.id).attr("src", new_current_view);
$("#linktool_"+item.id).attr("class", item.fclass);
//tool
$("#toolimage_" + item.id).attr("src", item.image);
//clase
$("#tooldesc_" + item.id).attr("class", item.tclass);
$("#istooldesc_" + item.id).attr("class", item.tclass);
});
$(".show-hide-all-tools").removeClass("disabled");
$(".normal-message").hide();
$("#id_confirmation_message").html(messaje_invisible);
$("#id_confirmation_message").show();
buttomForAllShowHide();
data = JSON.parse(data);
$.each(data,function(index,item){
new_current_view = "'.api_get_path(WEB_IMG_PATH).'" + item.view;
//eyes
//$("#linktool_"+item.id).attr("src", new_current_view);
$("#linktool_"+item.id).attr("class", item.fclass);
//tool
$("#toolimage_" + item.id).attr("src", item.image);
//clase
$("#tooldesc_" + item.id).attr("class", item.tclass);
$("#istooldesc_" + item.id).attr("class", item.tclass);
});
$(".show-hide-all-tools").removeClass("disabled");
$(".normal-message").hide();
$("#id_confirmation_message").html(messaje_invisible);
$("#id_confirmation_message").show();
buttomForAllShowHide();
},
error: function( jqXHR, textStatus, errorThrown ) {
$(".show-hide-all-tools").removeClass("disabled");
$(".normal-message").hide();
buttomForAllShowHide();
error: function( jqXHR, textStatus, errorThrown ) {
$(".show-hide-all-tools").removeClass("disabled");
$(".normal-message").hide();
buttomForAllShowHide();
}
});
});
Expand Down

0 comments on commit 9433a7b

Please sign in to comment.