Tinymce error : special effects not working in browser - ruby-on-rails

I added tinymce to my active-admin so I could format large text areas. It works great, I can add effects and save that model. But when I go to browser it just shows html code like this :
<p>Aizaugušu lauksaimniecības zemju apstrāde ar Ahvi zemes frēzi.</p> <p><span style="color: #333333; font-family: 'Segoe UI', Arial, Verdana, Tahoma, sans-serif; font-size: 13px;"><strong>In Microsoft Office OneNote 2007</strong>, you try to send a note to a mail recipient as an attachment. After you do this, the following text is unexpectedly inserted in the body of a new e-mail message:</span></p> <div class="message" style="margin: 0px; padding: 10px 30px; color: #333333; font-family: 'Segoe UI', Arial, Verdana, Tahoma, sans-serif; font-size: 13px;"><strong>Click the OneNote</strong> attachment if you want to view or edit the notes in OneNote. If you don't have OneNote 2007, you can click the second attachment to view the notes as a Web page.<br /><br />You can download a free OneNote trial version from: `http://r.office.microsoft.com/r/rlidOneNoteTrial?clid=1033&ver=12&app=onenote.exe&p1=12
Instead off text with specified effects.
That is because some Javascript error?
Thanks :)

This is probably due to the content being escaped before it is rendered in your view. Rails does this automatically as a safety precaution. In your view you probably have something like this:
<%= #model.content %>
Try turning off the escaping by doing:
<%= #model.content.html_safe %>
Hope that helps!

Related

Avoid Url to be treated as hyperlinks in Rails Mailer

I'm sending a mailer to users that includes a link to their created post.
This link should be for copying and pasting only, however it delivers automatically as a blue underlined hyperlink.
Any suggestions?
Thanks
<td width="440" height="50" bgcolor="#f5f5f5" style="border:1px solid #e3e3e3; display: block; margin:40px auto;">
<div style="color:#666f67; font-size:16px; font-weight: 400; font-family:sans-serif; text-decoration: none; display:block; text-align:center; padding: 16px;">
url
</div>
</td>
The Bootstrap library is not included in emails as it would be in regular views. If you need to format emails, you'll have to do it inline. For example:
hello
Checkout Mailchimp, they have great resources on how to create email templates.
I hope this helps.
I found another way for future reference, by placing it inside an input field "readonly."
<input type="text" value="www.mylink.com" readonly>

img will not render in Safari

I am working on a legacy application which works in ie but not in Safari.
The image in the code will not render in Safari.
<section class="feature pointer clickableSection tooltipContainer" id="SearchSection"
data-scd-nextScreen="#Url.Action("FullSearch", "Company")"data-placement="bottom"
data-toggle="tooltip" data-title="Click here to SEARCH Addresses">
<img src="#Url.Content("~/images/phonebook.png")" alt="Click here to SEARCH Addresses" />
<h3><span style="text-decoration: underline">Search Addresses</span><span id="searchHeading"></span></h3>
<div class="loadMessage"></div>
</section>
I have got the Safari Web Inspector up and running, but I cannot see where I can find out where the problem is. I am new to using this tool.
I found where the problem is.
In my CSS which I did not publish, it has;
section.feature img {
color: #999;
/*content: attr(alt);*/
font-size: 1.5em;
font-weight: 600;
height: 140px;
width: 200px;
}
I have commented out the line that is not compatable with Safari, ie content: attr(alt);

Firebug shows incorrect (possibly hijacked) link CouponDropDown

This is the first time I saw this... I have text in my code and it says Passport and Visa Requirements. This is my markup
<div class="rectangle"><span>Passport and Visa Requirements</span></div>
Crazy thing happens on the live server, somehow a link is injected on the word "visa". This is the markup I see in firebug.
<div class="rectangle">
<span>
Passport and
<a id="_GPLITA_0" title="Click to Continue > by CouponDropDown" style="text-decoration:underline" href="http://i.txtsrving.info/click?v=" in_rurl="http://i.txtsrving.info/click?v=" in_hdr="">
Visa
<img src="http://cdncache1-a.akamaihd.net/items/it/img/arrow-10x10.png" style="display: inline; vertical-align: super; margin: 0px 0px 0px 3px; padding: 0px; border: 0px none; height: 10px;">
</a>
Requirements
</span>
</div>
Is my htaccess file not configured properly? How do I deal with this? Is this a security issue?
http://www.bleepingcomputer.com/virus-removal/remove-coupondropdown
This is probably adware on your computer, affecting your browser. Your website is probably fine.

line-height vs. font-size/line-height

If in a font-size: CSS attribute you encounter font-size: 14px/19px, that's the same thing as saying font-size: 14px; line-height: 19px, isn't it?
If so then why aren't the following two paragraph tags the same height?:
http://www.frostjedi.com/terra/scripts/demo/line-height.html
First of all, you have font-size: 14px/19px; which is invalid. I think you mean font: 14px/19px; But this is still wrong...
When using the CSS shorthand for font, you cannot omit the size or family values.
Try font: 14px/19px Arial;
See the Omitted Mandatory Values section of http://www.impressivewebs.com/a-primer-on-the-css-font-shorthand-property/ for more info.

Getting Webdriver ElementNotVisibleException when I try to click on a hyperlink

I am trying to click on a link using webdriver but it throws me a ElementNotVisibleException saying "Element is not currently visible and so may not be interacted with"
My WebDriver code:
addProgram.click();
addProgram refers to an anchor element. This is populated by annotating #FindBy(how= How.LINK_TEXT, using="Add Program"). In other words it is similar to driver.findElement(By.linkText("Add Program")).
My HTML is:
<div class="form_btn">
<a href="/program/addProgram">
<span>Addrogram</span
</a>
</div>
It starts working when I remove the css declaration from the above div. The dive has a hover style, may be that is the one causing the problem.
CSS:
.form_btn {
float:left;
background:url(/bg_button_right.gif) no-repeat scroll top
right;
color: #fff;
display: block;
height:22px;
font: bold 10px arial;
margin-right: 0px;
margin-top:2px;
padding-right: 4px; /* sliding doors padding */
text-decoration: none;
}
.form_btn span {
background:url(/assets/images/provider/bg_button_left.gif) no-repeat;
display: block;
float:left;
line-height:18px;
padding: 2px 5px 5px 10px;
font-size:11px;
}
.form_btn a{
color:#fff;
}
.form_btn a:hover{
color:#fff;
text-decoration:none;
cursor:hand;
}
I have trawled the web trying to find a solution but none has worked. Any suggestions/help is greatly appreciated.
Thanks,
Chris.
(UPDATE) This issue was resolved and should be available since Selenium 2.4.0
Sounds like you ran into the same bug as I did:
http://code.google.com/p/selenium/issues/detail?id=1445
the work-around is to get the element inside the link and click.
re-writing your code:
driver.findElement(By.linkText("Add Program")).findElementBy(By.tagName("span"))
I just solve this error while using capybara in ror project by add " Capybara.ignore_elements = true " to features/support/env.rb
Working from #Zernel's solution, the following solves for ror project using capybara.
Add Capybara.ignore_hidden_elements = true to the file config/environments/test.rb
Using texts is not always the good methodology.
Try this:
driver.findElement(By.cssSelector("div.form_btn > a[href*='addProgram'] > span")).click();
Always Use CSS, It performs better than XPath.

Resources