Sha256: d6a5e95f416aad9b4ecb0362d2101bf8affd701734eeef37ed8f87299c165725

Contents?: true

Size: 1.67 KB

Versions: 4

Compression:

Stored size: 1.67 KB

Contents

#add_photo.modal.fade
  .modal-dialog
    .modal-content
      .modal-header
        %button.close{ type: 'button', aria_label: 'Close', data: { dismiss: 'modal' } }
          %span{ aria_hidden: "true" }
            ×
        %h4.modal-title
          = t('.add_new_photo')
      .modal-body
        %p= t('my_forum.attachments.allowed_extensions', ext: upload_allowed_extensions.join(', '))
        = form_for MyForum::Attachment.new, url: attachments_path, multipart: true, remote: true do |f|
          = f.file_field 'file[]', multiple: true, id: 'attachment_files'

        #loaded-content

      .modal-footer
        %button.btn.btn-default{ type: 'button', aria_label: 'Close', data: { dismiss: 'modal' } }
          Close

      :coffee
        $('#attachment_files').change ->
          form_data = new FormData()

          files_count = $('#attachment_files').prop('files').length
          form_data.append('files[]', $('#attachment_files').prop('files')[c]) for c in [0...files_count]

          $.ajax({
            url: "#{attachments_path}"
            dataType: 'html'
            cache: false
            contentType: false
            processData: false
            data: form_data
            type: 'post',
            success: (data, textStatus, jqXHR) ->
              response = $.parseJSON(data)
              bbcode_attachments = ''
              bbcode_attachments += ('[attachment=' + id + '] \n') for id in response.attachments
              $('##{textarea}').append(bbcode_attachments)
              $('#loaded-content').html('#{t('my_forum.successfull_aploaded')}')
              $('#add_photo').modal('hide')
              $('#attachment_files').val('')
          })

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
my_forum-0.0.1.beta31 app/views/my_forum/shared/_upload_photo.haml
my_forum-0.0.1.beta30 app/views/my_forum/shared/_upload_photo.haml
my_forum-0.0.1.beta29 app/views/my_forum/shared/_upload_photo.haml
my_forum-0.0.1.beta28 app/views/my_forum/shared/_upload_photo.haml