<commit_before>- url = url_for(:action => 'exp_changed')

-# Parameters:
-# exp_model    Model in use for this expression

%br
- if exp_model == "_display_filter_"
  -# Use list in @edit for reporting display filter
  = select_tag('chosen_field',
    options_for_select(["<#{_('Choose')}>"] + @edit[@expkey][:exp_available_fields], @edit[@expkey][:exp_field]),
    :multiple              => false,
    :class                 => "widthed",
    "data-miq_sparkle_on"  => true,
    "data-miq_sparkle_off" => true,
     "data-miq_observe"    => {:url => url}.to_json)
- else
  = select_tag('chosen_field',
    options_for_select(["<#{_('Choose')}>"] + MiqExpression.miq_adv_search_lists(exp_model, :exp_available_fields), @edit[@expkey][:exp_field]),
    :multiple              => false,
    :class                 => "widthed",
    "data-miq_sparkle_on"  => true,
    "data-miq_sparkle_off" => true,
    "data-miq_observe"     => {:url => url}.to_json)

- if adv_search_show_alias_checkbox? && !@edit[@expkey][:exp_field].blank?
  %br
  = check_box_tag("use_alias", "1", !@edit[@expkey][:alias].blank?,
    :style                      => "width: 20px",
    "data-miq_sparkle_on"       => true,
    "data-miq_sparkle_off"      => true,
    "data-miq_observe_checkbox" => {:url => url}.to_json)
  = _('Use Alias')
  - unless @edit[@expkey][:alias].blank?
    = text_field_tag("alias", @edit[@expkey][:alias],
      :maxlength         => 50,
      "data-miq_observe" => {:interval => '.5', :url => url}.to_json)

- if @edit[@expkey][:exp_field]
  %br
  - if @edit[@expkey][:exp_key] == "CONTAINS"
    %font{:color => "black"}
      = h(@edit[@expkey][:exp_key])
  - else
    = select_tag('chosen_key',
      options_for_select(MiqExpression.get_col_operators(@edit[@expkey][:exp_field]), @edit[@expkey][:exp_key]),
      :multiple               => false,
      :class                  => "widthed",
      "data-miq_sparkle_on"   => true,
      "data-miq_sparkle_off"  => true,
      "data-miq_observe"      => {:url => url}.to_json)
  - unless @edit[@expkey][:exp_key].include?("NULL") || @edit[@expkey][:exp_key].include?("EMPTY")
    %br
    %span#chosen_value_span
      - if @edit[@expkey][:val1][:type] == :boolean
        - if @edit[@expkey][:exp_value] == :user_input
          = "<user input>"
        - else
          - values = [[_("true"), "true"], [_("false"), "false"]]
          - if @edit[@expkey][:exp_value].blank?
            - values.insert(0, ["<#{_('Choose')}>", ""])
          = select_tag('chosen_value',
            options_for_select(values, @edit[@expkey][:exp_value]),
            :multiple              => false,
            :class                 => "widthed",
            "data-miq_sparkle_on"  => true,
            "data-miq_sparkle_off" => true,
            "data-miq_observe"     => {:url => url}.to_json)

      - elsif [:date, :datetime].include?(@edit[@expkey][:val1][:type])
        - if @edit[@expkey][:val1][:date_format] == 's'
          = datepicker_input_tag("miq_date_1_0",
            @edit[@expkey][:exp_value][0] ? @edit[@expkey][:exp_value][0].split(" ").first : "",
            :readonly               => "true",
            :size                   => 10,
            "data-miq_observe_date" => {:interval => '.5', :url => url}.to_json)
          - if @edit[@expkey][:exp_value][0].to_s.include?(":")
            = select_tag("miq_time_1_0",
              options_for_select(Array.new(24) { |i| ["#{i}:00", "#{i}:15", "#{i}:30", "#{i}:45"] }.flatten, @edit[@expkey][:exp_value][0].split(" ").last),
              "data-miq_sparkle_on"  => true,
              "data-miq_sparkle_off" => true,
              "data-miq_observe"     => {:url => url}.to_json)
        - else
          - opts = (@edit[@expkey][:val1][:type] == :datetime ? FROM_HOURS : [])
          - opts += FROM_DAYS + FROM_WEEKS + FROM_MONTHS + FROM_QUARTERS + FROM_YEARS
          = select_tag('chosen_from_1',
            options_for_select(HASH[opts.map {|x| [_(x), x]}], @edit[@expkey][:exp_value][0]),
            :multiple              => false,
            "data-miq_sparkle_on"  => true,
            "data-miq_sparkle_off" => true,
            "data-miq_observe"     => {:url => url}.to_json)

        - if @edit[@expkey][:exp_key] == EXP_FROM && @edit[@expkey][:exp_value][0]
          %br
          = _('THROUGH')
          %br
          - if @edit[@expkey][:val1][:date_format] == 's'
            = datepicker_input_tag("miq_date_1_1",
              @edit[@expkey][:exp_value][1] ? @edit[@expkey][:exp_value][1].split(" ").first : "",
              :readonly               => "true",
              :size                   => 10,
              "data-miq_observe_date" => {:interval => '.5', :url => url}.to_json)
            - if @edit[@expkey][:exp_value][1].to_s.include?(":")
              = select_tag("miq", "time_1_1",
                options_for_select(Array.new(24) { |i| ["#{i}:00", "#{i}:15", "#{i}:30", "#{i}:45"] }.flatten, @edit[@expkey][:exp_value][1].split(" ").last),
                "data-miq_sparkle_on"  => true,
                "data-miq_sparkle_off" => true,
                "data-miq_observe"     => {:url => url}.to_json)
          - else
            - if @edit[@expkey][:val1][:through_choices].length > 1
              = select_tag('chosen_through_1',
                options_for_select(@edit[@expkey][:val1][:through_choices], @edit[@expkey][:exp_value][1]),
                :multiple              => false,
                "data-miq_sparkle_on"  => true,
                "data-miq_sparkle_off" => true,
                "data-miq_observe"     => {:url => url}.to_json)<commit_msg>Fixed case-typo in expression editor when operating with date-fields<commit_after>- url = url_for(:action => 'exp_changed')

-# Parameters:
-# exp_model    Model in use for this expression

%br
- if exp_model == "_display_filter_"
  -# Use list in @edit for reporting display filter
  = select_tag('chosen_field',
    options_for_select(["<#{_('Choose')}>"] + @edit[@expkey][:exp_available_fields], @edit[@expkey][:exp_field]),
    :multiple              => false,
    :class                 => "widthed",
    "data-miq_sparkle_on"  => true,
    "data-miq_sparkle_off" => true,
     "data-miq_observe"    => {:url => url}.to_json)
- else
  = select_tag('chosen_field',
    options_for_select(["<#{_('Choose')}>"] + MiqExpression.miq_adv_search_lists(exp_model, :exp_available_fields), @edit[@expkey][:exp_field]),
    :multiple              => false,
    :class                 => "widthed",
    "data-miq_sparkle_on"  => true,
    "data-miq_sparkle_off" => true,
    "data-miq_observe"     => {:url => url}.to_json)

- if adv_search_show_alias_checkbox? && !@edit[@expkey][:exp_field].blank?
  %br
  = check_box_tag("use_alias", "1", !@edit[@expkey][:alias].blank?,
    :style                      => "width: 20px",
    "data-miq_sparkle_on"       => true,
    "data-miq_sparkle_off"      => true,
    "data-miq_observe_checkbox" => {:url => url}.to_json)
  = _('Use Alias')
  - unless @edit[@expkey][:alias].blank?
    = text_field_tag("alias", @edit[@expkey][:alias],
      :maxlength         => 50,
      "data-miq_observe" => {:interval => '.5', :url => url}.to_json)

- if @edit[@expkey][:exp_field]
  %br
  - if @edit[@expkey][:exp_key] == "CONTAINS"
    %font{:color => "black"}
      = h(@edit[@expkey][:exp_key])
  - else
    = select_tag('chosen_key',
      options_for_select(MiqExpression.get_col_operators(@edit[@expkey][:exp_field]), @edit[@expkey][:exp_key]),
      :multiple               => false,
      :class                  => "widthed",
      "data-miq_sparkle_on"   => true,
      "data-miq_sparkle_off"  => true,
      "data-miq_observe"      => {:url => url}.to_json)
  - unless @edit[@expkey][:exp_key].include?("NULL") || @edit[@expkey][:exp_key].include?("EMPTY")
    %br
    %span#chosen_value_span
      - if @edit[@expkey][:val1][:type] == :boolean
        - if @edit[@expkey][:exp_value] == :user_input
          = "<user input>"
        - else
          - values = [[_("true"), "true"], [_("false"), "false"]]
          - if @edit[@expkey][:exp_value].blank?
            - values.insert(0, ["<#{_('Choose')}>", ""])
          = select_tag('chosen_value',
            options_for_select(values, @edit[@expkey][:exp_value]),
            :multiple              => false,
            :class                 => "widthed",
            "data-miq_sparkle_on"  => true,
            "data-miq_sparkle_off" => true,
            "data-miq_observe"     => {:url => url}.to_json)

      - elsif [:date, :datetime].include?(@edit[@expkey][:val1][:type])
        - if @edit[@expkey][:val1][:date_format] == 's'
          = datepicker_input_tag("miq_date_1_0",
            @edit[@expkey][:exp_value][0] ? @edit[@expkey][:exp_value][0].split(" ").first : "",
            :readonly               => "true",
            :size                   => 10,
            "data-miq_observe_date" => {:interval => '.5', :url => url}.to_json)
          - if @edit[@expkey][:exp_value][0].to_s.include?(":")
            = select_tag("miq_time_1_0",
              options_for_select(Array.new(24) { |i| ["#{i}:00", "#{i}:15", "#{i}:30", "#{i}:45"] }.flatten, @edit[@expkey][:exp_value][0].split(" ").last),
              "data-miq_sparkle_on"  => true,
              "data-miq_sparkle_off" => true,
              "data-miq_observe"     => {:url => url}.to_json)
        - else
          - opts = (@edit[@expkey][:val1][:type] == :datetime ? FROM_HOURS : [])
          - opts += FROM_DAYS + FROM_WEEKS + FROM_MONTHS + FROM_QUARTERS + FROM_YEARS
          = select_tag('chosen_from_1',
            options_for_select(Hash[opts.map {|x| [_(x), x]}], @edit[@expkey][:exp_value][0]),
            :multiple              => false,
            "data-miq_sparkle_on"  => true,
            "data-miq_sparkle_off" => true,
            "data-miq_observe"     => {:url => url}.to_json)

        - if @edit[@expkey][:exp_key] == EXP_FROM && @edit[@expkey][:exp_value][0]
          %br
          = _('THROUGH')
          %br
          - if @edit[@expkey][:val1][:date_format] == 's'
            = datepicker_input_tag("miq_date_1_1",
              @edit[@expkey][:exp_value][1] ? @edit[@expkey][:exp_value][1].split(" ").first : "",
              :readonly               => "true",
              :size                   => 10,
              "data-miq_observe_date" => {:interval => '.5', :url => url}.to_json)
            - if @edit[@expkey][:exp_value][1].to_s.include?(":")
              = select_tag("miq", "time_1_1",
                options_for_select(Array.new(24) { |i| ["#{i}:00", "#{i}:15", "#{i}:30", "#{i}:45"] }.flatten, @edit[@expkey][:exp_value][1].split(" ").last),
                "data-miq_sparkle_on"  => true,
                "data-miq_sparkle_off" => true,
                "data-miq_observe"     => {:url => url}.to_json)
          - else
            - if @edit[@expkey][:val1][:through_choices].length > 1
              = select_tag('chosen_through_1',
                options_for_select(@edit[@expkey][:val1][:through_choices], @edit[@expkey][:exp_value][1]),
                :multiple              => false,
                "data-miq_sparkle_on"  => true,
                "data-miq_sparkle_off" => true,
                "data-miq_observe"     => {:url => url}.to_json)
{'fraction_non_alphanumeric': 0.19842463934861493, 'fraction_numerical': 0.010974422515266837, 'mean_word_length': 2.336285798641866, 'pattern_counts': {'":': 4, '<': 11, '<?xml version=': 0, '>': 139, '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': '6338140', 'n_tokens_mistral': 4137, 'n_tokens_neox': 4005, 'n_words': 547}