gottfrois / dashing-rails

The exceptionally handsome dashboard framework for Rails.
MIT License
1.45k stars 149 forks source link

Not able to display string with html on dashing page #72

Closed puneet18190 closed 9 years ago

puneet18190 commented 9 years ago

I want to display a string like

Hello

on dashing page with styles but it display in string. I need to know how can I display a string with styles on my dashing page.

gottfrois commented 9 years ago

Where and how did you add your string ? Can you show me some code ?

puneet18190 commented 9 years ago

news_headlines= [] news_headline = NewsHeadlineBuilder.BuildFrom(string_1,string_2) news_headlines.push(news_headline) Dashing.send_event('headlines', { :headlines => news_headlines})

class NewsHeadlineBuilder def self.BuildFrom(a,b) { title: a, description: b, } end end

string_2 contains html like

Hello

and on dashing page it displayed in string.I need to display it with styles.

puneet18190 commented 9 years ago

string_2 contains string with html tags like < h1 >Hello </ h1>

gottfrois commented 9 years ago

what widget do you use to display your text ?

puneet18190 commented 9 years ago

app/views/dashing/widgets/headlines.html

Headlines

puneet18190 commented 9 years ago

< div class="heading"> < span> Headlines

< div class="headline-container"> < h1 data-bind='current_headline.title' class="title"> < div class="headline"> < div> < p class="description" data-bind='current_headline.description'>

< /div> < /div> < /div>

gottfrois commented 9 years ago

ok so it's a custom widget you created ? If so, you need to sanitize the string containing your html on the widget. It's not related to how dashing-rails sends you the data but how you use it in your widget.

puneet18190 commented 9 years ago

I want to scrap news from http://www.propertyreporter.co.uk/rss.asp and display it on dashing page. But under description node, there is html with img tag and on dashing page, html is displayed as a string. I need to know how can I change string with html tags to html .

In rails, I used raw or html_safe methods for html string which display html in browser but using dashing-rails, I need to know where I can use it.

gottfrois commented 9 years ago

It's not a dashing-rails issue. You need to do that yourself using jquery for example http://stackoverflow.com/questions/24816/escaping-html-strings-with-jquery