<commit_before>:ruby
  if controller.is_a?( Devise::RegistrationsController )
    form_type = "sign-up"
    form_url = users_path
  elsif controller.is_a?( Devise::SessionsController )
    form_type = "log-in"
    form_url = session_path
  else
    form_type = "edit-after-auth"
    form_url = person_path( resource )
  end
  provider_names = if form_type == "sign-up"
    %w{facebook google_oauth2}
  else
    %w{facebook google_oauth2 flickr twitter yahoo}
  end
- content_for :extracss do
  = stylesheet_link_tag "users/registrations"
- content_for(:extrajs) do
  - if form_type == "sign-up"
    %script{ src: "https://www.google.com/recaptcha/api.js?hl=#{I18n.locale}" }
  = javascript_include_tag "moment/min/moment-with-locales.min"
  = javascript_include_tag "moment-timezone/builds/moment-timezone-with-data-2010-2020.min"
  = javascript_include_tag "users/registrations"

.flexrow
  - obs = @observations[rand(@observations.size)]
  - photo = obs.observation_photos.sort_by{ |op| op.position || op.id }.first.photo
  - place_guess = obs.public_places.select{|p| [Place::COUNTRY_LEVEL, Place::STATE_LEVEL].include?(p.admin_level)}.sort_by(&:admin_level).map(&:name).reverse.join( ", " )
  - place_guess = obs.place_guess if place_guess.blank?
  #imgcol.hidden-xs.hidden-sm{ style: "background-image: url('#{photo.large_url}');" }
    .about-observation
      = link_to_user obs.user, style: "background-image: url('#{obs.user.icon.url(:medium)}');", class: "usericon" do
        &nbsp;
      .details
        %div
          =t :photo_by
        = link_to obs, class: "username" do
          = obs.user.published_name
        %div
          = link_to t( :in_place_x, place: place_guess ), observations_url( lat: obs.latitude, lng: obs.longitude )

  #formcol{ class: form_type }
    .inner
      = form_for resource, url: form_url, html: { novalidate: form_type == "log-in" } do |f|
        %h1
          - if form_type == "sign-up"
            =t :join_the_largest_group_of_naturalists_in_the_world
          - elsif form_type == "log-in"
            =t :welcome_back!
          - else
            =t :almost_there_
            = hidden_field_tag "from_edit_after_auth", true
        .form-group.text-field.email
          = f.text_field :email, autocorrect: "off", autocapitalize: "off", required: true, placeholder: form_type == "log-in" ? t( :username_or_email ) : t( :email ), type: "email", class: "form-control"
          - unless resource.errors[:email].blank?
            .error= formatted_error_sentence_for( resource, :email )
        - if form_type != "log-in"
          - if form_type == "edit-after-auth"
            .form-group.unstacked
              %label=t :please_confirm_your_inat_username, site_name: @site.site_name_short
          .form-group.text-field.username
            = f.text_field :login, autocorrect: "off", autocapitalize: "off", required: true, placeholder: t( :username ), class: "form-control"
            - unless resource.errors[:login].blank?
              .error= formatted_error_sentence_for( resource, :login )
        - if form_type != "edit-after-auth"
          .form-group.text-field.password
            = f.password_field :password, class: "text form-control", required: true, placeholder: t(:password)
            - unless resource.errors[:password].blank?
              .error= formatted_error_sentence_for( resource, :password )
        - if form_type == "sign-up"
          .form-group.text-field.password-confirmation
            = f.password_field :password_confirmation, class: "text form-control", required: true, placeholder: t(:password_confirmation)
            - unless resource.errors[:password_confirmation].blank?
              .error= formatted_error_sentence_for( resource, :password_confirmation )
          - if @site.using_recaptcha?
            .form-group.recaptcha
              .g-recaptcha{ data: { sitekey: @site.google_recaptcha_key, callback: "RecaptchaCallback" }, style: "text-align: center" }
              - if resource.errors && !resource.errors[:recaptcha].blank?
                .error= resource.errors[:recaptcha].to_sentence
        - if %w(sign-up edit-after-auth).include?( form_type )
          #licensing.form-group.checkbox
            %label
              %input#license-all{ type: "checkbox", checked: true }
              #license-fields.hidden
                = f.check_box :preferred_observation_license, { checked: true }, Observation::CC_BY_NC
                = f.check_box :preferred_photo_license, { checked: true }, Observation::CC_BY_NC
                = f.check_box :preferred_sound_license, { checked: true }, Observation::CC_BY_NC
              %span
                =t :yes_license_my_observations_so_scientists_can_use
                %a{ href: "#", data: { toggle: "popover", content: t(:check_this_box_if_html), placement: "top" }, title: t(:about_licenses) }
                  =t :learn_more
          .form-group.hidden
            = f.select :time_zone, ActiveSupport::TimeZone.all.sort.map{|tz| [tz.to_s, tz.name, { "data-tz-name": tz.tzinfo.name } ]}, { }, { class: "time_zone_select" }
        - elsif devise_mapping.rememberable?
          .form-group.checkbox
            %label
              = f.check_box :remember_me
              = t(:remember_me)
        .form-group.centered
          - if form_type == "sign-up"
            = f.submit t(:create_an_account), class: "btn btn-inat btn-primary btn-lg"
          - elsif form_type == "log-in"
            = f.submit t(:log_in), class: "btn btn-inat btn-primary btn-lg"
          - else
            = f.submit t(:save_and_continue).html_safe, class: "btn btn-inat btn-primary btn-lg"
        - if form_type != "edit-after-auth"
          .form-group.centered
            - if form_type == "sign-up"
              = link_to t(:already_have_an_account_log_in_html), login_path, class: "btn btn-link"
            - else
              = link_to t(:dont_have_an_account_sign_up_html), signup_path, class: "btn btn-link"
          .form-group.centered.bigtext
            - if form_type == "sign-up"
              =t :or_all_caps
            - else
              =t :or_log_in_with_colon
          .form-group.centered.provider-authorizations
            - provider_names.each do |provider_name|
              - provider, url = ProviderAuthorization::AUTH_URLS.detect{|p,u| p == provider_name }
              - provider_label = ProviderAuthorization::PROVIDER_NAMES[provider].downcase
              - btn_label = t("sign_#{form_type == "sign-up" ? "up" : "in"}_with_provider", provider: ProviderAuthorization::PROVIDER_NAMES[provider] )
              - if provider_names.size <= 2
                .stacked
                  = link_to url, class: "btn btn-primary btn-lg providerlink #{provider_label}" do
                    %i.fa{ class: "fa-#{provider_label}" }
                    %span= btn_label
              - else
                = link_to url, class: "btn btn-circle providerlink #{provider_label}", alt: btn_label, title: btn_label do
                  %i.fa{ class: "fa-#{provider_label}" }
<commit_msg>Translate place guess place names.<commit_after>:ruby
  if controller.is_a?( Devise::RegistrationsController )
    form_type = "sign-up"
    form_url = users_path
  elsif controller.is_a?( Devise::SessionsController )
    form_type = "log-in"
    form_url = session_path
  else
    form_type = "edit-after-auth"
    form_url = person_path( resource )
  end
  provider_names = if form_type == "sign-up"
    %w{facebook google_oauth2}
  else
    %w{facebook google_oauth2 flickr twitter yahoo}
  end
- content_for :extracss do
  = stylesheet_link_tag "users/registrations"
- content_for(:extrajs) do
  - if form_type == "sign-up"
    %script{ src: "https://www.google.com/recaptcha/api.js?hl=#{I18n.locale}" }
  = javascript_include_tag "moment/min/moment-with-locales.min"
  = javascript_include_tag "moment-timezone/builds/moment-timezone-with-data-2010-2020.min"
  = javascript_include_tag "users/registrations"

.flexrow
  :ruby
    obs = @observations[rand(@observations.size)]
    photo = obs.observation_photos.sort_by{ |op| op.position || op.id }.first.photo
    place_guess = obs.public_places.select{|p| [Place::COUNTRY_LEVEL, Place::STATE_LEVEL].include?(p.admin_level)}.sort_by(&:admin_level).map{|p|
      t(
        p.name.parameterize.underscore,
        default: t(
          "places_name.#{p.name.parameterize.underscore}",
          default: p.name
        )
      )
    }.reverse.join( ", " )
    place_guess = obs.place_guess if place_guess.blank?
  #imgcol.hidden-xs.hidden-sm{ style: "background-image: url('#{photo.large_url}');" }
    .about-observation
      = link_to_user obs.user, style: "background-image: url('#{obs.user.icon.url(:medium)}');", class: "usericon" do
        &nbsp;
      .details
        %div
          =t :photo_by
        = link_to obs, class: "username" do
          = obs.user.published_name
        %div
          = link_to t( :in_place_x, place: place_guess ), observations_url( lat: obs.latitude, lng: obs.longitude )

  #formcol{ class: form_type }
    .inner
      = form_for resource, url: form_url, html: { novalidate: form_type == "log-in" } do |f|
        %h1
          - if form_type == "sign-up"
            =t :join_the_largest_group_of_naturalists_in_the_world
          - elsif form_type == "log-in"
            =t :welcome_back!
          - else
            =t :almost_there_
            = hidden_field_tag "from_edit_after_auth", true
        .form-group.text-field.email
          = f.text_field :email, autocorrect: "off", autocapitalize: "off", required: true, placeholder: form_type == "log-in" ? t( :username_or_email ) : t( :email ), type: "email", class: "form-control"
          - unless resource.errors[:email].blank?
            .error= formatted_error_sentence_for( resource, :email )
        - if form_type != "log-in"
          - if form_type == "edit-after-auth"
            .form-group.unstacked
              %label=t :please_confirm_your_inat_username, site_name: @site.site_name_short
          .form-group.text-field.username
            = f.text_field :login, autocorrect: "off", autocapitalize: "off", required: true, placeholder: t( :username ), class: "form-control"
            - unless resource.errors[:login].blank?
              .error= formatted_error_sentence_for( resource, :login )
        - if form_type != "edit-after-auth"
          .form-group.text-field.password
            = f.password_field :password, class: "text form-control", required: true, placeholder: t(:password)
            - unless resource.errors[:password].blank?
              .error= formatted_error_sentence_for( resource, :password )
        - if form_type == "sign-up"
          .form-group.text-field.password-confirmation
            = f.password_field :password_confirmation, class: "text form-control", required: true, placeholder: t(:password_confirmation)
            - unless resource.errors[:password_confirmation].blank?
              .error= formatted_error_sentence_for( resource, :password_confirmation )
          - if @site.using_recaptcha?
            .form-group.recaptcha
              .g-recaptcha{ data: { sitekey: @site.google_recaptcha_key, callback: "RecaptchaCallback" }, style: "text-align: center" }
              - if resource.errors && !resource.errors[:recaptcha].blank?
                .error= resource.errors[:recaptcha].to_sentence
        - if %w(sign-up edit-after-auth).include?( form_type )
          #licensing.form-group.checkbox
            %label
              %input#license-all{ type: "checkbox", checked: true }
              #license-fields.hidden
                = f.check_box :preferred_observation_license, { checked: true }, Observation::CC_BY_NC
                = f.check_box :preferred_photo_license, { checked: true }, Observation::CC_BY_NC
                = f.check_box :preferred_sound_license, { checked: true }, Observation::CC_BY_NC
              %span
                =t :yes_license_my_observations_so_scientists_can_use
                %a{ href: "#", data: { toggle: "popover", content: t(:check_this_box_if_html), placement: "top" }, title: t(:about_licenses) }
                  =t :learn_more
          .form-group.hidden
            = f.select :time_zone, ActiveSupport::TimeZone.all.sort.map{|tz| [tz.to_s, tz.name, { "data-tz-name": tz.tzinfo.name } ]}, { }, { class: "time_zone_select" }
        - elsif devise_mapping.rememberable?
          .form-group.checkbox
            %label
              = f.check_box :remember_me
              = t(:remember_me)
        .form-group.centered
          - if form_type == "sign-up"
            = f.submit t(:create_an_account), class: "btn btn-inat btn-primary btn-lg"
          - elsif form_type == "log-in"
            = f.submit t(:log_in), class: "btn btn-inat btn-primary btn-lg"
          - else
            = f.submit t(:save_and_continue).html_safe, class: "btn btn-inat btn-primary btn-lg"
        - if form_type != "edit-after-auth"
          .form-group.centered
            - if form_type == "sign-up"
              = link_to t(:already_have_an_account_log_in_html), login_path, class: "btn btn-link"
            - else
              = link_to t(:dont_have_an_account_sign_up_html), signup_path, class: "btn btn-link"
          .form-group.centered.bigtext
            - if form_type == "sign-up"
              =t :or_all_caps
            - else
              =t :or_log_in_with_colon
          .form-group.centered.provider-authorizations
            - provider_names.each do |provider_name|
              - provider, url = ProviderAuthorization::AUTH_URLS.detect{|p,u| p == provider_name }
              - provider_label = ProviderAuthorization::PROVIDER_NAMES[provider].downcase
              - btn_label = t("sign_#{form_type == "sign-up" ? "up" : "in"}_with_provider", provider: ProviderAuthorization::PROVIDER_NAMES[provider] )
              - if provider_names.size <= 2
                .stacked
                  = link_to url, class: "btn btn-primary btn-lg providerlink #{provider_label}" do
                    %i.fa{ class: "fa-#{provider_label}" }
                    %span= btn_label
              - else
                = link_to url, class: "btn btn-circle providerlink #{provider_label}", alt: btn_label, title: btn_label do
                  %i.fa{ class: "fa-#{provider_label}" }

{'fraction_non_alphanumeric': 0.12627843873930286, 'fraction_numerical': 0.0019480971265567384, 'mean_word_length': 2.4594464500601685, 'pattern_counts': {'":': 2, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 2, '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': '4544952', 'n_tokens_mistral': 4633, 'n_tokens_neox': 4515, 'n_words': 851}