Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

erb to haml

  • Loading branch information...
commit 3553acb6cb7d607d3c4b0deecc20622ad04e3bba 1 parent 103e281
Maylis Agniel authored
View
3  Gemfile
@@ -3,4 +3,5 @@ source :rubygems
gem 'sinatra'
gem 'activemodel'
gem 'heroku'
-gem 'pony'
+gem 'pony'
+gem 'haml'
View
2  Gemfile.lock
@@ -10,6 +10,7 @@ GEM
addressable (2.2.8)
builder (3.0.0)
excon (0.14.0)
+ haml (3.1.6)
heroku (2.26.6)
heroku-api (~> 0.2.4)
launchy (>= 0.3.2)
@@ -51,6 +52,7 @@ PLATFORMS
DEPENDENCIES
activemodel
+ haml
heroku
pony
sinatra
View
5 index.rb
@@ -1,6 +1,7 @@
require 'sinatra'
require 'active_model'
require 'pony'
+require 'haml'
# model gem
class BonjourGem
@@ -23,7 +24,7 @@ def initialize args={}
# Routes
get '/' do
@error, @confirm = false
- erb :index
+ haml :index
end
post "/*" do
@@ -36,7 +37,7 @@ def initialize args={}
@error = true
@confirm = false
end
- erb :index
+ haml :index
end
# Helpers
View
40 views/index.erb
@@ -1,40 +0,0 @@
-<div class="right-col">
- <h1><a href="#">Soumettez nous vos gems</a></h1>
- <% if @error %>
- <div class="alert alert-error">
- <strong>Il y a des erreurs !</strong> V&eacute;rifiez que les champs requis sont corrects.
- </div>
- <% end %>
- <% if @confirm %>
- <div class="alert alert-success">
- <strong>Gem transmise avec succès !</strong> Merci pour votre contribution.
- </div>
- <% end %>
- <form class="form-horizontal" action="/" method="POST">
- <fieldset>
- <div class="control-group">
- <label class="control-label" for="input01">Lien vers la gem *</label>
- <div class="controls">
- <input type="text" class="input-xlarge" id="input01" name="bonjour_gem[link]">
- <p class="help-block">exemple : https://github.com/sinatra/sinatra</p>
- </div>
- </div>
- <div class="control-group">
- <label class="control-label" for="input01">Pseudo Twitter *</label>
- <div class="controls">
- <input type="text" class="input-xlarge" id="input01" name="bonjour_gem[twitter]">
- <p class="help-block">exemple : @davidmaylis</p>
- </div>
- </div>
- <div class="control-group">
- <label class="control-label" for="input01">Un message</label>
- <div class="controls">
- <textarea rows="5" id="textarea" class="input-xlarge" name="bonjour_gem[message]"></textarea>
- </div>
- </div>
- <div class="form-actions">
- <button class="btn btn-primary" type="submit">Envoyer la gem</button>
- </div>
- </fieldset>
- </form>
-</div><!--/.right-col-->
View
31 views/index.haml
@@ -0,0 +1,31 @@
+.right-col
+ %h1
+ %a{:href => "#"} Soumettez nous vos gems
+ if @error
+ .alert.alert-error
+ %strong Il y a des erreurs !
+ Vérifiez que les champs requis sont corrects.
+ end
+ if @confirm
+ .alert.alert-success
+ %strong Gem transmise avec succès !
+ Merci pour votre contribution.
+ end
+ %form.form-horizontal{:action => "/", :method => "POST"}
+ %fieldset
+ .control-group
+ %label.control-label{:for => "input01"} Lien vers la gem *
+ .controls
+ %input#input01.input-xlarge{:name => "bonjour_gem[link]", :type => "text"}
+ %p.help-block exemple : https://github.com/sinatra/sinatra
+ .control-group
+ %label.control-label{:for => "input01"} Pseudo Twitter *
+ .controls
+ %input#input01.input-xlarge{:name => "bonjour_gem[twitter]", :type => "text"}
+ %p.help-block exemple : @davidmaylis
+ .control-group
+ %label.control-label{:for => "input01"} Un message
+ .controls
+ %textarea#textarea.input-xlarge{:name => "bonjour_gem[message]", :rows => "5"}
+ .form-actions
+ %button.btn.btn-primary{:type => "submit"} Envoyer la gem
Please sign in to comment.
Something went wrong with that request. Please try again.