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

RoundingWell / care-ops-frontend / 478f32b5-a05d-4bf1-aab0-cc40366fae9d

17 Sep 2025 08:01AM UTC coverage: 95.256% (-4.7%) from 100.0%
478f32b5-a05d-4bf1-aab0-cc40366fae9d

push

circleci

web-flow
Merge pull request #1514 from RoundingWell/formio-loader

Attach preloader html after formio DOM content is loaded

1709 of 1849 branches covered (92.43%)

Branch coverage included in aggregate %.

6002 of 6246 relevant lines covered (96.09%)

191.66 hits per line

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

96.0
/src/js/views/programs/shared/components/form_component.js
1
import Radio from 'backbone.radio';
2
import hbs from 'handlebars-inline-precompile';
3

4
import 'scss/modules/buttons.scss';
5

6
import intl from 'js/i18n';
7

8
import Droplist from 'js/components/droplist';
9

10
import './form-component.scss';
11

12
const i18n = intl.programs.shared.components.formComponent;
147✔
13

14
const FormTemplate = hbs`
147✔
15
  <button class="js-button button-secondary button__group flex-grow" {{#if isDisabled}}disabled{{/if}}>
16
    {{far "square-poll-horizontal"}}<span>{{ name }}</span>
17
  </button>
18
`;
19
const NoFormTemplate = hbs`
147✔
20
  <button class="js-button button-secondary w-100" {{#if isDisabled}}disabled{{/if}}>
21
    {{far "square-poll-horizontal"}}<span>{{ @intl.programs.shared.components.formComponent.defaultText }}</span>
22
  </button>
23
`;
24

25
let currentWorkspaceCache;
26
let formsCollection;
27

28
function getForms(workspace) {
29
  if (formsCollection) return formsCollection;
9✔
30
  formsCollection = workspace.getForms();
4✔
31
  const formModels = formsCollection.reject({ published_at: null });
4✔
32
  formsCollection.reset(formModels);
4✔
33
  return formsCollection;
4✔
34
}
35

36
export default Droplist.extend({
37
  viewOptions() {
38
    const selected = this.getState('selected');
9✔
39
    return {
9✔
40
      className: 'flex',
41
      template: selected ? FormTemplate : NoFormTemplate,
9✔
42
      templateContext() {
43
        return {
9✔
44
          isDisabled: this.getOption('state').isDisabled,
45
        };
46
      },
47
      tagName: 'div',
48
      triggers: {
49
        'click .js-button': 'click',
50
        'focus .js-button': 'focus',
51
      },
52
    };
53
  },
54
  viewEvents: {
55
    'click': 'onClick',
56
  },
57
  picklistOptions: {
58
    canClear: true,
59
    headingText: i18n.headingText,
60
    placeholderText: i18n.placeholderText,
61
    noResultsText: i18n.noResultsText,
62
    isSelectlist: true,
63
    itemTemplateContext: {
64
      icon: {
65
        type: 'far',
66
        icon: 'square-poll-horizontal',
67
      },
68
    },
69
    attr: 'name',
70
  },
71
  initialize({ form }) {
72
    const currentWorkspace = Radio.request('workspace', 'current');
9✔
73

74
    if (currentWorkspaceCache !== currentWorkspace.id) {
9✔
75
      formsCollection = null;
4✔
76
      currentWorkspaceCache = currentWorkspace.id;
4✔
77
    }
78

79
    this.collection = getForms(currentWorkspace);
9✔
80

81
    this.setState({ selected: form });
9✔
82
  },
83
  popWidth() {
84
    return this.getView().$el.outerWidth();
1✔
85
  },
86
  onChangeSelected(selected) {
87
    this.triggerMethod('change:form', selected);
×
88
  },
89
});
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