Removed gettext and simplified_localization-plugin. L18n is now the appropriate module.

Upgraded to rails 2.2.2 and replaced complex foodsoft.rb-loader with simple
initializers/load_app_config.rb. Multiple foodcoops option is temporarly deactivated.
This commit is contained in:
Benjamin Meichsner 2009-01-06 15:45:19 +01:00
parent 5b9a7e05df
commit 9f8d0d28ac
121 changed files with 1197 additions and 15237 deletions

View file

@ -0,0 +1,58 @@
# Foodsoft configuration
development: &defaults
# name of this foodcoop
name: FC Test
# foodcoop contact information (used for FAX messages)
contact:
street: Grüne Straße 103
zip_code: "10997"
city: Berlin
country: Deutschland
email: foodsoft@myfoodcoop.org
phone: "030 323 23249"
# base URL for this installation
base_url: http://www.fctest.de
# foodsoft documentation URL
help_url: http://foodsoft.fcschinke09.de/trac/wiki/FoodsoftDoku
# price markup in percent
price_markup: 2.0
# email address to be used as sender
email_sender: foodsoft@myfoodcoop.org
# Config for the exception_notification plugin
notification:
error_recipients:
- benni@dresdener27.de
sender_address: FoodSoft Error <foodsoft@foodcoops.net>
email_prefix: "[FoodSoft]"
# Access to sharedLists, the external article-database
shared_lists:
adapter: mysql
host: localhost
database: sharedlists_development
username: root
password:
encoding: utf8
socket: /opt/lampp/var/mysql/mysql.sock
# auto-units-conversion
# this is used for automatic article-synchronization to handle different units
# e.g. when foodcoop-unit should be 500g and supplier-unit is 1kg
units:
KG: 1
1kg: 1
500g: 0.5
400g: 0.4
300g: 0.3
250g: 0.25
200g: 0.2
150g: 0.15
125g: 0.125
100g: 0.1
50g: 0.05
test:
<<: *defaults
production:
<<: *defaults

View file

@ -67,7 +67,7 @@ module Rails
class << self
def rubygems_version
Gem::RubyGemsVersion if defined? Gem::RubyGemsVersion
Gem::RubyGemsVersion rescue nil
end
def gem_version
@ -82,14 +82,14 @@ module Rails
def load_rubygems
require 'rubygems'
unless rubygems_version >= '0.9.4'
$stderr.puts %(Rails requires RubyGems >= 0.9.4 (you have #{rubygems_version}). Please `gem update --system` and try again.)
min_version = '1.3.1'
unless rubygems_version >= min_version
$stderr.puts %Q(Rails requires RubyGems >= #{min_version} (you have #{rubygems_version}). Please `gem update --system` and try again.)
exit 1
end
rescue LoadError
$stderr.puts %(Rails requires RubyGems >= 0.9.4. Please install RubyGems and try again: http://rubygems.rubyforge.org)
$stderr.puts %Q(Rails requires RubyGems >= #{min_version}. Please install RubyGems and try again: http://rubygems.rubyforge.org)
exit 1
end

View file

@ -5,25 +5,22 @@
# ENV['RAILS_ENV'] ||= 'production'
# Specifies gem version of Rails to use when vendor/rails is not present
RAILS_GEM_VERSION = '2.1.0' unless defined? RAILS_GEM_VERSION
RAILS_GEM_VERSION = '2.2.2' unless defined? RAILS_GEM_VERSION
# Bootstrap the Rails environment, frameworks, and default configuration
require File.join(File.dirname(__FILE__), 'boot')
# Need gettext for i18n
require 'gettext/rails'
# Loads the "FoodSoft" module and configuration:
require 'foodsoft'
Rails::Initializer.run do |config|
# Settings in config/environments/* take precedence over those specified here
# 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.
# See Rails::Configuration for more options.
# Skip frameworks you're not going to use (only works if using vendor/rails)
# config.frameworks -= [ :action_web_service, :action_mailer ]
# Only load the plugins named here, by default all plugins in vendor/plugins are loaded
# config.plugins = %W( exception_notification ssl_requirement )
# config.plugins = [ :exception_notification, :ssl_requirement, :all ]
# Add additional load paths for your own custom dirs
# config.load_paths += %W( #{RAILS_ROOT}/extras )
@ -48,7 +45,7 @@ Rails::Initializer.run do |config|
# config.active_record.observers = :cacher, :garbage_collector
# Make Active Record use UTC-base instead of local time
# config.active_record.default_timezone = :utc
config.time_zone = 'UTC'
# Your secret key for verifying cookie session data integrity.
# If you change this key, all old sessions will become invalid!
@ -56,42 +53,31 @@ Rails::Initializer.run do |config|
# no regular words or you'll be exposed to dictionary attacks.
config.action_controller.session = {
:session_key => '_foodsoft_session',
:secret => FoodSoft.get_session_secret
:secret => "dhjfuez47892nsl39fh83ham3jsdfjkh4879sdh"
}
# Specify gems that this application depends on.
# They can then be installed with "rake gems:install" on new installations.
# You have to specify the :lib option for libraries, where the Gem name (sqlite3-ruby) differs from the file itself (sqlite3)
# config.gem "bj"
# config.gem "hpricot", :version => '0.6', :source => "http://code.whytheluckystiff.net"
# config.gem "sqlite3-ruby", :lib => "sqlite3"
# config.gem "aws-s3", :lib => "aws/s3"
#
# library for parsing/writing files from/to csv-file
config.gem "fastercsv"
# The internationalization framework can be changed to have another default locale (standard is :en) or more load paths.
# All files from config/locales/*.rb,yml are added automatically.
# config.i18n.load_path << Dir[File.join(RAILS_ROOT, 'my', 'locales', '*.{rb,yml}')]
config.i18n.default_locale = :de
# See Rails::Configuration for more options
end
# Add new inflection rules using the following format
# (all these examples are active by default):
# Inflector.inflections do |inflect|
# inflect.plural /^(ox)$/i, '\1en'
# inflect.singular /^(ox)en/i, '\1'
# inflect.irregular 'person', 'people'
# inflect.uncountable %w( fish sheep )decimal
# end
# Add new mime types for use in respond_to blocks:
# Mime::Type.register "text/richtext", :rtf
# Mime::Type.register "application/x-mobile", :mobile
# Include your application configuration below
# library for parsing/writing files from/to csv-file
# doc: http://fastercsv.rubyforge.org/
require 'faster_csv'
# Attention: Don't forget to set the locale through LocalizationSimplified plugin!
# Defines custom logging format.
class Logger
def format_message(severity, timestamp, progname, msg)
format("%s %-5.5s %s\n", timestamp.strftime('%H:%M:%S'), severity, msg)
end
end
# Configuration of the exception_notification plugin
# Mailadresses are set in config/foodsoft.yaml
ExceptionNotifier.exception_recipients = FoodSoft.get_notification_config[:error_recipients]
ExceptionNotifier.sender_address = FoodSoft.get_notification_config[:sender_address]
ExceptionNotifier.email_prefix = FoodSoft.get_notification_config[:email_prefix]
#class Logger
# def format_message(severity, timestamp, progname, msg)
# format("%s %-5.5s %s\n", timestamp.strftime('%H:%M:%S'), severity, msg)
# end
#end

View file

@ -4,6 +4,9 @@
# Code is not reloaded between requests
config.cache_classes = true
# Enable threaded mode
# config.threadsafe!
# Use a different logger for distributed setups
# config.logger = SyslogLogger.new
config.log_level = :warn
@ -12,6 +15,9 @@ config.log_level = :warn
config.action_controller.consider_all_requests_local = false
config.action_controller.perform_caching = true
# Use a different cache store in production
# config.cache_store = :mem_cache_store
# Enable serving of images, stylesheets, and javascripts from an asset server
# config.action_controller.asset_host = "http://assets.example.com"

View file

@ -27,8 +27,7 @@ test1:
email_sender: foodsoft@myfoodcoop.org
# localized date/time formats
date_format: %d.%m.%Y
time_format: %H:%M
#test2:
@ -44,5 +43,3 @@ test1:
# help_url: http://foodsoft.fcschinke09.de/trac/wiki/FoodsoftDoku
# price_markup: 1.0
# email_sender: foodsoft@fctest2.org
# date_format: %d.%m.%Y
# time_format: %H:%M

View file

@ -1,38 +0,0 @@
# Foodsoft configuration
# Config for the exception_notification plugin
notification:
error_recipients:
- foo@bar.tld
sender_address: FoodSoft Error <foodsoft@foodcoops.net>
email_prefix: "[FoodSoft]"
# Access to sharedLists, the external article-database
shared_lists:
adapter: mysql
host: localhost
database: sharedLists_development
username: root
password:
encoding: utf8
socket: /opt/lampp/var/mysql/mysql.sock
# secret to generate an integrity hash for cookie session data
# the string should have at least 30 characters
session_secret: dhjfuez47892nsl39fh83ham3jsdfjkh4879sdh
# auto-units-conversion
# this is used for automatic article-synchronization to handle different units
# e.g. when foodcoop-unit should be 500g and supplier-unit is 1kg
units:
KG: 1
1kg: 1
500g: 0.5
400g: 0.4
300g: 0.3
250g: 0.25
200g: 0.2
150g: 0.15
125g: 0.125
100g: 0.1
50g: 0.05

View file

@ -0,0 +1,12 @@
# extend the BigDecimal class
class String
# remove comma from decimal inputs
def self.delocalized_decimal(string)
if !string.blank? and string.is_a?(String)
BigDecimal.new(string.sub(',', '.'))
else
string
end
end
end

View file

@ -0,0 +1,10 @@
# Remove this file, when every gettext-method <_("text to translate..")>
# is replaced by rails l18n method: l18n.name.name...
module ActionView
class Base
def _(text)
text
end
end
end

View file

@ -0,0 +1,10 @@
# Be sure to restart your server when you modify this file.
# Add new inflection rules using the following format
# (all these examples are active by default):
# ActiveSupport::Inflector.inflections do |inflect|
# inflect.plural /^(ox)$/i, '\1en'
# inflect.singular /^(ox)en/i, '\1'
# inflect.irregular 'person', 'people'
# inflect.uncountable %w( fish sheep )
# end

View file

@ -0,0 +1,9 @@
raw_config = File.read(RAILS_ROOT + "/config/app_config.yml")
APP_CONFIG = YAML.load(raw_config)[RAILS_ENV].symbolize_keys
# Configuration of the exception_notification plugin
# Mailadresses are set in config/foodsoft.yaml
ExceptionNotifier.exception_recipients = APP_CONFIG[:error_recipients]
ExceptionNotifier.sender_address = APP_CONFIG[:sender_address]
ExceptionNotifier.email_prefix = APP_CONFIG[:email_prefix]

View file

@ -0,0 +1,5 @@
# Be sure to restart your server when you modify this file.
# Add new mime types for use in respond_to blocks:
# Mime::Type.register "text/richtext", :rtf
# Mime::Type.register_alias "text/html", :iphone

View file

@ -0,0 +1,17 @@
# These settings change the behavior of Rails 2 apps and will be defaults
# for Rails 3. You can remove this initializer when Rails 3 is released.
if defined?(ActiveRecord)
# Include Active Record class name as root for JSON serialized output.
ActiveRecord::Base.include_root_in_json = true
# Store the full class name (including module namespace) in STI type column.
ActiveRecord::Base.store_full_sti_class = true
end
# Use ISO 8601 format for JSON serialized times and dates.
ActiveSupport.use_standard_json_time_format = true
# Don't escape HTML entities in JSON, leave that for the #json_escape helper.
# if you're including raw json in an HTML page.
ActiveSupport.escape_html_entities_in_json = false

125
config/locales/de.yml Normal file
View file

@ -0,0 +1,125 @@
# German translations for Ruby on Rails
# by Clemens Kofler (clemens@railway.at)
de:
date:
formats:
default: "%d.%m.%Y"
short: "%e. %b"
long: "%e. %B %Y"
only_day: "%e"
day_names: [Sonntag, Montag, Dienstag, Mittwoch, Donnerstag, Freitag, Samstag]
abbr_day_names: [So, Mo, Di, Mi, Do, Fr, Sa]
month_names: [~, Januar, Februar, März, April, Mai, Juni, Juli, August, September, Oktober, November, Dezember]
abbr_month_names: [~, Jan, Feb, Mär, Apr, Mai, Jun, Jul, Aug, Sep, Okt, Nov, Dez]
order: [ :day, :month, :year ]
time:
formats:
default: "%A, %e. %B %Y, %H:%M Uhr"
short: "%e. %B, %H:%M Uhr"
long: "%A, %e. %B %Y, %H:%M Uhr"
time: "%H:%M"
am: "vormittags"
pm: "nachmittags"
datetime:
distance_in_words:
half_a_minute: 'eine halbe Minute'
less_than_x_seconds:
zero: 'weniger als 1 Sekunde'
one: 'weniger als 1 Sekunde'
other: 'weniger als {{count}} Sekunden'
x_seconds:
one: '1 Sekunde'
other: '{{count}} Sekunden'
less_than_x_minutes:
zero: 'weniger als 1 Minute'
one: 'weniger als eine Minute'
other: 'weniger als {{count}} Minuten'
x_minutes:
one: '1 Minute'
other: '{{count}} Minuten'
about_x_hours:
one: 'etwa 1 Stunde'
other: 'etwa {{count}} Stunden'
x_days:
one: '1 Tag'
other: '{{count}} Tage'
about_x_months:
one: 'etwa 1 Monat'
other: 'etwa {{count}} Monate'
x_months:
one: '1 Monat'
other: '{{count}} Monate'
about_x_years:
one: 'etwa 1 Jahr'
other: 'etwa {{count}} Jahre'
over_x_years:
one: 'mehr als 1 Jahr'
other: 'mehr als {{count}} Jahre'
number:
format:
precision: 2
separator: ','
delimiter: '.'
currency:
format:
unit: '€'
format: '%n %u'
separator:
delimiter:
precision:
percentage:
format:
delimiter: ""
precision:
format:
delimiter: ""
human:
format:
delimiter: ""
precision: 1
support:
array:
sentence_connector: "und"
skip_last_comma: true
activerecord:
errors:
template:
header:
one: "Konnte dieses {{model}} Objekt nicht speichern: 1 Fehler."
other: "Konnte dieses {{model}} Objekt nicht speichern: {{count}} Fehler."
body: "Bitte überprüfen Sie die folgenden Felder:"
messages:
inclusion: "ist kein gültiger Wert"
exclusion: "ist nicht verfügbar"
invalid: "ist nicht gültig"
confirmation: "stimmt nicht mit der Bestätigung überein"
accepted: "muss akzeptiert werden"
empty: "muss ausgefüllt werden"
blank: "muss ausgefüllt werden"
too_long: "ist zu lang (nicht mehr als {{count}} Zeichen)"
too_short: "ist zu kurz (nicht weniger als {{count}} Zeichen)"
wrong_length: "hat die falsche Länge (muss genau {{count}} Zeichen haben)"
taken: "ist bereits vergeben"
not_a_number: "ist keine Zahl"
greater_than: "muss größer als {{count}} sein"
greater_than_or_equal_to: "muss größer oder gleich {{count}} sein"
equal_to: "muss genau {{count}} sein"
less_than: "muss kleiner als {{count}} sein"
less_than_or_equal_to: "muss kleiner oder gleich {{count}} sein"
odd: "muss ungerade sein"
even: "muss gerade sein"
models:
article: Artikel
attributes:
article:
net_price: Nettopreis
gross_price: Bruttopreis

5
config/locales/en.yml Normal file
View file

@ -0,0 +1,5 @@
# Sample localization file for English. Add more files in this directory for other locales.
# See http://github.com/svenfuchs/rails-i18n/tree/master/rails%2Flocale for starting points.
en:
hello: "Hello world"

View file

@ -1,23 +1,46 @@
ActionController::Routing::Routes.draw do |map|
map.my_profile 'my_profile', :controller => 'index', :action => 'myProfile'
# The priority is based upon order of creation: first created -> highest priority.
# Sample of regular route:
# map.connect 'products/:id', :controller => 'catalog', :action => 'view'
# map.connect 'products/:id', :controller => 'catalog', :action => 'view'
# Keep in mind you can assign values other than :controller and :action
# Sample of named route:
# map.purchase 'products/:id/purchase', :controller => 'catalog', :action => 'purchase'
# map.purchase 'products/:id/purchase', :controller => 'catalog', :action => 'purchase'
# This route can be invoked with purchase_url(:id => product.id)
# You can have the root of your site routed by hooking up ''
# -- just remember to delete public/index.html.
#map.connect '', :controller => 'login'
# Sample resource route (maps HTTP verbs to controller actions automatically):
# map.resources :products
# Allow downloading Web Service WSDL as a file with an extension
# instead of a file named 'wsdl'
map.connect ':controller/service.wsdl', :action => 'wsdl'
# Sample resource route with options:
# map.resources :products, :member => { :short => :get, :toggle => :post }, :collection => { :sold => :get }
# Sample resource route with sub-resources:
# map.resources :products, :has_many => [ :comments, :sales ], :has_one => :seller
# Sample resource route with more complex sub-resources
# map.resources :products do |products|
# products.resources :comments
# products.resources :sales, :collection => { :recent => :get }
# end
# Sample resource route within a namespace:
# map.namespace :admin do |admin|
# # Directs /admin/products/* to Admin::ProductsController (app/controllers/admin/products_controller.rb)
# admin.resources :products
# end
# You can have the root of your site routed with map.root -- just remember to delete public/index.html.
# map.root :controller => "welcome"
# See how all your routes lay out with "rake routes"
# Install the default routes as the lowest priority.
# Note: These default routes make all actions in every controller accessible via GET requests. You should
# consider removing the them or commenting them out if you're using named routes and resources.
# Install the default route as the lowest priority.
map.connect ':controller/:action/:id', :controller => 'index'