Chris's first commit at Fri Jan 28 2011 10:14:32 GMT+0800 (CST)

This commit is contained in:
ihower committed 2011-04-13 18:19:51 +08:00
1 parent 554aa0a95d
commit 19a7d51e60
145 files changed
+12742 -893

No files matched your search

+21 -21
View File
@@ -4,49 +4,49 @@ require File.expand_path('../boot', __FILE__)
# require "active_record/railtie"
require "action_controller/railtie"
require "action_mailer/railtie"
# require "active_resource/railtie"
# require "rails/test_unit/railtie"
require "active_resource/railtie"
require "rails/test_unit/railtie"
require File.expand_path('lib/reroute_middleware')
# Auto-require default libraries and those for the current Rails environment.
Bundler.require :default, Rails.env
# If you have a Gemfile, require the gems listed there, including any gems
# you've limited to :test, :development, or :production.
Bundler.require(:default, Rails.env) if defined?(Bundler)
module R4
module PrototypeR4
class Application < Rails::Application
config.middleware.use RerouteMiddleware
# 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.
# Add additional load paths for your own custom dirs
# config.load_paths += %W( #{config.root}/extras )
# Custom directories with classes and modules you want to be autoloadable.
# config.autoload_paths += %W(#{config.root}/extras)
# 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
# :all can be used as a placeholder for all plugins not explicitly named.
# config.plugins = [ :exception_notification, :ssl_requirement, :all ]
# Activate observers that should always be running
# Activate observers that should always be running.
# config.active_record.observers = :cacher, :garbage_collector, :forum_observer
# 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 = 'Taipei'
# 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}')]
config.i18n.default_locale = :zh_tw
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
# config.i18n.default_locale = :de
config.i18n.default_locale = :en
# Configure generators values. Many other options are available, be sure to check the documentation.
# config.generators do |g|
# g.orm :active_record
# g.template_engine :erb
# g.test_framework :test_unit, :fixture => true
# end
# JavaScript files you want as :defaults (application.js is always included).
# config.action_view.javascript_expansions[:defaults] = %w(jquery rails)
# Configure the default encoding used in templates for Ruby 1.9.
config.encoding = "utf-8"
# Configure sensitive parameters which will be filtered from the log file.
config.filter_parameters << :password
config.filter_parameters += [:password]
end
end
+10 -14
View File
@@ -1,17 +1,13 @@
# Use Bundler (preferred)
require 'rubygems'
# Set up gems listed in the Gemfile.
gemfile = File.expand_path('../../Gemfile', __FILE__)
begin
require File.expand_path('../../.bundle/environment', __FILE__)
rescue LoadError
require 'rubygems'
ENV['BUNDLE_GEMFILE'] = gemfile
require 'bundler'
Bundler.setup
# To use 2.x style vendor/rails and RubyGems
#
# vendor_rails = File.expand_path('../../vendor/rails', __FILE__)
# if File.exist?(vendor_rails)
# Dir["#{vendor_rails}/*/lib"].each { |path| $:.unshift(path) }
# end
#
# require 'rubygems'
end
rescue Bundler::GemNotFound => e
STDERR.puts e.message
STDERR.puts "Try running `bundle install`."
exit!
end if File.exist?(gemfile)
+1 -1
View File
@@ -2,4 +2,4 @@
require File.expand_path('../application', __FILE__)
# Initialize the rails application
R4::Application.initialize!
PrototypeR4::Application.initialize!
+8 -2
View File
@@ -1,5 +1,5 @@
R4::Application.configure do
# Settings specified here will take precedence over those in config/environment.rb
PrototypeR4::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
@@ -17,4 +17,10 @@ R4::Application.configure do
# 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
# Only use best-standards-support built into browsers
config.action_dispatch.best_standards_support = :builtin
end
+18 -2
View File
@@ -1,5 +1,5 @@
R4::Application.configure do
# Settings specified here will take precedence over those in config/environment.rb
PrototypeR4::Application.configure do
# Settings specified here will take precedence over those in config/application.rb
# The production environment is meant for finished, "live" apps.
# Code is not reloaded between requests
@@ -9,6 +9,15 @@ R4::Application.configure do
config.consider_all_requests_local = false
config.action_controller.perform_caching = true
# Specifies the header that your server uses for sending files
config.action_dispatch.x_sendfile_header = "X-Sendfile"
# For nginx:
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect'
# If you have no front-end server that supports something like X-Sendfile,
# just comment this out and Rails will serve the files
# See everything in the log (default is :info)
# config.log_level = :debug
@@ -30,4 +39,11 @@ R4::Application.configure do
# Enable threaded mode
# config.threadsafe!
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
# the I18n.default_locale when a translation can not be found)
config.i18n.fallbacks = true
# Send deprecation notices to registered listeners
config.active_support.deprecation = :notify
end
+8 -2
View File
@@ -1,5 +1,5 @@
R4::Application.configure do
# Settings specified here will take precedence over those in config/environment.rb
PrototypeR4::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
# test suite. You never need to work with it otherwise. Remember that
@@ -14,6 +14,9 @@ R4::Application.configure do
config.consider_all_requests_local = true
config.action_controller.perform_caching = false
# Raise exceptions instead of rendering exception templates
config.action_dispatch.show_exceptions = false
# Disable request forgery protection in test environment
config.action_controller.allow_forgery_protection = false
@@ -26,4 +29,7 @@ R4::Application.configure do
# This is necessary if your schema can't be completely dumped by the schema dumper,
# like if you have constraints or database-specific column types
# config.active_record.schema_format = :sql
# Print deprecation notices to the stderr
config.active_support.deprecation = :stderr
end
+15
View File
@@ -0,0 +1,15 @@
require 'carrierwave/orm/mongoid'
begin
db_config = YAML::load(File.read(File.join(Rails.root, "/config/mongoid.yml")))
rescue
raise IOError, 'config/mongoid.yml could not be loaded'
end
CarrierWave.configure do |config|
config.grid_fs_database = db_config[Rails.env]['database']
config.grid_fs_host = db_config[Rails.env]['host']
config.grid_fs_port = db_config[Rails.env]['port']
config.storage = :grid_fs
config.grid_fs_access_url = "/gridfs"
end
+80 -40
View File
@@ -1,24 +1,20 @@
# Use this hook to configure devise mailer, warden hooks and so forth. The first
# four configuration values can also be set straight in your models.
Devise.setup do |config|
# ==> Mailer Configuration
# Configure the e-mail address which will be shown in DeviseMailer.
config.mailer_sender = "please-change-me@config-initializers-devise.com"
# ==> Configuration for :authenticatable
# Invoke `rake secret` and use the printed value to setup a pepper to generate
# the encrypted password. By default no pepper is used.
# config.pepper = "rake secret output"
# Configure the class responsible to send e-mails.
# config.mailer = "Devise::Mailer"
# Configure how many times you want the password is reencrypted. Default is 10.
# config.stretches = 10
# Define which will be the encryption algorithm. Supported algorithms are :sha1
# (default), :sha512 and :bcrypt. Devise also supports encryptors from others
# authentication tools as :clearance_sha1, :authlogic_sha512 (then you should set
# stretches above to 20 for default behavior) and :restful_authentication_sha1
# (then you should set stretches to 10, and copy REST_AUTH_SITE_KEY to pepper)
# config.encryptor = :sha1
# ==> ORM configuration
# Load and configure the ORM. Supports :active_record (default) and
# :mongoid (bson_ext recommended) by default. Other ORMs may be
# available as additional gems.
require 'devise/orm/mongoid'
# ==> Configuration for any authentication mechanism
# Configure which keys are used when authenticating an user. By default is
# just :email. You can configure it to use [:username, :subdomain], so for
# authenticating an user, both parameters are required. Remember that those
@@ -26,33 +22,80 @@ Devise.setup do |config|
# session. If you need permissions, you should implement that in a before filter.
# config.authentication_keys = [ :email ]
# Tell if authentication through request.params is enabled. True by default.
# config.params_authenticatable = true
# Tell if authentication through HTTP Basic Auth is enabled. False by default.
# config.http_authenticatable = false
# Set this to true to use Basic Auth for AJAX requests. True by default.
# config.http_authenticatable_on_xhr = true
# The realm used in Http Basic Authentication
# config.http_authentication_realm = "Application"
# ==> Configuration for :database_authenticatable
# For bcrypt, this is the cost for hashing the password and defaults to 10. If
# using other encryptors, it sets how many times you want the password re-encrypted.
config.stretches = 10
# Define which will be the encryption algorithm. Devise also supports encryptors
# from others authentication tools as :clearance_sha1, :authlogic_sha512 (then
# you should set stretches above to 20 for default behavior) and :restful_authentication_sha1
# (then you should set stretches to 10, and copy REST_AUTH_SITE_KEY to pepper)
config.encryptor = :bcrypt
# Setup a pepper to generate the encrypted password.
config.pepper = "a5a6b41c8a259f0642f9e8a51b77f3c671be92a430e021e00f7e0bcc71381c0698d3c3e9c1dc270872a16ed2703715e3b3b817245740bbb871a3411714944dce"
# ==> Configuration for :confirmable
# The time you want give to your user to confirm his account. During this time
# The time you want to give your user to confirm his account. During this time
# he will be able to access your application without confirming. Default is nil.
# When confirm_within is zero, the user won't be able to sign in without confirming.
# You can use this to let your user access some features of your application
# without confirming the account, but blocking it after a certain period
# (ie 2 days).
# config.confirm_within = 2.days
# ==> Configuration for :rememberable
# The time the user will be remembered without asking for credentials again.
# config.remember_for = 2.weeks
# If true, a valid remember token can be re-used between multiple browsers.
# config.remember_across_browsers = true
# If true, extends the user's remember period when remembered via cookie.
# config.extend_remember_period = false
# ==> Configuration for :validatable
# Range for password length
# config.password_length = 6..20
# Regex to use to validate the email address
# config.email_regexp = /^([\w\.%\+\-]+)@([\w\-]+\.)+([\w]{2,})$/i
# ==> Configuration for :timeoutable
# The time you want to timeout the user session without activity. After this
# time the user will be asked for credentials again.
# config.timeout_in = 10.minutes
# ==> Configuration for :lockable
# Number of authentication tries before locking an account.
# config.maximum_attempts = 20
# Defines which strategy will be used to lock an account.
# :failed_attempts = Locks an account after a number of failed attempts to sign in.
# :none = No lock strategy. You should handle locking by yourself.
# config.lock_strategy = :failed_attempts
# Defines which strategy will be used to unlock an account.
# :email = Sends an unlock link to the user email
# :time = Reanables login after a certain ammount of time (see :unlock_in below)
# :both = enables both strategies
# :time = Re-enables login after a certain amount of time (see :unlock_in below)
# :both = Enables both strategies
# :none = No unlock strategy. You should handle unlocking by yourself.
# config.unlock_strategy = :both
# Number of authentication tries before locking an account if lock_strategy
# is failed attempts.
# config.maximum_attempts = 20
# Time interval to unlock the account if :time is enabled as unlock_strategy.
# config.unlock_in = 1.hour
@@ -60,27 +103,30 @@ Devise.setup do |config|
# Defines name of the authentication token params key
# config.token_authentication_key = :auth_token
# ==> General configuration
# Load and configure the ORM. Supports :active_record (default), :mongo_mapper
# (requires mongo_ext installed) and :data_mapper (experimental).
# require 'devise/orm/mongo_mapper'
config.orm = :mongo_mapper
# ==> Scopes configuration
# Turn scoped views on. Before rendering "sessions/new", it will first check for
# "sessions/users/new". It's turned off by default because it's slower if you
# "users/sessions/new". It's turned off by default because it's slower if you
# are using only default views.
# config.scoped_views = true
# By default, devise detects the role accessed based on the url. So whenever
# accessing "/users/sign_in", it knows you are accessing an User. This makes
# routes as "/sign_in" not possible, unless you tell Devise to use the default
# scope, setting true below.
# config.use_default_scope = true
# Configure the default scope used by Devise. By default it's the first devise
# role declared in your routes.
# Configure the default scope given to Warden. By default it's the first
# devise role declared in your routes.
# config.default_scope = :user
# Configure sign_out behavior.
# By default sign_out is scoped (i.e. /users/sign_out affects only :user scope).
# In case of sign_out_all_scopes set to true any logout action will sign out all active scopes.
# config.sign_out_all_scopes = false
# ==> Navigation configuration
# Lists the formats that should be treated as navigational. Formats like
# :html, should redirect to the sign in page when the user does not have
# access, but formats like :xml or :json, should return 401.
# If you have any extra navigational formats, like :iphone or :mobile, you
# should add them to the navigational formats lists. Default is [:html]
# config.navigational_formats = [:html, :iphone]
# ==> Warden configuration
# If you want to use other strategies, that are not (yet) supported by Devise,
# you can configure them inside the config.warden block. The example below
# allows you to setup OAuth, using http://github.com/roman/warden_oauth
@@ -91,12 +137,6 @@ Devise.setup do |config|
# twitter.consumer_key = <YOUR CONSUMER KEY>
# twitter.options :site => 'http://twitter.com'
# end
# manager.default_strategies.unshift :twitter_oauth
# end
# Configure default_url_options if you are using dynamic segments in :path_prefix
# for devise_for.
# config.default_url_options do
# { :locale => I18n.locale }
# manager.default_strategies(:scope => :user).unshift :twitter_oauth
# end
end
+1 -1
View File
@@ -1,6 +1,6 @@
# Be sure to restart your server when you modify this file.
# Add new inflection rules using the following format
# 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'
+2
View File
@@ -0,0 +1,2 @@
data = File.open(File.join(RAILS_ROOT, 'config', 'list.yml')).read
LIST = YAML::load(ERB.new(data).result(binding)).symbolize_keys
+16
View File
@@ -0,0 +1,16 @@
def field_i18n(field, *options)
['en', 'zh_tw'].each do |locale|
field "#{field.to_s}_#{locale}".to_sym, *options
end
define_method(field) do
self.send("#{field.to_s}_#{I18n.locale}")
end
define_method("#{field}=") do |value|
['en', 'zh_tw'].each do |locale|
self.send("#{field.to_s}_#{locale}=", value)
end
end
end
+7
View File
@@ -0,0 +1,7 @@
# Be sure to restart your server when you modify this file.
# Your secret key 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.
PrototypeR4::Application.config.secret_token = 'b8d78ecaf3086ebfc1ba42e912acba60d85cf3d789d933e117770e1a045a12911f121ff012a234982abb446c8b8c768052eea4bf8b2d5d336be821e2c25d8cdb'
+3 -10
View File
@@ -1,15 +1,8 @@
# Be sure to restart your server when you modify this file.
# Your secret key for verifying cookie session data integrity.
# If you change this key, all old sessions 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.
ActionController::Base.session = {
:key => '_r4_session',
:secret => '3de7e1b7f4a979950642fd6ebf1a1f67488c568c7e510d7fe9011d6f8ad37e4195bc32aed07167ac7541b7b152d4ffbca73e05bd19d8faddff52b422f3851890'
}
PrototypeR4::Application.config.session_store :cookie_store, :key => '_prototype_R4_session'
# Use the database for sessions instead of the cookie-based default,
# which shouldn't be used to store highly confidential information
# (create the session table with "rake db:sessions:create")
# ActionController::Base.session_store = :active_record_store
# (create the session table with "rails generate session_migration")
# PrototypeR4::Application.config.session_store :active_record_store
+7
View File
@@ -0,0 +1,7 @@
forbidden_item_names:
- admin
- panel
markups:
- text_field
- select
+11 -13
View File
@@ -6,10 +6,7 @@ en:
not_locked: "was not locked"
devise:
sessions:
link: 'Sign in'
signed_in: 'Signed in successfully.'
signed_out: 'Signed out successfully.'
failure:
unauthenticated: 'You need to sign in or sign up before continuing.'
unconfirmed: 'You have to confirm your account before continuing.'
locked: 'Your account is locked.'
@@ -17,25 +14,26 @@ en:
invalid_token: 'Invalid authentication token.'
timeout: 'Your session expired, please sign in again to continue.'
inactive: 'Your account was not activated yet.'
sessions:
signed_in: 'Signed in successfully.'
signed_out: 'Signed out successfully.'
passwords:
link: 'Forgot password?'
send_instructions: 'You will receive an email with instructions about how to reset your password in a few minutes.'
updated: 'Your password was changed successfully. You are now signed in.'
confirmations:
link: "Didn't receive confirmation instructions?"
send_instructions: 'You will receive an email with instructions about how to confirm your account in a few minutes.'
confirmed: 'Your account was successfully confirmed. You are now signed in.'
registrations:
link: 'Sign up'
signed_up: 'You have signed up successfully.'
signed_up: 'You have signed up successfully. If enabled, a confirmation was sent to your e-mail.'
updated: 'You updated your account successfully.'
destroyed: 'Bye! Your account was successfully cancelled. We hope to see you again soon.'
unlocks:
link: "Didn't receive unlock instructions?"
send_instructions: 'You will receive an email with instructions about how to unlock your account in a few minutes.'
unlocked: 'Your account was successfully unlocked. You are now signed in.'
mailer:
confirmation_instructions: 'Confirmation instructions'
reset_password_instructions: 'Reset password instructions'
unlock_instructions: 'Unlock Instructions'
confirmation_instructions:
subject: 'Confirmation instructions'
reset_password_instructions:
subject: 'Reset password instructions'
unlock_instructions:
subject: 'Unlock Instructions'
+39
View File
@@ -0,0 +1,39 @@
zh_tw:
errors:
messages:
not_found: "沒有找到"
already_confirmed: "已被確認過了"
not_locked: "被鎖定了"
devise:
failure:
unauthenticated: '您需要先註冊、登入後才能繼續。'
unconfirmed: '您的帳號需需要經過確認後,才能繼續。'
locked: '您的帳號已被鎖定。'
invalid: 'Email 或密碼是無效的。'
invalid_token: '無效的認證代碼。'
timeout: '您的登入時效過期,請重新登入,才能繼續。'
inactive: '您的帳號尚未被啟用。'
sessions:
signed_in: '成功登入了。'
signed_out: '成功登出了。'
passwords:
send_instructions: '您將在幾分鐘後收到一封電子郵件,內有重新設定密碼的步驟說明。'
updated: '您的密碼已被修改,而您現在已重新登入。'
confirmations:
send_instructions: '您將在幾分鐘後收到一封電子郵件,內有確認帳號的步驟說明。'
confirmed: '您的帳號已經過確認,現在您已成功登入。'
registrations:
signed_up: '您已經成功的登錄,確認信件已送至您的 Email 信箱。'
updated: '您已經成功的更新帳號資訊。'
destroyed: '再會!您的帳號已被取消。有緣再會。'
unlocks:
send_instructions: '您將在幾分鐘後收到一封電子郵件,內有將帳號解除鎖定的步驟說明。'
unlocked: '您的帳號已被解鎖,現在您已成功登入。'
mailer:
confirmation_instructions:
subject: '確認步驟'
reset_password_instructions:
subject: '重設密碼步驟'
unlock_instructions:
subject: '解鎖步驟'
+99 -1
View File
@@ -2,4 +2,102 @@
# See http://github.com/svenfuchs/rails-i18n/tree/master/rails%2Flocale for starting points.
en:
hello: "Hello world"
_locale: English
add: Add
back: Back
create: Create
delete: Delete
disable: Disable
edit: Edit
enable: Enable
hide: Hide
homepage: Homepage
no_: "No"
nothing: Nothing
show: Show
sure?: Are you sure?
update: Update
yes_: "Yes"
admin:
add_language: Add language
admin: Admin
action: Action
announcement: Announcement
asset: Asset
attribute: Attribute
attributes: Attributes
class: Class
create_success_home: Homepage was successfully created.
create_success_layout: Layout was successfully created.
create_success_link: Link was successfully created.
create_success_page: Page was successfully created.
create_success_snippet: Snippet was successfully created.
content: Content
data: Data
delete_language: Delete language
description: Description
disable_language: Disable language
editing_home: Editing homepage
editing_layout: Editing layout
editing_link: Editing link
editing_page: Editing page
editing_snippet: Editing snippet
editing_user_attribute: Editing user attribute
enable_language: Enable language
file_name: Filename
filr_size: File size
format: Format
is_published: Is published
item: Item
key: Key
language: Language
layout: Layout
layout_name: Layout name
list_assets: Assets list
list_items: Items list
list_layouts: Layouts list
list_snippets: Snippets list
list_user_attributes: User attributes list
move_down: Move down
move_up: Move up
multilingual: Multilingual
no_home_page: You don't have a homepage
no_layout: You don't have a layout
name: Name
new_asset: New asset
new_component: New component
new_home: New homepage
new_layout: New layout
new_link: New link
new_page: New page
new_snippet: New snippet
new_user_attribute: New user attribute
non_multilingual: Non multilingual
options: Options
orig_upload_file: Original filename
position: Position
published?: Published?
title: Title
translation: Translation
type: Type
user_attribute: User attribute
update_success_home: Homepage was successfully updated.
update_success_layout: Layout was successfully updated.
update_success_link: Link was successfully updated.
update_success_page: Page was successfully updated.
update_success_snippet: Snippet was successfully updated.
panel:
action: Action
attributes: Attributes
email: Email
home: Home
list_users: Users list
my_avatar: My Avatar
name: Name
new_user: New user
user: User
user_panel: User panel
+304 -18
View File
@@ -1,27 +1,313 @@
zh_tw:
homepage: 首頁
show: 顯示
edit: 編輯
_locale: 中文
add: 新增
back: 回去
create: 創造
delete: 刪除
disable: 禁用
edit: 編輯
enable: 啟用
hide: 隱藏
homepage: 首頁
no_: "No"
nothing: 無
show: 顯示
sure?: 您肯定嗎?
update: 更新
yes_: "Yes"
admin:
home: 首頁
item: 項目管理
layout: 樣版管理
new_page: 新增頁面
new_component: 新增元件
new_link: 新增連結
new_snippet: 新增片段
new_layout: 新增樣板
announcement: 公告管理
asset: 資產管理
new_asset: 新增資產
move_up: 往上移
add_language: 新增語言
admin: 管理
action: 行動
announcement: 公告
asset: 資產
attribute: 屬性
attributes: 屬性
class: 階級
content: 內容
create_success_home: 首頁已成功創建。
create_success_layout: 樣板已成功創建。
create_success_link: 連結已成功創建。
create_success_page: 頁面已成功創建。
create_success_snippet: 片段已成功創建。
data: 數據
delete_language: 刪除語言
description: 描述
disable_language: 禁用語言
editing_home: 編輯首頁
editing_layout: 編輯樣板
editing_link: 編輯連結
editing_page: 編輯頁面
editing_snippet: 編輯片段
editing_user_attribute: 編輯人物屬性
enable_language: 啟用語言
file_name: 檔名
file_size: 檔案大小
format: 格式
is_published: 被出版
item: 項目
key: 關鍵
language: 語言
layout: 佈局
layout_name: 佈局名字
list_assets: 資產清單
list_items: 項目清單
list_layouts: 佈局清單
list_snippets: 斷片清單
list_user_attributes: 人物屬性清單
move_down: 往下移
user_attribute: 人物屬性
move_up: 往上移
multilingual: 多種語言
no_home_page: 您沒有首頁
no_layout: 您沒有佈局
name: 名稱
new_asset: 新增資產
new_component: 新增元件
new_home: 新增首頁
new_layout: 新增樣板
new_link: 新增連結
new_page: 新增頁面
new_snippet: 新增片段
new_user_attribute: 新增人物屬性
non_multilingual: 非多種語言
options: 選項
orig_upload_file: 原上傳檔名
position: 位置
published?: 發布?
title: 標題
translation: 翻譯
type: 類型
user_attribute: 人物屬性
update_success_home: 首頁已成功更新。
update_success_layout: 樣板已成功更新。
update_success_link: 連結已成功更新。
update_success_page: 頁面已成功更新。
update_success_snippet: 片段已成功更新。
panel:
action: 行動
attributes: 屬性
email: Email
home: 首頁
users: 使用者管理
new_user: 新增使用者
list_users: 使用清單
my_avatar: 我的頭像
name: 名稱
new_user: 新增使用
user: 用戶
user_panel: 用戶面板
# Chinese (Taiwan) translations for Ruby on Rails
# by tsechingho (http://github.com/tsechingho)
date:
formats:
default: "%Y-%m-%d"
short: "%b%d日"
long: "%Y年%b%d日"
day_names: [星期日, 星期一, 星期二, 星期三, 星期四, 星期五, 星期六]
abbr_day_names: [日, 一, 二, 三, 四, 五, 六]
month_names: [~, 一月, 二月, 三月, 四月, 五月, 六月, 七月, 八月, 九月, 十月, 十一月, 十二月]
abbr_month_names: [~, 1月, 2月, 3月, 4月, 5月, 6月, 7月, 8月, 9月, 10月, 11月, 12月]
order: [ :year, :month, :day ]
time:
formats:
default: "%Y年%b%d日 %A %H:%M:%S %Z"
short: "%b%d日 %H:%M"
long: "%Y年%b%d日 %H:%M"
am: "上午"
pm: "下午"
datetime:
distance_in_words:
half_a_minute: "半分鐘"
less_than_x_seconds:
one: "不到一秒"
other: "不到 %{count} 秒"
x_seconds:
one: "一秒"
other: "%{count} 秒"
less_than_x_minutes:
one: "不到一分鐘"
other: "不到 %{count} 分鐘"
x_minutes:
one: "一分鐘"
other: "%{count} 分鐘"
about_x_hours:
one: "大約一小時"
other: "大約 %{count} 小時"
x_days:
one: "一天"
other: "%{count} 天"
about_x_months:
one: "大約一個月"
other: "大約 %{count} 個月"
x_months:
one: "一個月"
other: "%{count} 個月"
about_x_years:
one: "大約一年"
other: "大約 %{count} 年"
over_x_years:
one: "一年多"
other: "%{count} 年多"
almost_x_years:
one: "接近一年"
other: "接近 %{count} 年"
prompts:
year: "年"
month: "月"
day: "日"
hour: "時"
minute: "分"
second: "秒"
number:
format:
separator: "."
delimiter: ","
precision: 3
significant: false
strip_insignificant_zeros: false
currency:
format:
format: "%u %n"
unit: "NT$"
separator: "."
delimiter: ","
precision: 2
significant: false
strip_insignificant_zeros: false
percentage:
format:
delimiter: ""
precision:
format:
delimiter: ""
human:
format:
delimiter: ""
precision: 1
significant: false
strip_insignificant_zeros: false
storage_units:
format: "%n %u"
units:
byte:
one: "Byte"
other: "Bytes"
kb: "KB"
mb: "MB"
gb: "GB"
tb: "TB"
decimal_units:
format: "%n %u"
units:
# 10^-21 zepto, 10^-24 yocto
atto: "渺" # 10^-18
femto: "飛" # 10^-15 毫微微
pico: "漠" # 10^-12 微微
nano: "奈" # 10^-9 毫微
micro: "微" # 10^-6
mili: "毫" # 10^-3 milli
centi: "厘" # 10^-2
deci: "分" # 10^-1
unit: ""
ten:
one: "十"
other: "十" # 10^1
hundred: "百" # 10^2
thousand: "千" # 10^3 kilo
million: "百萬" # 10^6 mega
billion: "十億" # 10^9 giga
trillion: "兆" # 10^12 tera
quadrillion: "千兆" # 10^15 peta
# 10^18 exa, 10^21 zetta, 10^24 yotta
support:
array:
words_connector: ", "
two_words_connector: " 和 "
last_word_connector: ", 和 "
select:
prompt: "請選擇"
activerecord:
errors:
template: # ~ 2.3.5 backward compatible
header:
one: "有 1 個錯誤發生使得「%{model}」無法被儲存。"
other: "有 %{count} 個錯誤發生使得「%{model}」無法被儲存。"
body: "以下欄位發生問題:"
full_messages:
format: "%{attribute} %{message}"
messages:
inclusion: "沒有包含在列表中"
exclusion: "是被保留的關鍵字"
invalid: "是無效的"
confirmation: "不符合確認值"
accepted: "必須是可被接受的"
empty: "不能留空"
blank: "不能是空白字元"
too_long: "過長(最長是 %{count} 個字)"
too_short: "過短(最短是 %{count} 個字)"
wrong_length: "字數錯誤(必須是 %{count} 個字)"
not_a_number: "不是數字"
not_an_integer: "必須是整數"
greater_than: "必須大於 %{count}"
greater_than_or_equal_to: "必須大於或等於 %{count}"
equal_to: "必須等於 %{count}"
less_than: "必須小於 %{count}"
less_than_or_equal_to: "必須小於或等於 %{count}"
odd: "必須是奇數"
even: "必須是偶數"
taken: "已經被使用"
record_invalid: "校驗失敗: %{errors}"
activemodel:
errors:
template:
header:
one: "有 1 個錯誤發生使得「%{model}」無法被儲存。"
other: "有 %{count} 個錯誤發生使得「%{model}」無法被儲存。"
body: "以下欄位發生問題:"
errors:
format: "%{attribute} %{message}"
messages:
inclusion: "沒有包含在列表中"
exclusion: "是被保留的關鍵字"
invalid: "是無效的"
confirmation: "不符合確認值"
accepted: "必須是可被接受的"
empty: "不能留空"
blank: "不能是空白字元"
too_long: "過長(最長是 %{count} 個字)"
too_short: "過短(最短是 %{count} 個字)"
wrong_length: "字數錯誤(必須是 %{count} 個字)"
not_a_number: "不是數字"
not_an_integer: "必須是整數"
greater_than: "必須大於 %{count}"
greater_than_or_equal_to: "必須大於或等於 %{count}"
equal_to: "必須等於 %{count}"
less_than: "必須小於 %{count}"
less_than_or_equal_to: "必須小於或等於 %{count}"
odd: "必須是奇數"
even: "必須是偶數"
template:
header:
one: "有 1 個錯誤發生使得「%{model}」無法被儲存。"
other: "有 %{count} 個錯誤發生使得「%{model}」無法被儲存。"
body: "以下欄位發生問題:"
helpers:
select:
prompt: "請選擇"
submit:
create: "新增%{model}"
update: "更新%{model}"
submit: "儲存%{model}"
+23
View File
@@ -0,0 +1,23 @@
defaults: &defaults
host: localhost
# slaves:
# - host: slave1.local
# port: 27018
# - host: slave2.local
# port: 27019
development:
<<: *defaults
database: prototype_r4_development
test:
<<: *defaults
database: prototype_r4_test
# set these environment variables on your prod server
production:
host: <%= ENV['MONGOID_HOST'] %>
port: <%= ENV['MONGOID_PORT'] %>
username: <%= ENV['MONGOID_USERNAME'] %>
password: <%= ENV['MONGOID_PASSWORD'] %>
database: <%= ENV['MONGOID_DATABASE'] %>
+48 -38
View File
@@ -1,37 +1,6 @@
R4::Application.routes.draw do |map|
resources :announcements
namespace :admin do
resources :items do
member do
put :up
put :down
end
end
resources :pages
resources :links
resources :components
resources :layouts
resources :snippets
resources :assets
resources :user_attributes
end
namespace :panel do
resources :users
resources :announcements
end
PrototypeR4::Application.routes.draw do
devise_for :users
# match 'users' => '#index', :as => :devise_for
match '/' => 'pages#index'
match '*page_name' => 'pages#show', :as => :page
# The priority is based upon order of creation:
# first created -> highest priority.
@@ -45,16 +14,17 @@ R4::Application.routes.draw do |map|
# Sample resource route (maps HTTP verbs to controller actions automatically):
# resources :products
resources :sites
# Sample resource route with options:
# resources :products do
# member do
# get :short
# post :toggle
# get 'short'
# post 'toggle'
# end
#
# collection do
# get :sold
# get 'sold'
# end
# end
@@ -63,12 +33,50 @@ R4::Application.routes.draw do |map|
# resources :comments, :sales
# resource :seller
# end
namespace :admin do
resources :assets
resources :items do
member do
put :up
put :down
end
end
resources :layouts
resources :links
resources :pages
resources :homes
resources :snippets
resources :translations
resources :user_attribute_models
end
namespace :panel do
resources :users
end
# Patch Mongo::GridIO to contain an each method.
require File.join Rails.root, 'lib/grid_io'
Mongo::GridIO.send(:include, PrototypeR4::GridIO)
match "/gridfs/*path", :via => :get, :to => proc { |env|
gridfs_path = env["PATH_INFO"].gsub("/gridfs/", "")
begin
gridfs_file = Mongo::GridFileSystem.new(Mongoid.database).open(gridfs_path, 'r')
[ 200, { 'Content-Type' => gridfs_file.content_type, 'Content-Length' => gridfs_file.file_length.to_s }, gridfs_file ]
rescue
message = 'Grid file not found.'
[ 404, { 'Content-Type' => 'text/plain', 'Content-Length' => message.size.to_s }, message ]
end
}
match '/' => 'pages#index'
match '*page_name' => 'pages#show', :as => :page
# Sample resource route with more complex sub-resources
# resources :products do
# resources :comments
# resources :sales do
# get :recent, :on => :collection
# get 'recent', :on => :collection
# end
# end
@@ -81,11 +89,13 @@ R4::Application.routes.draw do |map|
# You can have the root of your site routed with "root"
# just remember to delete public/index.html.
root :to => "pages#index"
# root :to => "welcome#index"
root :to => 'pages#index'
# See how all your routes lay out with "rake routes"
# This is a legacy wild controller route that's not recommended for RESTful applications.
# Note: This route will make all actions in every controller accessible via GET requests.
# match ':controller(/:action(/:id(.:format)))'
end