• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

tulibraries / manifold / b17e866c-0681-4963-bae4-c01149fde16e

pending completion
b17e866c-0681-4963-bae4-c01149fde16e

push

circleci

web-flow
Merge pull request #2952 from tulibraries/MAN-1300-hours-page-text-change

MAN-1300 hours page text change

40 of 40 new or added lines in 6 files covered. (100.0%)

2488 of 2889 relevant lines covered (86.12%)

15.74 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

70.59
/app/controllers/forms_controller.rb
1
# frozen_string_literal: true
2

3
class FormsController < ApplicationController
1✔
4
  def index
1✔
5
    respond_to do |format|
1✔
6
      format.json do
1✔
7
        @forms = form_objects_for_json
1✔
8
        render json: FormSerializer.new(@forms)
1✔
9
      end
10
    end
11
  end
12

13
  def show
1✔
14
    @form = Form.new
16✔
15
    if existing_forms.include? params[:id]
16✔
16
      @type = params[:id]
16✔
17
      info = FormInfo.find_by(slug: @type)
16✔
18
      if info.present?
16✔
19
        @title = info.title
16✔
20
        @intro = info.intro
16✔
21
        @recipients = info.recipients
16✔
22
      end
23
    else
24
      render "errors/not_found", status: :not_found
×
25
    end
26
  end
27

28
  def create
1✔
29
    @form = Form.new(params[:form])
×
30
    @form.request = request
×
31

32
    if @form.deliver
×
33
      persist_form!
×
34
      redirect_to forms_path(success: "true")
×
35
    else
36
      redirect_to forms_path(success: "false")
×
37
    end
38
  end
39

40
  def persist_form!
1✔
41
    type = params[:form].delete(:form_type)
×
42
    recipients = params[:form].delete(:recipients)
×
43
    FormSubmission.create(
×
44
      form_type: type,
45
      form_attributes: params["form"].except(:recipients)
46
    )
47
  end
48

49
  def existing_forms
1✔
50
    Dir.glob(Rails.root.join("app/views/forms/*/"))
17✔
51
      .map { |template_path| template_path.split("/").last }
306✔
52
      .reject { |template_name| template_name == "shared" }
306✔
53
  end
54

55
  def form_objects_for_json
1✔
56
    existing_forms.map do |form|
1✔
57
        OpenStruct.new(
18✔
58
          id: form,
59
          label: t("manifold.forms.#{form.underscore}.title"),
60
          link: "#{request.base_url}/forms/#{form}",
61
          updated_at: DateTime.new(0)
62
        )
63
      end
64
  end
65
end
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc