SumOfUs/Champaign

View on GitHub
app/views/plugins/call_tools/_form.slim

Summary

Maintainability
Test Coverage
.row.plugin.call-tool.collection-editor data-plugin-id=plugin.id
  .col-md-7
    - name = "plugins_call_tool_#{plugin.id}"
    = form_for plugin, remote: true, as: name, html: { class: 'form-element one-form' }, data: {type: name }  do |f|
      = render 'plugins/shared/plugin_metadata', f: f
      .form-group
        = f.label(:title, t('plugins.call_tool.title'))
        = f.text_field :title, class: 'form-control'

      .form-group
        = label_with_tooltip(f, :description, t('plugins.call_tool.talking_points'), t('tooltips.content'))
        .wysiwyg id='call-tool-wysiwyg'
        = f.hidden_field :description, id: "call-tool-wysiwyg_content"

      .form-group
        = label_with_tooltip(f, :caller_phone_number_id, t('plugins.call_tool.caller_id'), t('tooltips.call_tool.caller_id'))
        = f.select :caller_phone_number_id,
                   PhoneNumber.all.map { |p| ["#{p.country} #{p.number}", p.id] },
                   {include_blank: true},
                   class: 'form-control caller_id'

      .form-group
        = label_with_tooltip(f, :restricted_country_code, t('plugins.call_tool.restricted_country_code'), t('tooltips.call_tool.restricted_country_code'))
        = f.select :restricted_country_code,
                   ISO3166::Country.all.map {|c| [c.name, c.alpha2]},
                   { include_blank: true },
                   class: 'form-control restricted_country_code'

    .call-tool__target-form
      = render partial: 'plugins/call_tools/target_form.slim', locals: { plugin: plugin }

    .well.sound-clip-section
      = render partial: 'plugins/call_tools/sound_clip_form.slim', locals: { plugin: plugin }

javascript:
  $(function () {
    window.ee.emit("collection:edit:loaded");
    window.ee.emit("plugin:form:loaded")
    window.ee.emit("wysiwyg:setup", "call-tool-wysiwyg");
    $('.call-tool form.one-form').on('ajax:before', function(){
      window.ee.emit('wysiwyg:submit')
    });
  })