<commit_before>- model_class = Subscription
= page_header "#{t('.title', default: model_class.model_name.human.pluralize)} - #{@event.name}"

= form_tag event_subscriptions_path(@event), method: :get, class: 'form-search form-horizontal' do
  - values = params[:fields] || {}
  - @event.fields.where(searchable: true).each do |field|
    = render "subscriptions/inputs/#{field.field_type}_input",
        field: field,
        value: begin values[field.id.to_s][:value] rescue nil end,
        values: values,
        id: dom_id(field) rescue nil

  .control-group
    = label_tag 'name', t(:search), class: :'control-label'
    .controls
      = text_field_tag 'name', params[:term], name: "term", class: 'span4'

  .control-group
    = label_tag 'selects', t(:show).titleize, class: :'control-label'
    .controls
      - ['email', 'id_card'].each do |att|
        %span.checkbox_container
          = check_box_tag "selects[]", att, params['selects'].try(:include?, att), id: "select_#{att}"
          = label_tag "select_#{att}", Subscription.human_attribute_name(att), class: :collection_check_boxes

  .control-group
    = label_tag 'field_ids[]', t(:include_fields), class: :'control-label'
    .controls
      = select_tag 'field_ids[]', options_from_collection_for_select(@event.         |
          fields.where("field_type != 'file'"), :id, :name, params['field_ids']),    |
          multiple: '', class: 'chosen input-xxlarge',   |
          :'data-placeholder' => t(:select).titleize   |

  .control-group
    .controls
      = button_tag type: "submit", class: :'btn btn-primary' do
        #{icon_tag("icon-search icon-white")}
        #{t(:search)}
      = link_to icon_tag("icon-remove icon-white").html_safe,
          event_subscriptions_path(@event), title: t(:clear_fields),
          class: 'btn btn-warning'

%table.table.table-striped
  %thead
    %tr
      %th= model_class.human_attribute_name :created_at
      %th= model_class.human_attribute_name :number
      %th= model_class.human_attribute_name :name
      - for select in permitted_selects
        %th= model_class.human_attribute_name select
      - for field in @fields
        %th= field.name
      %th
  %tbody
    - @subscriptions.each do |subscription|
      %tr
        %td= l subscription.created_at, format: :short
        %td= link_to subscription.number, subscription_path(subscription)
        %td= abbr(subscription.name, size: 60)
        - for select in permitted_selects
          %td= subscription.attributes[select]
        - for field in @fields
          - fill = subscription.fills.where(field_id: field.id).first
          %td= fill.value_to_s if fill
        %td.actions
          = minilink_to_edit subscription, edit_subscription_path(subscription)
          = minilink_to_receipt(subscription)

.pull-right
  %strong
    = t :total, count: @count

= paginate @subscriptions

= link_to icon_tag('icon-download-alt icon-white') + " CSV",
    event_subscriptions_path(@event, format: 'csv', params: params.slice(:fields,
    :field_ids, :term, :selects)), class: 'btn btn-inverse', title: t(:'export.csv')
= link_to icon_tag('icon-download-alt icon-white') + " XLS",
    event_subscriptions_path(@event, format: 'xls', params: params.slice(:fields,
    :field_ids, :term, :selects)), class: 'btn btn-success', title: t(:'export.xls')
= link_to icon_tag('icon-download-alt icon-white') + " ZIP", '#download_fields',
    class: 'btn btn-info', :'data-toggle' => "modal", title: t(:'export.zip') if can? :download, @subscriptions.first.field_fills.build
= link_to icon_tag('icon-envelope icon-white') + " E-mail",
    new_event_notification_path(@event, filters: params[:fields]),
    class: 'btn btn-danger', :'data-toggle' => "modal", title: t(:'send_email') if can? :create, @event.notifications.build

-  if can? :download, @subscriptions.first.field_fills.build
  = render 'download_dialog', params: params, event: @event<commit_msg>Corrigindo erro ao exibir inscrições de evento sem inscrições.<commit_after>- model_class = Subscription
= page_header "#{t('.title', default: model_class.model_name.human.pluralize)} - #{@event.name}"

= form_tag event_subscriptions_path(@event), method: :get, class: 'form-search form-horizontal' do
  - values = params[:fields] || {}
  - @event.fields.where(searchable: true).each do |field|
    = render "subscriptions/inputs/#{field.field_type}_input",
        field: field,
        value: begin values[field.id.to_s][:value] rescue nil end,
        values: values,
        id: dom_id(field) rescue nil

  .control-group
    = label_tag 'name', t(:search), class: :'control-label'
    .controls
      = text_field_tag 'name', params[:term], name: "term", class: 'span4'

  .control-group
    = label_tag 'selects', t(:show).titleize, class: :'control-label'
    .controls
      - ['email', 'id_card'].each do |att|
        %span.checkbox_container
          = check_box_tag "selects[]", att, params['selects'].try(:include?, att), id: "select_#{att}"
          = label_tag "select_#{att}", Subscription.human_attribute_name(att), class: :collection_check_boxes

  .control-group
    = label_tag 'field_ids[]', t(:include_fields), class: :'control-label'
    .controls
      = select_tag 'field_ids[]', options_from_collection_for_select(@event.         |
          fields.where("field_type != 'file'"), :id, :name, params['field_ids']),    |
          multiple: '', class: 'chosen input-xxlarge',   |
          :'data-placeholder' => t(:select).titleize   |

  .control-group
    .controls
      = button_tag type: "submit", class: :'btn btn-primary' do
        #{icon_tag("icon-search icon-white")}
        #{t(:search)}
      = link_to icon_tag("icon-remove icon-white").html_safe,
          event_subscriptions_path(@event), title: t(:clear_fields),
          class: 'btn btn-warning'

%table.table.table-striped
  %thead
    %tr
      %th= model_class.human_attribute_name :created_at
      %th= model_class.human_attribute_name :number
      %th= model_class.human_attribute_name :name
      - for select in permitted_selects
        %th= model_class.human_attribute_name select
      - for field in @fields
        %th= field.name
      %th
  %tbody
    - @subscriptions.each do |subscription|
      %tr
        %td= l subscription.created_at, format: :short
        %td= link_to subscription.number, subscription_path(subscription)
        %td= abbr(subscription.name, size: 60)
        - for select in permitted_selects
          %td= subscription.attributes[select]
        - for field in @fields
          - fill = subscription.fills.where(field_id: field.id).first
          %td= fill.value_to_s if fill
        %td.actions
          = minilink_to_edit subscription, edit_subscription_path(subscription)
          = minilink_to_receipt(subscription)

.pull-right
  %strong
    = t :total, count: @count

= paginate @subscriptions

= link_to icon_tag('icon-download-alt icon-white') + " CSV",
    event_subscriptions_path(@event, format: 'csv', params: params.slice(:fields,
    :field_ids, :term, :selects)), class: 'btn btn-inverse', title: t(:'export.csv')
= link_to icon_tag('icon-download-alt icon-white') + " XLS",
    event_subscriptions_path(@event, format: 'xls', params: params.slice(:fields,
    :field_ids, :term, :selects)), class: 'btn btn-success', title: t(:'export.xls')
= link_to icon_tag('icon-download-alt icon-white') + " ZIP", '#download_fields',
    class: 'btn btn-info', :'data-toggle' => "modal", title: t(:'export.zip') if @subscriptions.first and can?(:download, @subscriptions.first.field_fills.build)
= link_to icon_tag('icon-envelope icon-white') + " E-mail",
    new_event_notification_path(@event, filters: params[:fields]),
    class: 'btn btn-danger', :'data-toggle' => "modal", title: t(:'send_email') if can? :create, @event.notifications.build

-  if @subscriptions.first and can?(:download, @subscriptions.first.field_fills.build)
  = render 'download_dialog', params: params, event: @event
{'fraction_non_alphanumeric': 0.1491173156379116, 'fraction_numerical': 0.0007512207336922499, 'mean_word_length': 3.5855338691159586, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 14, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '353559', 'n_tokens_mistral': 2569, 'n_tokens_neox': 2558, 'n_words': 549}