Minor - Spacing and naming changes in visibility switch for tools on course homepage - refs #3301

pull/3368/head
Yannick Warnier 5 years ago
parent e81dd33dcf
commit 862f2b7c10
  1. 1
      main/course_home/activity.php
  2. 28
      main/course_home/course_home.php
  3. 2
      main/inc/introductionSection.inc.php
  4. 4
      main/inc/lib/course_home.lib.php

@ -52,7 +52,6 @@ if ($session_id === 0 && api_is_course_admin() && api_is_allowed_to_edit(null, t
<div class="alert alert-success" id="id_confirmation_message" style="display:none"></div>
</div>';
$content .= $pluginExtra;
} elseif (api_is_coach()) {
$content .= $pluginExtra;
if (api_get_setting('show_session_data') === 'true' && $session_id > 0) {

@ -35,19 +35,22 @@ require_once __DIR__.'/../inc/global.inc.php';
$js = '<script>'.api_get_language_translate_html().'</script>';
$htmlHeadXtra[] = $js;
$htmlHeadXtra[] = '<script>
$htmlHeadXtra[] = '<script type="text/javascript">
/* show eye for all show/hide*/
function buttomForAllShowHide()
function buttonForAllShowHide()
{
tools_invisibles = [];
tools_visibles = [];
$.each($(".make_visible_and_invisible").parent(), function (index, item) {
var element = $(item).find("a");
image = $(element[0]).find("em")[0];
// extract the tool ID from the HTML em id, removing linktool_
image_id = $(image).attr("id").replace("linktool_","");
if (!$(image).hasClass("fa-eye-slash")) {
// if the image does not have the eye-slash icon, prepare to make invisible
tools_invisibles.push(image_id)
} else {
// if the image has the eye-slash icon, prepare to make visible
tools_visibles.push(image_id)
}
@ -61,8 +64,8 @@ $htmlHeadXtra[] = '<script>
}
};
/* option show/hide thematic-block */
$(function() {
buttomForAllShowHide();
$(function() {
buttonForAllShowHide();
/* option show/hide all*/
$(".show-hide-all-tools").on("click" , function() {
$(".show-hide-all-tools").addClass("disabled");
@ -78,12 +81,11 @@ $(function() {
tools_visibles.push(image_id)
}
});
messaje_invisible = "'.get_lang('ToolIsNowHidden', '').'";
message_invisible = "'.get_lang('ToolIsNowHidden', '').'";
ids = tools_invisibles;
if (tools_invisibles.length == 0) {
ids = tools_visibles;
messaje_invisible = "'.get_lang('ToolIsNowVisible', '').'";
message_invisible = "'.get_lang('ToolIsNowVisible', '').'";
}
$.ajax({
@ -100,24 +102,23 @@ $(function() {
$.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
//class
$("#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").html(message_invisible);
$("#id_confirmation_message").show();
buttomForAllShowHide();
buttonForAllShowHide();
},
error: function( jqXHR, textStatus, errorThrown ) {
$(".show-hide-all-tools").removeClass("disabled");
$(".normal-message").hide();
buttomForAllShowHide();
buttonForAllShowHide();
}
});
});
@ -185,8 +186,7 @@ $(function() {
}
});
});
});
});
</script>';
// The section for the tabs

@ -295,7 +295,7 @@ if (api_is_allowed_to_edit() && empty($session_id)) {
/* Tool to show /hide all tools on course */
$toolAllShowHide = '';
if (api_is_allowed_to_edit() && empty($session_id)) {
$toolAllShowHide = '<button class="btn btn-default hidden visible-all show-hide-all-tools" title="'.get_lang('Activate', '').'"><em class="fa fa-eye "></em></button>';
$toolAllShowHide = '<button class="btn btn-default hidden visible-all show-hide-all-tools" title="'.get_lang('Activate', '').'"><em class="fa fa-eye"></em></button>';
$toolAllShowHide .= '<button class="btn btn-default hidden invisible-all show-hide-all-tools" title="'.get_lang('Deactivate', '').'"><em class="fa fa-eye-slash"></em></button>';
}

@ -898,7 +898,7 @@ class CourseHome
ICON_SIZE_SMALL,
false
);
$link['name']='<em id="'.'linktool_'.$tool['iid'].'"class="fa fa-eye" title="'.get_lang('Deactivate').'"></em>';
$link['name']='<em id="'.'linktool_'.$tool['iid'].'" class="fa fa-eye" title="'.get_lang('Deactivate').'"></em>';
$link['cmd'] = 'hide=yes';
$lnk[] = $link;
}
@ -910,7 +910,7 @@ class CourseHome
ICON_SIZE_SMALL,
false
);
$link['name']='<em id="'.'linktool_'.$tool['iid'].'"class="fa fa-eye-slash text-muted" title="'.get_lang('Activate').'"></em>';
$link['name']='<em id="'.'linktool_'.$tool['iid'].'" class="fa fa-eye-slash text-muted" title="'.get_lang('Activate').'"></em>';
$link['cmd'] = 'restore=yes';
$lnk[] = $link;
}

Loading…
Cancel
Save