doctype html
html lang='en'
  head
    meta charset='utf8'
    meta name='viewport' content='width=device-width, initial-scale=1'
    = render('breadcrumbs_and_title')
    title
      = yield(:title)
    link href=asset_path('favicon.png') rel='icon' type='image/png'
    = action_cable_meta_tag
    = stylesheet_pack_tag('application', media: 'all', 'data-turbolinks-track': true)
    = stylesheet_pack_tag('stylesheets', media: 'all', 'data-turbolinks-track': true)
    = stylesheet_link_tag('application', media: 'all', 'data-turbolinks-track': true)
    = javascript_pack_tag('application', 'data-turbolinks-track': true)
    = javascript_include_tag('application', 'data-turbolinks-track': true)
    = yield(:head)
    = csrf_meta_tags
    = timeago_script_tag
    - unless Raven.configuration.current_environment == "development"
      script type="text/javascript"
        | I18n.defaultLocale = "#{I18n.default_locale}";
        | I18n.locale = "#{I18n.locale}";
        | Sentry.init({
        |      dsn: 'https://637ca99538224b4bb28cd9e670e1b372@sentry.xikolo.de/33',
        |      attachStacktrace: true,
        |      release: "#{Raven.configuration.release}",
        |      environment: "#{Raven.configuration.current_environment}",
        |  });
        - if @current_user
          | Sentry.configureScope(function(scope) {
          |   scope.setUser({
          |      "id": "#{@current_user.id}",
          |      "type": "#{@current_user.class.name}",
          |      "username": "#{@current_user.displayname}",
          |      "consumer": "#{@current_user.consumer.name}"
          |    });
          |  });
  body
    - unless @embed_options[:hide_navbar]
      nav.navbar.navbar-dark.bg-dark.navbar-expand-md.mb-4.py-1 role='navigation'
        .container
          .navbar-brand
            i.fa.fa-code
            = application_name
          button.navbar-toggler data-target='#navbar-collapse' data-toggle='collapse' type='button' aria-expanded='false' aria-label='Toggle navigation'
            span.navbar-toggler-icon
          #navbar-collapse.collapse.navbar-collapse
            = render('navigation', cached: true)
            ul.nav.navbar-nav.ml-auto
              = render('locale_selector', cached: true)
              li.nav-item.mr-3 = link_to(t('shared.help.link'), '#modal-help', data: {toggle: 'modal'}, class: 'nav-link')
              = render('session')
    div data-controller=controller_name
      = render('flash')
      - if current_user.try(:admin?) or current_user.try(:teacher?) && !@embed_options[:hide_navbar]
        = yield(:breadcrumbs)
    - if (controller_name == "exercises" && action_name == "implement")
      .container-fluid
        = yield
    - else
      .container
        = yield

    - template_variables = {execution_environment: @exercise.execution_environment} if action_name == 'implement'
    = render('shared/modal', classes: 'modal-lg', id: 'modal-help', template: 'application/help', template_variables: template_variables, title: t('shared.help.headline'))
