我只想获得两个修订版之间已更改文件的列表,这很简单:
git diff -–name-only commit1 commit2 > /path/to/my/file
Run Code Online (Sandbox Code Playgroud)
但是,如果我想将所有列出的文件复制到另一个地方,我该怎么写?我需要完全相同的目录结构复制文件.
例如,我修改并添加了文件:
/protected/texts/file1.txt
/protected/scripts/index.php
/public/pics/pic1.png
Run Code Online (Sandbox Code Playgroud)
我希望在/home/changes/所有更改和添加的文件中包含:
/home/changes/protected/texts/file1.txt
/home/changes/protected/scripts/index.php
/home/changes/public/pics/pic1.png
Run Code Online (Sandbox Code Playgroud) 我有模特邮政和收集帖子.并想用所有帖子的列表制作表格<select id="multi" multiple="multiple">.所以我必须在我的#multi中使用这个模板进行PostView渲染:
<option value=""><%= title %></option>
Run Code Online (Sandbox Code Playgroud)
但最后我把它包裹着div.有没有包装这个模板的解决方案<div>?
我正在通过本文http://blog.shinetech.com/2011/07/25/cascading-select-boxes-with-backbone-js/与backbone.js进行链接选择,但在扩展类时遇到错误.
所以,我有LocationsView类:
class Blog.Views.LocationsView extends Backbone.View
events:
"change": "changeSelected"
Run Code Online (Sandbox Code Playgroud)
CountriesView类:
class Blog.Views.CountriesView extends Blog.Views.LocationsView
setSelectedId: (countryId) ->
Run Code Online (Sandbox Code Playgroud)
CitiesView类:
class Blog.Views.CitiesView extends Blog.Views.LocationsView
setSelectedId: (cityId) ->
Run Code Online (Sandbox Code Playgroud)
但是当coffeescript代码编译为javascript时,我的双扩展类看起来像:
(function() {
var __hasProp = Object.prototype.hasOwnProperty, __extends = function(child, parent) {
for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; }
function ctor() { this.constructor = child; }
ctor.prototype = parent.prototype;
cities_view.js:5 Uncaught TypeError: Cannot read property 'prototype' of undefined
child.prototype = new ctor;
child.__super__ = parent.prototype;
return child; …Run Code Online (Sandbox Code Playgroud) 我想在我的Formtastic表单中选择部分链.但是,是否可以为将来的AJAX替换设置多个选择的自定义ID?
这不起作用:
<%= semantic_form_for [:admin, @production_year] do |f| %>
<%= f.inputs do %>
<%= f.input :car_model, :label => "CarModel", :as => :select, :collection => Brand.find(:all, :order => "name ASC"), :id => "brand_id" %>
<% end %>
<% end %>
Run Code Online (Sandbox Code Playgroud) 请显示使用Cocoon的'link_to_add_association'和html_options的任何示例. https://github.com/nathanvda/cocoon
文件说:
html_options: extra html-options (see link_to) There are two extra options that allow to conrol the placement of the new link-data:
data-association-insertion-node : the jquery selector of the node
data-association-insertion-position : insert the new data before or after the given node.
Run Code Online (Sandbox Code Playgroud)
但我无法理解该怎么做,如果我想在我的"添加元素"链接之前插入部分.不仅在父母的div开始之后.这不会起作用:
<%= link_to_add_association"add element",f,:production_years,:position =>"after_all"%>
我有这样的代码,用于在我的表单中进行链选择查看索引操作:
<%= form_tag do %>
<%= collection_select(*@brands_select_params) %>
<%= collection_select(*@car_models_select_params) %>
<%= collection_select(*@production_years_select_params) %>
<% # ???? ??? ????? ?????? ?? ?????? %>
<%= submit_tag "Send", :id => "submit", :name => "submit" %>
Run Code Online (Sandbox Code Playgroud)
而我的控制器:
class SearchController < ApplicationController
def index
@brands = Brand.all
@car_models = CarModel.all
if (params[:brand].blank?)
@brands_select_params = [:brand, :id, @brands, :id, :name, :prompt => "??????? ?????"]
if params[:car_model].blank?
@car_models_select_params = [:car_model, :id, @car_models, :id, :name, { :prompt => "Model" }, \
{ :disabled => "disabled" }]
@production_years_select_params …Run Code Online (Sandbox Code Playgroud) 我想在视图中制作一些CGridView表.并且一列应包含DropDown列表.主要问题是,此下拉列表必须由模型生成.
所以,在我看来,我这样做:
$this->widget('zii.widgets.grid.CGridView', array(
'dataProvider'=>$orders->search(),
'filter' => $orders,
'columns' => array(
array(
'name' => 'actions',
'header' => 'Actions',
'value' => '$data->actions',
'filter' => false,
),
));
Run Code Online (Sandbox Code Playgroud)
并在订单模型:
public function getActions() {
return CHtml::dropDownList('status', $this->status->id, CHtml::listData(Status::model()->findAll(), 'id', 'title'));
}
Run Code Online (Sandbox Code Playgroud)
我用这个下拉列表的代码得到了相当不错的列值,但所有特殊的chracters编码为lt; QUOT; GT; 等等,只是字符串,而不是html元素.
那么,如何获得真正的html下拉列表?
[已解决]只需为此列添加'type'=>'raw'即可解决所有这些问题
backbone.js ×2
forms ×2
cocoon-gem ×1
coffeescript ×1
formtastic ×1
git ×1
javascript ×1
php ×1
refactoring ×1
render ×1
ruby ×1
yii ×1