Skip to content

Commit

Permalink
Merge pull request #1165 from RRZE-Webteam/beta
Browse files Browse the repository at this point in the history
Beta
  • Loading branch information
xwolfde authored Jul 7, 2022
2 parents 8c7b4b0 + 97ddf90 commit 2fab330
Show file tree
Hide file tree
Showing 23 changed files with 251 additions and 22,279 deletions.
5,215 changes: 1 addition & 5,214 deletions css/fau-theme-admin.css

Large diffs are not rendered by default.

36 changes: 31 additions & 5 deletions functions/constants.php
Original file line number Diff line number Diff line change
Expand Up @@ -386,16 +386,41 @@ function fau_compatible_header_logo() {
/*--------------------------------------------------------------------*/
/* Suchfelder
/*--------------------------------------------------------------------*/
function fau_get_searchable_fields() {
$search_post_types = array("page", "post", "attachment");
function fau_get_searchable_fields($format = 'array') {
// $search_post_types = array("page", "post", "attachment");
$search_post_typelist = array(
"page" => __('Seiten','fau'),
"post" => __('Artikel','fau'),
"attachment" => __('Dokumente und Bilder','fau'),
);

if (class_exists('FAU_Studienangebot')) {
$search_post_types[] ='studienangebot';
// $search_post_types[] ='studienangebot';
$addsearch= array('studienangebot' => __('Studienangebot','fau'));
$search_post_typelist = array_merge($search_post_typelist, $addsearch);
}
if (class_exists('FAU_Person')) {
$search_post_types[] ='person';
// $search_post_types[] ='person';
$addsearch = array('person' => __('Kontakte','fau'));
$search_post_typelist = array_merge($search_post_typelist, $addsearch);
}
if (class_exists('RRZE\FAQ\CPT')) {
// $search_post_types[] = 'faq';
$addsearch= array('faq' => __('Fragen und Antworten','fau'));
$search_post_typelist = array_merge($search_post_typelist, $addsearch);
}

if ($format === 'list') {
return $search_post_typelist;
} else {
return array_keys($search_post_typelist);
}

return $search_post_types;




}
/*--------------------------------------------------------------------*/
/* Erstelle globale Kategorieliste
Expand Down Expand Up @@ -984,11 +1009,12 @@ function fau_get_searchable_fields() {
'type' => 'multiselectlist',
'title' => __( 'Filter', 'fau' ),
'label' => __( 'Vorab aktivierte Suchbereiche des Filters. In diesen wird gesucht, wenn der Nutzer der Seite keine Auswahl trifft oder diese nicht zur Verfügung gestellt wird.', 'fau' ),
'liste' => array(
'listeold' => array(
"page" => __('Seiten','fau'),
"post" => __('Artikel','fau'),
"attachment" => __('Dokumente und Bilder','fau'),
),
'liste' => fau_get_searchable_fields('list'),
'default' => $defaultoptions['search_post_types_checked'],
'parent' => 'suchergebnisse'
),
Expand Down
48 changes: 20 additions & 28 deletions functions/custom-fields.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,7 @@ function fau_add_metabox_page() {

add_meta_box(
'fau_metabox_page_untertitel',
esc_html__( 'Untertitel', 'fau' ),
'fau_do_metabox_page_untertitel',
'page','normal','low',
esc_html__( 'Untertitel', 'fau' ), 'fau_do_metabox_page_untertitel', 'page','normal','low',
array(
'__block_editor_compatible_meta_box' => true,
)
Expand Down Expand Up @@ -403,17 +401,10 @@ function fau_save_metabox_post_untertitel($post_id, $post) {
if (!current_user_can('edit_post', $post_id)) {
return;
}

$newval = isset($_POST['fau_metabox_post_untertitel']) ? sanitize_text_field($_POST['fau_metabox_post_untertitel']) : '';
$oldval = get_post_meta($post_id, 'fauval_untertitel', true);
fau_save_standard('fauval_untertitel', $newval, $post_id, 'post', 'text');

if (!empty($newval) && !empty($oldval)) {
update_post_meta($post_id, 'fauval_untertitel', $newval);
} elseif (!empty($newval) && empty($oldval)) {
add_post_meta($post_id, 'fauval_untertitel', $newval, true);
} else {
delete_post_meta($post_id, 'fauval_untertitel');
}
}

/* Display Options for menuquotes on pages */
Expand Down Expand Up @@ -444,15 +435,9 @@ function fau_save_metabox_page_untertitel( $post_id, $post ) {
}

$newval = isset($_POST['fau_metabox_page_untertitel']) ? sanitize_text_field($_POST['fau_metabox_page_untertitel']) : '';
$oldval = get_post_meta( $post_id, 'headline', true );
fau_save_standard('headline', $newval, $post_id, 'post', 'text');


if (!empty($newval) && !empty($oldval)) {
update_post_meta($post_id, 'headline', $newval);
} elseif (!empty($newval) && empty($oldval)) {
add_post_meta($post_id, 'headline', $newval, true);
} else {
delete_post_meta($post_id, 'headline');
}
}

/* Display Options for portalmenu unten on portal pages */
Expand Down Expand Up @@ -1039,16 +1024,20 @@ function fau_do_metabox_page_additional_attributes($object, $box) {
fau_form_select('fau_metabox_page_title_langcode', $liste, $prevalue, $labeltext, $howtotext);
}

echo '<div class="ontemplate_page-subnav">';


$ignoresubnavi = get_post_meta($object->ID, 'fauval_hide-in-subnav', true);
$labeltext = __('Seite verbergen','fau');
$howtotext = __('Diese Seite wird nicht im Navigationsmenü im Inhaltsbereich gezeigt.','fau').' '.$only_subnavi;
fau_form_toggle('fau_metabox_page_hide-in-subnav', $ignoresubnavi, $labeltext, $howtotext);

$ignoresubnavi = get_post_meta($object->ID, 'fauval_hide-in-subnav', true);
$labeltext = __('Seite verbergen','fau');
$howtotext = __('Diese Seite wird nicht im Navigationsmenü im Inhaltsbereich gezeigt.','fau').' '.$only_subnavi;
echo '<div class="ontemplate_page-subnav">';
fau_form_toggle('fau_metabox_page_hide-in-subnav', $ignoresubnavi, $labeltext, $howtotext);
echo '</div>';
echo '</div>';



$arialabel_subnav = get_post_meta($object->ID, 'fauval_aria-label', true);
$labeltext = __('ARIA Label','fau');
$howtotext = __('Wird der Seitentitel auch von einer oder mehreren anderen Seiten verwendet, ist es notwendig, diesen über ein ARIA-Label von den anderen Seiten zu unterscheiden. In diesem Label kann der Titel ergänzt werden um ein Kontext, der die Seite von anderen Seiten mit gleichen Namen unterscheidet.','fau');
fau_form_text('fau_metabox_page_aria-label', $arialabel_subnav, $labeltext, $howtotext);

if (get_theme_mod('website_type')==-1) {
$menuebene = get_post_meta($object->ID, 'menu-level', true);
Expand Down Expand Up @@ -1141,6 +1130,9 @@ function fau_save_metabox_page_additional_attributes( $post_id, $post ) {
$newval = isset($_POST['fau_metabox_page_imagelinks_size']) ? esc_attr($_POST['fau_metabox_page_imagelinks_size']) : '';
fau_save_standard('fauval_imagelink_size', $newval, $post_id, 'post', 'text');

$newval = isset($_POST['fau_metabox_page_aria-label']) ? sanitize_text_field($_POST['fau_metabox_page_aria-label']) : '';
fau_save_standard('fauval_aria-label', $newval, $post_id, 'post', 'text');


}
/*-----------------------------------------------------------------------------------*/
Expand Down
16 changes: 15 additions & 1 deletion functions/filters.php
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ function fau_add_classes_to_linked_images($content) {
$classes = 'media-img'; // can do multiple classes, separate with space

if (preg_match('/<a href=\"([^\"]+)\.(bmp|gif|jpeg|jpg|png)(?![\w.\-_])\"><img/i', $content) ) {
// link geht auf die Bilddtaie direkt, ergänze daher die class lightbox, bisher keine class gesetzt
// link geht auf die Bilddatei direkt, ergänze daher die class lightbox, bisher keine class gesetzt
$pattern = '/<a href=\"([^\"]+)\.(bmp|gif|jpeg|jpg|png)(?![\w.\-_])\"><img/i';
$replacement = '<a class="lightbox" href="$1.$2"><img';
$content = preg_replace($pattern, $replacement, $content);
Expand Down Expand Up @@ -367,3 +367,17 @@ function fau_remove_type_attr($tag, $handle) {
}
add_filter('style_loader_tag', 'fau_remove_type_attr', 10, 2);
add_filter('script_loader_tag', 'fau_remove_type_attr', 10, 2);


/*-----------------------------------------------------------------------------------*/
/* Add additional aria-label-attribut for special pages
/*-----------------------------------------------------------------------------------*/
function fau_add_aria_label_pages( $atts, $item, $args ) {
$arialabel_subnav = get_post_meta($item->object_id, 'fauval_aria-label', true);

if (!fau_empty($arialabel_subnav)) {
$atts['aria-label'] = $arialabel_subnav;
}
return $atts;
}
add_filter( 'nav_menu_link_attributes', 'fau_add_aria_label_pages', 10, 3 );
3 changes: 1 addition & 2 deletions functions/menu.php
Original file line number Diff line number Diff line change
Expand Up @@ -568,8 +568,7 @@ function start_el(&$output, $item, $depth = 0, $args = array(), $id = 0) {
$output .= apply_filters('walker_nav_menu_start_el', $item_output, $item, $depth, $args);
}

function end_el(&$output, $item, $depth = 0, $args = array())
{
function end_el(&$output, $item, $depth = 0, $args = array()) {

if ($this->level == 1 ||
($this->level == 2 && $this->count[$this->level] <= $this->maxsecondlevel && $this->showsub)) {
Expand Down
72 changes: 35 additions & 37 deletions functions/shortcodes.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,8 @@ function add_shortcodes() {
// Portalmenu
add_shortcode( 'portalmenu', array( $this, 'fau_portalmenu'));


}


/*-----------------------------------------------------------------------------------*/
/* Portalmenus als Shortcode
/*-----------------------------------------------------------------------------------*/
Expand All @@ -49,10 +47,10 @@ function fau_portalmenu( $atts, $content = null) {
$error .= "name=$menu";
if (! fau_empty($menu)) {

$showsubs = filter_var($showsubs, FILTER_VALIDATE_BOOLEAN);
$nothumbs = filter_var($nothumbs, FILTER_VALIDATE_BOOLEAN);
$nofallback = filter_var($nofallback, FILTER_VALIDATE_BOOLEAN);
$skewed = filter_var($skewed, FILTER_VALIDATE_BOOLEAN);
$showsubs = filter_var($showsubs, FILTER_VALIDATE_BOOLEAN);
$nothumbs = filter_var($nothumbs, FILTER_VALIDATE_BOOLEAN);
$nofallback = filter_var($nofallback, FILTER_VALIDATE_BOOLEAN);
$skewed = filter_var($skewed, FILTER_VALIDATE_BOOLEAN);


if ($menu == sanitize_key($menu)) {
Expand All @@ -63,35 +61,35 @@ function fau_portalmenu( $atts, $content = null) {
if ($term===false) {
$out = $error;
} else {
$slug = $term->slug;
$subentries = get_theme_mod('default_submenu_entries');
$slug = $term->slug;
$subentries = get_theme_mod('default_submenu_entries');
if ($showsubs===false) {
$subentries = 0;
}
// $spalte = get_theme_mod('default_submenu_spalten');

$a_contentmenuclasses[] = 'contentmenu';
$thumbnail = 'rwd-480-2-1';
$type = intval($type);

switch ($type) {
case 1:
$thumbnail = 'rwd-480-2-1';
$a_contentmenuclasses[] = 'size_2-1';
break;
case 2:
$a_contentmenuclasses[] = 'size_3-2';
$thumbnail = 'full';
break;
case 3:
$a_contentmenuclasses[] = 'size_3-4';
$thumbnail = 'full';
break;
default:
$thumbnail = 'rwd-480-2-1';
$type = 1;
break;
}
// $spalte = get_theme_mod('default_submenu_spalten');

$a_contentmenuclasses[] = 'contentmenu';
$thumbnail = 'rwd-480-2-1';
$type = intval($type);

switch ($type) {
case 1:
$thumbnail = 'rwd-480-2-1';
$a_contentmenuclasses[] = 'size_2-1';
break;
case 2:
$a_contentmenuclasses[] = 'size_3-2';
$thumbnail = 'full';
break;
case 3:
$a_contentmenuclasses[] = 'size_3-4';
$thumbnail = 'full';
break;
default:
$thumbnail = 'rwd-480-2-1';
$type = 1;
break;
}



Expand All @@ -102,17 +100,17 @@ function fau_portalmenu( $atts, $content = null) {
$a_contentmenuclasses[] = 'no-sub';
}
if ($nofallback === true) {
$a_contentmenuclasses[] = 'no-fallback';
}
$a_contentmenuclasses[] = 'no-fallback';
}
if ($nothumbs === true) {
$a_contentmenuclasses[] = 'no-thumb';
}
$a_contentmenuclasses[] = 'no-thumb';
}
$out .= '<div class="'. implode(' ',$a_contentmenuclasses) . '" role="navigation" aria-label="'.__('Inhaltsmenü','fau').'">';
$out .= '<ul class="subpages-menu">';
$outnav = wp_nav_menu( array( 'menu' => $slug,
'echo' => false,
'container' => true,
'items_wrap' => '%3$s',
'items_wrap' => '%3$s',
'link_before' => '',
'link_after' => '',
'item_spacing' => 'discard',
Expand Down
5 changes: 2 additions & 3 deletions functions/template-functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -539,7 +539,6 @@ function fau_display_search_resultitem() {
$output .= $attachment['image'];
} else {
$output .= fau_get_image_fallback_htmlcode('rwd-480-3-2', '', 'fallback');
// $output .= '<img src="'.fau_esc_url($attachment['icon']).'" class="fallback" alt="">';
}

$output .= "\t\t".'</div>'."\n";
Expand Down Expand Up @@ -1785,7 +1784,7 @@ function fau_get_image_htmlcode($id = 0, $size = 'rwd-480-3-2', $alttext = '', $
if ($attributes) {
$item_output .= $attributes;
}
$item_output .= '>';
$item_output .= ' loading="lazy">';

return $item_output;
}
Expand Down Expand Up @@ -1893,7 +1892,7 @@ function fau_get_image_fallback_htmlcode($size = 'rwd-480-3-2', $alttext = '', $
if ($attributes) {
$item_output .= $attributes;
}
$item_output .= '>';
$item_output .= ' loading="lazy">';

return $item_output;

Expand Down
4 changes: 2 additions & 2 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,7 @@ function unset_debugmode() {
*/
function upversionpatch() {
var newVer = semver.inc(info.version, 'patch');
return src(['./package.json', 'theme.json', './' + info.maincss])
return src(['./package.json','./' + info.maincss])
.pipe(bump({
version: newVer
}))
Expand All @@ -438,7 +438,7 @@ function upversionpatch() {
*/
function devversion() {
var newVer = semver.inc(info.version, 'prerelease');
return src(['./package.json', 'theme.json', './' + info.maincss])
return src(['./package.json', './' + info.maincss])
.pipe(bump({
version: newVer
}))
Expand Down
2 changes: 1 addition & 1 deletion js/fau-theme.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "FAU-Einrichtungen",
"textdomain": "fau",
"version": "2.1.2-5",
"version": "2.1.4",
"keywords": [
"WordPress",
"Theme",
Expand Down
2 changes: 1 addition & 1 deletion print.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion searchform.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
// Only Posts please :)
echo '<input type="hidden" name="post_type[]" value="post">'."\n";
} else {
$listtypes = get_theme_mod('search_post_types');
$listtypes = fau_get_searchable_fields(); // get_theme_mod('search_post_types');
$autosearch_types = get_theme_mod('search_post_types_checked');
foreach ($listtypes as $type) {
if (in_array($type, $autosearch_types)) {
Expand Down
12 changes: 12 additions & 0 deletions src/js/main/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,18 @@ jQuery(document).ready(function ($) {
$(window).scroll(fixedHeader); // TODO: Automatically debounced via JQuery?


// Add custom var with height for fixed header
var setHeaderHeight = function() {
document.documentElement.removeAttribute('style');
var headerHeight = document.querySelector('#headerwrapper').scrollHeight;
document.documentElement.style.setProperty('--js-fixed-header-height', `${headerHeight}px`);
};

setHeaderHeight();




// Add toggle icons to organigram
$('.organigram .has-sub').each(function () {
$(this).prepend('<span class="toggle-icon"></span>');
Expand Down
1 change: 1 addition & 0 deletions src/sass/_variables.scss
Original file line number Diff line number Diff line change
Expand Up @@ -397,6 +397,7 @@ $grid-gutter-width: $fau-gutter-width;


$searchbackdrop-offset-top: 195px;
$scroll-target-offset: 190px;

$subnav-width-sm: 260px;
$subnav-width-md: 275px;
Expand Down
Loading

0 comments on commit 2fab330

Please sign in to comment.