Skip to content

Instantly share code, notes, and snippets.

View parndt's full-sized avatar

Philip Arndt parndt

View GitHub Profile
@parndt
parndt / _menu_branch.html.erb
Created August 19, 2011 04:59 — forked from michaelward82/_menu_branch.html.erb
Limit menu rendering in Refinery CMS
<%
if !!local_assigns[:apply_css] and (classes = menu_branch_css(local_assigns)).any?
css = "class='#{classes.join(' ')}'".html_safe
end
# dom_id DEPRECATED: REMOVE AT 1.1, serves no purpose same with css attributes 'first' and 'last'
dom_id = "id='item_#{menu_branch_counter}'".html_safe if menu_branch.parent_id.nil?
-%>
<li<%= ['', css, dom_id].compact.join(' ').gsub(/\ *$/, '').html_safe %>>
<%= link_to menu_branch.title, menu_branch.url -%>
<% if ( (children = menu_branch.children unless hide_children).present? &&
require 'spec_helper'
module Refinery
describe Page do
let(:page) do
Page.create!({
:title => 'RSpec is great for testing too',
:deletable => true
})
@parndt
parndt / gist:988127
Created May 24, 2011 04:09 — forked from djones/gist:720672
4 views in Refinery that use a new type of content_page
rendering a custom plugin
<% content_for :page_title do %>
<%= @destination.title %>
<% end %>
<% content_for :page_body do %>
<section>
<h1>Choose from our most popular recommended itineraries below</h1>
</section>
@parndt
parndt / my-gh-issues.rb
Created May 8, 2011 03:35 — forked from copiousfreetime/my-gh-issues.rb
My Github Issues
#!/usr/bin/env ruby
#
# A quick script to dump an overview of all the open issues in all my github projects
#
require 'octokit'
require 'awesome_print'
require 'rainbow'
@parndt
parndt / gist:958385
Created May 6, 2011 03:19 — forked from mhaylock/gist:958381
Setting up GIT Bash autocompletion

Run the following to create ~/.git-completion.bash:

curl https://github.com/git/git/raw/master/contrib/completion/git-completion.bash > ~/.git-completion.bash

Then add the following to your ~/.bashrc or ~/.bash_profile after PATH:

# Set the base PS1
export PS1="\t: \W$ "

Source the git bash completion file

<% children = @page.root.children.map {|child| (child.in_menu?) ? child : nil}
if children.any?
unless defined?(selected_item)
selected_item = collection.detect{|page| selected_page?(page)}
selected_item = @page if selected_item.nil?
end
sibling_count = children.size - 1
-%>
<ul id="submenu"><%= render :partial => "/shared/submenu_branch", :collection => children, :locals => {
:hide_children => hide_children,
#!/usr/bin/env ruby
require 'rubygems'
require 'socket'
require 'octopi'
include Octopi
COMPETITORS = {
'refinery' => "resolve/refinerycms",
'radiant' => "radiant/radiant",
Page ------------> Page Part
as is
+ master_page_id
+ locale
Page has many Page
<%
css = []
css << "selected" if selected_page?(menu_branch) or descendant_page_selected?(menu_branch)
css << "first" if menu_branch_counter == 0
css << "last" if menu_branch_counter == (sibling_count ||= menu_branch.shown_siblings.size)
domid = "item_#{menu_branch_counter}" unless menu_branch.parent_id.present? or menu_branch.title.blank?
-%>
<% if menu_branch.in_menu? %>
<li<%= " class='#{css.join(' ')}'" if css.present? -%><%= " id='#{domid}'" if domid.present? -%>>
<%= link_to menu_branch.title, menu_branch.url %>
demolicious/
|-- LICENSE
|-- README
|-- page_layouts
| |-- config.yml
| |-- homepage.erb.html
| `-- locale.yml
|-- images
|-- stylesheets
`-- views