<commit_before>=javascript_include_tag "transcribe"

=render({ :partial => '/shared/page_tabs', :locals => { :selected => 3, :page_id => @page.id }})

-editor_class = 'page-editor' + (@auto_fullscreen == 'yes' ? ' fullscreen' : '')

=form_for(@page, :url => { :action => 'save_transcription' }, :html => { class: editor_class }) do |f|
  =hidden_field_tag(:page_id, @page.id)
  =validation_summary @page.errors

  .page-toolbar
    .toolbar
      .toolbar_group
        a.button.outline(data-fullscreen-toggle) =t('.fullscreen')
      .toolbar_group
        -layout_modes = { 'ltr' => t('.image_at_the_left'), 'rtl' => t('.image_at_the_right'), 'ttb' => t('.image_at_the_top'), 'btt' => t('.image_at_the_bottom') }
        dl.dropdown.page-columns-layout(data-dropdown='{ "selectable": true }')
          dt.button.outline
            =svg_symbol "#icon-layout-#{@layout_mode}", class: 'icon'
            span.hide-l =layout_modes[@layout_mode]
          dd
            -layout_modes.each do |mode, text|
              a(data-layout-set="#{mode}")
                =svg_symbol "#icon-layout-#{mode}", class: 'icon'
                span =text
      .toolbar_group.hide-m
        label.auto-fullscreen
          =check_box_tag 'auto-fullscreen', 'yes', @auto_fullscreen == 'yes'
          |&nbsp;
          span =t('.always_show_fullscreen')

      .toolbar_group.w100.aright
        =f.label 'mark_blank', t('.mark_as_blank')
        -if @page.status == Page::STATUS_BLANK
          =f.check_box('mark_blank', {checked: true})
        -else
          =f.check_box('mark_blank', {checked: false})

      .toolbar_group.w100.aright
        =f.label 'needs_review', t('.needs_review')
        -if @page.status == Page::STATUS_NEEDS_REVIEW
          =f.check_box('needs_review', {checked: true})
        -else
          =f.check_box('needs_review', {checked: false})

      .toolbar_group.w100.aright
        =button_tag t('.save_changes'), :name => 'save', id: 'save_button_top', onclick: 'unsavedNotes(event);'

  -if @page.status == Page::STATUS_NEEDS_REVIEW
    .page-review
      =t('.this_page_marked_needs_review')

  .page-columns(data-layout-mode="#{@layout_mode}" data-fullheight='{ "bottom": 30, "cssrule": "height" }')
    .page-column
      .page-imagescan
        =render :partial => '/shared/osd_div'

    div class=(!@collection.field_based ? 'page-column' : 'page-column fieldarea')
      -if @page.status == Page::STATUS_BLANK
        .centered
          .centered_content
            p.nodata_text==t('.this_page_marked_blank')
        .page-editarea(style=("display:none"))
          =f.text_area :source_text

      -else
        -if @collection.voice_recognition
          .page-column_voice
            =image_submit_tag 'mic-icon.png', height: '40', alt: t('.microphone'), class: 'voice', id: 'start_img', onclick: 'startButton(event);'
            span.voice-info

        .page-column_actions
          -unless @preview_xml
            =>button_tag t('.preview'), :name => 'preview'
          -else
            =>button_tag t('.edit'), :name => 'edit'
          -unless @collection.subjects_disabled || @collection.field_based
            =>button_tag t('.autolink'), :name => 'autolink'
        -if @preview_xml
          .page-preview[*language_attrs(@collection)] ==xml_to_html(@preview_xml)

        .page-editarea(style=("display:none" if @preview_xml) *language_attrs(@collection))
          -if @work.scribes_can_edit_titles
            .page-editarea_title
              span =f.label :title, t('.title'), class: 'a50'
              span =f.text_field :title
          -if !@collection.field_based
            =f.text_area(:source_text, autocomplete: "off", autocorrect: "off", autocapitalize: "off", spellcheck: false)
            =f.label :source_text, t('.edit_transcription'), class: 'hidden'
          -else
            =render ({partial: 'transcription_field/field_layout', locals: {collection_id: @collection, transcribe: true}})

  .page-toolbar.mt-10
    .toolbar.aright
      =button_tag t('.save_changes'), :name => 'save', id: 'save_button_bottom', onclick: 'unsavedNotes(event);'

.fgfaded ==@work.set_transcription_conventions

.fgfaded.page-indent
  =render :partial => 'shared/markup_help'

.page-indent
  =link_to t('.more_help'), collection_work_help_path(@collection.owner, @collection, @page.work), target: '_blank'

h2.legend t('notes_and_questions')
.page-notes
  =render :partial => "notes/notes"

=render({ :partial => '/shared/collection_footer' })

-unless @current_user_alerted
  -unless current_user.slug.nil?
    -content_for :javascript
      javascript:
        setInterval("transcribe_periodic_timer()", 60000);

        function transcribe_periodic_timer() {
          $.ajax({
            url: "#{collection_transcribe_still_editing_path(current_user.slug, @collection.id, @work.id, @page.id)}",

            complete: function() {
              $(".page-busy-overlay").hide();
            }
          });
        }

        transcribe_periodic_timer();

-content_for :javascript
  javascript:
    //set language for voice to text
    var lang = "#{current_user.dictation_language || @collection.language}";

    $(function() {
      $('[data-fullscreen-toggle]').on('click', function() {
        $(this).toggleClass('pressed');
        $('.page-editor').toggleClass('fullscreen');
        $(window).trigger('resize.FullHeight');
      });
      $('[data-layout-set]').on('click', function() {
        var mode = $(this).data('layout-set');
        Cookies.set('transcribe_layout_mode', mode, { expires: 365 });
        $('[data-layout-mode]').attr('data-layout-mode', mode);
      });
      $('#auto-fullscreen').on('change', function() {
        var checked = this.checked ? 'yes' : 'no';
        Cookies.set('auto_fullscreen', checked, { expires: 365 });
      });

      $('#page_needs_review').click(function(){
        $('#page_mark_blank').prop('checked', false);
      });

      $('#page_mark_blank').click(function(){
        $('#page_needs_review').prop('checked', false);
      });

    });

-unless MIXPANEL_ID.blank?
  javascript:  mixpanel.track("Transcribe Page");
<commit_msg>Fixes 2162 by fixing slim<commit_after>=javascript_include_tag "transcribe"

=render({ :partial => '/shared/page_tabs', :locals => { :selected => 3, :page_id => @page.id }})

-editor_class = 'page-editor' + (@auto_fullscreen == 'yes' ? ' fullscreen' : '')

=form_for(@page, :url => { :action => 'save_transcription' }, :html => { class: editor_class }) do |f|
  =hidden_field_tag(:page_id, @page.id)
  =validation_summary @page.errors

  .page-toolbar
    .toolbar
      .toolbar_group
        a.button.outline(data-fullscreen-toggle) =t('.fullscreen')
      .toolbar_group
        -layout_modes = { 'ltr' => t('.image_at_the_left'), 'rtl' => t('.image_at_the_right'), 'ttb' => t('.image_at_the_top'), 'btt' => t('.image_at_the_bottom') }
        dl.dropdown.page-columns-layout(data-dropdown='{ "selectable": true }')
          dt.button.outline
            =svg_symbol "#icon-layout-#{@layout_mode}", class: 'icon'
            span.hide-l =layout_modes[@layout_mode]
          dd
            -layout_modes.each do |mode, text|
              a(data-layout-set="#{mode}")
                =svg_symbol "#icon-layout-#{mode}", class: 'icon'
                span =text
      .toolbar_group.hide-m
        label.auto-fullscreen
          =check_box_tag 'auto-fullscreen', 'yes', @auto_fullscreen == 'yes'
          |&nbsp;
          span =t('.always_show_fullscreen')

      .toolbar_group.w100.aright
        =f.label 'mark_blank', t('.mark_as_blank')
        -if @page.status == Page::STATUS_BLANK
          =f.check_box('mark_blank', {checked: true})
        -else
          =f.check_box('mark_blank', {checked: false})

      .toolbar_group.w100.aright
        =f.label 'needs_review', t('.needs_review')
        -if @page.status == Page::STATUS_NEEDS_REVIEW
          =f.check_box('needs_review', {checked: true})
        -else
          =f.check_box('needs_review', {checked: false})

      .toolbar_group.w100.aright
        =button_tag t('.save_changes'), :name => 'save', id: 'save_button_top', onclick: 'unsavedNotes(event);'

  -if @page.status == Page::STATUS_NEEDS_REVIEW
    .page-review
      =t('.this_page_marked_needs_review')

  .page-columns(data-layout-mode="#{@layout_mode}" data-fullheight='{ "bottom": 30, "cssrule": "height" }')
    .page-column
      .page-imagescan
        =render :partial => '/shared/osd_div'

    div class=(!@collection.field_based ? 'page-column' : 'page-column fieldarea')
      -if @page.status == Page::STATUS_BLANK
        .centered
          .centered_content
            p.nodata_text==t('.this_page_marked_blank')
        .page-editarea(style=("display:none"))
          =f.text_area :source_text

      -else
        -if @collection.voice_recognition
          .page-column_voice
            =image_submit_tag 'mic-icon.png', height: '40', alt: t('.microphone'), class: 'voice', id: 'start_img', onclick: 'startButton(event);'
            span.voice-info

        .page-column_actions
          -unless @preview_xml
            =>button_tag t('.preview'), :name => 'preview'
          -else
            =>button_tag t('.edit'), :name => 'edit'
          -unless @collection.subjects_disabled || @collection.field_based
            =>button_tag t('.autolink'), :name => 'autolink'
        -if @preview_xml
          .page-preview[*language_attrs(@collection)] ==xml_to_html(@preview_xml)

        .page-editarea(style=("display:none" if @preview_xml) *language_attrs(@collection))
          -if @work.scribes_can_edit_titles
            .page-editarea_title
              span =f.label :title, t('.title'), class: 'a50'
              span =f.text_field :title
          -if !@collection.field_based
            =f.text_area(:source_text, autocomplete: "off", autocorrect: "off", autocapitalize: "off", spellcheck: false)
            =f.label :source_text, t('.edit_transcription'), class: 'hidden'
          -else
            =render ({partial: 'transcription_field/field_layout', locals: {collection_id: @collection, transcribe: true}})

  .page-toolbar.mt-10
    .toolbar.aright
      =button_tag t('.save_changes'), :name => 'save', id: 'save_button_bottom', onclick: 'unsavedNotes(event);'

.fgfaded ==@work.set_transcription_conventions

.fgfaded.page-indent
  =render :partial => 'shared/markup_help'

.page-indent
  =link_to t('.more_help'), collection_work_help_path(@collection.owner, @collection, @page.work), target: '_blank'

h2.legend =t('notes_and_questions')
.page-notes
  =render :partial => "notes/notes"

=render({ :partial => '/shared/collection_footer' })

-unless @current_user_alerted
  -unless current_user.slug.nil?
    -content_for :javascript
      javascript:
        setInterval("transcribe_periodic_timer()", 60000);

        function transcribe_periodic_timer() {
          $.ajax({
            url: "#{collection_transcribe_still_editing_path(current_user.slug, @collection.id, @work.id, @page.id)}",

            complete: function() {
              $(".page-busy-overlay").hide();
            }
          });
        }

        transcribe_periodic_timer();

-content_for :javascript
  javascript:
    //set language for voice to text
    var lang = "#{current_user.dictation_language || @collection.language}";

    $(function() {
      $('[data-fullscreen-toggle]').on('click', function() {
        $(this).toggleClass('pressed');
        $('.page-editor').toggleClass('fullscreen');
        $(window).trigger('resize.FullHeight');
      });
      $('[data-layout-set]').on('click', function() {
        var mode = $(this).data('layout-set');
        Cookies.set('transcribe_layout_mode', mode, { expires: 365 });
        $('[data-layout-mode]').attr('data-layout-mode', mode);
      });
      $('#auto-fullscreen').on('change', function() {
        var checked = this.checked ? 'yes' : 'no';
        Cookies.set('auto_fullscreen', checked, { expires: 365 });
      });

      $('#page_needs_review').click(function(){
        $('#page_mark_blank').prop('checked', false);
      });

      $('#page_mark_blank').click(function(){
        $('#page_needs_review').prop('checked', false);
      });

    });

-unless MIXPANEL_ID.blank?
  javascript:  mixpanel.track("Transcribe Page");

{'fraction_non_alphanumeric': 0.16870891828288567, 'fraction_numerical': 0.005193540533960886, 'mean_word_length': 2.8840214308225653, 'pattern_counts': {'":': 6, '<': 3, '<?xml version=': 0, '>': 49, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 10}, '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': '813604', 'n_tokens_mistral': 4051, 'n_tokens_neox': 3889, 'n_words': 662}