Permalink
Browse files

push on github

  • Loading branch information...
0 parents commit d28714f19c61b93e03967beb7ec024c303f87c4a @Awea committed Jun 5, 2012
Showing with 348 additions and 0 deletions.
  1. BIN .DS_Store
  2. +6 −0 Gemfile
  3. +56 −0 Gemfile.lock
  4. +5 −0 README.md
  5. +17 −0 config.ru
  6. +49 −0 index.rb
  7. +40 −0 views/index.erb
  8. +175 −0 views/layout.erb
BIN .DS_Store
Binary file not shown.
@@ -0,0 +1,6 @@
+source :rubygems
+
+gem 'sinatra'
+gem 'activemodel'
+gem 'heroku'
+gem 'pony'
@@ -0,0 +1,56 @@
+GEM
+ remote: http://rubygems.org/
+ specs:
+ activemodel (3.2.2)
+ activesupport (= 3.2.2)
+ builder (~> 3.0.0)
+ activesupport (3.2.2)
+ i18n (~> 0.6)
+ multi_json (~> 1.0)
+ addressable (2.2.8)
+ builder (3.0.0)
+ excon (0.14.0)
+ heroku (2.26.6)
+ heroku-api (~> 0.2.4)
+ launchy (>= 0.3.2)
+ netrc (~> 0.7.2)
+ rest-client (~> 1.6.1)
+ rubyzip
+ heroku-api (0.2.4)
+ excon (~> 0.14.0)
+ i18n (0.6.0)
+ launchy (2.1.0)
+ addressable (~> 2.2.6)
+ mail (2.4.4)
+ i18n (>= 0.4.0)
+ mime-types (~> 1.16)
+ treetop (~> 1.4.8)
+ mime-types (1.18)
+ multi_json (1.3.6)
+ netrc (0.7.4)
+ polyglot (0.3.3)
+ pony (1.4)
+ mail (> 2.0)
+ rack (1.4.1)
+ rack-protection (1.2.0)
+ rack
+ rest-client (1.6.7)
+ mime-types (>= 1.16)
+ rubyzip (0.9.8)
+ sinatra (1.3.2)
+ rack (~> 1.3, >= 1.3.6)
+ rack-protection (~> 1.2)
+ tilt (~> 1.3, >= 1.3.3)
+ tilt (1.3.3)
+ treetop (1.4.10)
+ polyglot
+ polyglot (>= 0.3.1)
+
+PLATFORMS
+ ruby
+
+DEPENDENCIES
+ activemodel
+ heroku
+ pony
+ sinatra
@@ -0,0 +1,5 @@
+# bonjourgem_form
+
+Simple form for [Bonjourgem][1]
+
+[1]: http://www.bonjourgem.com/
@@ -0,0 +1,17 @@
+# encoding: utf-8
+
+require 'rubygems'
+
+begin
+ require 'bundler/setup'
+ Bundler.require(:default)
+rescue Bundler::GemNotFound
+ raise RuntimeError, "Bundler couldn't find some gems."
+end
+
+require './index'
+
+set :environment, :production
+disable :run
+
+run App
@@ -0,0 +1,49 @@
+require 'sinatra'
+require 'active_model'
+require 'pony'
+
+# model gem
+class BonjourGem
+ include ActiveModel::Validations
+
+ # Attributes
+ attr_accessor :link, :twitter, :message
+
+ # Validations
+ validates_presence_of :link, :twitter
+ validates :link, :format => URI::regexp(%w(http https))
+
+ def initialize args={}
+ args.each do |attr, val|
+ instance_variable_set("@#{attr}", val)
+ end
+ end
+end
+
+# Routes
+get '/' do
+ @error, @confirm = false
+ erb :index
+end
+
+post "/*" do
+ bonjour_gem = BonjourGem.new params['bonjour_gem']
+ if bonjour_gem.valid?
+ @error = false
+ @confirm = true
+ Pony.mail(:to => 'aweaoftheworld@gmail.com', :from => 'bonjourgem@bonjourgem.com', :subject => "Une gem de #{bonjour_gem.twitter}", :body => "Adresse de la gem : #{bonjour_gem.link} \n #{bonjour_gem.message}")
+ else
+ @error = true
+ @confirm = false
+ end
+ erb :index
+end
+
+# Helpers
+helpers do
+ def today_class
+ array_day = ['dimanche', 'lundi', 'mardi', 'mercredi', 'jeudi', 'vendredi', 'samedi']
+ day_number = Time.now.strftime("%w").to_i
+ return "logo-#{array_day[day_number]}"
+ end
+end
@@ -0,0 +1,40 @@
+<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-->
@@ -0,0 +1,175 @@
+<!DOCTYPE html>
+<html lang="en">
+ <head>
+ <meta charset="utf-8" />
+ <title>Formulaire | Bonjour gem</title>
+ <meta name="description" content="{block:PostSummary}{PostSummary} | {/block:PostSummary}{Title}. {Description}" />
+
+ <!-- Le HTML5 shim, for IE6-8 support of HTML elements -->
+ <!--[if lt IE 9]>
+ <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
+ <![endif]-->
+
+ <!-- RSS -->
+ <link rel="alternate" type="application/rss+xml" href="{RSS}" />
+
+ <!-- Google Webfonts -->
+ <link href='http://fonts.googleapis.com/css?family=Noticia+Text:400,400italic,700,700italic' rel='stylesheet' type='text/css' />
+ <link href='http://fonts.googleapis.com/css?family=Droid+Sans+Mono' rel='stylesheet' type='text/css' />
+ <!-- Feuille de style font -->
+ <link href="http://www.webdesigner-developpeur-marseille.com/site/bonjour-gem/css/font.css" rel="stylesheet" />
+ <!-- Le styles -->
+ <link href="http://www.webdesigner-developpeur-marseille.com/site/bonjour-gem/css/bootstrap.css" rel="stylesheet" />
+
+ <!-- Le fav icon -->
+ <link rel="shortcut icon" href="http://www.webdesigner-developpeur-marseille.com/site/bonjour-gem/favicon.ico" />
+ </head>
+ <body onload="prettyPrint()">
+
+ <!-- Precharger font -->
+ <p class="hidden novecento-normal">Novecento Normal</p>
+ <p class="hidden novecento-demibold">Novecento Demibold</p>
+ <p class="hidden novecento-bold">Novecento Bold</p>
+
+ <div class="container-fluid">
+
+ <header class="row-fluid">
+
+ <div class="span8">
+
+ <div class="left-col"></div><!--/.left-col-->
+
+ <div class="right-col">
+ <a class="logo <%= today_class %>" href="http://www.bonjourgem.com"></a>
+ <h3>Un jour, <span>une gem</span></h3>
+ </div><!--/.right-col-->
+
+ </div><!--/.span8-->
+
+ </header><!--/header.row-fluid-->
+
+ <div class="row-fluid">
+
+ <div class="span8">
+
+ <div class="left-col">
+ <p class="date"><%= Time.now.strftime("%d/%m/%Y") %></p>
+ <ul class="pager">
+ <li><span class="btn-disabled" id="prev">Pr&eacute;c</span></li>
+ <li><span class="btn-disabled" id="next">Suiv</span></li>
+ </ul>
+ </div><!--/.left-col-->
+
+ <%= yield %>
+
+ <div class="clear"></div>
+
+ <div class="left-col">
+ <ul class="pager">
+ <li><span class="btn-disabled" id="prev">Pr&eacute;c</span></li>
+ <li><span class="btn-disabled" id="next">Suiv</span></li>
+ </ul>
+ </div><!--/.left-col-->
+
+ <div class="right-col">
+ <ul class="social-buttons cf">
+ <!-- <li><a href="https://plusone.google.com/_/+1/confirm?hl=en&amp;url={Permalink}" class="socialite googleplus" data-size="medium" data-href="{Permalink}" rel="nofollow" target="_blank"><span>Partager sur Google+</span></a></li> -->
+ <li><a href="http://www.facebook.com/sharer.php?u={Permalink}" class="socialite facebook" data-href="{Permalink}" data-send="false" data-layout="button_count" data-width="60" data-show-faces="false" rel="nofollow" target="_blank"><span>Partager sur Facebook</span></a></li>
+ <li><a href="https://twitter.com/share" class="twitter-share-button" data-via="davidmaylis" data-lang="en" data-hashtags="BonjourGem" data-text="{block:Title}{Title}{/block:Title}">Partager sur Twitter</a></li>
+ </ul>
+ </div><!--/.right-col-->
+
+ <div class="clear"></div>
+
+ </div><!--/.span8-->
+
+ <div class="span4">
+
+ <div class="sidebar-nav">
+ <ul class="nav nav-list">
+ <li class="nav-header">Cat&eacute;gories</li>
+ <li><a href="http://www.bonjourgem.com/tagged/authentification">Authentification</a></li>
+ <li><a href="http://www.bonjourgem.com/tagged/autorisation">Autorisation</a></li>
+ <li><a href="http://www.bonjourgem.com/tagged/base_de_données">Base de Données</a></li>
+ <li><a href="http://www.bonjourgem.com/tagged/communication">Communication</a></li>
+ <li><a href="http://www.bonjourgem.com/tagged/css">CSS</a></li>
+ <li><a href="http://www.bonjourgem.com/tagged/déploiement_et_hébergement">Déploiement et hébergement</a></li>
+ <li><a href="http://www.bonjourgem.com/tagged/gestion_de_contenu">Gestion de contenu</a></li>
+ <li><a href="http://www.bonjourgem.com/tagged/html">HTML</a></li>
+ <li><a href="http://www.bonjourgem.com/tagged/javascript">JavaScript</a></li>
+ <li><a href="http://www.bonjourgem.com/tagged/maintenance_et_monitoring">Maintenance et monitoring</a></li>
+ <li><a href="http://www.bonjourgem.com/tagged/outil_de_développement">Outil de développement</a></li>
+ <li><a href="http://www.bonjourgem.com/tagged/outil_pour_la_documentation">Outil pour la documentation</a></li>
+ <li><a href="http://www.bonjourgem.com/tagged/parseur">Parseur</a></li>
+ <li><a href="http://www.bonjourgem.com/tagged/plugin_active_record">Plugin Active Record</a></li>
+ <li><a href="http://www.bonjourgem.com/tagged/plugin_rails">Plugin Rails</a></li>
+ <li><a href="http://www.bonjourgem.com/tagged/service_et_interaction">Service et interaction</a></li>
+ <li><a href="http://www.bonjourgem.com/tagged/temps_et_espace">Temps et espace</a></li>
+ <li><a href="http://www.bonjourgem.com/tagged/test">Test</a></li>
+ <li><a href="http://www.bonjourgem.com/tagged/upload_de_fichier">Upload de fichier</a></li>
+ <li><a href="http://www.bonjourgem.com/tagged/utilitaire">Utilitaire</a></li>
+ <li><a href="http://www.bonjourgem.com/tagged/web_app">Web app</a></li>
+ <li><a href="http://www.bonjourgem.com/tagged/wtf">WTF</a></li>
+ </ul>
+ <div class="separator"></div>
+ <ul class="nav nav-list">
+ <li class="nav-header follow-heading">Nous suivre</li>
+ <li><a href="https://twitter.com/#!/davidmaylis" onclick="window.open(this.href);return false;">David & Maylis sur Twitter</a></li>
+ </ul>
+ </div><!--/.sidebar-nav -->
+
+ </div><!--/.span4-->
+
+ </div><!--/.row-fluid-->
+
+ <footer class="row-fluid">
+
+ <div class="span8">
+
+ <div class="left-col"></div><!--/.left-col-->
+
+ <div class="right-col">
+ <span>
+ <a href="https://www.tumblr.com" onclick="window.open(this.href);return false;">Tumblr</a> Bonjour gem par <a href="http://www.webdesigner-developpeur-marseille.com" onclick="window.open(this.href);return false;">David & Maylis</a> construit avec le fabuleux <a href="http://twitter.github.com/bootstrap" onclick="window.open(this.href);return false;">Twitter Bootstrap</a>
+ </span>
+ </div><!--/.right-col-->
+
+ </div><!--/.span8-->
+
+ </footer><!--/footer.row-fluid-->
+
+ </div><!--/.container-fluid-->
+
+ <!-- Le javascript -->
+ <!-- Placed at the end of the document so the pages load faster -->
+ <!-- Jquery -->
+ <script src="http://www.webdesigner-developpeur-marseille.com/site/bonjour-gem/js/jquery-1.7.1.min.js"></script>
+ <!-- Prettify -->
+ <script src="http://www.webdesigner-developpeur-marseille.com/site/bonjour-gem/js/prettify.js"></script>
+ <!-- Socialite -->
+ <script src="http://www.webdesigner-developpeur-marseille.com/site/bonjour-gem/js/socialite-1.0.js"></script>
+ <script type="text/javascript">
+ $(document).ready(function()
+ {
+ Socialite.load($('.social-buttons'));
+ }
+ );
+ </script>
+ <script type="text/javascript">
+ !function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");
+ </script>
+ <!-- Google Analytics -->
+ <script type="text/javascript">
+ var _gaq = _gaq || [];
+ _gaq.push(['_setAccount', 'UA-22833339-4']);
+ _gaq.push(['_trackPageview']);
+
+ (function() {
+ var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
+ ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
+ var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
+ })();
+ </script>
+
+ </body>
+</html>

0 comments on commit d28714f

Please sign in to comment.