I try to do this : final result. For this I have put a other image (this one : cover) on the first. And for the border color, I have created a class "parallelogram".
HTML File :
<%= image_tag(project.projectpicture.url(:slider), :class => "image") %>
<%= image_tag(("/assets/coverslider.png"), :class => "cover") %>
<div class="parallelogram" style="background: red;"></div>
CSS File :
.image
{
position: relative;
}
.cover
{
position: absolute;
z-index: 1;
top: 0;
left:0;
}
.parallelogram
{
position: absolute;
z-index: 1;
top: 0;
left:227px;
opacity: 0.5;
width:10px;
height:200px;
transform: skew(20deg);
-webkit-transform: skew(20deg);
}
All of this works. I dont know if it the best solution and I am open at every better solution.
Now I want to have the possibility to change the parallelogram color. For that I tried :
<div class="parallelogram" style="background: #{project.color};"></div>
Where project.color is the project color. This doesn't work. Rails generates this html code :
<img class="image" src="/system/projects/projectpictures/0..." alt="15"></img>
<img class="cover" src="/assets/coverslider.png" alt="Coverslider"></img>
<div class="parallelogram" style="background: #{project.color};"></div>
I don't know why the #{project.color} doesn't set the color and stays like this.
Thank you for your help. I begin so if you have a better solution, I will be happy to learn it.
colorattribute in yourprojectstable?<%= link_to project.name, project_path(project), style: "background: #{project.color};" %>Rails generates the good code :<a style="background: #FF004F" href="http://localhost:3000/projects/21"></a>and turns#{project.color}into#FF004F. I don't know why Rails doesn't do the same with<div>.