fix validation for photo title if russian locale
This commit is contained in:
parent
aedc18f834
commit
d996de1514
1
Gemfile
1
Gemfile
|
@ -8,6 +8,7 @@ gem 'mime-types', :require => 'mime/types'
|
|||
gem 'carrierwave', '0.6.2'
|
||||
gem 'dynamic_form'
|
||||
gem 'princely'
|
||||
gem 'russian', :git => 'git://github.com/yaroslav/russian.git'
|
||||
|
||||
# -- Heroku
|
||||
#gem 'heroku'
|
||||
|
|
|
@ -1,3 +1,10 @@
|
|||
GIT
|
||||
remote: git://github.com/yaroslav/russian.git
|
||||
revision: e2dde13672bcee176f8b0be364a55ac256913231
|
||||
specs:
|
||||
russian (0.6.0)
|
||||
i18n (>= 0.5.0)
|
||||
|
||||
GEM
|
||||
remote: http://rubygems.org/
|
||||
specs:
|
||||
|
@ -123,4 +130,5 @@ DEPENDENCIES
|
|||
mini_magick
|
||||
princely
|
||||
rails (= 3.2.6)
|
||||
russian!
|
||||
sqlite3-ruby
|
||||
|
|
|
@ -39,24 +39,28 @@ class FileUploader < CarrierWave::Uploader::Base
|
|||
# Create different versions of your uploaded files
|
||||
version :collection do
|
||||
process :resize_to_fill => [200, 200]
|
||||
|
||||
def store_dir
|
||||
ENV['STORAGE_PATH'] + "/thumbs/#{model.album.path}"
|
||||
end
|
||||
end
|
||||
version :album do
|
||||
process :resize_to_fill => [100, 100]
|
||||
|
||||
def store_dir
|
||||
ENV['STORAGE_PATH'] + "/thumbs/#{model.album.path}"
|
||||
end
|
||||
end
|
||||
version :preview do
|
||||
process :resize_to_fit => [210, 210]
|
||||
|
||||
def store_dir
|
||||
ENV['STORAGE_PATH'] + "/thumbs/#{model.album.path}"
|
||||
end
|
||||
end
|
||||
version :single do
|
||||
process :resize_to_limit => [950, 950]
|
||||
|
||||
def store_dir
|
||||
ENV['STORAGE_PATH'] + "/thumbs/#{model.album.path}"
|
||||
end
|
||||
|
|
|
@ -23,7 +23,7 @@ $(document).ready(function() {
|
|||
|
||||
// Specify what files to browse for
|
||||
filters:[
|
||||
{title : "Image files", extensions : "jpg,gif,png,bmp,jpeg,tif,tiff"}
|
||||
{title:"Image files", extensions:"jpg,gif,png,bmp,jpeg,tif,tiff,JPG,GIF,PNG,BMP,JPEG,TIF,TIFF"}
|
||||
],
|
||||
|
||||
// Flash settings
|
||||
|
@ -61,11 +61,9 @@ $(document).ready(function() {
|
|||
if (uploader.total.uploaded == uploader.files.length)
|
||||
$('form').submit();
|
||||
});
|
||||
|
||||
uploader.start();
|
||||
} else
|
||||
alert('You must at least upload one file.');
|
||||
|
||||
e.preventDefault();
|
||||
}
|
||||
});
|
||||
|
@ -77,7 +75,6 @@ $(document).ready(function() {
|
|||
<div id="uploader">
|
||||
<p>You browser doesn't have Flash, Silverlight, Gears, BrowserPlus or HTML5 support.</p>
|
||||
</div>
|
||||
|
||||
<br>
|
||||
<div id="thumbs"></div>
|
||||
</form>
|
||||
|
|
|
@ -14,6 +14,8 @@ module Balder
|
|||
config.autoload_paths += %W(#{config.root}/lib #{config.root}/app/middleware/)
|
||||
|
||||
config.encoding = "utf-8"
|
||||
config.i18n.default_locale = :ru
|
||||
config.time_zone = 'Moscow'
|
||||
|
||||
# Configure sensitive parameters which will be filtered from the log file.
|
||||
config.filter_parameters += [:password, :password_confirmation]
|
||||
|
|
22
config/initializers/to_url.rb
Normal file
22
config/initializers/to_url.rb
Normal file
|
@ -0,0 +1,22 @@
|
|||
String.class_eval do
|
||||
def to_url
|
||||
self.parameterize
|
||||
end
|
||||
|
||||
def linkify
|
||||
result = self.downcase
|
||||
result.gsub!(/&(\d)+;/, '') # Ditch Entities
|
||||
result.gsub!('&', 'and') # Replace & with 'and'
|
||||
result.gsub!(/['"]/, '') # replace quotes by nothing
|
||||
result.gsub!(/\W/, ' ') # strip all non word chars
|
||||
result.gsub!(/\ +/, '-') # replace all white space sections with a dash
|
||||
result.gsub!(/(-)$/, '') # trim dashes
|
||||
result.gsub!(/^(-)/, '') # trim dashes
|
||||
result.gsub!(/[^a-zA-Z0-9\-]/, '-') # Get rid of anything we don't like
|
||||
result
|
||||
end
|
||||
|
||||
def linkify!
|
||||
self.replace(self.linkify)
|
||||
end
|
||||
end
|
40
db/schema.rb
40
db/schema.rb
|
@ -16,8 +16,8 @@ ActiveRecord::Schema.define(:version => 20100412220801) do
|
|||
create_table "albums", :force => true do |t|
|
||||
t.string "title", :null => false
|
||||
t.text "description"
|
||||
t.datetime "created_at"
|
||||
t.datetime "updated_at"
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
t.text "path"
|
||||
t.string "address"
|
||||
t.float "longitude"
|
||||
|
@ -30,8 +30,8 @@ ActiveRecord::Schema.define(:version => 20100412220801) do
|
|||
create_table "collection_albums", :force => true do |t|
|
||||
t.integer "collection_id"
|
||||
t.integer "album_id"
|
||||
t.datetime "created_at"
|
||||
t.datetime "updated_at"
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
end
|
||||
|
||||
add_index "collection_albums", ["album_id"], :name => "index_collection_albums_on_album_id"
|
||||
|
@ -40,8 +40,8 @@ ActiveRecord::Schema.define(:version => 20100412220801) do
|
|||
create_table "collections", :force => true do |t|
|
||||
t.string "title", :null => false
|
||||
t.string "description"
|
||||
t.datetime "created_at"
|
||||
t.datetime "updated_at"
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
end
|
||||
|
||||
add_index "collections", ["id"], :name => "index_collections_on_id", :unique => true
|
||||
|
@ -51,15 +51,15 @@ ActiveRecord::Schema.define(:version => 20100412220801) do
|
|||
t.string "permissible_type"
|
||||
t.string "action"
|
||||
t.boolean "granted"
|
||||
t.datetime "created_at"
|
||||
t.datetime "updated_at"
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
end
|
||||
|
||||
create_table "photo_tags", :force => true do |t|
|
||||
t.integer "tag_id"
|
||||
t.integer "photo_id"
|
||||
t.datetime "created_at"
|
||||
t.datetime "updated_at"
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
end
|
||||
|
||||
add_index "photo_tags", ["photo_id"], :name => "index_photo_tags_on_photo_id"
|
||||
|
@ -69,8 +69,8 @@ ActiveRecord::Schema.define(:version => 20100412220801) do
|
|||
t.string "title", :null => false
|
||||
t.text "description"
|
||||
t.integer "album_id"
|
||||
t.datetime "created_at"
|
||||
t.datetime "updated_at"
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
t.text "path"
|
||||
t.float "longitude"
|
||||
t.float "latitude"
|
||||
|
@ -84,20 +84,20 @@ ActiveRecord::Schema.define(:version => 20100412220801) do
|
|||
t.integer "roleable_id"
|
||||
t.string "roleable_type"
|
||||
t.integer "role_id"
|
||||
t.datetime "created_at"
|
||||
t.datetime "updated_at"
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
end
|
||||
|
||||
create_table "roles", :force => true do |t|
|
||||
t.string "name"
|
||||
t.datetime "created_at"
|
||||
t.datetime "updated_at"
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
end
|
||||
|
||||
create_table "tags", :force => true do |t|
|
||||
t.string "title", :null => false
|
||||
t.datetime "created_at"
|
||||
t.datetime "updated_at"
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
end
|
||||
|
||||
add_index "tags", ["id"], :name => "index_tags_on_id", :unique => true
|
||||
|
@ -116,8 +116,8 @@ ActiveRecord::Schema.define(:version => 20100412220801) do
|
|||
t.datetime "last_login_at"
|
||||
t.string "current_login_ip"
|
||||
t.string "last_login_ip"
|
||||
t.datetime "created_at"
|
||||
t.datetime "updated_at"
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
t.string "name"
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue