My ActionMailer involves generating a report and,storing it into a HTML file and sending it as a HTML attachment. I wanted to give it some styling , so I added inline styling that gets written into the HTML file everytime the report is generated .
But the styling does not reflect in the attachment. Interestingly, the generated report when opened locally on my machine reflects the styling. I saw the HTML source of the attachment and the inline css styling is missing. I'm absolutely clueless as to why its happening.
A heads-up would be appreciated !
ActionMailer has some very strange ways of operating. CSS is one of the things it can really fall over with when rendering a template. Have a look at this solution:
http://devblog.imedo.de/2008/08/05/rails-actionmailer-with-html-layouts-inline-css-and-entity-substitution/
Related
My Jquery files are only loading when page is refreshed. But when I remove (import "#hotwired/turbo-rails") from application.js It works normally. But removing "#hotwired/turbo-rails" causing other issues. Anyone please help.
Like Mike said it's hard to know your exact issue without more detail, but it sounds like an issue I was just having with my link_to and redirects not triggering my javascript events (so my DataTables and certain componants of the random html5 template I'm using were not working).
I was reading through this link and it mentioned making turbo-drive "opt-in" globally across the app by adding this code to the bottom of your app/javascript/controllers/application.js
import { Turbo } from "#hotwired/turbo-rails"
Turbo.session.drive = false
Search for "Disabling Turbo by default" in the link to get to the section I'm referring to.
I'm sure there is a better solution that involves keeping turbo-drive enabled and writing better JS or putting it in a better location, but at least now the JS in my app/javascript/application.js file as well as the JS files in the app/assests/javascripts directory are working the way I expect.
Thanks.
I am trying to extract background-url from a div using Nokogiri but am not able parse background-url of it.
While Searching on StackOverflow I found this link
Parsing: Can I pick up the URL of embedded CSS Background in Nokogiri?
but the solution given there doesn't work.
Nokogiri is not a web browser. It stands on top of libxml2 to provide fast and excellent parsing of XML and HTML, and manipulation and extraction of data from this.
It only deals with the HTML in a web page. It does not run any JavaScript. It does not apply CSS to the DOM. There is no way to use Nokogiri to find a CSS style applied to an element unless it is directly on the style="..." attribute on that element. (And even then you would need to use something else, like regex, to parse the CSS therein.)
You will want to use something else, like a headless browser controlled by Ruby, e.g. Watir or Selenium, if you want to process a web page and treat it like a web browser does.
Is there a way to edit your views and CSS and see the results on the fly like with a jsfiddle program? I can't seem to use jsfiddle when programming with Rails because so many of my views are Rails code.
Try the Webkit web inspector, or Firebug in Firefox. You can select any element, edit attributes, modify the css, and change the text on the page.
If you have your web running on a server (localhost works too) you can try WebPutty from Fog Creek guys to change your CSS and see the results on the fly. It's free for now.
You can read how to import your site here
I've just installed and setup sIFR on my Magento store. An example page can be seen here:
http://www.mint-creative.co.uk/shop
And you can see it loads the heading brilliantly, but still displays the alternate text-only headline. I've quadruple checked the .css files and everything's loading ok I think. Also, in IE it doesn't display at all and every .css and .js file has an error according to the error log in IE8.
Any help on this would be great as it's an urgent project!
Cheers.
This is a known issue with IE8. The best thing to do is put this in your header
< meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
(I had to add a space after < to get it to show up for some reason so make sure you delete that space)
It'll fix your problem.
I'd also try Cufon or Font-face over sIFR.
There's a parse error in the CSS files. Try validating them and see what comes up.
I'm Using sIFR 3r436, and although I believe everything is set up correctly, and my console shows that the .swf font file is loading correctly, the HTML type is hidden but the sIFR type is not displaying. Below is a link to the site in question:
Schaffer's Website
Below is a link to a test site that uses exactly the same sifr-config.js, sifr.js, css, and swf files. And it works. The main difference between the two is the server that they are running on.
Schaffer's Test Site
I'm hoping that maybe somebody can see a problem that I'm unable to. Appreciate the help!
The server gives a 403 forbidden for the Flash movie – in other words, it does not load.