<commit_before>module Breeze
  module ApplyOnline
    class ApplicationFormBuilder < Breeze::Admin::FormBuilder
      unloadable
      
      def current_step
        @object
      end
      
      def page
        @object.page
      end
      
      def steps
        step_list = page.views.collect do |step|
          state = case current_step.step <=> step.step
          when -1 then "pending"
          when  0 then "active"
          when  1 then "complete"
          end
          %{<li class="multipage-step-#{step.step} #{state}#{' first' if step.step == 1}#{' last' if step.step == page.views.count}"><span class="number">#{step.step}</span> <span class="title">#{step.title}</span></li>}
        end.join("\n")
        
        template.content_tag :div, "<ol>#{step_list}</ol>".html_safe, :class => "multipage-steps step-#{current_step.step}"
      end
      
      def fields
        current_step.form_fields.collect { |field| field.to_html(self) }.join("\n").html_safe
      end

      def back_button(label = "Back", options = {})
        template.submit_tag label, options.merge(:name => :back_button) if current_step.previous?
      end
      
      def next_button(label = "Next", options = {})
        label = options.delete(:finish) || "Finish" if current_step.next? && !current_step.next.next?
        template.submit_tag label, options.merge(:name => :next_button) if current_step.next?
      end
      
      def error_messages
        template.render "/breeze/apply_online/error_messages", :target => object, :object_name => :form
      end
      
      def radio_button_group(method, choices, options = {})
        choice_lis = choices.collect do |choice|
          choice = [ choice.to_s.humanize, choice ] unless choice.is_a?(Array)
          radio_button method, choice.last, :label => choice.first, :errors => false<commit_msg>fix radio button labels<commit_after>module Breeze
  module ApplyOnline
    class ApplicationFormBuilder < Breeze::Admin::FormBuilder
      unloadable
      
      def current_step
        @object
      end
      
      def page
        @object.page
      end
      
      def steps
        step_list = page.views.collect do |step|
          state = case current_step.step <=> step.step
          when -1 then "pending"
          when  0 then "active"
          when  1 then "complete"
          end
          %{<li class="multipage-step-#{step.step} #{state}#{' first' if step.step == 1}#{' last' if step.step == page.views.count}"><span class="number">#{step.step}</span> <span class="title">#{step.title}</span></li>}
        end.join("\n")
        
        template.content_tag :div, "<ol>#{step_list}</ol>".html_safe, :class => "multipage-steps step-#{current_step.step}"
      end
      
      def fields
        current_step.form_fields.collect { |field| field.to_html(self) }.join("\n").html_safe
      end

      def back_button(label = "Back", options = {})
        template.submit_tag label, options.merge(:name => :back_button) if current_step.previous?
      end
      
      def next_button(label = "Next", options = {})
        label = options.delete(:finish) || "Finish" if current_step.next? && !current_step.next.next?
        template.submit_tag label, options.merge(:name => :next_button) if current_step.next?
      end
      
      def error_messages
        template.render "/breeze/apply_online/error_messages", :target => object, :object_name => :form
      end
      
      def radio_button_group(method, choices, options = {})
        choice_lis = choices.collect do |choice|
          choice = [ Symbol === choice ? choice.to_s.humanize : choice.to_s, choice ] unless choice.is_a?(Array)
          radio_button method, choice.last, :label => choice.first, :errors => false
{'fraction_non_alphanumeric': 0.13099041533546327, 'fraction_numerical': 0.002129925452609159, 'mean_word_length': 2.469067405355494, 'pattern_counts': {'":': 0, '<': 23, '<?xml version=': 0, '>': 35, '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': '3515883', 'n_tokens_mistral': 1116, 'n_tokens_neox': 1129, 'n_words': 255}