Skip to content

Instantly share code, notes, and snippets.

@craigmcnamara
Created November 18, 2009 08:00
Show Gist options
  • Save craigmcnamara/237640 to your computer and use it in GitHub Desktop.
Save craigmcnamara/237640 to your computer and use it in GitHub Desktop.
- content_for :head do
= stylesheet_link_tag "smoothness/jquery-ui.css"
= stylesheet_link_tag "../javascripts/markitup/skins/markitup/style.css"
= stylesheet_link_tag "../javascripts/markitup/sets/textile/style.css"
= stylesheet_link_tag "jquery.Jcrop.css"
#tabs
%ul
%li=link_to "About", '#about', :class => 'selected'
%li=link_to "Body", '#page_body'
#about
%dl
%dd= form.label :name
%dd= form.text_field :slug, :value => @page.title
%dd= form.label :banner
%dd= form.file_field :banner
%dd= yield :buttons
- if @page.banner.url
= render :partial => "cropper", :locals => {:page => @page}
- unless @page.plugin?
#page_body
%dl
%dd= form.label :body
%dd= form.text_area :body, :id => "body"
- content_for :javascript do
= javascript_include_tag :defaults
= javascript_include_tag "jquery.Jcrop.js"
= javascript_include_tag "markitup/jquery.markitup.js"
= javascript_include_tag "markitup/sets/textile/set.js"
:javascript
$(document).ready(function() {
$('#body').markItUp(mySettings);
$('#cropper').Jcrop({ aspectRatio: 700 / 250,
onChange: updateCoords,
onSelect: updateCoords})
});
function updateCoords(c) {
$('#x').val(c.x);
$('#y').val(c.y);
$('#x2').val(c.x2);
$('#y2').val(c.y2);
$('#height').val($('.jcrop-holder').height());
$('#width').val($('.jcrop-holder').width());
};
$("#tabs").tabs();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment