views:

62

answers:

1

Hi,

In my rails app, I am setting up my own admin with the help of http://github.com/linoj/gridify. That works really well with one exception: HTML gets rendered in the table view which blows the cells up like crazy. I use

white-space:nowrap;

in my css which helps against other formatting trouble.

I still need to either get rid of the html before it gets to the table or ignore it when the table is rendered(which I think is harder to do)

What I have is a controller and an index view to produce the grid for me:

in the controller:

def index
 statics = Static.find(:all) do
  if params[:_search] == "true"
   name    =~ "%#{params[:name]}%" if params[:name].present?
   content  =~ "%#{params[:content]}%" if params[:content].present?                      
  end
  paginate :page => params[:page], :per_page => params[:rows]      
  order_by "#{params[:sidx]} #{params[:sord]}"
end

respond_to do |format|
  format.html
  format.json { render :json => statics.to_jqgrid_json([:id,:name,:content], params[:page], params[:rows], statics.total_entries) }
end
end

In the index.html.erb:

<%= jqgrid("Static Pages", "statics", "/admin/statics",
[
{ :field => "id", :label => "ID", :width => 35, :resizable => false },
{ :field => "name", :label => "Name", :width => 100, :editable => true },
{ :field => "content", :label => "Content", :width => 800, :editable => true, :edittype => "textarea", :editoptions => { :rows => 20, :cols => 60 } }
], { :add => true, :edit => true, :inline_edit => false, :delete => true, :edit_url => "/admin/statics/post_data" }
) %>

Does anyone have an idea how I can achieve that for this action the html is escaped/stripped ... whatever works best?

A: 

I guessed this question wouldn't fly and I admit I didn't find an incredibly elegant way to solve my problem. For completeness, this is what I do in my css to have things display the way I want:

td {height:22px;white-space:nowrap;overflow:hidden;}
p {display:inline;}
br {display:none;}
h3 {display:inline;}
...

I am especially happy about the br tag as the maintainers of the imported data use it excessively.

val_to_many