Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
chtelmko committed Oct 29, 2021
1 parent 8254ca8 commit 465d686
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 0 deletions.
7 changes: 7 additions & 0 deletions app/javascript/create.js.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// app/views/home/create.js.erb

// Test for ajax success
console.log("This is the create.js.erb file");
// Render flash message
$('#contact').html("<%= j render 'contact_form' %>");
$('#flash-message').html("<%= j render 'flash' %>").delay(3000).fadeOut(4000);
26 changes: 26 additions & 0 deletions app/views/pages/_contact_form.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<%= form_for @contact, url: pages_index_path, remote: true do |f| %>


<div>
<h2>Contact Us</h2>
<p>Have a topic idea? Want to present at a Cinci.rb meeting? Have a suggestion? Send us a comment here.</p>
<p class='flash flash_notice'></p>
<%= form_for Contact.new, url: "/pages", :remote => true do |f| %>
<div>
<div>
<%= f.text_field :name, :placeholder => "Name" %>
<%= f.text_field :email, :placeholder => "Email Address" %>
<%= f.text_field :subject, :placeholder => "Subject" %>
</div>
<div>
<%= f.text_area :message, :placeholder => "Message", :rows => 5 %>
</div>
<div>
<input type="submit" value="Submit">
</div>
</div>
<%- end %>
<div class="col-md-6" id="flash-message">
<%= render 'flash' %>
</div>
</div>
3 changes: 3 additions & 0 deletions app/views/pages/_flash.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<% flash.each do |message_type, message| %>
<%= content_tag(:div, message, class: "alert alert-#{message_type}") %>
<% end %>

0 comments on commit 465d686

Please sign in to comment.