<commit_before>- @instructor ||= Center.new
- create_view = @event.new_record?
- submit_btn_caption = ( create_view ? (action_event ? t('activities.caption.button.create') : t('event.caption.button.create')) : t('event.caption.button.update') )
= form_for @event, html: { class: 'form-horizontal', role: 'form'} do |f|
  - if action_event
    = hidden_field_tag 'manage_page', 'activity'
    = f.hidden_field :event_category_id, value: @event_categories.first.id
  .row
    .col-xs-12.col-sm-12
      .center
        = render partial: 'shared/error_messages', locals: { target: f.object }
  .row
    .col-xs-12
      - if !action_event
        .form-group
          %label.col-sm-3.control-label.no-padding-right= t('event.caption.event_category')
          .col-sm-9
            = f.collection_select :event_category_id, @event_categories,:id,:name
        .space-4
      .form-group
        %label.col-sm-3.control-label.no-padding-right= t('common.caption.name')
        .col-sm-9
          = f.text_field :name, class: 'col-xs-10 col-sm-5'
      .space-4
      .form-group
        %label.col-sm-3.control-label.no-padding-right= t('common.caption.description')
        .col-sm-9
          = f.text_area :description, rows: 4, class: 'form-control', :class => 'ckeditor'
      .space-4
      .form-group
        %label.col-sm-3.control-label.no-padding-right{for: 'form-field-1'} #{t('common.caption.image')}
        .col-sm-9
          = f.file_field :avatar, class: 'col-xs-10 col-sm-5'
      - if @event.avatar.present?
        .form-group#event_avatar_part
          %label.col-sm-3.control-label.no-padding-right
          .col-sm-9
            = image_tag @event.avatar.url(:thumb)
      .form-group
        %label.col-sm-3.control-label.no-padding-right
        .col-sm-9
          %img(src='' id='preview_event_avatar' style='display:none;')

      .clearfix
        .col-md-offset-3.col-md-9
          = f.submit "#{submit_btn_caption}", class: 'btn btn-primary', title: "#{submit_btn_caption}"
          = link_to t('common.caption.button.cancel'), events_path, class: 'btn', title: t('common.caption.button.cancel')<commit_msg>#74 - Fixed redirection after click on "Cancel" button<commit_after>- @instructor ||= Center.new
- create_view = @event.new_record?
- submit_btn_caption = ( create_view ? (action_event ? t('activities.caption.button.create') : t('event.caption.button.create')) : t('event.caption.button.update') )
- btn_cancel_redirection = action_event ? events_path(manage_page: action_event) : events_path
= form_for @event, html: { class: 'form-horizontal', role: 'form'} do |f|
  - if action_event
    = hidden_field_tag 'manage_page', 'activity'
    = f.hidden_field :event_category_id, value: @event_categories.first.id
  .row
    .col-xs-12.col-sm-12
      .center
        = render partial: 'shared/error_messages', locals: { target: f.object }
  .row
    .col-xs-12
      - if !action_event
        .form-group
          %label.col-sm-3.control-label.no-padding-right= t('event.caption.event_category')
          .col-sm-9
            = f.collection_select :event_category_id, @event_categories,:id,:name
        .space-4
      .form-group
        %label.col-sm-3.control-label.no-padding-right= t('common.caption.name')
        .col-sm-9
          = f.text_field :name, class: 'col-xs-10 col-sm-5'
      .space-4
      .form-group
        %label.col-sm-3.control-label.no-padding-right= t('common.caption.description')
        .col-sm-9
          = f.text_area :description, rows: 4, class: 'form-control', :class => 'ckeditor'
      .space-4
      .form-group
        %label.col-sm-3.control-label.no-padding-right{for: 'form-field-1'} #{t('common.caption.image')}
        .col-sm-9
          = f.file_field :avatar, class: 'col-xs-10 col-sm-5'
      - if @event.avatar.present?
        .form-group#event_avatar_part
          %label.col-sm-3.control-label.no-padding-right
          .col-sm-9
            = image_tag @event.avatar.url(:thumb)
      .form-group
        %label.col-sm-3.control-label.no-padding-right
        .col-sm-9
          %img(src='' id='preview_event_avatar' style='display:none;')

      .clearfix
        .col-md-offset-3.col-md-9
          = f.submit "#{submit_btn_caption}", class: 'btn btn-primary', title: "#{submit_btn_caption}"
          = link_to t('common.caption.button.cancel'), btn_cancel_redirection, class: 'btn', title: t('common.caption.button.cancel')
{'fraction_non_alphanumeric': 0.16098442086249717, 'fraction_numerical': 0.014450214495371415, 'mean_word_length': 2.5553772070626004, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5194165', 'n_tokens_mistral': 1556, 'n_tokens_neox': 1534, 'n_words': 235}