我有一个回形针和多个图像'我实现active_admin和产品更新很好,但是,我不能上传或编辑多个图像,我有的形式是这样的:
form :html => { :multipart => true } do |f|
f.inputs "Details" do
f.input :name
f.input :created_at, :label => "Publish Product at"
f.input :category
end
f.inputs "Images" do
f.has_many :assets do |p|
p.input :asset, :as => :file, :input_html => { :multiple => true }, :label => "Image", :hint => p.object.asset.nil? ? p.template.content_tag(:span, "No Image Yet") : p.template.image_tag(p.object.asset.url(:thumb))
p.input :_destroy, :as=>:boolean, :required => false, :label=>'Remove'
end
end
f.inputs "Content" do
f.input :description
end
f.buttons
end
Run Code Online (Sandbox Code Playgroud)
和......
f.inputs "Images" do
f.has_many …Run Code Online (Sandbox Code Playgroud) 我有一个属于Car页面的Feature页面.除了一件事,这正是我想要的.
在创建,更新或销毁之后,我希望将页面重定向到创建和更新admin_car_path(car)的默认值而不是.admin_car_feature_path(car,feature)admin_car_features_path(car)
我没有成功搜索到那个.
ActiveAdmin.register Car do
end
ActiveAdmin.register Feature do
belongs_to :car
end
Run Code Online (Sandbox Code Playgroud)
TIA
上次我遇到active_admin的问题.在我有5000多行数据的表格中,它的工作速度非常慢.我该如何优化呢?也许有人知道这个模块的一些异步加载插件?
你们中的任何人都设法让Carrierwave的Active Admin工作吗?
当我安装AA时,一切正常,但图像文件上传字段是纯文本字段,因此添加如下:
ActiveAdmin.register Club do
form do |f|
f.inputs "Club" do
f.input :league
f.input :name
f.input :image, :as => :file
f.input :approved
end
f.buttons
end
end
Run Code Online (Sandbox Code Playgroud)
现在它显示为文件上传字段,我可以选择一个文件,但在我提交表单后没有任何改变.仍然没有图像,图像字段为空.任何人都知道还有什么可以让它工作?
我在Rails 3.2(使用Active Admin)中使用Formtastic 2.1.1,我想在我的表单中插入一行,但没有输入字段.这是可能的吗?Formtastic DSL中的语法是什么来实现这一目标?
这是一个例子:
form do |f|
f.inputs "Model Info" do
f.input :title
f.input :published
f.input :path
end
end
Run Code Online (Sandbox Code Playgroud)
我想做这样的事情:
form do |f|
f.inputs "Model Info" do
f.input :title
f.input :published
f.input :path
f.div "This is some important text that people using this form need to know"
end
end
Run Code Online (Sandbox Code Playgroud)
有没有人以前用Formtastic做过这件事?
我在我的rails应用程序中使用Active admin gem.我添加了有20列的资源书,现在我只需要自定义一列并按原样打印剩余的列.我试过下面的代码
ActiveAdmin.register Book do
index do
column :description do
raw "<a class='view_description button'>View Description</a>"
end
end
end
Run Code Online (Sandbox Code Playgroud)
但它隐藏了所有列并仅显示描述.任何帮助都会有用.
我注意到我的资产似乎被编译了两次,这大大减慢了我的部署,因为这一步是最耗时的部分:
~/projects/rewportal(mapwidget ?) rake assets:precompile
/home/ruy/.rvm/rubies/ruby-1.9.3-p194/bin/ruby /home/ruy/.rvm/gems/ruby-1.9.3-p194@rewportal/bin/rake assets:precompile:all RAILS_ENV=production RAILS_GROUPS=assets
AssetSync: using /home/ruy/projects/rewportal/config/initializers/asset_sync.rb
AssetSync: using /home/ruy/projects/rewportal/config/initializers/asset_sync.rb
AssetSync: Syncing.
Using: Directory Search of /home/ruy/projects/rewportal/public/assets
Uploading: assets/application-5170f52c1dd49cb382d5135bee01d75e.js
[...]
Fetching files to flag for delete
Flagging 8 file(s) for deletion
Deleting: assets/active_admin-4ce46d089d4b0080e87c9abcb6fa6c97.css
[...]
AssetSync: Done.
Run Code Online (Sandbox Code Playgroud)
这是正常的吗?
当我预编译到其他环境(非生产)时,我可以看到每个资产的详细编译两次:
~/projects/rewportal(mapwidget ?) rake RAILS_ENV=qa assets:precompile --trace
** Invoke assets:precompile (first_time)
** Execute assets:precompile
/home/ruy/.rvm/rubies/ruby-1.9.3-p194/bin/ruby /home/ruy/.rvm/gems/ruby-1.9.3-p194@rewportal/bin/rake assets:precompile:all RAILS_ENV=qa RAILS_GROUPS=assets --trace
** Invoke assets:precompile:all (first_time)
** Execute assets:precompile:all
** Invoke assets:precompile:primary (first_time)
** Invoke assets:environment (first_time)
** Execute …Run Code Online (Sandbox Code Playgroud) 我有一个类别模型和一个子类别模型和id类似于SubCategory选择输入要刷新,具体取决于与我选择的特定类别相关联的子类别.
form do |f|
f.inputs do
f.input :title
f.input :category, as: :select, collection: Category.all, :input_html => { :class => 'chzn-select', :width => 'auto', "data-placeholder" => 'Click' }
f.input :sub_category, as: :select, collection: SubCategory.all, :input_html => { :class => 'chzn-select', :width => 'auto', "data-placeholder" => 'Click' }
end
f.actions
end
Run Code Online (Sandbox Code Playgroud) 我开始使用formstatic,但我需要创建一个带有图像预览的文件字段.我的意思是,当我编辑一个对象时,我希望看到已经链接的图像.
我怎样才能做到这一点?
谢谢 !
默认情况下,ActiveAdmin在/ admin下运行.有什么办法改变吗?