Skip to content

Commit

Permalink
Merge branch 'master' of gitlab.com:radiet/cempaka-sobat-bumi
Browse files Browse the repository at this point in the history
  • Loading branch information
Radiet committed May 25, 2018
2 parents 6a471d5 + b76abb5 commit e9bb950
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 2 deletions.
2 changes: 1 addition & 1 deletion app/controllers/api/v1/feedbacks_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ class FeedbacksController < Api::V1::ApiController

def create
Feedback.create!(feedback_params)
render json: { success: 'Your feedback succesfully sended' }, status: :ok
render json: { success: 'Your feedback succesfully sended' }, status: :ok
end

private
Expand Down
3 changes: 2 additions & 1 deletion app/controllers/api/v1/products_controller.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
module Api
module V1
class ProductsController < Api::V1::ApiController

skip_before_action :authenticate_user!, raise: false

def index
@products = Product.all
render json: @products
Expand Down
4 changes: 4 additions & 0 deletions app/controllers/pages_controller.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
class PagesController < ApplicationController
def landing
end

def contact
@feedback = Feedback.new
end
end
2 changes: 2 additions & 0 deletions app/controllers/products_controller.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
class ProductsController < ApplicationController
before_action :set_products
skip_before_action :authenticate_user!, raise: false

def index
Product.all
end

private
Expand Down
26 changes: 26 additions & 0 deletions app/views/pages/contact.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<div class="header-intro-contact view hm-black-light jarallax" data-jarallax='{"speed": 0.2}' style="background-image: url(assets/images/contact-bg.jpg);">
<div class="full-bg-img">
<div class="container flex-center">
<div class="row pt-5 mt-3">
<div class="col-md-12 mb-3">
<div class="intro-info-content text-center">
<h5 class="font-up mb-1 font-bold wow fadeInDown" data-wow-delay="0.3s">We Can Make Your Ideas Become Stunning Application?</h5>
<h1 class="display-3 mb-1 wow fadeInDown" data-wow-delay="0.3s">Contact Us</h1>
<div class="intro-separator"></div>
<%= form_for @feedback, url: {action: 'create', controller: 'api/v1/feedbacks'}, :html => {:class => 'contact-form'} do |f| %>
<div class="container">
<div class="row">
<%= f.text_field :name, placeholder: "Name", :html => {:class => 'col-md-12'}%>
<%= f.email_field :email, placeholder: "Email", :html => {:class => 'col-md-12'}%>
<%= f.telephone_field :phone_number, placeholder: "Telephone", :html => {:class => 'col-md-12'}%>
<%= f.text_area :message, placeholder: "Message", :html => {:class => 'col-md-12'}%>
<%= f.submit "Send My Message", :html => {:class => 'col-md-12'}%>
</div>
</div>
<% end %>
</div>
</div>
</div>
</div>
</div>
</div>
7 changes: 7 additions & 0 deletions config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,13 @@
mount RailsAdmin::Engine => '/admin', as: 'rails_admin'

root 'pages#landing'

resources :pages do
collection do
get :contact
end
end

mount_devise_token_auth_for 'User', at: '/api/v1/users', controllers: {
registrations: 'api/v1/registrations'

Expand Down

0 comments on commit e9bb950

Please sign in to comment.