Remove useless code not removed in merge
Fix argument bug in link_to_field
This commit is contained in:
parent
d19ba7b1c6
commit
39c6660c67
|
@ -10,24 +10,6 @@ class DefaultWidgetController< OrbitWidgetController
|
||||||
@page_part.module_app.enable_frontend?
|
@page_part.module_app.enable_frontend?
|
||||||
end
|
end
|
||||||
|
|
||||||
def query_for_default_widget
|
|
||||||
ori_class_name = @default_widget["query"].split('.')[0]
|
|
||||||
result = nil
|
|
||||||
if !params["tag_id"].blank?
|
|
||||||
@tag = Tag.find(params["tag_id"]) rescue nil
|
|
||||||
if params["category_id"].blank?
|
|
||||||
result = @tag.send(ori_class_name.downcase.pluralize).desc(:created_at)
|
|
||||||
else
|
|
||||||
result = @tag.send(ori_class_name.downcase.pluralize).where(get_category_field_name(ori_class_name) => params['category_id']).desc(:created_at)
|
|
||||||
end
|
|
||||||
elsif params["category_id"].blank?
|
|
||||||
result = eval(@default_widget["query"]).desc(:created_at)
|
|
||||||
else
|
|
||||||
result = eval("#{ori_class_name}.where(get_category_field_name(ori_class_name) => params['category_id'])").desc(:created_at)
|
|
||||||
end
|
|
||||||
result.available_for_lang(I18n.locale).can_display.desc(:created_at)
|
|
||||||
end
|
|
||||||
|
|
||||||
def default_widget
|
def default_widget
|
||||||
if !params[:id].blank?
|
if !params[:id].blank?
|
||||||
redirect_to eval("#{@page_part.module_app.widget_fields_link_method['title']['method']}('#{params[:id]}', {inner: #{params[:inner] || true}})")
|
redirect_to eval("#{@page_part.module_app.widget_fields_link_method['title']['method']}('#{params[:id]}', {inner: #{params[:inner] || true}})")
|
||||||
|
@ -65,11 +47,4 @@ class DefaultWidgetController< OrbitWidgetController
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def get_category_field_name(ori_class_name)
|
|
||||||
ori_class_name = ori_class_name.constantize
|
|
||||||
ori_class_name.fields.each_key do |key|
|
|
||||||
return key if key.include?('category_id')
|
|
||||||
end
|
|
||||||
nil
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -3,7 +3,7 @@ module DefaultWidgetHelper
|
||||||
I18n.t("#{@page_part.module_app.key}.default_widget.#{field}")
|
I18n.t("#{@page_part.module_app.key}.default_widget.#{field}")
|
||||||
end
|
end
|
||||||
|
|
||||||
def link_to_field(row_data,field, options=nil, switch)
|
def link_to_field(row_data,field, switch, options=nil)
|
||||||
method_ary = @page_part.module_app.widget_fields_link_method
|
method_ary = @page_part.module_app.widget_fields_link_method
|
||||||
field = field.to_sym
|
field = field.to_sym
|
||||||
if(method_ary.has_key?(field) and (switch == "true"))
|
if(method_ary.has_key?(field) and (switch == "true"))
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
<% @data.each do |row_data| %>
|
<% @data.each do |row_data| %>
|
||||||
<tr>
|
<tr>
|
||||||
<% @fields.each do |field|%>
|
<% @fields.each do |field|%>
|
||||||
<td><%= content_tag(:span,link_to_field(row_data,field[0], orig_page: @page_id.to_s, field[2]),:class=>field[1])%></td>
|
<td><%= content_tag(:span,link_to_field(row_data,field[0], field[2], {orig_page: @page_id.to_s}),:class=>field[1])%></td>
|
||||||
<% end %>
|
<% end %>
|
||||||
</tr>
|
</tr>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="wrap">
|
<div class="wrap">
|
||||||
<% @fields.each do |field|%>
|
<% @fields.each do |field|%>
|
||||||
<%= content_tag(:span,link_to_field(row_data,field[0], orig_page: @page_id.to_s, field[2]),:class=>field[1])%>
|
<%= content_tag(:span,link_to_field(row_data,field[0], field[2], {orig_page: @page_id.to_s}),:class=>field[1])%>
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
<% @data.each do |row_data| %>
|
<% @data.each do |row_data| %>
|
||||||
<%= content_tag(:li) do %>
|
<%= content_tag(:li) do %>
|
||||||
<% @fields.each do |field|%>
|
<% @fields.each do |field|%>
|
||||||
<%= content_tag(:span, link_to_field(row_data,field[0], orig_page: @page_id.to_s, field[2]),:class=>field[1])%>
|
<%= content_tag(:span, link_to_field(row_data,field[0], field[2], {orig_page: @page_id.to_s}),:class=>field[1])%>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
Reference in New Issue