<commit_before><%= javascript_include_tag 'bootstrap-timepicker' %>
<%= stylesheet_link_tag 'bootstrap-timepicker' %>
<%= javascript_include_tag 'bootstrap-datepicker' %>
<%= stylesheet_link_tag 'bootstrap-datepicker' %>

<script>
  $(function(){
    $('.bootstrap-timepicker-component.weekday input').timepicker({defaultTime: 'value'});
    $('.bootstrap-timepicker-component.weekend input').timepicker({defaultTime: false});

    $('#second-week-btn').click(function(){
      var week_holder = $(this).parents('.week-holder');
      var tab = $('#week1 .week-holder').clone();

      tab.find('input').each(function(){
        var name = $(this).attr('name');
        var i = name.match(/\d/)[0]*1;
        $(this).attr('name', name.replace(/\d/, i+7))
      });

      week_holder.html(tab);
      $('.week-label').removeClass('hide');
    });

    $(document).on("focus", "[data-behavior='datepicker']", function(e){
        $(this).datepicker({"format": "yyyy-mm-dd", "weekStart": 0, "autoclose": true});
    });
  });
</script>

<h2>New schedule</h2>

<%= form_for @schedule do |f| %>
  <%= f.hidden_field :user_id %>
  <%= f.label :start_date %>
  <%= f.text_field :start_date, data: {behavior: 'datepicker'} %>

  <div class="row-fluid">
    <div id="week1" class="span5">
      <div class="week-label hide">Week 1</div>
      <div class="week-holder">
        <table class="table">
          <thead>
            <tr>
              <th>Day</th>
              <th>Start</th>
              <th>End</th>
              <th>Lunch*</th>
            </tr>
          </thead>
          <tbody>
            <% (0..6).each do |num_day| %>
              <tr>
                <td><%= Date::DAYNAMES[num_day] %></td>
                <td class="input-append bootstrap-timepicker-component <%= [0,6].include?(num_day) ? 'weekend' : 'weekday' %>"><%= text_field_tag "days[#{num_day}][start]", [0,6].include?(num_day) ? "" : "8:00 AM", class: 'input-small' %><span class="add-on"><i class="icon-time"></i></span></td>
                <td class="input-append bootstrap-timepicker-component <%= [0,6].include?(num_day) ? 'weekend' : 'weekday' %>"><%= text_field_tag "days[#{num_day}][end]", [0,6].include?(num_day) ? "" : "5:00 PM", class: 'input-small' %><span class="add-on"><i class="icon-time"></i></span></td>
                <td><%= select_tag "days[#{num_day}][lunch]", options_for_select([['1 Hour Lunch', 1], ['30 Minute Lunch', 0.5], ['No Lunch', 0]], 1), class: 'input-medium' %></td>
              </tr>
            <% end %>
          <tbody>
        </table>
      </div>
      <p class=".muted">* Lunch is 60 minutes unless otherwise specified.</p>
    </div>
    <div id="week2" class="span5">
      <div class="week-label hide">Week 2</div>
      <div class="week-holder">
        <a id="second-week-btn" href="#">Add Second Week</a>
      </div>
    </div>
  </div>

  <%= f.submit %>
<% end %>

<%= link_to 'Back', edit_profiles_path %>
<commit_msg>Removing remaining script tag direct to bootstrap-datepicker which is now included in application<commit_after><script>
  $(function(){
    $('.bootstrap-timepicker-component.weekday input').timepicker({defaultTime: 'value'});
    $('.bootstrap-timepicker-component.weekend input').timepicker({defaultTime: false});

    $('#second-week-btn').click(function(){
      var week_holder = $(this).parents('.week-holder');
      var tab = $('#week1 .week-holder').clone();

      tab.find('input').each(function(){
        var name = $(this).attr('name');
        var i = name.match(/\d/)[0]*1;
        $(this).attr('name', name.replace(/\d/, i+7))
      });

      week_holder.html(tab);
      $('.week-label').removeClass('hide');
    });

    $(document).on("focus", "[data-behavior='datepicker']", function(e){
        $(this).datepicker({"format": "yyyy-mm-dd", "weekStart": 0, "autoclose": true});
    });
  });
</script>

<h2>New schedule</h2>

<%= form_for @schedule do |f| %>
  <%= f.hidden_field :user_id %>
  <%= f.label :start_date %>
  <%= f.text_field :start_date, data: {behavior: 'datepicker'} %>

  <div class="row-fluid">
    <div id="week1" class="span5">
      <div class="week-label hide">Week 1</div>
      <div class="week-holder">
        <table class="table">
          <thead>
            <tr>
              <th>Day</th>
              <th>Start</th>
              <th>End</th>
              <th>Lunch*</th>
            </tr>
          </thead>
          <tbody>
            <% (0..6).each do |num_day| %>
              <tr>
                <td><%= Date::DAYNAMES[num_day] %></td>
                <td class="input-append bootstrap-timepicker-component <%= [0,6].include?(num_day) ? 'weekend' : 'weekday' %>"><%= text_field_tag "days[#{num_day}][start]", [0,6].include?(num_day) ? "" : "8:00 AM", class: 'input-small' %><span class="add-on"><i class="icon-time"></i></span></td>
                <td class="input-append bootstrap-timepicker-component <%= [0,6].include?(num_day) ? 'weekend' : 'weekday' %>"><%= text_field_tag "days[#{num_day}][end]", [0,6].include?(num_day) ? "" : "5:00 PM", class: 'input-small' %><span class="add-on"><i class="icon-time"></i></span></td>
                <td><%= select_tag "days[#{num_day}][lunch]", options_for_select([['1 Hour Lunch', 1], ['30 Minute Lunch', 0.5], ['No Lunch', 0]], 1), class: 'input-medium' %></td>
              </tr>
            <% end %>
          <tbody>
        </table>
      </div>
      <p class=".muted">* Lunch is 60 minutes unless otherwise specified.</p>
    </div>
    <div id="week2" class="span5">
      <div class="week-label hide">Week 2</div>
      <div class="week-holder">
        <a id="second-week-btn" href="#">Add Second Week</a>
      </div>
    </div>
  </div>

  <%= f.submit %>
<% end %>

<%= link_to 'Back', edit_profiles_path %>

{'fraction_non_alphanumeric': 0.2281125884993956, 'fraction_numerical': 0.013469176308064238, 'mean_word_length': 2.798032786885246, 'pattern_counts': {'":': 6, '<': 149, '<?xml version=': 0, '>': 149, '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': '5606841', 'n_tokens_mistral': 2075, 'n_tokens_neox': 1946, 'n_words': 359}