视频播放器实际上加载正常.我的实际问题是,当我使用AJAX刷新页面的某些部分并且这些部分包含视频播放器时,HTML5播放器加载正常,但不是自定义它的Video.js部分.
video.js文件加载在页面的标题中.我已阅读该文档,但无法找到如何在已加载的页面上初始化视频播放器.myPlayer.initialize()当我加载包含视频的页面部分以使视频播放器正确加载Video.js时,是否有一种我可以调用的功能?
我认为video.js文件仅在页面加载时自动执行.
感谢您的宝贵帮助!
我有一个用于我的Rails应用程序的暂存和生产环境(在Heroku上运行).目前,staging.rb和production.rb中有很多东西,我必须在每个文件中单独定义,例如:
# Code is not reloaded between requests
config.cache_classes = true
# Full error reports are disabled and caching is turned on
config.consider_all_requests_local = false
config.action_controller.perform_caching = true
# Disable Rails's static asset server (Apache or nginx will already do this)
config.serve_static_assets = false
# Compress JavaScripts and CSS
config.assets.compress = true
# Don't fallback to assets pipeline if a precompiled asset is missed
config.assets.compile = false
# Generate digests for assets URLs
config.assets.digest = true
Run Code Online (Sandbox Code Playgroud)
事实并非如此DRY.有没有一种优雅的方法可以有效地将设置从production.rb导入到staging.rb中,然后只是覆盖我希望为登台环境更改的设置?
找到了一些建议:http://openmonkey.com/articles/2009/03/cucumber-steps-for-testing-page-urls-and-redirects
我已经将上述方法添加到我的Web步骤定义中,编写了我的功能,运行它并得到有关nil对象的错误.经过一番调查,我注意到,我没有回应并请求对象,它们是零
来自web_steps.rb:
Then /^I should be on the (.+?) page$/ do |page_name|
request.request_uri.should == send("#{page_name.downcase.gsub(' ','_')}_path")
response.should be_success
end
Then /^I should be redirected to the (.+?) page$/ do |page_name|
request.headers['HTTP_REFERER'].should_not be_nil
request.headers['HTTP_REFERER'].should_not == request.request_uri
Then "I should be on the #{page_name} page"
end
Run Code Online (Sandbox Code Playgroud)
请求和响应对象是零,为什么?
我有一个UITableViewCell我这样使用的自定义:
AppTableCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
NSArray *topLevelObjects = [[NSBundle mainBundle] loadNibNamed:@"AppTableCell" owner:self options:nil];
for(id currentObject in topLevelObjects) {
if([currentObject isKindOfClass:[AppTableCell class]]) {
cell = (AppTableCell *)currentObject;
break;
}
}
}
Run Code Online (Sandbox Code Playgroud)
工作完美无瑕.但是,我想在创建时为单元格做一些自定义的事情.通常我会覆盖类似的东西initWithFrame,但它没有在这里使用.我应该覆盖哪种方法来自定义初始化?
经过长时间的休整后,我才回到轨道编码.我之前使用的是rinari,但注意到有一个新版本的emacs-rails.有人用过吗?对一个人的偏好是什么?这些天人们在emacs中使用哪些铁轨项目?
如果我有这样的国际电话号码:
0541754301
如何格式化它以产生这样的东西:
0541-754-301
我正在尝试测试我的应用程序正在使用的引擎内部的控制器.规范不在引擎内,而是在应用程序本身(我试图在引擎内测试但也有问题).
我的引擎有以下路由.rb:
Revision::Engine.routes.draw do
resources :steps, only: [] do
collection { get :first }
end
end
Run Code Online (Sandbox Code Playgroud)
引擎通常安装在应用程序routes.rb上:
mount Revision::Engine => "revision"
Run Code Online (Sandbox Code Playgroud)
当我跑步时rake routes,在最后一行我得到:
Routes for Revision::Engine:
first_steps GET /steps/first(.:format) revision/steps#first
root / revision/steps#first
Run Code Online (Sandbox Code Playgroud)
在我的引擎控制器(lib/revision/app/controllers/revision/steps_controller.rb)上,我有:
module Revision
class StepsController < ApplicationController
def first
end
end
end
Run Code Online (Sandbox Code Playgroud)
在Rspec上,我测试这个控制器:
require 'spec_helper'
describe Revision::StepsController do
it "should work" do
get :first
response.should be_success
end
end
Run Code Online (Sandbox Code Playgroud)
然后,当我运行此规范时,我得到:
ActionController::RoutingError:
No route matches {:controller=>"revision/steps", :action=>"first"}
Run Code Online (Sandbox Code Playgroud)
为了确保路由确实不存在,我将其添加到规范中:
before do
puts @routes.set.to_a.map(&:defaults)
end
Run Code Online (Sandbox Code Playgroud)
结果如下:
[...] …Run Code Online (Sandbox Code Playgroud) 我的项目中有一个Category和Subcategory模型.我希望以灵活的方式拥有许多子级别.我认为制作一个自我引用的"父母"外键,但我不太清楚该怎么做.有任何想法吗?谢谢!
Cat1
Sub1
SubSub1
SubSub2
Sub2
Cat2
Sub1
Cat3
Sub1
Sub2
SubSub1
Run Code Online (Sandbox Code Playgroud) ruby model-view-controller ruby-on-rails ruby-on-rails-plugins
在ruby on rails上,我试图更新2个部分.
show.html.erb:
<div id="filters"><%= render :partial => "pricelistfilters" %></div>
Run Code Online (Sandbox Code Playgroud)
pricelistfilters.html.erb:
<% @properties.each do |prop| %>
#Render the page on properties (and the newproperties)
#<select ...><option>...</option><option>...</option>
#</select>
<% end %>
Run Code Online (Sandbox Code Playgroud)
products.js - >渲染部分的事件
$(window).ready(function(){
selectionchanges();
});
function selectionchanges(){
$('#filters select').change(function(){
//Doing stuff to send with ajax
//Ajax:
$.ajax({
url: document.URL,
type: 'POST',
data: params
});
});
}
Run Code Online (Sandbox Code Playgroud)
products_controller.rb - >用于处理所做更改的代码
def show
#Changing the properties (and the pricelist properties)
@properties #is filled
@newproperties #is filled
respond_to do |format|
format.html …Run Code Online (Sandbox Code Playgroud) 我在 VideoJS 论坛上发布了这个,但还没有收到回复,我希望我能在这里得到一些帮助。:)
我正在尝试删除视频 js 中的视频播放完毕后显示的“大播放按钮”。
我尝试了很多隐藏/表演,但似乎无法让它在最后消失。我已经通过简单地改变 css 让它在开始时隐藏起来,但我最终什么也没找到。我使用的是最新版本的 Video JS,因此我发现的旧修复程序不起作用。
请帮忙。先感谢您!