小编ash*_*vin的帖子

如何在rails_admin中的编辑表单中隐藏"保存并添加另一个"按钮?

我在我的Rails应用程序中应用了rails_admin gem.我想删除特定模型编辑表单中的一些不必要的按钮,并添加我自己的自定义按钮.请参阅屏幕截图,了解我要删除的内容.

布局快照

ruby ruby-on-rails-4

7
推荐指数
1
解决办法
765
查看次数

如何在Angular 2中打印Pdf

我有exf url的pdf文件的URL是"test.example.com/incoice/1/download?auth_token="some_token",当我访问此URL时,url将在浏览器中显示PDF.

现在我想用打印功能打开这个pdf,我的意思是用户不必按CTRL+P我想从我这边做这个.

我试过iframe,但它给了我错误的交叉起源.这是我使用的演示代码

//first try

 let _printIframe;
var iframe = _printIframe;
if (!_printIframe) {
    iframe = _printIframe = document.createElement('iframe');
    document.body.appendChild(iframe);

    iframe.style.display = 'none';
    iframe.id  = "printf";
    iframe.name = "printf";
    iframe.onload = function() {
      setTimeout(function() {
        iframe.focus();
        iframe.contentWindow.print();
      }, 1);
    };
  }

// second try 
   // SRC of pdf
iframe.src = "Some API URl " + "/download?access_token=" + 
this.authenticationService.currentTokenDetails.access_token;
let url = iframe.src + "&output=embed";

window.frames["printf"].focus();
window.frames["printf"].print();
var newWin = window.frames["printf"];
newWin.document.write('<body onload="window.print()">dddd</body>');
newWin.document.close();
Run Code Online (Sandbox Code Playgroud)

我在plunker中为print pdf创建了一个demo.http://embed.plnkr.co/WvaB9HZicxK6tC3OAUEw/在这个plunker我打开pdf在新窗口,但我想直接打印该pdf.我怎样才能做到这一点 …

javascript pdf angular

7
推荐指数
1
解决办法
2万
查看次数

不兼容的库版本puma_http11.so

当我rake db:create在我的ruby on rails项目中运行时,它给了我错误LoadError: incompatible library version - /home/tps/.rvm/gems/ruby-2.3.1/gems/puma-3.6.0/lib/puma/puma_http11.so

这是完整的错误

tps@tps-H81M-S1:~/sites/my_app$ rake db:create
rake aborted!
LoadError: incompatible library version - /home/tps/.rvm/gems/ruby-    2.3.1/gems/puma-3.6.0/lib/puma/puma_http11.so
/home/tps/.rvm/gems/ruby-2.3.1/gems/puma-3.6.0/lib/puma/server.rb:15:in `require'
/home/tps/.rvm/gems/ruby-2.3.1/gems/puma-  3.6.0/lib/puma/server.rb:15:in `<top (required)>'
/home/tps/.rvm/gems/ruby-2.3.1/gems/puma-3.6.0/lib/puma.rb:14:in `require'
/home/tps/.rvm/gems/ruby-2.3.1/gems/puma-3.6.0/lib/puma.rb:14:in `<top   (required)>'
/home/tps/sites/my_app/config/application.rb:7:in `<top (required)>'
/home/tps/sites/my_app/Rakefile:4:in `<top (required)>'
/home/tps/.rvm/gems/ruby-2.3.1/gems/rake-11.3.0/exe/rake:27:in `<top (required)>'
(See full trace by running task with --trace)
Run Code Online (Sandbox Code Playgroud)

谁能帮帮我吗?

提前致谢

ruby-on-rails

5
推荐指数
1
解决办法
961
查看次数

通过MySQL协议连接到Sphinx时出错

'thinking-sphinx', '~> 3.1.1'在我的Rails应用程序中使用gem .我按照Git hub的所有步骤进行安装thinking-sphinx,但是当我搜索记录时,它会给我错误

通过MySQL协议连接到Sphinx时出错.通过MySQL协议连接到Sphinx时出错.

无法连接到'127.0.0.1'上的MySQL服务器(111) - SELECT*FROM listing_core,listing_delta WHERE MATCH(' product 1 ')AND community_ids= 1 AND sphinx_deleted= 0 ORDER BY sort_dateDESC LIMIT 0,24 OPTION field_weights =(title = 10, category = 8,description = 3); SHOW META

mysql ruby-on-rails thinking-sphinx

3
推荐指数
1
解决办法
1542
查看次数