Sha256: 77a76d7fcc390ca2e9a03b5408244481e808fda4c9a314e90ed4f22860f82fd1

Contents?: true

Size: 1.97 KB

Versions: 21

Compression:

Stored size: 1.97 KB

Contents

<script type="text/javascript">
    function attachFileUploader() {
        <% key = Rails.application.config.session_options[:key] %>
        var uploadify_script_data = {};
        var csrf_param = $('meta[name=csrf-param]').attr('content');

        var csrf_token = $('meta[name=csrf-token]').attr('content');
        uploadify_script_data[csrf_param] = encodeURI(encodeURIComponent(csrf_token));
        uploadify_script_data['<%= key %>'] = '<%= cookies[key] %>';

        //var uploadify_script_data = {};
        $('#file_uploader').uploadify({
            swf: '<%= asset_path("uploadify.swf") %>',
            uploader: '<%= url_for(controller: '/admin/store/printable_catalogs', action: 'create') %>',
            buttonText: 'Загрузить файлы...',
            buttonCursor: 'hand',
            height: 20,
            fileExt: '*.pdf;',
            fileDesc: 'Возможна загрузка только PDF файлов',
            auto: true,
            multi: true,
            removeCompleted: false,
            beforeSend: function (xhr) {
                //alert("Before Send");
                xhr.setRequestHeader('X-CSRF-Token', csrf_token);
            },
            onUploadSuccess: function (file, data, response) {
                var upFileData = jQuery.parseJSON(data);

                //alert('Image Data:' + imageData.filename.thumb.url );
                var str =
                        '<li>' +
                        '<a href="' + upFileData.filename.url + '" alt=""/>file </a>' +
                        '</li>';

                $('#uploaded_files_container').append(str);
            },
            onUploadError: function (file, errorCode, errorMsg, errorString) {
                alert('The file ' + file.name + ' could not be uploaded: ' + errorString);
            },
            formData: uploadify_script_data,
             onUploadComplete : function(file) {
               //alert(jQuery.toJSON(file));
             }
        });
    }
</script>

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
kirgudu_base-0.0.25 app/views/kirgudu_base/admin/default/admin/shared/_attach_file_uploader.html.erb
kirgudu_base-0.0.23 app/views/kirgudu_base/admin/default/admin/shared/_attach_file_uploader.html.erb
kirgudu_base-0.0.22 app/views/kirgudu_base/admin/default/admin/shared/_attach_file_uploader.html.erb
kirgudu_base-0.0.21 app/views/admin_templates/default/admin/shared/_attach_file_uploader.html.erb
kirgudu_base-0.0.19 app/views/admin_templates/default/admin/shared/_attach_file_uploader.html.erb
kirgudu_base-0.0.18 app/views/admin_templates/default/admin/shared/_attach_file_uploader.html.erb
kirgudu_base-0.0.17 app/views/admin_templates/default/admin/shared/_attach_file_uploader.html.erb
kirgudu_base-0.0.16 app/views/admin_templates/default/admin/shared/_attach_file_uploader.html.erb
kirgudu_base-0.0.15 app/views/admin_templates/default/admin/shared/_attach_file_uploader.html.erb
kirgudu_base-0.0.14 app/views/admin_templates/default/admin/shared/_attach_file_uploader.html.erb
kirgudu_base-0.0.13 app/views/admin_templates/default/admin/shared/_attach_file_uploader.html.erb
kirgudu_base-0.0.12 app/views/admin_templates/default/admin/shared/_attach_file_uploader.html.erb
kirgudu_base-0.0.11 app/views/admin_templates/default/admin/shared/_attach_file_uploader.html.erb
kirgudu_base-0.0.10 app/views/admin_templates/default/admin/shared/_attach_file_uploader.html.erb
kirgudu_base-0.0.9 app/views/admin_templates/default/admin/shared/_attach_file_uploader.html.erb
kirgudu_base-0.0.8 app/views/admin_templates/default/admin/shared/_attach_file_uploader.html.erb
kirgudu_base-0.0.7 app/views/admin_templates/default/admin/shared/_attach_file_uploader.html.erb
kirgudu_base-0.0.6 app/views/admin_templates/default/admin/shared/_attach_file_uploader.html.erb
kirgudu_base-0.0.5 app/views/admin_templates/default/admin/shared/_attach_file_uploader.html.erb
kirgudu_base-0.0.4 app/views/admin_templates/default/admin/shared/_attach_file_uploader.html.erb