fix new ui page get_item search and back_end_helper can add args option
This commit is contained in:
parent
a108426412
commit
e71a343718
|
@ -197,8 +197,8 @@ class PagesController < ApplicationController
|
||||||
else
|
else
|
||||||
model = params[:app_action].classify.constantize rescue nil
|
model = params[:app_action].classify.constantize rescue nil
|
||||||
if !model.nil?
|
if !model.nil?
|
||||||
item = model.find(params[:id])
|
item = model.where(:_id=>params[:id]).first
|
||||||
@item = Item.where(:category => [item.category_id.to_s]).first if !module_app.has_category.blank?
|
@item = Item.where(:category => [item.category_id.to_s]).first if !module_app.has_category.blank? and !item.blank?
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -271,17 +271,31 @@ module OrbitBackendHelper
|
||||||
# TODO: links to other actions
|
# TODO: links to other actions
|
||||||
# ===============================================================
|
# ===============================================================
|
||||||
def footer(args={})
|
def footer(args={})
|
||||||
|
|
||||||
|
if args[:link_name]
|
||||||
|
link_name = args[:link_name]
|
||||||
|
else
|
||||||
|
link_name = content_tag(:i, nil, :class => 'icon-plus') + ' ' + t(:add)
|
||||||
|
end
|
||||||
|
|
||||||
paginate = args.has_key?(:paginate) ? args[:paginate] : true
|
paginate = args.has_key?(:paginate) ? args[:paginate] : true
|
||||||
link = (is_manager? || is_sub_manager? rescue nil) && args.has_key?(:link) ? true : false
|
link = (is_manager? || is_sub_manager? rescue nil) && args.has_key?(:link) ? true : false
|
||||||
if paginate || link
|
if paginate || link
|
||||||
@index_footer = content_tag :div, class: "bottomnav clearfix" do
|
@index_footer = content_tag :div, class: "bottomnav clearfix" do
|
||||||
concat content_tag :div, link_to(content_tag(:i, nil, :class => 'icon-plus') + ' ' + t(:add), args[:link].blank? ? '#' : send(args[:link]), :class => (args[:link_class] || 'btn btn-primary'), data: args[:link_data]), class: "action pull-right" if link
|
concat content_tag :div, link_to(link_name, args[:link].blank? ? '#' : send(args[:link]), :class => (args[:link_class] || 'btn btn-primary'), data: args[:link_data]), class: "action pull-right" if link
|
||||||
concat content_tag :div, paginate(@objects, :params => {:direction => params[:direction], :sort => params[:sort], :filter => @filter, :new_filter => nil, :sort_options => params[:sort_options]}), class: "pagination pagination-centered" if paginate
|
concat content_tag :div, paginate(@objects, :params => {:direction => params[:direction], :sort => params[:sort], :filter => @filter, :new_filter => nil, :sort_options => params[:sort_options]}), class: "pagination pagination-centered" if paginate
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def get_quick_link(quick, object, authorization, approvable)
|
def get_quick_link(quick, object, authorization, approvable)
|
||||||
|
|
||||||
|
if !quick[:link_option].blank?
|
||||||
|
link_option = ",#{quick[:link_option]}"
|
||||||
|
else
|
||||||
|
link_option = ""
|
||||||
|
end
|
||||||
|
|
||||||
case quick[:type]
|
case quick[:type]
|
||||||
when 'approval'
|
when 'approval'
|
||||||
if show_approval_link(object)
|
if show_approval_link(object)
|
||||||
|
@ -293,12 +307,12 @@ module OrbitBackendHelper
|
||||||
end
|
end
|
||||||
when 'edit'
|
when 'edit'
|
||||||
if authorization && approvable
|
if authorization && approvable
|
||||||
content_tag :li, link_to(t(quick[:translation] || :edit), quick[:link].nil? ? '#' : eval("#{quick[:link]}('#{object.id}')"), class: quick[:class], data: eval("#{quick[:data]}"))
|
content_tag :li, link_to(t(quick[:translation] || :edit), quick[:link].nil? ? '#' : eval("#{quick[:link]}('#{object.id}'#{link_option})"), class: quick[:class], data: eval("#{quick[:data]}"))
|
||||||
end
|
end
|
||||||
when 'delete'
|
when 'delete'
|
||||||
if show_delete_link(object)
|
if show_delete_link(object)
|
||||||
@delete_options = {title: quick[:title], warning: quick[:warning], cancel: quick[:cancel], submit: quick[:submit]}
|
@delete_options = {title: quick[:title], warning: quick[:warning], cancel: quick[:cancel], submit: quick[:submit]}
|
||||||
content_tag :li, link_to(t(quick[:translation] || :delete_), '#', rel: eval("#{quick[:link]}('#{object.id}')"), class: "delete #{quick[:class] || 'text-error'}")
|
content_tag :li, link_to(t(quick[:translation] || :delete_), '#', rel: eval("#{quick[:link]}('#{object.id}'#{link_option})"), class: "delete #{quick[:class] || 'text-error'}")
|
||||||
end
|
end
|
||||||
when 'detail'
|
when 'detail'
|
||||||
content_tag :li, link_to(t(quick[:translation] || :detail), '#', class: (quick[:class] || "detail-row"))
|
content_tag :li, link_to(t(quick[:translation] || :detail), '#', class: (quick[:class] || "detail-row"))
|
||||||
|
|
Reference in New Issue