【问题标题】:customize rails4 delete popup box自定义rails4删除弹出框
【发布时间】:2015-04-28 08:58:43
【问题描述】:

请指导我如何自定义我想要自己设计的删除弹出框的rails。在我看来,我已经给出了这个:

<td class="text-center">
   <%= link_to delete, user_path(user.id), method: :delete, :remote => true, data: { confirm: 'Are you sure?', no_turbolink: true } %>
</td>

我的弹出 html 代码是

<div class="container">
  <div class="grid">
          <p  class="margin_B0"><a href="#"class="place-right" ><img src="images/close_icon.png" width="13" height="13"></a></p>
          <div class="row margin_T5 margin_B0 bg-white">
            <div class="row">
              <p>Text goes here</p>
            </div>
            <div class="row text-center">
              <input type="button" value="CANCEL" class="button meduim text_upper buttons_orange">
              <input type="submit" value="SUBMIT" class="button meduim text_upper buttons_orange">
            </div>
          </div>
  </div>
</div>

请帮助我在哪里写我自己的弹出框视图。

提前致谢。

【问题讨论】:

    标签: ruby-on-rails ruby-on-rails-4.1


    【解决方案1】:
    <%= link_to delete, user_path(user.id), method: :delete, :remote => true, data: { popup: true, no_turbolink: true } %>
    
    $('a[data-popup]').on('click', function(e) { 
        var myWindow = window.open("", "myWindow", "width=200, height=100");   // Opens a new window; 
        myWindow.document.write("<p>This is 'myWindow'</p>");   // Text in the new window
    
        e.preventDefault(); 
    });
    

    试试这样的

    【讨论】:

    • 我将在哪里提供我的自定义视图代码实际上并没有得到。
    • 使用“window.open”创建弹出窗口,使用“document.write”在弹出窗口中添加内容
    • 不,它总是给 你确定吗? 只有没有改变它不工作:(
    • 我的问题也和上面一样,但唯一的改变是我必须在弹出框中给出关闭图标,即close_icon.png。我希望我必须在我的 data: { confirm: 'Are you sure?', no_turbolink: true } 中传递一些东西。但我不知道如何做到这一点。
    猜你喜欢
    • 2014-08-11
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多