ActiveAdmin记录激活页面?
我正在开发一个应用程序,管理员必须在显示“主题”之前激活该应用程序。主题表只有一个名为 active
的列。
我将 ActiveAdmin gem 用于管理面板的其余部分,并且我还有一个主题编辑页面,可以在其中更改主题的各个方面。但是,我还希望有一个主题的辅助页面,该页面仅显示该标题,并可以激活该主题(无法更改其他列)。我确信这会更加用户友好,但我不知道如何去做,或者是否可能。
我的印象是每个模型只能创建一个编辑页面。
有什么想法吗?
编辑
topic.erb
class Topic < ActiveRecord::Base
scope :pending, where(:active => false)
validates_presence_of :title, :description, :user_id
belongs_to :user
has_many :solutions
accepts_nested_attributes_for :solutions, :allow_destroy => true, :reject_if => Proc.new{|attributes| attributes["title"].blank?}
acts_as_taggable
end
I'm working on an application for which the admin has to activate 'topics' before they are shown. The topics table simply has a column called active
.
I'm using the ActiveAdmin gem for the rest of the admin panel and I also have an edit page for topics where every aspect of the topic can be changed. However, I would also like to have a secondary page for topics which would only display that title, and make it possible to activate the topic (without being able to change the other columns). I'm sure this would be more user-friendly, but I don't know how to go about it, or if it is even possible.
I have the impression that only one edit page can be made for each model.
Any ideas?
EDIT
topic.erb
class Topic < ActiveRecord::Base
scope :pending, where(:active => false)
validates_presence_of :title, :description, :user_id
belongs_to :user
has_many :solutions
accepts_nested_attributes_for :solutions, :allow_destroy => true, :reject_if => Proc.new{|attributes| attributes["title"].blank?}
acts_as_taggable
end
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我现在无法自己尝试,但我想说您需要这样的 ActiveAdmin 配置:
其中
pending
范围将是一个模型范围,用于仅显示待处理(非活动)主题。喜欢:最好的问候
托比亚斯
I can't try it right now myself, but I'd say you want something like this as ActiveAdmin configuration:
Where the
pending
scope would be a model scope for just showing the pending (not active) topics. Like:Best Regards
Tobias