Skip to content

Instantly share code, notes, and snippets.

View parndt's full-sized avatar
🇺🇦

Philip Arndt parndt

🇺🇦
View GitHub Profile
class Floorplan < ActiveRecord::Base
belongs_to :floor
end
, toolsItems: [
{'name': 'Bold', 'title': 'Bold', 'css': 'wym_tools_strong'}
,{'name': 'Italic', 'title': 'Emphasis', 'css': 'wym_tools_emphasis'}
,{'name': 'InsertOrderedList', 'title': 'Ordered_List', 'css': 'wym_tools_ordered_list'}
,{'name': 'InsertUnorderedList', 'title': 'Unordered_List', 'css': 'wym_tools_unordered_list'}
/*,{'name': 'Indent', 'title': 'Indent', 'css': 'wym_tools_indent'}
,{'name': 'Outdent', 'title': 'Outdent', 'css': 'wym_tools_outdent'}
,{'name': 'Undo', 'title': 'Undo', 'css': 'wym_tools_undo'}
,{'name': 'Redo', 'title': 'Redo', 'css': 'wym_tools_redo'}*/
,{'name': 'CreateLink', 'title': 'Link', 'css': 'wym_tools_link'}
1,3c1
< /**
< * @version 0.5-rc1
< *
---
> /*
5c3
< * Copyright (c) 2005 - 2009 Jean-Francois Hovinne, http://www.wymeditor.org/
---
> * Copyright (c) 2008 Jean-Francois Hovinne, http://www.wymeditor.org/
# This is how to use content_for :head :
<% content_for :head do %>
<script type='text/javascript'>
$(document).ready(function() {
// do something here that happens when the DOM is loaded (when all the HTML has been parsed)
}
</script>
<% end %>
<%
show_empty_sections ||= false
remove_automatic_sections ||= false
sections = [
{:yield => :body_content_title, :fallback => page_title, :id => 'body_content_page_title', :title => true},
{:yield => :body_content_left, :fallback => @page[:body]},
{:yield => :body_content_right, :fallback => @page[:side_body]}
]
def self.find_or_set(name, the_value, options={})
if self.column_names.include?('scoping')
options = {:scoping => nil}.merge(options)
find_or_create_by_name_and_scoping(:name => name.to_s, :value => the_value, :scoping => options[:scoping]).value
else
find_or_create_by_name(:name => name.to_s, :value => the_value).value
end
end
before_save :normalise_text_fields
protected
def normalise_text_fields
unless self.body.blank? or self.body =~ /^\</
self.body = "<p>#{self.body.gsub("\r\n\r\n", "</p><p>").gsub("\r\n", "<br/>")}</p>"
end
end
// makes the footer sit anchored on the bottom of the page
// change for whatever your DOM looks like.
$(document).ready(function(){
$(window).resize(adjust_footer);
$(document).add('img').load(adjust_footer);
});
adjust_footer = function() {
height = 0;
@states = {'AL'=>"Alabama", 'AK'=>"Alaska", 'AZ'=>"Arizona", 'AR'=>"Arkansas", 'CA'=>"California", 'CO'=>"Colorado", 'CT'=>"Connecticut", 'DE'=>"Delaware",
'DC'=>"District Of Columbia", 'FL'=>"Florida", 'GA'=>"Georgia", 'HI'=>"Hawaii", 'ID'=>"Idaho", 'IL'=>"Illinois", 'IN'=>"Indiana", 'IA'=>"Iowa", 'KS'=>"Kansas",
'KY'=>"Kentucky", 'LA'=>"Louisiana", 'ME'=>"Maine", 'MD'=>"Maryland", 'MA'=>"Massachusetts", 'MI'=>"Michigan", 'MN'=>"Minnesota", 'MS'=>"Mississippi",
'MO'=>"Missouri", 'MT'=>"Montana", 'NE'=>"Nebraska", 'NV'=>"Nevada", 'NH'=>"New Hampshire", 'NJ'=>"New Jersey", 'NM'=>"New Mexico", 'NY'=>"New York",
'NC'=>"North Carolina", 'ND'=>"North Dakota", 'OH'=>"Ohio", 'OK'=>"Oklahoma", 'OR'=>"Oregon", 'PA'=>"Pennsylvania", 'RI'=>"Rhode Island", 'SC'=>"South Carolina",
'SD'=>"South Dakota", 'TN'=>"Tennessee", 'TX'=>"Texas", 'UT'=>"Utah", 'VT'=>"Vermont", 'VA'=>"Virginia", 'WA'=>"Washington", 'WV'=>"West Virginia", 'WI'=>"Wisconsin", 'WY'=>"Wyoming"
}
<%
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 %>