Skip to content

Commit

Permalink
add the feedback form. add the images on footer.
Browse files Browse the repository at this point in the history
  • Loading branch information
Sanghapal committed Sep 1, 2013
1 parent 9981414 commit 9046b61
Show file tree
Hide file tree
Showing 11 changed files with 203 additions and 2 deletions.
15 changes: 15 additions & 0 deletions app/controllers/home_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,20 @@ def nominate
end
end
end

def feedback
@feedback = Feedback.new
if request.post?
@feedback = Feedback.new(params[:feedback])
if @feedback.save
user = User.where(:roles => "Admin").collect(&:email)
UserMailer.feedbackReport(@feedback, user).deliver
redirect_to root_path

else
render action: "feedback"
end
end
end
end

5 changes: 5 additions & 0 deletions app/mailers/user_mailer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,9 @@ def nominateReport(nominate, user)
@user = user
mail(:from => "abrails7@gmail.com", :to => @user, :subject => "Nomination request", :template_path => "user_mailer", :template_name => "nomination")
end

def feedbackReport(feedback, user)
@feedback = feedback
mail(:from => @feedback.email, :to => user, :subject => "Feedback", :template_path => "user_mailer", :template_name => "feedback_report")
end
end
12 changes: 12 additions & 0 deletions app/models/feedback.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
class Feedback
include Mongoid::Document

field :name, type: String
field :email, type: String
field :content_feedback, type: String
field :accessible_feedback, type: String
field :other_feedback, type: String

#validation
validates :name, :email, :presence => true
end
22 changes: 21 additions & 1 deletion app/views/application/_footer.html.haml
Original file line number Diff line number Diff line change
@@ -1 +1,21 @@
.row .span5.pull-right %ul.nav %li %img{:src =>'/images/Rackspace_Cloud_Company_Logo_clr_300x109.jpg', :alt => 'rackspace logo', :width => "100px"} %li %p Hosting partner rackspace

.span6.pull-left
%ul.nav
%li
%img{:src =>'/images/Josh.svg', :alt => 'Josh software logo', :width => "100px"}
%li
%p Knowledge Partner
.span6.pull-middle
%ul.nav
%li
%img{:src =>'/images/techvision4.jpg', :alt => 'TechVision logo', :width => "125px"}
%li
%p Develop by
.span3.pull-right
%ul.nav
%li
%img{:src =>'/images/Rackspace_Cloud_Company_Logo_clr_300x109.jpg', :alt => 'Rackspace logo', :width => "100px"}
%li
%p Hosting Partner


2 changes: 2 additions & 0 deletions app/views/application/_header.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
%ul.nav.pull-right
%li
= link_to "Nominate", nominate_path
%li
= link_to "Feedback", feedback_path
- if user_signed_in?
%li.dropdown
%a.dropdown-toggle{"data-toggle" => "dropdown", :href => "#", "aria-haspopup" => "true"}
Expand Down
14 changes: 14 additions & 0 deletions app/views/home/feedback.html.haml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
%h1 Feedback form
.content
= simple_form_for @feedback, url: feedback_path, method: :post, html: {:class => 'form-horizontal'} do |f|
= f.error_notification
.form-inputs
= f.input :name
= f.input :email
= f.input :content_feedback, as: :text, :input_html => {:cols => 20, :rows => 5}
= f.input :accessible_feedback, as: :text, :input_html => {:cols => 20, :rows => 5}
= f.input :other_feedback, as: :text, :input_html => {:cols => 20, :rows => 5}

.form-actions
= f.submit "Submit", class: 'btn btn-large btn-success'
= link_to "Cancel", root_path, class: 'btn btn-large btn-success'
28 changes: 28 additions & 0 deletions app/views/user_mailer/feedback_report.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<!DOCTYPE html>
<html>
<head>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />
</head>
<body>
<p>
<i> Hello sir,</i>
</p>
<p>
<b>Content Feedback</b></br>
<%= @feedback.content_feedback %>
</p></br>
<p>
<b> Accessible Feedback</b></br>
<%= @feedback.accessible_feedback %>
</p></br>
<p>
<b> Other Feedback</b></br>
<%= @feedback.other_feedback %>
</p>

</br>
</br>
Regards</br>
<%= @feedback.name %>
</body>
</html>
4 changes: 3 additions & 1 deletion config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
:sign_out => 'logout',
:password => 'secret',
:confirmation => 'verification',
:root_path => 'home#index'
:root_path => 'home#index'
}

resources :users
Expand All @@ -22,6 +22,8 @@
match '/levels_list' => 'levels#levels_list', :via => :get, as: :levels_list
match '/nominate' => 'home#nominate', :via => [:get, :post], as: :nominate
match 'nominate_list' => 'home#nominate_list', :via => :get, as: :nominate_list
match '/feedback' => 'home#feedback', :via => [:get, :post], as: :feedback
match '/feedback_list' => 'home#feedback_list', :via => :get, as: :feedback_list

# The priority is based upon order of creation:
# first created -> highest priority.
Expand Down
98 changes: 98 additions & 0 deletions public/images/Josh.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/images/techvision4.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions spec/models/feedback_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
require 'spec_helper'

describe Feedback do
pending "add some examples to (or delete) #{__FILE__}"
end

0 comments on commit 9046b61

Please sign in to comment.