小编gio*_*vaZ的帖子

从"blob"网址检索下载文件

网站的视频标记元素的结构如下:

<video id="playerVideo" width="450px" autoplay="autoplay" height="338px" style="height:100%;width:100%;" class="mejs-rai-e" src="blob:http%3A//www.example.com/d70a74e1-0324-4b9f-bad4-84e3036ad354"></video>
Run Code Online (Sandbox Code Playgroud)

正如您所看到的,src元素的url预先配置为blob.是否有像脚本或视频下载器插件的方法来定位文件并下载它?

video html5

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

基金会宝石不兼容的单位:'rem'和'px'

我已经使用版本5.5.2.1安装了基础gem.当我启动应用程序时,我收到此错误:

Showing /home/user/Scrivania/sites/store/app/views/layouts/application.html.erb where line #9 raised:

Incompatible units: 'rem' and 'px'.
Run Code Online (Sandbox Code Playgroud)

在互联网上的一些其他案例后,我试图更改我的gem文件夹中的文件_settings.scss:

../../var/lib/gems/2.1.0/gems/foundation-rails-5.5.2.1/vendor/assets/stylesheets/foundation/_settings.css
Run Code Online (Sandbox Code Playgroud)

我评论过这些内容:

$row-width: rem-calc(1000);
$column-gutter: rem-calc(30);
$total-columns: 12;
Run Code Online (Sandbox Code Playgroud)

我已经设置了我的自定义$ base-font-size:

 $base-font-size: 14px;
 $rem-base: $base-font-size;
Run Code Online (Sandbox Code Playgroud)

我不想降级我的宝石,所以你能帮我解决这个错误吗?

css ruby-on-rails sass zurb-foundation zurb-foundation-5

14
推荐指数
1
解决办法
3772
查看次数

Yii2在页面的头部加载Jquery

在我的Yii2应用程序中,我有一个脚本需要将Jquery加载到页面的头部.

我知道有一个参数可以在AppAssets.php中设置:

public $jsOptions = [
    'position' => \yii\web\View::POS_HEAD
];
Run Code Online (Sandbox Code Playgroud)

但这将在页面的头部呈现所有Javascripts文件.是否有可能只加载头部的Jquery?

在此先感谢所有的帮助

javascript jquery yii2

13
推荐指数
1
解决办法
8307
查看次数

yii2 select2 by kartik-v 设置默认值

我有一个关于 yii2 kartik-v widget select 2 的问题。

该小部件附加到我视图中的一个字段

<?=
$form->field($model, 'address')->widget(Select2::className(), [
    'options' => ['placeholder' => 'Inserta an address '],
    'pluginOptions' => [
        'allowClear' => true,
        'minimumInputLength' => 3,
        'ajax' => [
            'url' => Url::to(['register/addresses']),
            'dataType' => 'json',
            'data' => new JsExpression('function(params) { return {q:params.term}; }')
        ],
        'escapeMarkup' => new JsExpression('function (markup) { return markup; }'),
        'templateResult' => new JsExpression('function(address) { return address.name; }'),
        'templateSelection' => new JsExpression('function (address) { return address.name; }'),
    ],
    'pluginEvents' => [
        "select2:select" => "function(e) …
Run Code Online (Sandbox Code Playgroud)

php yii2

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

Ruby on Rails 在特定字段中存在错误

我正在定义一个名为“联系人”的表中存在的一些字段的验证:

class Contact < ActiveRecord::Base
    validates :nome, :cognome, :indirizzo_abitazione, 
              :numero_civico, :indirizzo_email, :prefisso_cellulare, :cellulare, presence: true
    validates :nome, :cognome, :indirizzo_email, 
              :prefisso_cellulare, :cellulare, uniqueness: true
    validates :indirizzo_email, format: { with: /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\z/i, on: :create }
end
Run Code Online (Sandbox Code Playgroud)

如果存在错误,我想利用引导程序的类属性“has-error”以红色突出显示特定字段;所以我试图以这种方式做到这一点:

  <div class="form-group <%= @contact.errors[:name] ? "has-error" : "" %>" >
    <%= f.label :name , :class => "control-label" %><br>
    <%= f.text_field :name, :class => "form-control" %>
  </div>
Run Code Online (Sandbox Code Playgroud)

但是当我登录到这个页面时,该字段已经是红色的。有没有一种方法可以查看在验证一条记录期间,特定字段是否出现错误?

ruby ruby-on-rails twitter-bootstrap

4
推荐指数
1
解决办法
1585
查看次数

Jquery通过td中的隐藏输入字段值选择tr

我是jQuery语言的初学者,我有一个问题.

我的网站上有一个这样的表:

<table id="filter-table" class="table table-striped">
  <thead>
    <tr>
      <th>Code</th>
      <th>Name</th>
      <th>Typology</th>
      <th>Select</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>IYCE8</td>
      <td>NAME</td>
      <td>
        <input class='typology' type='hidden' value='1'>TYPE1
        <input class='typology' type='hidden' value='2'>TYPE2
        <input class='typology' type='hidden' value='3'>TYPE3
      </td>
      <td>
        <input type="checkbox">
      </td>
    </tr>
    <tr>
      <td>IYCE9</td>
      <td>NAME2</td>
      <td>
        <input class='typology' type='hidden' value='1'>TYPE1
        <input class='typology' type='hidden' value='2'>TYPE2
      </td>
      <td>
        <input type="checkbox">
      </td>
    </tr>
  </tbody>
</table>
Run Code Online (Sandbox Code Playgroud)

如您所见,行具有与类型相关联的隐藏输入(type1 => 1).

使用下拉选择器我选择一个值:

<select id="filter" name="filter">
  <option value="">SELECT ONE</option>
  <option value="1">TYPE1</option>
  <option value="2">TYPE2</option>
  <option value="3">TYPE3</option>
</select> 
Run Code Online (Sandbox Code Playgroud)

使用过滤器中的事件OnChange我想要选择表中具有输入字段值=的所有行到下拉列表中选择的行

我怎么能用Jquery做到这一点?在此先感谢所有的帮助

html javascript jquery

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

带有Gmail SMTP的Rails 4邮件

我想将Mailer of Rails 4与Gmail的smtp配置一起使用,在我的开发文件中设置为:

  config.action_mailer.perform_deliveries = true
  config.action_mailer.delivery_method = :smtp
  config.action_mailer.smtp_settings = {
      :address              => "smtp.gmail.com",
      :port                 => 587,
      :domain               => "gmail.com",
      :user_name            => "mymail@gmail.com",
      :password             => "mygmailpassword",
      :authentication       => :plain,
      :enable_starttls_auto => true
  }
Run Code Online (Sandbox Code Playgroud)

但我不收任何邮件。这是终端的输出:

To: antonioni.giovanni9@gmail.com
Message-ID: <55ffb56da9e91_aa929362303435c@pc-rails.mail>
Subject: Conferma ordine
Mime-Version: 1.0
Content-Type: multipart/alternative;
 boundary="--==_mimepart_55ffb56da807b_aa92936230342e1";
 charset=UTF-8
Content-Transfer-Encoding: 7bit


----==_mimepart_55ffb56da807b_aa92936230342e1
Content-Type: text/plain;
 charset=UTF-8
Content-Transfer-Encoding: quoted-printable
Run Code Online (Sandbox Code Playgroud)

因此我的应用程序尝试发送电子邮件,但此邮件未显示在我的gmail仪表板上。有解决这个麻烦的主意吗?

ruby-on-rails actionmailer

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

Devise destroy_user_session_path doesn't work

In my ruby on rails application I've a problem for the user logout with devise

I've this navbar:

<% if current_user %>
<nav class="top-bar" data-topbar role="navigation">
  <ul class="title-area">
    <li class="name">
      <h1><%= link_to 'Prova CMS', articles_path %></h1>
    </li>
    <li class="toggle-topbar menu-icon"><a href="#"></a></li>
  </ul>

  <section class="top-bar-section">
    <ul class="right">
      <li><%=link_to 'Gestisci Articoli', articles_path %></li>
      <li><%=link_to 'Gestisci Categorie', categories_path %></li>
      <li class="has-dropdown">
        <a href="#"><%= current_user.email %></a>
        <ul class="dropdown">
          <li><%= link_to "Logout", destroy_user_session_path, :method => :delete %></li>
        </ul>
      </li>
    </ul>

    <% if current_page?(articles_path) %>
    <ul …
Run Code Online (Sandbox Code Playgroud)

ruby-on-rails devise

0
推荐指数
1
解决办法
2380
查看次数

无法发布带有桌子的表单

这是一个页面,我有一个表,其中包含一些必须使用表单发送到另一页的输入.

<form action="another-page.php" method="POST" id="action-form"></form>
      <table id="filter-table" class="table table-striped">
        <thead>
          <tr>
            <th> CODE </th>
            <th> NAME </th>
            <th> CONF </th>
            <th> SELECT </th>
          </tr>
         </thead>
         <tbody>
          <tr>
               <td>A0294850</td>
               <td>Test</td>
               <td>A792</td>
               <td><input type="checkbox" name="[A0294850]checkbox" value="A0294850" form="action-form"></td>
          </tr>
         </tbody>
       </table>
<div class="row-fluid">
   <div class="span12 module_cont module_promo_text">
      <div class="shortcode_promoblock ">
         <div class="row-fluid">
            <div class="span9 promo_text_block">
               <h4>Submit the form</h4>
            </div>
            <div class="span3 promo_button_block">
               <input type="submit" class="promo_button" value="OK" form="action-form">
            </div>
            </div>
           </div>
           </div><!--.module_cont -->
           <div class="clear"><!-- ClearFIX --></div>
           </div><!-- .row-fluid -->
Run Code Online (Sandbox Code Playgroud)

在另一个页面('another-page.php')中,我尝试打印$ _POST值,但我收到一个空数组作为响应.

这是代码

<?php …
Run Code Online (Sandbox Code Playgroud)

php

-2
推荐指数
1
解决办法
1710
查看次数