modified statuses and also now custom call to frontend controller is working.

This commit is contained in:
Harry Bomrah 2014-06-18 17:57:36 +08:00
parent 06df84df57
commit 201d0e61d8
2 changed files with 61 additions and 50 deletions

View File

@ -198,8 +198,10 @@ module ApplicationHelper
html = html.gsub("{{pagination_goes_here}}",""); html = html.gsub("{{pagination_goes_here}}","");
end end
html.html_safe html.html_safe
elsif params[:target_action] == "show" else
file = File.open(File.join(Rails.root, 'app', 'templates', "#{@key}", 'modules', params[:target_controller].singularize, "#{params[:target_action]}.html.erb")) f = File.join(Rails.root, 'app', 'templates', "#{@key}", 'modules', params[:target_controller].singularize, "#{params[:target_action]}.html.erb")
if File.exists?f
file = File.open(f)
doc = Nokogiri::HTML(file, nil, "UTF-8") doc = Nokogiri::HTML(file, nil, "UTF-8")
file.close file.close
controller = "#{params[:target_controller].capitalize}_controller".classify.constantize.new controller = "#{params[:target_controller].capitalize}_controller".classify.constantize.new
@ -259,6 +261,7 @@ module ApplicationHelper
end end
end end
end end
end
def action_data def action_data
controller = "#{params[:target_controller].capitalize}_controller".classify.constantize.new controller = "#{params[:target_controller].capitalize}_controller".classify.constantize.new

View File

@ -27,6 +27,14 @@ module OrbitModel
statuses statuses
end end
def statuses_with_classname
statuses = []
statuses << {"name" => I18n.t(:top), "classname" => "top"} if is_top?
statuses << {"name" => I18n.t(:hot), "classname" => "hot"} if is_hot?
statuses << {"name" => I18n.t(:hidden), "classname" => "hidden"} if is_hidden?
statuses
end
def status_for_table def status_for_table
status = "" status = ""
status << "<span class='label label-success'>#{I18n.t(:top)}</span> " if self.is_top status << "<span class='label label-success'>#{I18n.t(:top)}</span> " if self.is_top