我目前正在使用Twitter Bootstrap框架,当使用模态窗口时,我无法通过js元素来工作,如datepicker或验证,尽管选择和均匀渲染正确.请看下面的模态窗口:
<div class="modal hide in" id="newMember" style="display: block; " aria-hidden="false">
<div class="modal-header">
<button class="close" data-dismiss="modal" type="button">×</button>
<h3>New Member Form</h3>
</div>
<form accept-charset="UTF-8" action="/players" class="form-horizontal" id="new_user" method="post"><div style="margin:0;padding:0;display:inline"><input name="utf8" type="hidden" value="?"><input name="authenticity_token" type="hidden" value="KdL6cc2Vb53qeMY+PpBUS70myT4HX1uWofMUBolLea8="></div>
<div class="modal-body">
<div class="widget-content nopadding">
<div class="control-group">
<label class="control-label" for="user_role">Role</label>
<div class="controls">
<select id="user_role" name="user[role]" style="display: none; " class="chzn-done"><option value="">Select member role</option>
<option value="1">Player</option>
<option value="2">Coach</option>
<option value="3">Parent</option>
<option value="4">Manager</option>
<option value="5">Non-player</option></select><div id="user_role_chzn" class="chzn-container chzn-container-single" style="width: 222px; "><a href="javascript:void(0)" class="chzn-single"><span>Select member role</span><div><b></b></div></a><div class="chzn-drop" style="left: -9000px; width: …Run Code Online (Sandbox Code Playgroud) 我最近从RVM迁移到Rbenv,当我尝试执行rails时,我收到的错误如下所示
Pauls-Air:~ $ rails
rbenv: rails: command not found
The `rails' command exists in these Ruby versions:
2.1.2
Run Code Online (Sandbox Code Playgroud) 我有一个选择框的代码,由Chosen jQuery插件显示.我想要实现的是从已选择的当前项获取值:
<div>
<select id="schedule_event" name="schedule[event]" style="display: none; " class="chzn-done"><option value="Game" selected="selected">Game</option>
<option value="Event">Event</option>
<option value="Training">Training</option>
</select>
<div id="schedule_event_chzn" class="chzn-container chzn-container-single chzn-container-active" style="width: 854px; ">
<a href="javascript:void(0)" class="chzn-single chzn-single-with-drop" tabindex="-1">
<span>Game</span>
<div></div>
</a>
<div class="chzn-drop" style="width: 849px; top: 27px; left: 0px; ">
<div class="chzn-search">
<input type="text" autocomplete="off" style="width: 814px; " tabindex="0">
</div>
<ul class="chzn-results">
<li id="schedule_event_chzn_o_0" class="active-result result-selected highlighted" style="">Game</li>
<li id="schedule_event_chzn_o_1" class="active-result" style="">Event</li>
<li id="schedule_event_chzn_o_2" class="active-result" style="">Training</li>
</ul>
</div>
</div>
</div>
Run Code Online (Sandbox Code Playgroud)
我现在用来查找当前值的JavaScript是:
$("#schedule_event").chosen().change( function() {
alert(+ $(this).text());
$('#' + …Run Code Online (Sandbox Code Playgroud) 我正在尝试设计从某些方面的默认值中显示不同的布局模板.
当用户进入登录页面时,我有这个工作,但我需要显示不同的布局,以便注册,忘记密码和重置.
这是我的应用程序控制器中的当前代码:
layout :layout
private
def layout
# only turn it off for login pages:
is_a?(Devise::SessionsController) ? "login" : "application"
# or turn layout off for every devise controller:
#devise_controller? && "application"
end
Run Code Online (Sandbox Code Playgroud) 当我从轨道表格中保存多个红宝石时,它似乎在前面添加了一个空白元素.我该如何删除它?该字段是selected_player.
{"utf8"=>"?",
"authenticity_token"=>"H8W7qPBezubyeU0adnTGZ4oJqYErin1QNz5oK0QV6WY=",
"schedule"=>{"event"=>"1",
"result_id"=>"",
"time"=>"26/10/2012",
"duration"=>"15",
"arrival_time"=>"14",
"location_id"=>"25",
"selected_players"=>["", "38", "41"],
"team_id"=>"1",
"opponent_id"=>"7",
"home_or_away"=>"Home"},
"commit"=>"Save Event"}
Run Code Online (Sandbox Code Playgroud)
调节器
def update
@schedule = Schedule.find(params[:id])
@user = User.find(current_user)
@players = User.where(:team_id => current_user[:team_id]).all
respond_to do |format|
if @schedule.update_attributes(params[:schedule])
Notifier.event_added(@user,@schedule).deliver
format.html { redirect_to(@schedule,
:notice => "#{event_display_c(@schedule.event)} vs #{@schedule.opponent.name} was successfully updated.") }
format.json { head :no_content }
else
format.html { render :action => "edit" }
format.json { render :json => @schedule.errors, :status => :unprocessable_entity }
end
end
end
Run Code Online (Sandbox Code Playgroud) 我想对某些标准操作进行部分调用.我正在使用此方法来调用partial:
%li= link_to 'Delete Event', 'javascript:void(0);', :class => 'alert tiny button', :data => {'reveal-id' => :RevealDelete}
= render 'layouts/reveal_delete', :item => event_display(@event.event), :resource => @event
Run Code Online (Sandbox Code Playgroud)
然后在我的部分,
#RevealDelete.reveal-modal
%a.close-reveal-modal ×
%h3= "Delete #{item}"
%p Are you sure you want to delete this?
=link_to "Delete #{item}", resource, :method => :delete, :remote => :true, :confirm => resource, :class => 'button close-reveal-modal'
%a.button.alert.close-reveal-modal Cancel
Run Code Online (Sandbox Code Playgroud)
我怎么能有这样的东西:
link_to 'Delete', '#', :partial => 'layouts/delete', :remote => :true?
Run Code Online (Sandbox Code Playgroud)
所以我只在点击时渲染部分,而不是在页面加载时渲染?
我有一个导航栏,在加载时从页面顶部开始大约200px.当我向下滚动时,我希望导航栏能够"粘贴"到页面的顶部,并在滚动浏览其余内容时可见.我可以让导航栏从顶部保持200px的位置,它忽略了我向前拉的内容并将其全部拉到左侧.我需要确保导航栏仍然可见,并且布局/样式在整个过程中都是相同的.
下面是我的jsfiddle,显示我遇到的麻烦
<!-- Begin Logo / Search -->
<header class="masthead">
<div class="row">
<div class="span6">
<div class="logo pull-left">
<h1><a href="/">name</a></h1>
</div>
</div>
<div class="span6">
<div class="pull-right hidden-phone">
<form class="search" action="/search" id="site-search">
<input type="hidden" name="records" value="6">
<div class="input-append">
<input type="text" name="q" class="search_box" placeholder="Search" value="" autocomplete="off" />
<button class="btn" type="submit"><i class="icon-search"></i></button>
</div>
</form>
</div>
</div>
</div>
</header>
<!-- Begin Navbar -->
<div>
<div class="navbar navbar-static">
<div class="navbar-inner" id="mastnav">
<div class="container">
<!-- .btn-navbar is used as the toggle for collapsed navbar content -->
<a …Run Code Online (Sandbox Code Playgroud) 我试图使用内联if语句来检查是否存在一个数据,以及是否显示它.此代码当前位于我的渲染,返回块中.
我遇到的问题是使用它,内容不再呈现
{(() => {
if (this.props.data.size) {
<Text style={styles.headerLabel}>Sizes</Text>
{(this.props.data.size||[]).map((section,i) => (
<AddToCartRow key={i} data={section} productName={this.props.data.name} value={Config.priceToPriceWithCurrency(section.price)} />
))}
}
})()}
Run Code Online (Sandbox Code Playgroud) 我正在尝试找出如何用竖线(|)分隔限制器值的方法
理想情况下,最终结果将是:View | 48 | 120 | 全部,目前我已经能够查看:48 120 ALL
这是我到目前为止使用的:
<div class="field limiter">
<label class="label" for="limiter">
<span><?= /* @escapeNotVerified */ __('View:') ?></span>
</label>
<div class="control">
<?php foreach ($block->getAvailableLimit() as $_key => $_limit): ?>
<a data-role="limiter" href="#" data-value="<?php /* @escapeNotVerified */ echo $_key ?>"<?php if ($block->isLimitCurrent($_key)): ?>
class="selected"<?php endif ?>>
<?php /* @escapeNotVerified */ echo $_limit ?>
</a>
<?php endforeach; ?>
</div>
</div>
Run Code Online (Sandbox Code Playgroud) 我试图在我的苗条模板的开头添加一个空间,由于链接我不得不打破文本,我不能为我的生活工作这一个
.mdl-cell.mdl-cell--4-col-phone.mdl-cell--8-col-tablet.mdl-cell--12-col-desktop
| Don't have an account?
= link_to 'Create one here.', sign_up_path
Run Code Online (Sandbox Code Playgroud) jquery ×3
arrays ×1
categories ×1
conditional ×1
datepicker ×1
devise ×1
if-statement ×1
layout ×1
magento2 ×1
onchange ×1
rbenv ×1
react-native ×1
render ×1
ruby ×1
slim-lang ×1