davidherney / moodle-format_onetopic

Course format Onetopic to LMS Moodle
GNU General Public License v3.0
19 stars 44 forks source link

Only add marker class on tabs if section > 0 #131

Closed sharpchi closed 1 year ago

sharpchi commented 1 year ago

We use the marker class on tabs to identify a highlighted section. Since, by default, all courses set marker=0 our lightbulb appears on all section zeros. image

Updating https://github.com/davidherney/moodle-format_onetopic/blob/fda90eae6e42761d6e4a411b691342f92c1a2dc9/classes/output/courseformat/content.php#L283 to read

if ($course->marker == $section && $section > 0) {

would do the trick for us. Happy to do a pull request, if helpful.

sharpchi commented 1 year ago

Since it's a similar issue for us, we also add a class to parent tabs so we can highlight it's a parent tab. So at line 353 (https://github.com/davidherney/moodle-format_onetopic/blob/fda90eae6e42761d6e4a411b691342f92c1a2dc9/classes/output/courseformat/content.php#L353) we add

$parenttab->specialclass = $parenttab->specialclass . ' parenttab';

And we use that to add some font awesome icons. Again, happy to add that to a pull request. If you want me to update the style sheet to include our additions, can do that too.

davidherney commented 1 year ago

Hi @sharpchi...

For the first case: the tab 0 is really highlight and the styles are correct. We can't remove the marker in this case because it is in the correct state.

You can use the tab 0 over tabs without content and not like a tab. Other possibility is overwrite the CSS for the first tab, something like:

.format-onetopic .course-content ul.nav-tabs li.tab_position_0.tab_level_0.marker a {
    font-weight: normal;
    // Other styles.
}

A class for parent tabs is a good idea, but I used the "haschilds" name. It is included in the new release.

I love the arrow icon for tabs with child's... I added it in template directly.

Any more ideas with icons?

Muchas gracias

Saludos

sharpchi commented 1 year ago

Hi David, thanks for looking at this. I'll have a look at the css for the first tab. You asked about other icons. Yes, we've also included the closed eye for hidden sections image We combine this with a slightly altered link title adding the "hiddenfromstudents" string so screenreaders can pick up that it's a hidden section. https://github.com/ltu-solent/moodle-format_onetopic/blob/ab41e7c1160bf403e7cbde8378b40c80a438ab18/classes/output/courseformat/content.php#L257 We also did a very light grey to outline the tab which seemed to work to help ghost the tab. These are the styles we applied. https://github.com/ltu-solent/moodle-theme_solent/blob/MOODLE_400_DEV/scss/moodle/course_format.scss

davidherney commented 1 year ago

I added the "hiddenfromstudents" label for now. I need think more about the icon and border styles.

Saludos