<commit_before>require 'omniauth'

module OmniAuth
  class Form
    DEFAULT_CSS = '' unless defined? DEFAULT_CSS

    attr_accessor :options

    def initialize(options = {})
      options[:title] ||= "Authentication Info Required"
      options[:header_info] ||= ""
      self.options = options

      @html = ""
      @with_custom_button = false
      header(options[:title],options[:header_info])
    end

    def self.build(options = {},&block)
      form = OmniAuth::Form.new(options)
      if block.arity > 0
        yield form 
      else
        form.instance_eval(&block)
      end
      form
    end

    def label_field(text, target)
      @html << "\n<label for='#{target}'>#{text}:</label>"
      self
    end

    def input_field(type, name)
      @html << "\n<input type='#{type}' id='#{name}' name='#{name}'/>"
      self
    end

    def text_field(label, name)
      label_field(label, name)
      input_field('text', name)
      self
    end

    def password_field(label, name)
      label_field(label, name)
      input_field('password', name)
      self
    end

    def button(text)
      @with_custom_button = true
      @html << "\n" << '<input class="signin-button" type="submit" value="' << text << '">'
    end

    def html(html)
      @html << html
    end

    def fieldset(legend, options = {}, &block)
      @html << "\n<fieldset#{" style='#{options[:style]}'" if options[:style]}#{" id='#{options[:id]}'" if options[:id]}>\n  <legend>#{legend}</legend>\n"
      self.instance_eval &block
      @html << "\n</fieldset>"
      self
    end

    def header(title,header_info)
      @html << <<-HTML
      <!DOCTYPE html>
      <html>
      <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
        <title>#{title}</title>
        <link href="//#{cc_url}/all-1.css" rel="stylesheet" />
        <link href="//#{cc_url}/theme/style.css" rel="stylesheet" />
        <script src="//#{cc_url}/theme/settings.js"></script>
        <script type="text/javascript">
          $CC_URL = "//#{cc_url}"
        </script>
        <script src="/jquery-1.10.1.min.js"></script>
        <script src="/aok.js"></script>
        #{header_info}
      </head>
      <body class="login">
        <div class="page_wrapper">
          <div class="content">
            <div class="login_logo">
              <div class="stackato_logo"></div>
              <h2>#{title}</h2>
              
            </div>
            <form id="login_form" method='post' #{"action='#{options[:url]}' " if options[:url]}noValidate='noValidate'>
      HTML
      self
    end

    def footer
      return self if @footer
      @html << "\n" << '<input class="signin-button" type="submit" value="Sign in">' unless @with_custom_button
      @html << <<-HTML
            </form>
          </div><!-- .content -->
        </div><!-- .page_wrapper -->
      </body>
      </html>
      HTML
      @footer = true
      self
    end
<commit_msg>quick styling of the AOK login page<commit_after>require 'omniauth'

module OmniAuth
  class Form
    DEFAULT_CSS = '' unless defined? DEFAULT_CSS

    attr_accessor :options

    def initialize(options = {})
      options[:title] ||= "Authentication Info Required"
      options[:header_info] ||= ""
      self.options = options

      @html = ""
      @with_custom_button = false
      header(options[:title],options[:header_info])
    end

    def self.build(options = {},&block)
      form = OmniAuth::Form.new(options)
      if block.arity > 0
        yield form 
      else
        form.instance_eval(&block)
      end
      form
    end

    def label_field(text, target)
      @html << "\n<div class='form-group'><label class='col-lg-2 control-label' for='#{target}'>#{text}:</label>"
      self
    end

    def input_field(type, name)
      @html << "\n<div class='col-lg-10'><input type='#{type}' class='form-control' id='#{name}' name='#{name}' placeholder='#{name}'/></div></div>"
      self
    end

    def text_field(label, name)
      label_field(label, name)
      input_field('text', name)
      self
    end

    def password_field(label, name)
      label_field(label, name)
      input_field('password', name)
      self
    end

    def button(text)
      @with_custom_button = true
      @html << "\n" << '<input class="signin-button btn btn-primary btn-lg pull-right" type="submit" value="' << text << '">'
    end

    def html(html)
      @html << html
    end

    def fieldset(legend, options = {}, &block)
      @html << "\n<fieldset#{" style='#{options[:style]}'" if options[:style]}#{" id='#{options[:id]}'" if options[:id]}>\n  <legend>#{legend}</legend>\n"
      self.instance_eval &block
      @html << "\n</fieldset>"
      self
    end

    def header(title,header_info)
      @html << <<-HTML
      <!DOCTYPE html>
      <html>
      <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
        <title>#{title}</title>
        <link href="/console/css/console.css" rel="stylesheet" />
        <link href="//#{cc_url}/theme/style.css" rel="stylesheet" />
        <script src="//#{cc_url}/theme/settings.js"></script>
        <script type="text/javascript">
          $CC_URL = "//#{cc_url}"
        </script>
        <script src="/jquery-1.10.1.min.js"></script>
        <script src="/aok.js"></script>
        #{header_info}
      </head>
      <body class="login">
        <div id="header-container">
          <nav class="navbar navbar-default navbar-inverse navbar-fixed-top" role="navigation">
            <img class="navbar-brand" src="/console/img/stackato_logo_header.png" alt="Stackato">
          </nav>
        </div>
        <div class="page_wrapper">
          <div class="container">
            <div class="content">
              <div class="well">
                <h2>#{title}</h2>
                <form id="login_form" class="form form-horizontal" method='post' #{"action='#{options[:url]}' " if options[:url]}noValidate='noValidate'>
      HTML
      self
    end

    def footer
      return self if @footer
      @html << "\n" << '<input class="signin-button btn btn-primary btn-lg pull-right" type="submit" value="Sign in">' unless @with_custom_button
      @html << <<-HTML
                </form>
                <div class='clearfix'></div>
              </div>
            </div><!-- .content -->
          </div>
        </div>
      </body>
      </html>
      HTML
      @footer = true
      self
    end

{'fraction_non_alphanumeric': 0.1728567007118539, 'fraction_numerical': 0.0030950170225936243, 'mean_word_length': 2.2674418604651163, 'pattern_counts': {'":': 0, '<': 159, '<?xml version=': 0, '>': 101, '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': '5274500', 'n_tokens_mistral': 2054, 'n_tokens_neox': 2030, 'n_words': 428}