<commit_before>- minimal = params[:action] === 'embed'

- if @certificate.expired? || @certificate.expiring?
  - content_for :header do
    %header.notice{class: @certificate.expired? ? 'notice-error' : 'notice-warning'}
      .container
        %h1
          - if @certificate.expired?
            %i.icon.icon-warning-sign
              Expired
            %p= t('certificate.expired_notice', jurisdiction: @certificate.response_set.jurisdiction)
          - else
            %i.icon.icon-warning-sign
              Warning
            %p= t('certificate.expiring_notice', jurisdiction: @certificate.response_set.jurisdiction, days: @certificate.days_to_expiry)

- scope_locale @certificate.response_set.locale do

  .certificate.hero-unit{class: "#{@certificate.attained_level}-level"}
    - unless minimal
      %ul.pull-right.unstyled
        - if @certificate.response_set.published?
          %li= link_to(t("certificates.embed_this_on_your_site"), "#embed-#{@certificate.id}", :class => 'btn btn-small btn-info pull-right', 'data-toggle' => :modal)
        - elsif @certificate.response_set.draft?
          %li
            .btn.btn-small.btn-info.pull-right{disabled:'disabled'}= t 'certificate.not_yet_published'
          %li
            =#link_to t('certificate.edit_questionnaire'), [surveyor, @certificate.response_set], class: 'btn btn-small btn-info pull-left'
            =link_to t('certificate.edit_questionnaire'), surveyor.continue_my_survey_path(survey_code: @certificate.response_set.survey.access_code, response_set_code: @certificate.response_set.access_code), class: 'btn btn-small btn-info pull-left'
      =render :partial => 'shared/embed_code', :locals => {:certificate => @certificate}

    .certificate-badge.centered

    .certificate-summary
      %p.certificate-level
        = t("levels.#{@certificate.attained_level}.title_with_level")
        %small
          = t @certificate.certification_type, scope: 'certificate.certification_types'
        %span.jurisdiction
          %span.badge= @certificate.response_set.jurisdiction
          %span.status= @certificate.response_set.survey.try(:status)
      %p
        = t("certificate.this_data_has_achieved")
        %strong.certificate-level
          #{t("levels.#{@certificate.attained_level}.title_with_level")}
        = t("certificate.on_date", date: @certificate.created_at.strftime("%d %B %Y"))
        = t("certificate.which_means")
        = t("levels.#{@certificate.attained_level}.description")

    %div
      .row
        .span9.offset3
          %h1= @certificate.response_set.title

  - if current_user.try(:admin?)
    = form_for @certificate, url: dataset_certificate_path(@certificate.response_set.dataset.id, @certificate.id), html: {class: "admin-functions #{@certificate.audited ? 'admin-approved' : ''}"} do |f|
      - if @certificate.audited
        %i.icon-ok.icon-large
        = t("certificate.audited")
      - else
        %i.icon-info-sign.icon-large
        = t("certificate.not_audited")

      = f.hidden_field :audited, value: !@certificate.audited
      =submit_tag t(@certificate.audited ? "certificate.unmark_audited" : "certificate.mark_audited"), class: 'btn'

  - if minimal # don't show the summary
    =render @certificate.response_set
  - else
    .row.certicate-content
      .span3
        .well.summary
          = render 'shared/response_set_summary', response_set: @certificate.response_set

        .well.verification
          = render 'community_verification_panel'

      .span9
        = render @certificate.response_set
<commit_msg>NESTING STUFF IN THE H1 MAKES EVERYTHING A BIT SHOUTY<commit_after>- minimal = params[:action] === 'embed'

- if @certificate.expired? || @certificate.expiring?
  - content_for :header do
    %header.notice{class: @certificate.expired? ? 'notice-error' : 'notice-warning'}
      .container
        %h1
          %i.icon.icon-warning-sign
          - if @certificate.expired?
            Expired
            - notice = t('certificate.expired_notice', jurisdiction: @certificate.response_set.jurisdiction)
          - else
            Warning
            - notice = t('certificate.expiring_notice', jurisdiction: @certificate.response_set.jurisdiction, days: @certificate.days_to_expiry)
        %p= notice

- scope_locale @certificate.response_set.locale do

  .certificate.hero-unit{class: "#{@certificate.attained_level}-level"}
    - unless minimal
      %ul.pull-right.unstyled
        - if @certificate.response_set.published?
          %li= link_to(t("certificates.embed_this_on_your_site"), "#embed-#{@certificate.id}", :class => 'btn btn-small btn-info pull-right', 'data-toggle' => :modal)
        - elsif @certificate.response_set.draft?
          %li
            .btn.btn-small.btn-info.pull-right{disabled:'disabled'}= t 'certificate.not_yet_published'
          %li
            =#link_to t('certificate.edit_questionnaire'), [surveyor, @certificate.response_set], class: 'btn btn-small btn-info pull-left'
            =link_to t('certificate.edit_questionnaire'), surveyor.continue_my_survey_path(survey_code: @certificate.response_set.survey.access_code, response_set_code: @certificate.response_set.access_code), class: 'btn btn-small btn-info pull-left'
      =render :partial => 'shared/embed_code', :locals => {:certificate => @certificate}

    .certificate-badge.centered

    .certificate-summary
      %p.certificate-level
        = t("levels.#{@certificate.attained_level}.title_with_level")
        %small
          = t @certificate.certification_type, scope: 'certificate.certification_types'
        %span.jurisdiction
          %span.badge= @certificate.response_set.jurisdiction
          %span.status= @certificate.response_set.survey.try(:status)
      %p
        = t("certificate.this_data_has_achieved")
        %strong.certificate-level
          #{t("levels.#{@certificate.attained_level}.title_with_level")}
        = t("certificate.on_date", date: @certificate.created_at.strftime("%d %B %Y"))
        = t("certificate.which_means")
        = t("levels.#{@certificate.attained_level}.description")

    %div
      .row
        .span9.offset3
          %h1= @certificate.response_set.title

  - if current_user.try(:admin?)
    = form_for @certificate, url: dataset_certificate_path(@certificate.response_set.dataset.id, @certificate.id), html: {class: "admin-functions #{@certificate.audited ? 'admin-approved' : ''}"} do |f|
      - if @certificate.audited
        %i.icon-ok.icon-large
        = t("certificate.audited")
      - else
        %i.icon-info-sign.icon-large
        = t("certificate.not_audited")

      = f.hidden_field :audited, value: !@certificate.audited
      =submit_tag t(@certificate.audited ? "certificate.unmark_audited" : "certificate.mark_audited"), class: 'btn'

  - if minimal # don't show the summary
    =render @certificate.response_set
  - else
    .row.certicate-content
      .span3
        .well.summary
          = render 'shared/response_set_summary', response_set: @certificate.response_set

        .well.verification
          = render 'community_verification_panel'

      .span9
        = render @certificate.response_set

{'fraction_non_alphanumeric': 0.13174404015056462, 'fraction_numerical': 0.0018123518750871323, 'mean_word_length': 3.078453666856168, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5509526', 'n_tokens_mistral': 2310, 'n_tokens_neox': 2251, 'n_words': 348}