Sha256: 4c4495f6dee9829147a5e23ba9aeda4298738426a8ad6812941c7df0165c1ac6

Contents?: true

Size: 1.76 KB

Versions: 68

Compression:

Stored size: 1.76 KB

Contents

<h2>This week</h2>

<div id="forms-container">
  <div id="subcontainer-0">
    <%= render "think_feel_do_engine/activities/activity_form_fields", create_path: create_path %>
  </div>
</div>

<div class="btn-toolbar">
  <button class="btn btn-default" id="add-forms" type="button"><i class="fa fa-plus"></i> Add Activities</button>
</div>

<div class="btn-toolbar">
  <%= submit_tag t(:next), class: 'btn btn-default', id: "submit-forms" %>
</div>

<script>
  sc.recordActivities = function(formContainers, path, partial) {
    $("#add-forms").on("click", function() {
      var count;
      count = $(formContainers).length;
      $("#forms-container").append("<div id='subcontainer-" + count + "'>" + partial + "</div>");
      return false;
    });
    $("#submit-forms").on("click", function(event) {
      event.preventDefault();

      sc.displayErrors();

      if ($(".form-group.has-error").length == 0) {

        _.each($(formContainers), function(form, index, list) {
          var $form;
          $form = $(form);

          return $.ajax({
            async: false,
            data: $form.serialize(),
            dataType: "script",
            type: "POST",
            url: $form.attr("action"),
            success: function() {
              if ((index + 1) === list.length) {
                window.location.href = path;
              }
            }
          });
        });

      };

      return false;
    });
  };

  var afterSubmitPath, partial;

  afterSubmitPath = "<%= navigator_next_content_url %>";

  partial = "<%= j render(partial: 'think_feel_do_engine/activities/activity_form_fields', locals: { create_path: create_path }) %>";

  $(document).on("page:change", sc.recordActivities("#forms-container form.activity_form", afterSubmitPath, partial));

</script>

Version data entries

68 entries across 68 versions & 1 rubygems

Version Path
think_feel_do_engine-3.22.9 app/views/think_feel_do_engine/activities/input_new_activity_form.html.erb
think_feel_do_engine-3.22.8 app/views/think_feel_do_engine/activities/input_new_activity_form.html.erb
think_feel_do_engine-3.22.7 app/views/think_feel_do_engine/activities/input_new_activity_form.html.erb
think_feel_do_engine-3.22.6 app/views/think_feel_do_engine/activities/input_new_activity_form.html.erb
think_feel_do_engine-3.22.5 app/views/think_feel_do_engine/activities/input_new_activity_form.html.erb
think_feel_do_engine-3.22.4 app/views/think_feel_do_engine/activities/input_new_activity_form.html.erb
think_feel_do_engine-3.22.2 app/views/think_feel_do_engine/activities/input_new_activity_form.html.erb
think_feel_do_engine-3.22.1 app/views/think_feel_do_engine/activities/input_new_activity_form.html.erb
think_feel_do_engine-3.22.0 app/views/think_feel_do_engine/activities/input_new_activity_form.html.erb
think_feel_do_engine-3.21.2 app/views/think_feel_do_engine/activities/input_new_activity_form.html.erb
think_feel_do_engine-3.21.1 app/views/think_feel_do_engine/activities/input_new_activity_form.html.erb
think_feel_do_engine-3.21.0 app/views/think_feel_do_engine/activities/input_new_activity_form.html.erb
think_feel_do_engine-3.20.1 app/views/think_feel_do_engine/activities/input_new_activity_form.html.erb
think_feel_do_engine-3.19.9 app/views/think_feel_do_engine/activities/input_new_activity_form.html.erb
think_feel_do_engine-3.19.8 app/views/think_feel_do_engine/activities/input_new_activity_form.html.erb
think_feel_do_engine-3.19.7 app/views/think_feel_do_engine/activities/input_new_activity_form.html.erb
think_feel_do_engine-3.19.6 app/views/think_feel_do_engine/activities/input_new_activity_form.html.erb
think_feel_do_engine-3.19.5 app/views/think_feel_do_engine/activities/input_new_activity_form.html.erb
think_feel_do_engine-3.19.4 app/views/think_feel_do_engine/activities/input_new_activity_form.html.erb
think_feel_do_engine-3.19.3 app/views/think_feel_do_engine/activities/input_new_activity_form.html.erb