Skip to content

Instantly share code, notes, and snippets.

@djones
Created November 29, 2010 21:35
Show Gist options
  • Save djones/720667 to your computer and use it in GitHub Desktop.
Save djones/720667 to your computer and use it in GitHub Desktop.
4 views in Refinery that are hardcoded
rendering a custom plugin
<section id='body_content'>
<h1><%= @destination.title %></h1>
<section id='page_body'>
<section>
<h1>Choose from our most popular recommended itineraries below</h1>
</section>
<%= render @destination.trips %>
</section>
<section id='page_side_body'>
<aside>
<%= render :partial => "/shared/customize_your_itinerary" %>
<%=raw @destination.side_body %>
<%= render :partial => "/shared/brochure" %>
<%= render :partial => "/shared/have_a_question" %>
</aside>
</section>
</section>
rendering a standard page
<section id='body_content'>
<h1><%= @page.display_title %></h1>
<section id='page_body'>
<%=raw @page[:body] %>
</section>
<section id='page_side_body'>
<%=raw @page[:side_body] %>
</section>
</section>
render a home page
<section id='body_content'>
<section id='page_title'>
<%= image_tag('peru.png') %>
</section>
<section id='page_body'>
<h1>What Sets Us Apart</h1>
<%= raw @page[:what_sets_us_apart] %>
<%= render :partial => "/shared/have_a_question" %>
</section>
<section id='page_side_body'>
<div class='clearfix'>
<%= image_tag('south-america.png') %>
<h1>Where Do You Want To Go?</h1>
<%= raw @page[:"where_do_you_want_to_go?"] %>
</div>
<div class='clearfix'>
<%= image_tag('brochure-large.png') %>
<h1>Vaya Adventures Brochure</h1>
<%= raw @page[:vaya_adventures_brochure] %>
</div>
<h1>What Our Travellers Say</h1>
<%= raw @page[:what_our_travellers_say] %>
</section>
</section>
render a news index page
<section id='body_content'>
<h1><%= t('plugins.refinerycms_news.title') %></h1>
<section id='page_body'>
<%= @page[:body] if @news_items.offset == 0 %>
<% if @news_items.any? %>
<% @news_items.each do |item| %>
<article class="news_item_truncated">
<h3><%= link_to item.title, news_item_url(item) %></h3>
<p>
<small><%= t('.published') %> <%= l(item.publish_date, :format => :long) %></small>
</p>
<%= truncate item.body, :length => 200,
:omission => " ... #{link_to t('.read_more'), news_item_url(item)}",
:preserve_html_tags => true %>
</article>
<% end %>
<%= will_paginate(@news_items) %>
<% else %>
<p><em><%= t('.no_items_yet') %></em></p>
<% end %>
</section>
<section id='page_side_body'>
<%=raw @page[:side_body] %>
</section>
</section>
@djones
Copy link
Author

djones commented Nov 29, 2010

  • Easy to understand
  • Highly customisable
  • Highly decoupled
  • Heavy duplication

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment