twitter-bootstrap-rails - differences between development and production - ruby-on-rails

I'm going crazy with this.
Using bootstrap for rails + less-rails gem and some styles are completely different on development and production.
Example:
a styles do have a black background-color on the hover event. I overwrote the a:hover style already via
background-color: none !important;
but it still shows up this weird black background on the hover event. Inspecting the element via Chrome does not even show this CSS style! So where does it come from?
Also, the font is different (dev vs live) and other minor things.
On the other hand, buttons and most major elements (well, lead etc etc) are working fine.
Where does this difference come from and how do I make dev versus live the same CSS appearance?
I deploy my app on heroku btw.
Thanks for any help.

I think you are using other style on your application, something like a scaffold for generator, scaffold will generate scaffold css. I'm use scaffold and i'm having scaffold.css.scss on my apps, Here's style of link on scaffold.css.scss
a {
color: #000;
&:visited {
color: #666;
}
&:hover {
color: #fff;
background-color: #000;
}
}
You should remove style of link or you can remove scaffold style on your apps if you won't it.
Twitter bootstrap do not have style link with a black background, by default.
If you don't have other style on your app and only use twitter bootstrap you should find style of link that bring about an issue

Related

How to use UI font icons inside an angular app

I'm designing mockups in Sketch, and I'm using the home and search icons from a UI Font designed for icons. Now I want to display these icons in my angular app using html and css. There doesn't seem to be any resource online that teaches how to do this. I have used resources such as FontAwesome before which have very clear documentation on how this is done.
I got it to work by copying the CSS attributes of the icon inside of sketch by right clicking:
/* home: */
font-family: UIFont-Solid;
font-size: 30px;
color: #FFFFFF;
So add this to your css:
.icon {font-family: UIFont-Solid; font-size: 30px; color: #FFFFFF;}
Then all you have to do in the html/view is add the class to the element and put the name of the icon as text inside of the element:
<div class="icon">home</div>
You can even put multiple icons in the same div:
<div class="icon">home search help</div>
Note that this may not work in production unless you add the font to the fonts folder and reference it in the css using #font-face.

ngTagsInput issue with ng-invalid style

I'm using https://github.com/mbenford/ngTagsInput.
I created a basic form with a url and a tag-input field that is required.
Since it's required, i used the attribute min-tags="1"
I used it in conjonction with bootstrap stylehseet.
When displayed, the field appears with a red shadow border (since it is empty), even before any submit of the form. This is really annoying, is there any workaround ?
Validate the field only after form submission ?
Removing min-tags="1" and find another way to check the required aspect.
Playing with css to discard those styles applied to this .ng-invalid .tags
Thank you
Edit :
sample code :
<tags-input min-tags="1" ng-model="mytags"></tags-input>
Have done a plunker : http://plnkr.co/edit/EQcYfr4vLpkeJESho3GL?p=preview
You can simply use a custom class to handle the pristine state:
CSS
.custom-tags.ng-pristine .tags {
box-shadow: inset 0 1px 1px rgba(0,0,0,.075);
border: 1px solid #ccc
}
HTML
<tags-input min-tags="1" ng-model="mytags" class="custom-tags"></tags-input>
Working Plunker
Also, Angular 1.3 isn't officially supported yet. This is particularly important here because both pristine and dirty states won't be correctly set if you use that version of the framework.

different jquery ui buttons at the same time

Is there a proper way to have 2 differently styled jquery ui buttons on the same page?
I am able to copy css around for the second button but there are a lot of different !important styles that I keep needing to add a second !important after the first in order to change the style.
for ex:
.ui-state-active {
background:none !important;
background-color:#E1E1E1 !important;
color:#000 !important;
}
I will then have to go and add right after (and it needs to be after
.new-theme.ui-state-active {
background:none !important;
background-color:red !important;
color:#000 !important;
}
the problem is these important styles are all over for each state so I have to mind where they go. Is this normal or is this usually handled a different way?
Are you using an older version of jQuery UI that requires you to use !important to override their styles? Newer version have fixed this: Use of !important in jquery-ui.css should be avoided.
If you can/are using a newer version, try getting rid of !important and instead rely on selector specificity to get your desired results.
I would recommend using jqueryui-speciffic css. Except difficulties with different button stylings, there may be performance problems while rendering larger amounts of buttons.
This resource is relatively old but I found it very valuable while using jqueryui css.

z-index not properly rendered on iPad and Google Chrome 22

I have attached two pictures, the first shows the "desktop" of the webapp I work on, some of the icons you see open dialogs made of a <div/> containing an <iframe/>, but while on a normal pc it all works properly, on the iPad it seems there is a problem with the z-index of some elements, as shown in second picture.
The small red rounds with number inside are defined as follows:
.countComunicazioni {
position: relative;
background: url(/images/admin/menu_sgs/counter.gif) no-repeat center center;
height: 35px;
width: 35px;
color: #FFF;
top: -105px;
left: 120px;
z-index: 0;
font-weight: bold;
display: none;
}
.countComunicazioni p {
margin-top: -5px;
padding-top: 10px;
}
The markup is a <div class="countComunicazioni"/> tag and a <p/> tag inside.
I also noticed that now the problem also appears in Google Chrome V22, the numbers in red circles are always on top even if they have z-index == 0 and the dialogs have z-index > 1000.
As per this bug report ( http://code.google.com/p/chromium/issues/detail?id=144518 ), the change seems to be intended, even if I would bet it'll broke many layouts, not only ours.
This problem was not present in previous versions of Google Chrome, nor is present on Firefox V15 or Internet Explorer V9, where everything is rendered problem.
How can this problem be solved? I'm no CSS expert, so I must admit I have tried little, if anything, so far... And also, who is "right" here? Is our markup incorrect, or does the problem lie in google chrome new rendering strategy?
EDIT
It seems I've been able to solve the issue shown in the two pics: all the dialogs generated from my web app are placed inside a <div/> with position:fixed placed on the very top of the body, now I tried to move the div to the very bottom of the page, and the layout seems now correct.
There is one more problem though: when opening a modal dialog, the opaque layer that is supposed to be created between the dialog and the below content, is actually created above it, see new screenshot.
How could this problem be solved? Does it require modifying our javascript or is it an issue with jquery ui itself?
Just found out myself that the way that chrome 22+ handles z-index has been altered.
Check out this awesome explanation here that I didn't write here...
http://updates.html5rocks.com/2012/09/Stacking-Changes-Coming-to-position-fixed-elements
Basically the way I understand it is that elements which have
position: fixed
now get counted with their own z-index layer so you'll have to adjust your pages accordingly to suit.
Hope that helps!

Is it possible to apply CSS3Pie border radius to jQuery UI globally?

To apply behavior: url(PIE.htc); to all css files in the project seams to be very long story and with each new version i need to repeat it again.
Is there jquery ui CSS3Pie versions i can find somewhere?
OR
Is it possible to add CSS3Pie support in separate css file, so in such case it will be possible to use that css for any new jquery ui version.
I am trying to do such fix for jquery UI that in my custom css:
.ui-corner-top, .ui-corner-left, .ui-corner-right, .ui-corner-bottom { behavior: url("PIE.htc"); }
.ui-corner-all, .ui-corner-tl, .ui-corner-tr, .ui-corner-bl, .ui-corner-br { behavior: url("PIE.htc"); }
But it is not working.
At the same time such fix working for my styles, for example if a have style
.mystyle
{
border-radius: 8px;
-webkit-border-radius: 8px;
-moz-border-radius: 8px;
border: solid 2px #36405c;
}
Than i could define this and it will be working:
.mystyle
{
behavior: url("PIE.htc"); /*it will be working*/
}
So i am assuming that it is not working in jquery UI case because jquery UI has multiple places with .ui-corner-* declarations with different radiuses.
Anyway is it possible to do something with that?
Any ideas someone?
You could create your own theme with http://jqueryui.com/themeroller/, set all the border-radius to 0 and then apply your styles to ".ui-corner-all"

Resources