0

在我的 rails 应用程序中,当页面加载时,我在 Chrome Inspector 中收到以下错误:其他文件中的相同错误

在此处输入图像描述

是什么导致我的 Rails 应用程序出现这种情况?

看法

<%= stylesheet_link_tag 'admin/dashboard' %>
<%= stylesheet_link_tag 'admin/new' %>
<%= javascript_include_tag 'admin/dashboard'%>
<script>


    $(function () {
        'use strict';

        // Initialize the jQuery File Upload widget:
        $('#fileupload').fileupload();

        // Enable iframe cross-domain access via redirect option:
        $('#fileupload').fileupload(
                'option',
                'redirect',
                window.location.href.replace(
                        /\/[^\/]*$/,
                        '/cors/result.html?%s'
                )
        );

        $('#fileupload').fileupload('option', {
            maxFileSize:10000000,
            acceptFileTypes:/(\.|\/)(gif|jpe?g|png)$/i,
            sequentialUploads:true,
            process:[
                {
                    action:'load',
                    fileTypes:/^image\/(gif|jpeg|png)$/,
                    maxFileSize:20000000 // 20MB
                },
                {
                    action:'resize',
                    maxWidth:2048,
                    maxHeight:2048
                },
                {
                    action:'save'
                }
            ]
        });

        if ($.support.cors) {
            $.ajax({
                url:'//jquery-file-upload.appspot.com/',
                type:'HEAD'
            }).fail(function () {
                        $('<span class="alert alert-error"/>')
                                .text('Upload server currently unavailable - ' +
                                new Date())
                                .appendTo('#fileupload');
                    });
        }


        // Load existing files:
        $('#fileupload').each(function () {
            var that = this;
            $.getJSON(this.action, function (result) {
                if (result && result.length) {
                    $(that).fileupload('option', 'done')
                            .call(that, null, {result:result});
                }
            });
        });


    });

</script>
<div class="container">
  <header class="header">
      <div class="header_content clearfix">
        <h1 class="page_name">Dashboard</h1>
          <ul class="navbar">
            <li class="nav_item">Move</li>
            <li class="nav_item">Edit</li>
            <li class="nav_item">Delete</li>
          </ul>
      </div>
  </header>
  <section class="sidebar">
    <div class="sidebar_content">
      <ul class="menu">
        <li class="menu_item active-menu"><%=link_to 'manage albums', admin_albums_path%></li>
        <li class="menu_item"><%=link_to 'manage media' %></li>
        <li class="menu_item"></li>
        <li class="menu_item"></li>
        <li class="menu_item"></li>
      </ul>
    </div>
  </section>
  <section class="content">
    <div class="inner-box clearfix">
      <%= form_for [:admin, @album, @image], :html => { :multipart => true, :id => "fileupload"  } do |f| %>
        <!-- The fileupload-buttonbar contains buttons to add/delete files and start/cancel the upload -->
        <div class="row fileupload-buttonbar">
            <div class="span7">
                <!-- The fileinput-button span is used to style the file input field as button -->
                <span class="btn btn-success fileinput-button">
                    <i class="icon-plus icon-white"></i>
                    <span><%= t('fileupload.add_files') %></span>
                    <%= f.file_field :path, :multiple => true %>
                </span>
                <button type="submit" class="btn btn-primary start">
                    <i class="icon-upload icon-white"></i>
                    <span><%= t('fileupload.start_upload') %></span>
                </button>
                <button type="reset" class="btn btn-warning cancel">
                    <i class="icon-ban-circle icon-white"></i>
                    <span><%= t('fileupload.cancel_upload') %></span>
                </button>
                <button type="button" class="btn btn-danger delete">
                    <i class="icon-trash icon-white"></i>
                    <span><%= t('fileupload.delete_multi') %></span>
                </button>
                <input type="checkbox" class="toggle">
            </div>
            <div class="span5">
                <!-- The global progress bar -->
                <div class="progress progress-success progress-striped active fade">
                    <div class="bar" style="width:0%;"></div>
                </div>
            </div>
        </div>
        <!-- The loading indicator is shown during image processing -->
        <div class="fileupload-loading"></div>
        <br>
        <!-- The table listing the files available for upload/download -->
        <table class="table table-striped"><tbody class="files" data-toggle="modal-gallery" data-target="#modal-gallery"></tbody>
        </table>
    <% end %>
<script>
  var fileUploadErrors = {
    maxFileSize: 'File is too big',
    minFileSize: 'File is too small',
    acceptFileTypes: 'Filetype not allowed',
    maxNumberOfFiles: 'Max number of files exceeded',
    uploadedBytes: 'Uploaded bytes exceed file size',
    emptyResult: 'Empty file upload result'
  };
</script>

    </div>
  </section>
</div>
4

0 回答 0