Created
January 26, 2012 15:33
-
-
Save starflyer59/1683298 to your computer and use it in GitHub Desktop.
jQuery dialog problems
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Gist Outline: | |
(1) fablemaker partial | |
(2) create.js.erb | |
(3) leftsidebar partial (which links to the fablemaker partial) | |
(4) application.js | |
(5) routes | |
(1) _fablemaker.html.erb partial: | |
<div id="fableMaker" title="Fable Maker" style="display:none"> | |
<div id="countdownTimer"> | |
<span id="countdown_timer" class="timer">4:20</span><br /> | |
<button id="play_btn">Play Timer</button> | |
<button id="pause_btn">Pause Timer</button> | |
<button id="reset_btn">Reset Timer</button> | |
</div> | |
<%= form_for @fable do |f| %> | |
<p> | |
<%= f.label :content, "Fable Portal:" %><br /> | |
<%= f.text_area :content, :style => "" %> | |
</p> | |
<p> | |
<%= f.label :title, "What would you like to title your creation?" %><br /> | |
<%= f.text_field :title %> | |
</p> | |
<p><%= f.submit "Create Fable", remote: true %></p> | |
<% end %> | |
</div> | |
(2) create.js.erb (for creating fable in dialog box) | |
$("#fableMaker").dialog({ | |
autoOpen: false, | |
height: 900, | |
width: 550, | |
modal: true, | |
title: 'Fable Maker', | |
buttons: { | |
"Create Fable": function() { $("#fableMaker").submit() }, | |
}, | |
open: function() { | |
$("#fableMaker").html("<%= escape_javascript(render('fableMaker')) %>") | |
}, | |
}); | |
(3) _leftsidebar.html.erb | |
<div id="fableMakerLink"> | |
<ul> | |
<li><%= link_to image_tag("makeyourfable.png", :size => "130x102", | |
:alt => "freewriting portal", | |
:class => "typewriter", | |
:mouseover => "makeyourfableH.png"), | |
new_fable_path %> | |
</li> | |
</ul> | |
<p class="clear"> </p> | |
</div><!-- FableMaker --> | |
(4) application.js | |
//= require jquery | |
//= require jquery_ujs | |
//= require_tree . | |
(5) routes.rb | |
root :to => "pages#home" | |
devise_for :users, :controllers => {:registrations => 'registrations'} do | |
match '/login', :to => 'devise/sessions#new' | |
match '/users/sign_out', :to => 'devise/sessions#destroy' | |
end | |
resources :users, :only => [:index, :show] | |
resources :authentications | |
resources :fables | |
match '/auth/:provider/callback', :to => 'authentications#create' | |
get "fables/create" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment