set_model
@my_list_model = Manifest.manifest.models[@my_action.item_name]
@my_list_model_class = @my_list_model.classify
- @list = Locmare::ListGroup.list @my_controller.name, @my_action.action_name, @operators, params
+ @list = Locmare::ListGroup.list @my_action.controller.name, @my_action.action_name, @operators, params
end
def filer_list
:filer => @filer
}
}
- format.json {
- res = {
- :page_status => @list.page_status.to_hash,
- # rails3.2 has problem
- # y method defined as private
- # attribute y conflict at PanelPicture, balloon ..etc
- # use i.attributes[name]
- :list => @items.map{|i| i.attributes}
- # :list => @items.to_json
- }
- render json: res.to_json
- }
+ list_json_format @list, format
format.atom
format.rss
end
end
+ def list_json_format list, format
+ format.json {
+ res = {
+ :page_status => list.page_status.to_hash,
+ # rails3.2 has problem
+ # y method defined as private
+ # attribute y conflict at PanelPicture, balloon ..etc
+ # use i.attributes[name]
+ :list => list.items.map{|i| i.attributes}
+ # :list => @items.to_json
+ }
+ render json: res.to_json
+ }
+ end
+
def set_play
set_list
- @binder_controller = Manifest.manifest.controllers[params[:controller].to_s]
- @binder_action = @my_controller.actions[params[:action].to_s]
+ @binder_action = @my_action.original
+ @binder_controller = @binder_action.controller
@binder_model = Manifest.manifest.models[@binder_action.item_name]
@binder_model_class = @binder_model.classify
@item = @binder_model_class.show(params[:id], @operators)
end
def play_list
- @options = params
- @options[:my_play] = @item.own?(@operators)
- list_result = @list.open(@operators)
- @items = list_result.items
- @count = list_result.count
- @pager = list_result.paginate
+ @items = @list.items #.map {|sp| sp.root }
+ @count = @list.total
+ @pager = @list.page_status.pager
end
def set_show
def render_form
respond_to do |format|
format.html {
- @form = Locmare::Bucket.factory @item.item_name, @item, true, true, @operators
+ @form = Locmare::Bucket.factory @item.item_name, 'default', @item, true, true, @operators
render @form.template_name, :locals => {
:form => @form
}
def updated_json_format format
format.json {
- head :ok
+ render json: '{}', status: :ok
}
end
def destroyed_json_format format
format.json {
- head :ok
+ render json: '{}', status: :ok
}
end
}
end
- def render_destroy redirect_url = nil
+ def render_destroy redirect_url
if @item.destroy
respond_to do |format|
destroyed_html_format format, redirect_url
end
end
- def list_count
- set_list
- j = {:count => @list.count()}
- respond_to do |format|
- format.json { render json: j.to_json }
+ def render_destroy_by destroy_method_name, redirect_url = nil
+ if @item.__send__(destroy_method_name)
+ respond_to do |format|
+ destroyed_html_format format, redirect_url
+ destroyed_json_format format
+ end
+ else
+ respond_to do |format|
+ not_destroyed_html_format format
+ not_destroyed_json_format format
+ end
end
end
}
end
- def assist_items controller_name, list_name
- list = Locmare::ListGroup.list controller_name, list_name, @operators, {:id => @item.id, :page => 1, :page_size => 5}
- list_result = list.open(@operators)
- list_result.items
+ def assist_items controller_name, action_name
+ list = Locmare::ListGroup.list controller_name, action_name, @operators, {:id => @item.id, :page => 1, :page_size => 5}
+ list.items
end
def set_image(file)