Skip to content

Commit

Permalink
Merge branch 'master' of github.com:ftorghele/swap_io into active_admin
Browse files Browse the repository at this point in the history
Conflicts:
	db/schema.rb
  • Loading branch information
wolli2710 committed Mar 6, 2012
2 parents 8ac9ce7 + c5eeb8b commit eedc28f
Show file tree
Hide file tree
Showing 44 changed files with 960 additions and 218 deletions.
1 change: 0 additions & 1 deletion Gemfile
Expand Up @@ -12,7 +12,6 @@ gem 'omniauth-facebook'
gem 'activeadmin'

gem 'haml'
gem 'twitter-bootstrap-rails', '2.0.2'

# Gems used only for assets and not required
# in production environments by default.
Expand Down
23 changes: 5 additions & 18 deletions Gemfile.lock
Expand Up @@ -68,8 +68,6 @@ GEM
coffee-script-source
execjs
coffee-script-source (1.2.0)
commonjs (0.2.0)
therubyracer (~> 0.9.9)
database_cleaner (0.7.1)
devise (2.0.0)
bcrypt-ruby (~> 3.0)
Expand All @@ -79,7 +77,7 @@ GEM
erubis (2.7.0)
execjs (1.3.0)
multi_json (~> 1.0)
factory_girl (2.6.0)
factory_girl (2.6.1)
activesupport (>= 2.3.9)
faraday (0.7.6)
addressable (~> 2.2)
Expand Down Expand Up @@ -117,14 +115,8 @@ GEM
kgio (2.7.2)
launchy (2.0.5)
addressable (~> 2.2.6)
less (2.0.9)
commonjs (~> 0.2.0)
therubyracer (~> 0.9.9)
less-rails (2.1.6)
actionpack (>= 3.1)
less (~> 2.0.7)
libv8 (3.3.10.4)
mail (2.4.1)
mail (2.4.3)
i18n (>= 0.4.0)
mime-types (~> 1.16)
treetop (~> 1.4.8)
Expand Down Expand Up @@ -153,7 +145,7 @@ GEM
oauth2 (0.5.2)
faraday (~> 0.7)
multi_json (~> 1.0)
omniauth (1.0.2)
omniauth (1.0.3)
hashie (~> 1.2)
rack
omniauth-facebook (1.2.0)
Expand All @@ -171,7 +163,7 @@ GEM
activerecord (~> 3.0)
polyglot (0.3.3)
rack (1.4.1)
rack-cache (1.1)
rack-cache (1.2)
rack (>= 0.4)
rack-ssl (1.3.2)
rack
Expand Down Expand Up @@ -229,11 +221,7 @@ GEM
treetop (1.4.10)
polyglot
polyglot (>= 0.3.1)
twitter-bootstrap-rails (2.0.2)
actionpack (>= 3.1)
less-rails (~> 2.1.5)
railties (>= 3.1)
tzinfo (0.3.31)
tzinfo (0.3.32)
uglifier (1.2.3)
execjs (>= 0.3.0)
multi_json (>= 1.0.2)
Expand Down Expand Up @@ -272,6 +260,5 @@ DEPENDENCIES
shoulda
simplecov
therubyracer
twitter-bootstrap-rails (= 2.0.2)
uglifier (>= 1.0.3)
unicorn
Binary file added app/assets/images/logo.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 0 additions & 1 deletion app/assets/javascripts/application.js
Expand Up @@ -12,5 +12,4 @@
//
//= require jquery
//= require jquery_ujs
//= require twitter/bootstrap
//= require_tree .
22 changes: 0 additions & 22 deletions app/assets/javascripts/bootstrap.js.coffee

This file was deleted.

7 changes: 7 additions & 0 deletions app/assets/javascripts/bootstrap.min.js

Large diffs are not rendered by default.

3 changes: 1 addition & 2 deletions app/assets/stylesheets/application.css
Expand Up @@ -9,6 +9,5 @@
* compiled file, but it's generally better to create a new file per style scope.
*
*= require_self
*= require twitter/bootstrap
*= require_tree .
*/
*/
5 changes: 0 additions & 5 deletions app/assets/stylesheets/bootstrap.css.less

This file was deleted.

643 changes: 643 additions & 0 deletions app/assets/stylesheets/bootstrap.css.scss

Large diffs are not rendered by default.

34 changes: 34 additions & 0 deletions app/assets/stylesheets/pages.css.scss
@@ -1,3 +1,37 @@
// Place all the styles related to the pages controller here.
// They will automatically be included in application.css.
// You can use Sass (SCSS) here: http://sass-lang.com/
@import "bootstrap.css.scss";

.with-margin {
margin: 10px 0;
}

#welcome-page {

#logo {
margin: 0 auto;
width: 450px;
height: 343px;
}

#newsletter-box {
form {
@extend .well;
@extend .form-inline;
#newsletter-center {
margin: 5px auto;
width: 500px;
}
}
.submit_btn {
@extend .btn-success;
}

.help-inline {
text-align:center;
width: 500px;
margin: 10px auto 0 auto;
}
}
}
3 changes: 3 additions & 0 deletions app/assets/stylesheets/wissenteilen.css.scss
@@ -0,0 +1,3 @@
.copyright {
text-align: center;
}
31 changes: 31 additions & 0 deletions app/controllers/newsletter_subscribers_controller.rb
@@ -0,0 +1,31 @@
class NewsletterSubscribersController < ApplicationController

require 'hash'

def create
email = params[:newsletter_subscriber][:email]

@subscriber = NewsletterSubscriber.new(:email => email, :signout_hash => Hash.create_token(email) )

if @subscriber.valid?
@subscriber.save!
flash[:info] = I18n.t('newsletter_subscriber.create.success')
redirect_to welcome_path

else
flash[:error] = I18n.t('newsletter_subscriber.create.fail')
render 'pages/welcome', :layout => 'welcome'
end
end

def unsubscribe
if NewsletterSubscriber.unsubscribe(params[:token])
flash[:info] = I18n.t('newsletter_subscriber.unsubscribe.success')
redirect_to 'home'
else
flash[:error] = I18n.t('newsletter_subscriber.unsubscribe.fail')
redirect_to 'home'
end
end

end
7 changes: 5 additions & 2 deletions app/controllers/pages_controller.rb
@@ -1,8 +1,11 @@
class PagesController < ApplicationController
def overview
render :home unless signed_in? and return

redirect_to :welcome unless signed_in? and return

end

def welcome
@subscriber = NewsletterSubscriber.new
render :layout => 'welcome'
end
end
28 changes: 0 additions & 28 deletions app/controllers/subscribers_controller.rb

This file was deleted.

2 changes: 2 additions & 0 deletions app/helpers/newsletter_subscribers_helper.rb
@@ -0,0 +1,2 @@
module NewsletterSubscribersHelper
end
2 changes: 0 additions & 2 deletions app/helpers/subscribers_helper.rb

This file was deleted.

2 changes: 1 addition & 1 deletion app/mailers/system_mailer.rb
Expand Up @@ -26,7 +26,7 @@ def request_course(user, user_profile_link, course_link )

def news(email, body)
@body = body
@unsubscribe_token = Subscriber.find_by_email(email).signout_hash
@unsubscribe_token = NewsletterSubscriber.find_by_email(email).signout_hash
mail to: email, subject: "#{I18n.t('mailer.subject.news')}"
end

Expand Down
2 changes: 1 addition & 1 deletion app/models/newsletter.rb
Expand Up @@ -5,7 +5,7 @@ class Newsletter < ActiveRecord::Base
def self.spread_newsletter(newsletter_id = self.last.id)
return if self.find(newsletter_id).sent
newsletter = self.find(newsletter_id)
Subscriber.find_all_by_newsletter_id(newsletter_id).each do |subscriber|
NewsletterSubscriber.all.each do |subscriber|
SystemMailer.news(subscriber.email, newsletter.body).deliver
end
newsletter.sent = true
Expand Down
12 changes: 12 additions & 0 deletions app/models/newsletter_subscriber.rb
@@ -0,0 +1,12 @@
class NewsletterSubscriber < ActiveRecord::Base

validates_presence_of :email, :signout_hash
validates :email, :presence => true, :email => true
validates_uniqueness_of :email

def self.unsubscribe(token)
subscriber = self.find_by_signout_hash(token)
subscriber.destroy
end

end
12 changes: 0 additions & 12 deletions app/models/subscriber.rb

This file was deleted.

7 changes: 5 additions & 2 deletions app/views/layouts/_footer.html.haml
Expand Up @@ -3,11 +3,14 @@
.navbar-inner
.container
%ul.nav
- if signed_in?
%li= link_to I18n.t('pages.overview.title'), root_path
- else
%li= link_to I18n.t('pages.welcome.title'), root_path
%li= link_to I18n.t('pages.about.title'), about_path
%li= link_to I18n.t('pages.coverage.title'), coverage_path
%li= link_to I18n.t('pages.contact.title'), contact_path
%li= link_to I18n.t('pages.imprint.title'), imprint_path
%li= link_to I18n.t('pages.terms.title'), terms_path
%li= link_to I18n.t('pages.help.title'), help_path

%p &copy; #{I18n.t('app.footer_text')}
.copyright &copy; #{I18n.t('app.footer_text')}
30 changes: 30 additions & 0 deletions app/views/layouts/welcome.html.haml
@@ -0,0 +1,30 @@
!!! 5
%html{:lang => "de"}
%head
%meta{:charset => "utf-8"}/
%title= content_for?(:title) ? yield(:title) : I18n.t('app.headline')
= stylesheet_link_tag :application
= csrf_meta_tags
/[if lt IE 9]
= javascript_include_tag "http://html5shim.googlecode.com/svn/trunk/html5.js"
%body
.container
.content
.row
.span12
.pull-right.with-margin
= link_to I18n.t('app.sign_up_link'), new_user_registration_path, :class => 'btn'
= link_to I18n.t('app.sign_in_link'), new_user_session_path, :class => 'btn'
= link_to I18n.t('app.sign_in_with_link', :provider => "Facebook"), user_omniauth_authorize_path(:facebook), :class => 'btn'

.row
.span12
- flash.each do |name, msg|
= content_tag :div, msg, :class => "alert alert-#{name}" if msg.is_a?(String)
.row
.span12
= yield

= render('layouts/footer')

= javascript_include_tag :application
5 changes: 0 additions & 5 deletions app/views/pages/home.html.haml

This file was deleted.

13 changes: 13 additions & 0 deletions app/views/pages/welcome.html.haml
@@ -0,0 +1,13 @@
#welcome-page
#logo
= image_tag 'logo.jpg'

#newsletter-box
=form_for @subscriber do |f|
#newsletter-center
= f.label :email, I18n.t('pages.welcome.newsletter_sign_up_label'), :class => 'control-label'
%span.control-group{ :class => form_status(@subscriber, :email) }
= f.email_field :email, :placeholder=> I18n.t('pages.welcome.newsletter_sign_up_placeholder')
= submit_tag I18n.t('pages.welcome.newsletter_sign_up_button'), :class => "submit_btn"
- if @subscriber.errors.any?
%span.help-inline= form_status_msg(@subscriber, :email)
2 changes: 1 addition & 1 deletion config/application.rb
Expand Up @@ -15,7 +15,7 @@ class Application < Rails::Application
# -- all .rb files in that directory are automatically loaded.

# Custom directories with classes and modules you want to be autoloadable.
# config.autoload_paths += %W(#{config.root}/extras)
config.autoload_paths += %W(#{config.root}/lib)

# Only load the plugins named here, in the order given (default is alphabetical).
# :all can be used as a placeholder for all plugins not explicitly named.
Expand Down

0 comments on commit eedc28f

Please sign in to comment.