src/StartPlatz/Bundle/MentorsBundle/Resources/views/Public/_accelerator-mentor-card.html.twig line 1

Open in your IDE?
  1. {# AI Accelerator Mentor Card - Simplified Version #}
  2. {% set mentorData = mentor.mentorMetadata %}
  3. {# Set language for all fields #}
  4. {% if language is defined %}
  5.     {% set lang = language %}
  6. {% else %}
  7.     {% set lang = app.request.locale|default('de') %}
  8. {% endif %}
  9. {% if lang not in ['de', 'en'] %}{% set lang = 'de' %}{% endif %}
  10. <div class="mentor-card accelerator-modern" data-categories="{{ mentor.categories|join(',') }}">
  11.     {# Edit Icon for Admins/Masters #}
  12.     {% if is_granted('ROLE_ADMIN') or is_granted('ROLE_MASTER') %}
  13.         <a href="{{ path('admin_mentors_edit', {'category': 'accelerator', 'id': mentor.id}) }}"
  14.            class="edit-corner-link"
  15.            title="Bearbeiten"
  16.            aria-label="Mentor bearbeiten">
  17.             <i class="fas fa-edit"></i>
  18.         </a>
  19.     {% endif %}
  20.     {# SP-Connect URL using the correct route #}
  21.     {% if mentor.id %}
  22.         {% set spConnectUrl = path('connect_mentor_show', {'id': mentor.id}) %}
  23.         <a href="{{ spConnectUrl }}"
  24.            target="_blank"
  25.            rel="noopener noreferrer"
  26.            class="sp-connect-corner-link"
  27.            aria-label="{{ lang == 'de' ? 'SP-Connect Profil von' : 'SP-Connect Profile of' }} {{ mentor.firstName }} {{ mentor.lastName }}"
  28.            title="{{ lang == 'de' ? 'SP-Connect Profil ansehen' : 'View SP-Connect Profile' }}">
  29.             <i class="fas fa-rocket"></i>
  30.         </a>
  31.     {% endif %}
  32.     <div class="card-gradient-overlay"></div>
  33.     <div class="mentor-visual">
  34.         <img src="{{ mentor.profileImage|default('https://res.cloudinary.com/startplatz/image/upload/v1637360496/Wordpress/Sprechstunden/Sprechstunden_Platzhalter.jpg') }}"
  35.              alt="{{ mentor.firstName }} {{ mentor.lastName }}"
  36.              class="profile-image">
  37.         {# Badge removed for cleaner design #}
  38.     </div>
  39.     <div class="mentor-content">
  40.         <h3 class="mentor-name">{{ mentor.academicTitle ? mentor.academicTitle ~ ' ' : '' }}{{ mentor.firstName }} {{ mentor.lastName }}</h3>
  41.         {# Mentor Institution - NEW FIELD #}
  42.         {% set institutionField = 'mentorInstitution_' ~ lang %}
  43.         {% set mentorInstitution = attribute(mentorData, institutionField) is defined ? attribute(mentorData, institutionField) : null %}
  44.         {% if not mentorInstitution %}
  45.             {# Fallback to company or firma #}
  46.             {% set mentorInstitution = mentor.company|default(mentor.mentorFirma|default('')) %}
  47.         {% endif %}
  48.         {% if mentorInstitution %}
  49.             <p class="mentor-tagline text-muted">{{ mentorInstitution }}</p>
  50.         {% endif %}
  51.         {# Mentor Bio - NEW SIMPLIFIED FIELD with fallback #}
  52.         {% set bioField = 'mentorBio_' ~ lang %}
  53.         {% set mentorBio = attribute(mentorData, bioField) is defined ? attribute(mentorData, bioField) : null %}
  54.         {% if not mentorBio %}
  55.             {# Fallback to description #}
  56.             {% set mentorBio = mentor.mentorProfile|default(mentor.description|default('')) %}
  57.         {% endif %}
  58.         {% if mentorBio %}
  59.             <p class="mentor-bio">
  60.                 {{ mentorBio|striptags|slice(0, 160) }}{% if mentorBio|striptags|length > 160 %}...{% endif %}
  61.             </p>
  62.         {% else %}
  63.             <p class="mentor-bio text-muted">
  64.                 <em>{{ lang == 'de' ? 'Profil in Bearbeitung' : 'Profile under construction' }}</em>
  65.             </p>
  66.         {% endif %}
  67.         {# Meine Themen / My Topics - NEW FIELD #}
  68.         {% set topicsField = 'mentorTopics_' ~ lang %}
  69.         {% set mentorTopics = attribute(mentorData, topicsField) is defined ? attribute(mentorData, topicsField) : null %}
  70.         {% if not mentorTopics %}
  71.             {# Fallback to buildWithMe or skills if available #}
  72.             {% set buildField = 'buildWithMe_' ~ lang %}
  73.             {% set mentorTopics = attribute(mentorData, buildField) is defined ? attribute(mentorData, buildField) : null %}
  74.             {% if not mentorTopics and mentor.skills %}
  75.                 {% if mentor.skills is iterable %}
  76.                     {# Skills is already an array #}
  77.                     {% set skills = mentor.skills|slice(0,3) %}
  78.                 {% else %}
  79.                     {# Skills is a string, process it #}
  80.                     {% set skills = mentor.skills|replace({'#': ''})|split(' ')|slice(0,3) %}
  81.                 {% endif %}
  82.                 {% set mentorTopics = skills|join(', ') %}
  83.             {% endif %}
  84.         {% endif %}
  85.         {% if mentorTopics %}
  86.             <div class="mentor-feature mb-2">
  87.                 <strong class="text-muted small">{{ lang == 'de' ? 'Meine Themen:' : 'My Topics:' }}</strong>
  88.                 <span class="text-dark">{{ mentorTopics }}</span>
  89.             </div>
  90.         {% endif %}
  91.         {# Connect With Me - Multi-Select #}
  92.         {% set connectModes = mentorData.connectModes ?? ['community'] %}
  93.         {% if connectModes is not empty %}
  94.             <div class="mentor-feature mb-3">
  95.                 <strong class="text-muted small d-block mb-1">Connect with me:</strong>
  96.                 <ul class="list-unstyled mb-0 small">
  97.                     {% set modeLabels = {
  98.                         'appointment': {
  99.                             'de': 'Ich vereinbare gerne individuelle Termine',
  100.                             'en': 'I\'m happy to schedule individual appointments',
  101.                             'icon': '📅'
  102.                         },
  103.                         'community': {
  104.                             'de': 'Vernetz dich im STARTPLATZ Netzwerk',
  105.                             'en': 'Connect through the STARTPLATZ network',
  106.                             'icon': '🤝'
  107.                         },
  108.                         'events': {
  109.                             'de': 'Triff mich bei Veranstaltungen des Accelerators',
  110.                             'en': 'Meet me at Accelerator events',
  111.                             'icon': '🎪'
  112.                         },
  113.                         'office_hours': {
  114.                             'de': 'Besuche mich bei den STARTPLATZ Office Hours',
  115.                             'en': 'Visit me at STARTPLATZ Office Hours',
  116.                             'icon': '🏢'
  117.                         },
  118.                         'speaking': {
  119.                             'de': 'Ich gebe Workshops und Vorträge im Programm',
  120.                             'en': 'I give workshops and talks in the program',
  121.                             'icon': '🎤'
  122.                         }
  123.                     } %}
  124.                     {# Sort alphabetically by label #}
  125.                     {% set sortedModes = [] %}
  126.                     {% for mode in connectModes %}
  127.                         {% if modeLabels[mode] is defined %}
  128.                             {% set sortedModes = sortedModes|merge([{
  129.                                 'code': mode,
  130.                                 'label': modeLabels[mode][lang] ?? modeLabels[mode]['de'],
  131.                                 'icon': modeLabels[mode].icon
  132.                             }]) %}
  133.                         {% endif %}
  134.                     {% endfor %}
  135.                     {% set sortedModes = sortedModes|sort((a, b) => a.label <=> b.label) %}
  136.                     {# Display sorted list #}
  137.                     {% for item in sortedModes %}
  138.                         <li class="text-info">
  139.                             <span class="mr-1">{{ item.icon }}</span>{{ item.label }}
  140.                         </li>
  141.                     {% endfor %}
  142.                 </ul>
  143.             </div>
  144.         {% endif %}
  145.         {# Social Links - GitHub still shown if available #}
  146.         {% if mentorData.githubUrl is defined and mentorData.githubUrl %}
  147.             <div class="social-links">
  148.                 <a href="{{ mentorData.githubUrl }}" target="_blank" class="social-icon" title="GitHub">
  149.                     <i class="fab fa-github"></i>
  150.                 </a>
  151.             </div>
  152.         {% endif %}
  153.     </div>
  154. </div>