Guest User

Untitled

a guest
Feb 3rd, 2015
297
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 3.26 KB | None | 0 0
  1. <% Post.limit(10).offset(30).order(id: :desc).each do |post| %>
  2. <% unless post.image.blank? %>
  3.     <% img = post.image.split(' ') %>
  4.     <% if post.post_type == 1 %>
  5.         <div class="post_type1">
  6.           <h1>
  7.             <a href="post/<%= post.slug %>">
  8.               <%= post.title %>
  9.             </a>
  10.           </h1>
  11.           <!--<img class="img1" src="<%= img[0] %>" />-->
  12.           <div class="img1" style="background-image: url('<%= img[0] %>'); background-size: cover;"></div>
  13.           <div class="img2" style="background-image: url('<%= img[1] %>'); background-size: cover;"></div>
  14.           <!--<img class="img2" src="<%= img[1] %>" />-->
  15.           <!--<img class="img3" src="<%= img[2] %>" />-->
  16.           <div class="img3" style="background-image: url('<%= img[2] %>'); background-size: cover;"></div>
  17.           <div class="post_title1">
  18.             <i class="fa fa-star"></i>
  19.             <a href="<%= post.slug %>"><h3>Read more</h3></a>
  20.           </div>
  21.         </div>
  22.     <% end %>
  23.  
  24.     <% if post.post_type == 2 %>
  25.         <div class="post_type2">
  26.           <!--<img src="<%= img[0] %>" />-->
  27.           <div class="post_type2_img" style="background-image: url('<%= img[0] %>'); background-size: cover;"></div>
  28.           <div class="post_title2">
  29.             <i class="fa fa-star"></i>
  30.             <p>
  31.               <a href="post/<%= post.slug %>">
  32.                 <%= post.title %>
  33.               </a>
  34.             </p>
  35.             <span class="see_more"><%= link_to "See more", "post/#{ post.slug }" %></span>
  36.           </div>
  37.         </div>
  38.     <% end %>
  39.  
  40.     <% if post.post_type == 3 %>
  41.         <div class="post_type3">
  42.           <!--<img src="<%= img[0] %>" />-->
  43.           <div class="post_type3_img" style="background-image: url('<%= img[0] %>'); background-size: cover;"></div>
  44.           <div class="post_title3">
  45.             <i class="fa fa-star"></i>
  46.             <p>
  47.               <a href="post/<%= post.slug %>">
  48.                 <%= post.title %>
  49.               </a>
  50.             </p>
  51.             <span class="see_more"><%= link_to "See more", "post/#{ post.slug }" %></span>
  52.           </div>
  53.         </div>
  54.     <% end %>
  55.  
  56.     <% if post.post_type == 4 %>
  57.         <div class="post_type4">
  58.           <div class="post_title4">
  59.             <i class="fa fa-star"></i>
  60.             <h1>
  61.               <a href="post/<%= post.slug %>">
  62.                 <%= post.title %>
  63.               </a>
  64.             </h1>
  65.           </div>
  66.           <!--<img src="http://placehold.it/960x400" />-->
  67.           <div class="post_type4_img" style="background-image: url('<%= img[0] %>'); background-size: cover;"></div>
  68.         </div>
  69.     <% end %>
  70. <% else %>
  71.     <% unless post.video.blank? %>
  72.         <% video = post.video %>
  73.         <div class="post_type4">
  74.           <div class="post_title4">
  75.             <i class="fa fa-star"></i>
  76.             <h1>
  77.               <a href="post/<%= post.slug %>">
  78.                 <%= post.title %>
  79.               </a>
  80.             </h1>
  81.           </div>
  82.           <!--<img src="http://placehold.it/960x400" />-->
  83.           <div class="post_type4_img">
  84.             <iframe src="<%= video %>" frameborder="0" allowfullscreen="allowfullscreen"></iframe>
  85.           </div>
  86.         </div>
  87.     <% end %>
  88. <% end %>
  89. <% end %>
Advertisement
Add Comment
Please, Sign In to add comment