我也遇到了类似的问题。 我做了些什么,使自己的<代码>bip.purr.js文档删除best_in_place.purr
。 要求我提出申请。 js file:
//application.js
//= require jquery
//= require best_in_place
//= require jquery_ujs
//= require best_in_place.jquery-ui
//= require jquery.purr
//REMOVED / COMMENTED OUT THE NEXT LINE:
// require best_in_place.purr
// ADDED THIS LINE:
//= require bip.purr
//= require turbolinks
//= require bootstrap-sprockets
//= require_tree .
我的错误职能OOB没有发挥作用,因此我也改变了这种情况。 如果为你工作,请看。 你在提出自己的档案之前应该这样做,但这正是我们所看的(资产/javascripts/bp.purr.js):
/*
* BestInPlace 3.0.0.alpha (2014)
*
* Depends:
* best_in_place.js
* jquery.purr.js
*/
/*global BestInPlaceEditor */
BestInPlaceEditor.defaults.purrErrorContainer = "<span class= bip-flash-error ></span>";
BestInPlaceEditor.defaults.purrSuccessContainer = "<span class= bip-flash-success ></span>";
//edited this binding to stop showing Error Object object
jQuery(document).on( best_in_place:error , function (event, request, error) {
use strict ;
// Display all error messages from server side validation
var errors_string = "";
jQuery.each(jQuery.parseJSON(request.responseText), function (index, value) {
if (typeof value === "object") {
$.each(value, function (i, v) {
errors_string += i[0].toUpperCase() + i.slice(1) + " " + v + ". ";
});
} else {
errors_string = value;
}
var container = jQuery(BestInPlaceEditor.defaults.purrErrorContainer).html(errors_string);
container.purr();
});
});
//added this binding for success messages:
jQuery(document).on( best_in_place:success , function (event, request, error) {
use strict ;
// Display all success messages from server side validation
var msg = "Updated Successfully";
var container = jQuery(BestInPlaceEditor.defaults.purrSuccessContainer).html(msg);
container.purr();
});
而且,就幸运的是,一些基本的SCSS能够找到不同的东西:
// for best in place / purr styling
.purr {
position: fixed;
top: 60px;
right: 100px;
width: 500px;
padding: 20px;
&.bip-flash-error {
background-color: red;
}
&.bip-flash-success {
background-color: green;
}
border: solid 1px #dadada;
border-radius: 6px;
-moz-border-radius: 6px;
-webkit-border-radius: 6px;
-webkit-box-shadow: 4px 4px 15px 0px rgba(0, 0, 0, 0.75);
-moz-box-shadow: 4px 4px 15px 0px rgba(0, 0, 0, 0.75);
box-shadow: 4px 4px 15px 0px rgba(0, 0, 0, 0.75);
&:first-letter {
text-transform: uppercase
}
;
font-size: 20px;
color: white;
font-weight: bolder;
text-shadow: -1px 0 black, 0 1px black, 1px 0 black, 0 -1px black;
}