Commit bd78788b authored by mafolz's avatar mafolz
Browse files

inital commit

parents
# Be sure to restart your server when you modify this file.
# Your secret key is used for verifying the integrity of signed cookies.
# If you change this key, all old signed cookies will become invalid!
# Make sure the secret is at least 30 characters and all random,
# no regular words or you'll be exposed to dictionary attacks.
# You can use `rake secret` to generate a secure secret key.
# Make sure your secret_key_base is kept private
# if you're sharing your code publicly.
SpacePunkte::Application.config.secret_key_base = '456f0496494604c1b4147fbb881b61fb432d16d2b68328b4412e1dbc9eb5dd32fe79f8679f3dee2aa03bebaf5ffaf419bb8282b8c94ab7d66b421cd2de510f04'
# Be sure to restart your server when you modify this file.
SpacePunkte::Application.config.session_store :cookie_store, key: '_space_punkte_session'
# Be sure to restart your server when you modify this file.
# This file contains settings for ActionController::ParamsWrapper which
# is enabled by default.
# Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
ActiveSupport.on_load(:action_controller) do
wrap_parameters format: [:json] if respond_to?(:wrap_parameters)
end
# To enable root element in JSON for ActiveRecord objects.
# ActiveSupport.on_load(:active_record) do
# self.include_root_in_json = true
# end
# Additional translations at https://github.com/plataformatec/devise/wiki/I18n
en:
devise:
confirmations:
confirmed: "Your account was successfully confirmed."
send_instructions: "You will receive an email with instructions about how to confirm your account in a few minutes."
send_paranoid_instructions: "If your email address exists in our database, you will receive an email with instructions about how to confirm your account in a few minutes."
failure:
already_authenticated: "You are already signed in."
inactive: "Your account is not activated yet."
invalid: "Invalid email or password."
locked: "Your account is locked."
last_attempt: "You have one more attempt before your account will be locked."
not_found_in_database: "Invalid email or password."
timeout: "Your session expired. Please sign in again to continue."
unauthenticated: "You need to sign in or sign up before continuing."
unconfirmed: "You have to confirm your account before continuing."
mailer:
confirmation_instructions:
subject: "Confirmation instructions"
reset_password_instructions:
subject: "Reset password instructions"
unlock_instructions:
subject: "Unlock Instructions"
omniauth_callbacks:
failure: "Could not authenticate you from %{kind} because \"%{reason}\"."
success: "Successfully authenticated from %{kind} account."
passwords:
no_token: "You can't access this page without coming from a password reset email. If you do come from a password reset email, please make sure you used the full URL provided."
send_instructions: "You will receive an email with instructions about how to reset your password in a few minutes."
send_paranoid_instructions: "If your email address exists in our database, you will receive a password recovery link at your email address in a few minutes."
updated: "Your password was changed successfully. You are now signed in."
updated_not_active: "Your password was changed successfully."
registrations:
destroyed: "Bye! Your account was successfully cancelled. We hope to see you again soon."
signed_up: "Welcome! You have signed up successfully."
signed_up_but_inactive: "You have signed up successfully. However, we could not sign you in because your account is not yet activated."
signed_up_but_locked: "You have signed up successfully. However, we could not sign you in because your account is locked."
signed_up_but_unconfirmed: "A message with a confirmation link has been sent to your email address. Please open the link to activate your account."
update_needs_confirmation: "You updated your account successfully, but we need to verify your new email address. Please check your email and click on the confirm link to finalize confirming your new email address."
updated: "You updated your account successfully."
sessions:
signed_in: "Signed in successfully."
signed_out: "Signed out successfully."
unlocks:
send_instructions: "You will receive an email with instructions about how to unlock your account in a few minutes."
send_paranoid_instructions: "If your account exists, you will receive an email with instructions about how to unlock it in a few minutes."
unlocked: "Your account has been unlocked successfully. Please sign in to continue."
errors:
messages:
already_confirmed: "was already confirmed, please try signing in"
confirmation_period_expired: "needs to be confirmed within %{period}, please request a new one"
expired: "has expired, please request a new one"
not_found: "not found"
not_locked: "was not locked"
not_saved:
one: "1 error prohibited this %{resource} from being saved:"
other: "%{count} errors prohibited this %{resource} from being saved:"
# Files in the config/locales directory are used for internationalization
# and are automatically loaded by Rails. If you want to use locales other
# than English, add the necessary files in this directory.
#
# To use the locales, use `I18n.t`:
#
# I18n.t 'hello'
#
# In views, this is aliased to just `t`:
#
# <%= t('hello') %>
#
# To use a different locale, set it with `I18n.locale`:
#
# I18n.locale = :es
#
# This would use the information in config/locales/es.yml.
#
# To learn more, please read the Rails Internationalization guide
# available at http://guides.rubyonrails.org/i18n.html.
en:
hello: "Hello world"
SpacePunkte::Application.routes.draw do
devise_for :hackers
root :to => 'hackers#index'
resources :hackers
# The priority is based upon order of creation: first created -> highest priority.
# See how all your routes lay out with "rake routes".
# You can have the root of your site routed with "root"
# root 'welcome#index'
# Example of regular route:
# get 'products/:id' => 'catalog#view'
# Example of named route that can be invoked with purchase_url(id: product.id)
# get 'products/:id/purchase' => 'catalog#purchase', as: :purchase
# Example resource route (maps HTTP verbs to controller actions automatically):
# resources :products
# Example resource route with options:
# resources :products do
# member do
# get 'short'
# post 'toggle'
# end
#
# collection do
# get 'sold'
# end
# end
# Example resource route with sub-resources:
# resources :products do
# resources :comments, :sales
# resource :seller
# end
# Example resource route with more complex sub-resources:
# resources :products do
# resources :comments
# resources :sales do
# get 'recent', on: :collection
# end
# end
# Example resource route with concerns:
# concern :toggleable do
# post 'toggle'
# end
# resources :posts, concerns: :toggleable
# resources :photos, concerns: :toggleable
# Example resource route within a namespace:
# namespace :admin do
# # Directs /admin/products/* to Admin::ProductsController
# # (app/controllers/admin/products_controller.rb)
# resources :products
# end
end
class DeviseCreateHackers < ActiveRecord::Migration
def change
create_table(:hackers) do |t|
## Database authenticatable
t.string :email, :null => false, :default => ""
t.string :encrypted_password, :null => false, :default => ""
## Recoverable
t.string :reset_password_token
t.datetime :reset_password_sent_at
## Rememberable
t.datetime :remember_created_at
## Trackable
t.integer :sign_in_count, :default => 0, :null => false
t.datetime :current_sign_in_at
t.datetime :last_sign_in_at
t.string :current_sign_in_ip
t.string :last_sign_in_ip
## Confirmable
# t.string :confirmation_token
# t.datetime :confirmed_at
# t.datetime :confirmation_sent_at
# t.string :unconfirmed_email # Only if using reconfirmable
## Lockable
# t.integer :failed_attempts, :default => 0, :null => false # Only if lock strategy is :failed_attempts
# t.string :unlock_token # Only if unlock strategy is :email or :both
# t.datetime :locked_at
#
t.string :nickname
t.timestamps
end
add_index :hackers, :email, :unique => true
add_index :hackers, :reset_password_token, :unique => true
# add_index :hackers, :confirmation_token, :unique => true
# add_index :hackers, :unlock_token, :unique => true
end
end
class CreateQuests < ActiveRecord::Migration
def change
create_table :quests do |t|
t.integer :points
t.string :title
t.string :description
t.string :image_url
t.timestamps
end
end
end
class CreateRewards < ActiveRecord::Migration
def change
create_table :rewards do |t|
t.integer :points
t.string :title
t.string :image_url
t.string :description
t.timestamps
end
end
end
class CreateRedemptions < ActiveRecord::Migration
def change
create_table :redemptions do |t|
t.integer :hacker_id
t.integer :user_id
t.integer :reward_id
t.integer :points
t.string :chronicle_text
t.timestamps
end
end
end
class CreateEarnings < ActiveRecord::Migration
def change
create_table :earnings do |t|
t.integer :hacker_id
t.integer :user_id
t.integer :quest_id
t.integer :points
t.string :chronicle_text
t.timestamps
end
end
end
class CreateCancels < ActiveRecord::Migration
def change
create_table :cancels do |t|
t.integer :hacker_id
t.integer :user_id
t.integer :subject_id
t.string :subject_type
t.string :chronicle_text
t.timestamps
end
end
end
# encoding: UTF-8
# This file is auto-generated from the current state of the database. Instead
# of editing this file, please use the migrations feature of Active Record to
# incrementally modify your database, and then regenerate this schema definition.
#
# Note that this schema.rb definition is the authoritative source for your
# database schema. If you need to create the application database on another
# system, you should be using db:schema:load, not running all the migrations
# from scratch. The latter is a flawed and unsustainable approach (the more migrations
# you'll amass, the slower it'll run and the greater likelihood for issues).
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 20140209154606) do
create_table "cancels", force: true do |t|
t.integer "hacker_id"
t.integer "user_id"
t.integer "subject_id"
t.string "subject_type"
t.string "chronicle_text"
t.datetime "created_at"
t.datetime "updated_at"
end
create_table "earnings", force: true do |t|
t.integer "hacker_id"
t.integer "user_id"
t.integer "quest_id"
t.integer "points"
t.string "chronicle_text"
t.datetime "created_at"
t.datetime "updated_at"
end
create_table "hackers", force: true do |t|
t.string "email", default: "", null: false
t.string "encrypted_password", default: "", null: false
t.string "reset_password_token"
t.datetime "reset_password_sent_at"
t.datetime "remember_created_at"
t.integer "sign_in_count", default: 0, null: false
t.datetime "current_sign_in_at"
t.datetime "last_sign_in_at"
t.string "current_sign_in_ip"
t.string "last_sign_in_ip"
t.string "nickname"
t.datetime "created_at"
t.datetime "updated_at"
end
add_index "hackers", ["email"], name: "index_hackers_on_email", unique: true
add_index "hackers", ["reset_password_token"], name: "index_hackers_on_reset_password_token", unique: true
create_table "quests", force: true do |t|
t.integer "points"
t.string "title"
t.string "description"
t.string "image_url"
t.datetime "created_at"
t.datetime "updated_at"
end
create_table "redemptions", force: true do |t|
t.integer "hacker_id"
t.integer "user_id"
t.integer "reward_id"
t.integer "points"
t.string "chronicle_text"
t.datetime "created_at"
t.datetime "updated_at"
end
create_table "rewards", force: true do |t|
t.integer "points"
t.string "title"
t.string "image_url"
t.string "description"
t.datetime "created_at"
t.datetime "updated_at"
end
end
# encoding: UTF-8
# This file should contain all the record creation needed to seed the database with its default values.
# The data can then be loaded with the rake db:seed (or created alongside the db with db:setup).
#
# Examples:
#
# cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }])
# Mayor.create(name: 'Emanuel', city: cities.first)
Quest.delete_all
Reward.delete_all
Quest.create({
:title => 'Küche aufgeräumt',
:points => 50,
:image_url => 'glyphicon-fire'
})
Quest.create({
:title => 'Müll rausgebracht',
:points => 1,
:image_url => 'glyphicon-trash'
})
Quest.create({
:title => 'Getränke gekauft',
:points => 5,
:image_url => 'glyphicon-glass'
})
Reward.create({
:title => 'Roter Artikel einlösen (Getränk)',
:points => 15,
:image_url => 'icon-beer'
})
Reward.create({
:title => 'Gelber Artikel einlösen (Snack)',
:points => 10,
:image_url => 'icon-drink'
})
Reward.create({
:title => 'Blauer Artikel einlösen (Mini-Snack)',
:points => 5
})
require 'ffaker'
hacker = Hacker.first
1.upto(10) do
Earning.create({
:hacker => hacker,
:user => (rand(100) % 2) == 0 ? hacker : nil,
:points => rand(100),
:quest => Quest.all.shuffle.first,
:chronicle_text => Faker::Lorem.sentence
})
end
1.upto(4) do
Redemption.create({
:hacker => hacker,
:user => (rand(100) % 2) == 0 ? hacker : nil,
:points => rand(100),
:reward => Reward.all.shuffle.first,
:chronicle_text => Faker::Lorem.sentence
})
end
Cancel.create({
:hacker => hacker,
:subject => Earning.all.shuffle.first,
:chronicle_text => Faker::Lorem.sentence
})
Cancel.create({
:hacker => hacker,
:subject => Redemption.all.shuffle.first,
:chronicle_text => Faker::Lorem.sentence
})
<!DOCTYPE html>
<html>
<head>
<title>The page you were looking for doesn't exist (404)</title>
<style>
body {
background-color: #EFEFEF;
color: #2E2F30;
text-align: center;
font-family: arial, sans-serif;
}
div.dialog {
width: 25em;
margin: 4em auto 0 auto;
border: 1px solid #CCC;
border-right-color: #999;
border-left-color: #999;
border-bottom-color: #BBB;
border-top: #B00100 solid 4px;
border-top-left-radius: 9px;
border-top-right-radius: 9px;
background-color: white;
padding: 7px 4em 0 4em;
}
h1 {
font-size: 100%;
color: #730E15;
line-height: 1.5em;
}
body > p {
width: 33em;
margin: 0 auto 1em;
padding: 1em 0;
background-color: #F7F7F7;
border: 1px solid #CCC;
border-right-color: #999;
border-bottom-color: #999;
border-bottom-left-radius: 4px;
border-bottom-right-radius: 4px;
border-top-color: #DADADA;
color: #666;
box-shadow:0 3px 8px rgba(50, 50, 50, 0.17);
}
</style>
</head>
<body>
<!-- This file lives in public/404.html -->
<div class="dialog">
<h1>The page you were looking for doesn't exist.</h1>
<p>You may have mistyped the address or the page may have moved.</p>
</div>
<p>If you are the application owner check the logs for more information.</p>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<title>The change you wanted was rejected (422)</title>
<style>
body {
background-color: #EFEFEF;
color: #2E2F30;
text-align: center;
font-family: arial, sans-serif;
}
div.dialog {
width: 25em;
margin: 4em auto 0 auto;
border: 1px solid #CCC;
border-right-color: #999;
border-left-color: #999;
border-bottom-color: #BBB;
border-top: #B00100 solid 4px;
border-top-left-radius: 9px;
border-top-right-radius: 9px;
background-color: white;
padding: 7px 4em 0 4em;
}
h1 {
font-size: 100%;
color: #730E15;
line-height: 1.5em;
}
body > p {
width: 33em;
margin: 0 auto 1em;
padding: 1em 0;
background-color: #F7F7F7;
border: 1px solid #CCC;
border-right-color: #999;
border-bottom-color: #999;
border-bottom-left-radius: 4px;
border-bottom-right-radius: 4px;
border-top-color: #DADADA;
color: #666;
box-shadow:0 3px 8px rgba(50, 50, 50, 0.17);
}
</style>
</head>
<body>
<!-- This file lives in public/422.html -->
<div class="dialog">
<h1>The change you wanted was rejected.</h1>
<p>Maybe you tried to change something you didn't have access to.</p>
</div>
<p>If you are the application owner check the logs for more information.</p>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<title>We're sorry, but something went wrong (500)</title>
<style>
body {
background-color: #EFEFEF;
color: #2E2F30;
text-align: center;
font-family: arial, sans-serif;
}
div.dialog {
width: 25em;
margin: 4em auto 0 auto;