Created
December 30, 2015 16:32
-
-
Save eltonsantos/2ffa4c316bdeaa961ea6 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
= simple_form_for('/enviarmail', html: { class: 'form-horizontal' }) do |f| | |
= f.error_notification | |
.container-fluid | |
.form-inputs | |
.form-group | |
= label_tag "Nome", nil, class: "control-label" | |
= text_field_tag :name, nil, class: "string required form-control" | |
.form-group | |
= label_tag "Email", nil, class: "control-label" | |
= text_field_tag :email, nil, class: "string required form-control" | |
.form-actions.pull-right | |
= button_tag "Enviar", class: "btn btn-warning" | |
%br | |
%br |
This file contains hidden or 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
class DiscosController < ApplicationController | |
before_action :set_disco, only: [:show, :edit, :update, :destroy, :interesse, :enviarmail] | |
# GET /discos | |
# GET /discos.json | |
def index | |
@discos = Disco.all | |
end | |
# GET /discos/1 | |
# GET /discos/1.json | |
def show | |
end | |
def interesse | |
# Aqui era pra ter alguma coisa, como os dados recebidos pelo formulário | |
end | |
def enviarmail | |
EnviarEmail.send_mail(@disco).deliver | |
respond_to do |format| | |
format.html {render :show, notice: "Email enviado com sucesso!"} | |
format.js | |
end | |
end |
This file contains hidden or 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
$(".modal-body").empty(); | |
$('.modal-body').html('#{escape_javascript(render 'interesse')}'); | |
$("#modal-interesse").modal('show'); |
This file contains hidden or 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
resources :discos do | |
member do | |
get 'interesse' => 'discos#interesse' | |
get 'enviarmail' => 'discos#enviarmail' | |
end | |
end |
This file contains hidden or 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
%p | |
%strong Nome: | |
= @disco.name | |
%p | |
%strong Imagem: | |
= image_tag @disco.image.url(:medium) | |
= link_to interesse_disco_path, {class: 'btn btn-warning', 'data-toggle' => 'modal', 'data-target' => '#modal-show', :remote => true} do | |
%i.fa.fa-heart-o | |
Estou interessado! | |
#modal-interesse.modal.fade{:role => "dialog", :tabindex => "-1"} | |
.modal-dialog | |
.modal-content | |
.modal-header | |
%button.close{"aria-label" => "Close", "data-dismiss" => "modal", :type => "button"} | |
%span{"aria-hidden" => "true"} × | |
%h4.modal-title Tenho interesse no disco: #{@disco.name} | |
.modal-body | |
.modal-footer | |
%button.btn.btn-default{"data-dismiss" => "modal", :type => "button"} Close |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment