The working basics

This commit is contained in:
Godwin
2014-03-09 14:43:33 -06:00
parent b490a97852
commit db60933506
628 changed files with 81918 additions and 1060 deletions
+16 -12
View File
@@ -6,18 +6,22 @@ require 'rails/all'
# you've limited to :test, :development, or :production.
Bundler.require(:default, Rails.env)
module Starterapp
class Application < Rails::Application
# Settings in config/environments/* take precedence over those specified here.
# Application configuration should go into files in config/initializers
# -- all .rb files in that directory are automatically loaded.
ENV['JPEGOPTIM_BIN'] = 'jpegoptim'
ENV['OPTIPNG_BIN'] = 'optipng'
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
# config.time_zone = 'Central Time (US & Canada)'
module BikeBike
class Application < Rails::Application
# Settings in config/environments/* take precedence over those specified here.
# Application configuration should go into files in config/initializers
# -- all .rb files in that directory are automatically loaded.
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
# config.i18n.default_locale = :de
end
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
# config.time_zone = 'Central Time (US & Canada)'
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
config.i18n.default_locale = :en #:de
config.i18n.enforce_available_locales = false
end
end
+6 -6
View File
@@ -16,12 +16,12 @@
#
development:
adapter: postgresql
encoding: utf8
encoding: unicode
database: bike_bike_dev
username: bike_bike
password: NewOrleans@)!#
host: 127.0.0.1
port: 5433
port: 5432
pool: 5
@@ -36,20 +36,20 @@ development:
# Do not set this db to the same as development or production.
test:
adapter: postgresql
encoding: utf8
encoding: unicode
database: bike_bike_test
username: bike_bike
password: NewOrleans@)!#
host: 127.0.0.1
port: 5433
port: 5432
pool: 5
production:
adapter: postgresql
encoding: utf8
encoding: unicode
database: bike_bike
username: bike_bike
password: NewOrleans@)!#
host: 127.0.0.1
port: 5433
port: 5432
pool: 5
+1 -1
View File
@@ -2,4 +2,4 @@
require File.expand_path('../application', __FILE__)
# Initialize the Rails application.
Starterapp::Application.initialize!
BikeBike::Application.initialize!
+37 -21
View File
@@ -1,29 +1,45 @@
Starterapp::Application.configure do
# Settings specified here will take precedence over those in config/application.rb.
BikeBike::Application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# In the development environment your application's code is reloaded on
# every request. This slows down response time but is perfect for development
# since you don't have to restart the web server when you make code changes.
config.cache_classes = false
# In the development environment your application's code is reloaded on
# every request. This slows down response time but is perfect for development
# since you don't have to restart the web server when you make code changes.
config.cache_classes = false
# Do not eager load code on boot.
config.eager_load = false
# Do not eager load code on boot.
config.eager_load = false
# Show full error reports and disable caching.
config.consider_all_requests_local = true
config.action_controller.perform_caching = false
# Show full error reports and disable caching.
config.consider_all_requests_local = true
config.action_controller.perform_caching = false
# Don't care if the mailer can't send.
config.action_mailer.raise_delivery_errors = false
# Don't care if the mailer can't send.
config.action_mailer.raise_delivery_errors = false
# Print deprecation notices to the Rails logger.
config.active_support.deprecation = :log
# Print deprecation notices to the Rails logger.
config.active_support.deprecation = :log
# Raise an error on page load if there are pending migrations
config.active_record.migration_error = :page_load
# Raise an error on page load if there are pending migrations
config.active_record.migration_error = :page_load
# Debug mode disables concatenation and preprocessing of assets.
# This option may cause significant delays in view rendering with a large
# number of complex assets.
config.assets.debug = true
# Debug mode disables concatenation and preprocessing of assets.
# This option may cause significant delays in view rendering with a large
# number of complex assets.
config.assets.debug = false
config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = {
:enable_starttls_auto => true,
:address => 'mail.bikebike.org',
:domain => 'bikebike.org',
:port => 587,
:authentication => :plain,
:enable_starttls_auto => true,
:openssl_verify_mode => 'none',
:user_name => 'info@bikebike.org',
:password => 'NewOrleans@)!#'
}
config.action_mailer.raise_delivery_errors = true
config.action_mailer.perform_deliveries = true
#config.action_mailer.default_charset = 'utf-8'
end
+1 -1
View File
@@ -1,4 +1,4 @@
Starterapp::Application.configure do
BikeBike::Application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# Code is not reloaded between requests.
+1 -1
View File
@@ -1,4 +1,4 @@
Starterapp::Application.configure do
BikeBike::Application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# The test environment is used exclusively to run your application's
+44
View File
@@ -0,0 +1,44 @@
# ---------------------------------------------------------------------------- #
# Project Info
# Default values shown. Learn more about these options by running
# `fontcustom help` or visit <http://fontcustom.com>.
# ---------------------------------------------------------------------------- #
font_name: bikebike-icons
#css_prefix: icon-
#preprocessor_path: ""
#no_hash: false
#debug: false
#quiet: false
# ---------------------------------------------------------------------------- #
# Project Paths
# Relative paths are expanded from PROJECT_ROOT (default: working directory).
# INPUT and OUTPUT can be assigned as hashes instead of a strings.
# The OUPUT hash can route custom templates according to their filename.
# ---------------------------------------------------------------------------- #
#project_root: some/other/place
#data_cache: tmp/fontcustom
#input:
vectors: app/assets/fonts/fontcustom-svgs
# templates: app/assets/fonts/fontcustom/templates
#output:
fonts: app/assets/fonts
# css: app/assets/stylesheets
# preview: app/views/styleguide
# my-custom-template.yml: config
# ---------------------------------------------------------------------------- #
# Templates
# Included in Font Custom:
# preview, css, scss, scss-rails, bootstrap, bootstrap-scss, bootstrap-ie7,
# bootstrap-ie7-scss
# Custom templates should be saved in the INPUT[:templates] directory.
# ---------------------------------------------------------------------------- #
#templates: [ scss, preview, my-custom-template.yml ]
+21
View File
@@ -0,0 +1,21 @@
# config/initializers/geocoder.rb
Geocoder.configure(
# geocoding service (see below for supported options):
:lookup => :google,
# IP address geocoding service (see below for supported options):
:ip_lookup => :freegeoip,
# to use an API key:
# :api_key => "AIzaSyDitM1lyVWkrumteDvSkje6GiIKYyHlAXM",
# geocoding service request timeout, in seconds (default 3):
:timeout => 5,
# set default units to kilometers:
:units => :km,
# caching (see below for details):
#:cache => Redis.new,
#:cache_prefix => "..."
)
+4
View File
@@ -0,0 +1,4 @@
require 'i18n/backend/active_record'
I18n.backend = I18n::Backend::ActiveRecord.new
I18n::Backend::ActiveRecord.send(:include, I18n::Backend::Memoize)
I18n::Backend::ActiveRecord.send(:include, I18n::Backend::Flatten)
+1 -1
View File
@@ -9,4 +9,4 @@
# Make sure your secret_key_base is kept private
# if you're sharing your code publicly.
Starterapp::Application.config.secret_key_base = '3f1afc86622ac2ad0b6807f8c39f54eac579b9c430adae6f49ed02bb68d9b2615a082bf0037397f9342f995b71b73ba9167476697e0e5ec0d40173969b5fecfc'
BikeBike::Application.config.secret_key_base = '3f1afc86622ac2ad0b6807f8c39f54eac579b9c430adae6f49ed02bb68d9b2615a082bf0037397f9342f995b71b73ba9167476697e0e5ec0d40173969b5fecfc'
+1 -1
View File
@@ -1,3 +1,3 @@
# Be sure to restart your server when you modify this file.
Starterapp::Application.config.session_store :cookie_store, key: '_starterapp_session'
BikeBike::Application.config.session_store :cookie_store, key: '_starterapp_session'
+438
View File
@@ -0,0 +1,438 @@
# The first thing you need to configure is which modules you need in your app.
# The default is nothing which will include only core features (password encryption, login/logout).
# Available submodules are: :user_activation, :http_basic_auth, :remember_me,
# :reset_password, :session_timeout, :brute_force_protection, :activity_logging, :external
# Rails.application.config.sorcery.submodules = [:remember_me, :reset_password, :user_activation, :brute_force_protection, :external]
Rails.application.config.sorcery.submodules = [:remember_me, :reset_password, :brute_force_protection, :external]
# Here you can configure each submodule's features.
Rails.application.config.sorcery.configure do |config|
# -- core --
# What controller action to call for non-authenticated users. You can also
# override the 'not_authenticated' method of course.
# Default: `:not_authenticated`
#
# config.not_authenticated_action =
# When a non logged in user tries to enter a page that requires login, save
# the URL he wanted to reach, and send him there after login, using 'redirect_back_or_to'.
# Default: `true`
#
# config.save_return_to_url =
# Set domain option for cookies; Useful for remember_me submodule.
# Default: `nil`
#
# config.cookie_domain =
# -- session timeout --
# How long in seconds to keep the session alive.
# Default: `3600`
#
# config.session_timeout =
# Use the last action as the beginning of session timeout.
# Default: `false`
#
# config.session_timeout_from_last_action =
# -- http_basic_auth --
# What realm to display for which controller name. For example {"My App" => "Application"}
# Default: `{"application" => "Application"}`
#
# config.controller_to_realm_map =
# -- activity logging --
# will register the time of last user login, every login.
# Default: `true`
#
# config.register_login_time =
# will register the time of last user logout, every logout.
# Default: `true`
#
# config.register_logout_time =
# will register the time of last user action, every action.
# Default: `true`
#
# config.register_last_activity_time =
# -- external --
# What providers are supported by this app, i.e. [:twitter, :facebook, :github, :linkedin, :xing, :google, :liveid] .
# Default: `[]`
#
# config.external_providers =
# You can change it by your local ca_file. i.e. '/etc/pki/tls/certs/ca-bundle.crt'
# Path to ca_file. By default use a internal ca-bundle.crt.
# Default: `'path/to/ca_file'`
#
# config.ca_file =
# For information about LinkedIn API:
# - user info fields go to https://developer.linkedin.com/documents/profile-fields
# - access permissions go to https://developer.linkedin.com/documents/authentication#granting
#
# config.linkedin.key = ""
# config.linkedin.secret = ""
# config.linkedin.callback_url = "http://0.0.0.0:3000/oauth/callback?provider=linkedin"
# config.linkedin.user_info_fields = ['first-name', 'last-name']
# config.linkedin.user_info_mapping = {first_name: "firstName", last_name: "lastName"}
# config.linkedin.access_permissions = ['r_basicprofile']
#
#
# For information about XING API:
# - user info fields go to https://dev.xing.com/docs/get/users/me
#
# config.xing.key = ""
# config.xing.secret = ""
# config.xing.callback_url = "http://0.0.0.0:3000/oauth/callback?provider=xing"
# config.xing.user_info_mapping = {first_name: "first_name", last_name: "last_name"}
#
#
# Twitter wil not accept any requests nor redirect uri containing localhost,
# make sure you use 0.0.0.0:3000 to access your app in development
#
# config.twitter.key = ""
# config.twitter.secret = ""
# config.twitter.callback_url = "http://0.0.0.0:3000/oauth/callback?provider=twitter"
# config.twitter.user_info_mapping = {:email => "screen_name"}
#
# config.facebook.key = ""
# config.facebook.secret = ""
# config.facebook.callback_url = "http://0.0.0.0:3000/oauth/callback?provider=facebook"
# config.facebook.user_info_mapping = {:email => "name"}
# config.facebook.access_permissions = ["email", "publish_stream"]
#
# config.github.key = ""
# config.github.secret = ""
# config.github.callback_url = "http://0.0.0.0:3000/oauth/callback?provider=github"
# config.github.user_info_mapping = {:email => "name"}
#
# config.google.key = ""
# config.google.secret = ""
# config.google.callback_url = "http://0.0.0.0:3000/oauth/callback?provider=google"
# config.google.user_info_mapping = {:email => "email", :username => "name"}
#
# config.vk.key = ""
# config.vk.secret = ""
# config.vk.callback_url = "http://0.0.0.0:3000/oauth/callback?provider=vk"
# config.vk.user_info_mapping = {:login => "domain", :name => "full_name"}
#
# To use liveid in development mode you have to replace mydomain.com with
# a valid domain even in development. To use a valid domain in development
# simply add your domain in your /etc/hosts file in front of 127.0.0.1
#
# config.liveid.key = ""
# config.liveid.secret = ""
# config.liveid.callback_url = "http://mydomain.com:3000/oauth/callback?provider=liveid"
# config.liveid.user_info_mapping = {:username => "name"}
# --- user config ---
config.user_config do |user|
# -- core --
# specify username attributes, for example: [:username, :email].
# Default: `[:username]`
#
# user.username_attribute_names =
# change *virtual* password attribute, the one which is used until an encrypted one is generated.
# Default: `:password`
#
# user.password_attribute_name =
# downcase the username before trying to authenticate, default is false
# Default: `false`
#
# user.downcase_username_before_authenticating =
# change default email attribute.
# Default: `:email`
#
# user.email_attribute_name =
# change default crypted_password attribute.
# Default: `:crypted_password`
#
# user.crypted_password_attribute_name =
# what pattern to use to join the password with the salt
# Default: `""`
#
# user.salt_join_token =
# change default salt attribute.
# Default: `:salt`
#
# user.salt_attribute_name =
# how many times to apply encryption to the password.
# Default: `nil`
#
# user.stretches =
# encryption key used to encrypt reversible encryptions such as AES256.
# WARNING: If used for users' passwords, changing this key will leave passwords undecryptable!
# Default: `nil`
#
# user.encryption_key =
# use an external encryption class.
# Default: `nil`
#
# user.custom_encryption_provider =
# encryption algorithm name. See 'encryption_algorithm=' for available options.
# Default: `:bcrypt`
#
user.encryption_algorithm = :sha512
# make this configuration inheritable for subclasses. Useful for ActiveRecord's STI.
# Default: `false`
#
# user.subclasses_inherit_config =
# -- remember_me --
# allow the remember_me cookie to settable through AJAX
# Default: `true`
#
# user.remember_me_httponly =
# How long in seconds the session length will be
# Default: `604800`
#
# user.remember_me_for =
# -- user_activation --
# the attribute name to hold activation state (active/pending).
# Default: `:activation_state`
#
# user.activation_state_attribute_name =
# the attribute name to hold activation code (sent by email).
# Default: `:activation_token`
#
# user.activation_token_attribute_name =
# the attribute name to hold activation code expiration date.
# Default: `:activation_token_expires_at`
#
# user.activation_token_expires_at_attribute_name =
# how many seconds before the activation code expires. nil for never expires.
# Default: `nil`
#
# user.activation_token_expiration_period =
# your mailer class. Required.
# Default: `nil`
#
## user.user_activation_mailer = UserMailer
# when true sorcery will not automatically
# email activation details and allow you to
# manually handle how and when email is sent.
# Default: `false`
#
# user.activation_mailer_disabled =
# activation needed email method on your mailer class.
# Default: `:activation_needed_email`
#
# user.activation_needed_email_method_name =
# activation success email method on your mailer class.
# Default: `:activation_success_email`
#
# user.activation_success_email_method_name =
# do you want to prevent or allow users that did not activate by email to login?
# Default: `true`
#
# user.prevent_non_active_users_to_login =
# -- reset_password --
# reset password code attribute name.
# Default: `:reset_password_token`
#
# user.reset_password_token_attribute_name =
# expires at attribute name.
# Default: `:reset_password_token_expires_at`
#
# user.reset_password_token_expires_at_attribute_name =
# when was email sent, used for hammering protection.
# Default: `:reset_password_email_sent_at`
#
# user.reset_password_email_sent_at_attribute_name =
# mailer class. Needed.
# Default: `nil`
#
user.reset_password_mailer = UserMailer
# reset password email method on your mailer class.
# Default: `:reset_password_email`
#
# user.reset_password_email_method_name =
# when true sorcery will not automatically
# email password reset details and allow you to
# manually handle how and when email is sent
# Default: `false`
#
# user.reset_password_mailer_disabled =
# how many seconds before the reset request expires. nil for never expires.
# Default: `nil`
#
# user.reset_password_expiration_period =
# hammering protection, how long to wait before allowing another email to be sent.
# Default: `5 * 60`
#
# user.reset_password_time_between_emails =
# -- brute_force_protection --
# Failed logins attribute name.
# Default: `:failed_logins_count`
#
# user.failed_logins_count_attribute_name =
# This field indicates whether user is banned and when it will be active again.
# Default: `:lock_expires_at`
#
# user.lock_expires_at_attribute_name =
# How many failed logins allowed.
# Default: `50`
#
# user.consecutive_login_retries_amount_limit =
# How long the user should be banned. in seconds. 0 for permanent.
# Default: `60 * 60`
#
# user.login_lock_time_period =
# Unlock token attribute name
# Default: `:unlock_token`
#
# user.unlock_token_attribute_name =
# Unlock token mailer method
# Default: `:send_unlock_token_email`
#
# user.unlock_token_email_method_name =
# when true sorcery will not automatically
# send email with unlock token
# Default: `false`
#
# user.unlock_token_mailer_disabled = true
# Unlock token mailer class
# Default: `nil`
#
user.unlock_token_mailer = UserMailer
# -- activity logging --
# Last login attribute name.
# Default: `:last_login_at`
#
# user.last_login_at_attribute_name =
# Last logout attribute name.
# Default: `:last_logout_at`
#
# user.last_logout_at_attribute_name =
# Last activity attribute name.
# Default: `:last_activity_at`
#
# user.last_activity_at_attribute_name =
# How long since last activity is he user defined logged out?
# Default: `10 * 60`
#
# user.activity_timeout =
# -- external --
# Class which holds the various external provider data for this user.
# Default: `nil`
#
# user.authentications_class =
# User's identifier in authentications class.
# Default: `:user_id`
#
# user.authentications_user_id_attribute_name =
# Provider's identifier in authentications class.
# Default: `:provider`
#
# user.provider_attribute_name =
# User's external unique identifier in authentications class.
# Default: `:uid`
#
# user.provider_uid_attribute_name =
end
# This line must come after the 'user config' block.
# Define which model authenticates with sorcery.
config.user_class = "User"
end
+4 -22
View File
@@ -1,23 +1,5 @@
# 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"
home:
what_is_bikebike: What is Bike!Bike!?
its_awesome: It's awesome, that's what it is.
+3
View File
@@ -0,0 +1,3 @@
es:
home:
what_is_bikebike: ¿Qué es la Bike!Bike!?
+54
View File
@@ -0,0 +1,54 @@
Bike!Bike! translation and English copyright is being designed to operate on a volunteer basis.
Do not use any static text that will be seen by the public on the site. Instead use the single underscore
helper method. For example, on a page that includes a page header such as 'Organizations', simply enter:
%h1
<%= _ organizations.title ?>
Upon first viewing the page, the user (probably you) will see the resulting HTML:
<h1><a class="translate-me" ... >organizations.title</a></h1>
Assuming that you're viewing the sire in English, clicking the link will then allow you to enter English
copy. Enter 'Organizations' and save it. The next time you see the page, you will see:
<h1>Organizations</h1>
Once a spanish viewer sees the page they will see:
<h1><a class="translate-me lang-eng" ... >Organizations</a></h1>
This will allow them to choose an appropriate translation. They may then enter 'Organizaciones'
which will result in subsequent Spanish viewers to see the translation.
When the text to be shown cannot be surrounded by HTML tags, for example for an <input> control,
the translation controls can be queued to be shown comtime afterwards using the double underscore
method, followed by the single underscore method. For example:
%input{:name => "organization-name", :placeholder => <%= __ organizations.enter_name %>}
<%= _ %>
Assuming that 'en.organizations.enter_name' = 'Enter the name of your organization', this willl
result in the following HTML:
<input name="organization-name" placeholder="Enter the name of your organization" />
However, for a Spanish viewer, before a translation has been selected they should see:
<input name="organization-name" placeholder="Enter the name of your organization" />
<div class="untranslated-list">
<a class="translate-me lang-eng">Enter the name of your organization</a>
</div>
If multiple items are queued, they will all be shown inside this div. After a translation has been entered
by a Spanish speaking volunteer, subsequent volunteers will simply see:
<input name="organization-name" placeholder="Escriba el nombre de su organización" />
Best practices:
- Never edit en.yml, or any other files directly, always use the site tool to do this as it will
help ensure proper testing of all pages and that all text will be translated.
- Reuse locale keys as much as possible. Use concatenation of printf where it makes sense to do
so. The less work volunteers have to do, the more likely that they will get it all done.
+59 -2
View File
@@ -1,5 +1,62 @@
Starterapp::Application.routes.draw do
BikeBike::Application.routes.draw do
root 'pages#home'
#resources :conference_registration_responses
#resources :conference_registrations
#resources :conference_registraton_form_fields
resources :registration_form_fields
#resources :conference_admins
#resources :conference_host_organizations
resources :conferences, :param => 'slug' do
get :hosts
get :registration
get :workshops
get :registration
#resources :registrations, :path => 'registration' do
# get :form, on: :collection
#end
get 'registration/form' => 'conferences#registration', :sub_action => "form", as: 'registration_form'
get 'registration/form/register' => 'conferences#registration', :sub_action => "register", as: 'registration_register'
get 'registration/form/stats' => 'conferences#registration', :sub_action => "stats", as: 'registration_stats'
post :nonhosts
post 'registration/form/add-field' => 'conferences#add_field', as: 'registration_add_field'
post 'registration/form/remove-field' => 'conferences#remove_field', as: 'registration_remove_field'
post 'registration/form/reorder' => 'conferences#reorder', as: 'registration_reorder'
end
#resources :user_organization_relationships
resources :organizations, :param => 'slug' do
get :members
get :identity
post :nonmembers
end
resources :users
#resources :user_sessions
#resources :organization_statuses
resources :conference_types
resources :workshop_streams
resources :workshop_resources
resources :workshop_presentation_styles
resources :locations
post '/translate/' => 'pages#translate'
post '/location/territories/' => 'pages#location_territories'
get 'login' => 'user_sessions#new', :as => :login
post 'logout' => 'user_sessions#destroy', :as => :logout
get 'register' => 'users#new', :as => 'register'
root 'pages#home'
end