fix issue #37 plus other ones related to theme assets and assets

This commit is contained in:
did 2011-02-19 00:51:57 +01:00
parent 083debc516
commit bd992cc882
12 changed files with 36 additions and 31 deletions

View File

@ -1,6 +1,6 @@
GIT GIT
remote: git://github.com/floehopper/mocha.git remote: git://github.com/floehopper/mocha.git
revision: 6f18b724c50a89a1fad954dc32a8a590dbb877ca revision: 2b4e868d1907859cd03f407078bd8b630f7d0dd6
specs: specs:
mocha (0.9.12.20110213002255) mocha (0.9.12.20110213002255)
@ -42,8 +42,8 @@ GEM
autotest (4.4.6) autotest (4.4.6)
ZenTest (>= 4.4.1) ZenTest (>= 4.4.1)
bcrypt-ruby (2.1.4) bcrypt-ruby (2.1.4)
bson (1.2.1) bson (1.2.2)
bson_ext (1.2.1) bson_ext (1.2.2)
builder (2.1.2) builder (2.1.2)
capybara (0.4.1.2) capybara (0.4.1.2)
celerity (>= 0.7.9) celerity (>= 0.7.9)
@ -54,7 +54,7 @@ GEM
rack-test (>= 0.5.4) rack-test (>= 0.5.4)
selenium-webdriver (>= 0.0.27) selenium-webdriver (>= 0.0.27)
xpath (~> 0.1.3) xpath (~> 0.1.3)
celerity (0.8.7) celerity (0.8.8)
childprocess (0.1.7) childprocess (0.1.7)
ffi (~> 0.6.3) ffi (~> 0.6.3)
closure-compiler (1.0.0) closure-compiler (1.0.0)
@ -88,7 +88,7 @@ GEM
diff-lcs (1.1.2) diff-lcs (1.1.2)
erubis (2.6.6) erubis (2.6.6)
abstract (>= 1.0.0) abstract (>= 1.0.0)
excon (0.5.2) excon (0.5.4)
factory_girl (1.3.3) factory_girl (1.3.3)
factory_girl_rails (1.0.1) factory_girl_rails (1.0.1)
factory_girl (~> 1.3) factory_girl (~> 1.3)
@ -118,7 +118,7 @@ GEM
json_pure (>= 1.2.0, < 1.5.0) json_pure (>= 1.2.0, < 1.5.0)
launchy (~> 0.3.2) launchy (~> 0.3.2)
rest-client (>= 1.4.0, < 1.7.0) rest-client (>= 1.4.0, < 1.7.0)
httparty (0.7.3) httparty (0.7.4)
crack (= 0.1.8) crack (= 0.1.8)
i18n (0.5.0) i18n (0.5.0)
inherited_resources (1.1.2) inherited_resources (1.1.2)
@ -129,7 +129,7 @@ GEM
yui-compressor (>= 0.9.1) yui-compressor (>= 0.9.1)
json (1.5.1) json (1.5.1)
json_pure (1.4.6) json_pure (1.4.6)
kgio (2.3.0) kgio (2.3.2)
launchy (0.3.7) launchy (0.3.7)
configuration (>= 0.0.5) configuration (>= 0.0.5)
rake (>= 0.8.1) rake (>= 0.8.1)
@ -153,8 +153,8 @@ GEM
mime-types (1.16) mime-types (1.16)
mimemagic (0.1.8) mimemagic (0.1.8)
mimetype-fu (0.1.2) mimetype-fu (0.1.2)
mongo (1.2.1) mongo (1.2.2)
bson (>= 1.2.1) bson (>= 1.2.2)
mongoid (2.0.0.rc.7) mongoid (2.0.0.rc.7)
activemodel (~> 3.0) activemodel (~> 3.0)
mongo (~> 1.2) mongo (~> 1.2)
@ -224,7 +224,7 @@ GEM
rubyzip (0.9.4) rubyzip (0.9.4)
s3 (0.3.7) s3 (0.3.7)
proxies proxies
selenium-webdriver (0.1.2) selenium-webdriver (0.1.3)
childprocess (~> 0.1.5) childprocess (~> 0.1.5)
ffi (~> 0.6.3) ffi (~> 0.6.3)
json_pure json_pure

View File

@ -26,7 +26,7 @@ class Asset
## methods ## ## methods ##
%w{image stylesheet javascript pdf video audio}.each do |type| %w{image stylesheet javascript pdf media}.each do |type|
define_method("#{type}?") do define_method("#{type}?") do
self.content_type.to_s == type self.content_type.to_s == type
end end

View File

@ -54,7 +54,7 @@ class AssetCollection
end end
def store_asset_positions! def store_asset_positions!
return if @assets_order.blank? return if @assets_order.nil?
ids = @assets_order.split(',').collect { |id| BSON::ObjectId(id) } ids = @assets_order.split(',').collect { |id| BSON::ObjectId(id) }

View File

@ -39,7 +39,7 @@ class ThemeAsset
## methods ## ## methods ##
%w{movie image stylesheet javascript font}.each do |type| %w{media image stylesheet javascript font}.each do |type|
define_method("#{type}?") do define_method("#{type}?") do
self.content_type.to_s == type self.content_type.to_s == type
end end
@ -116,7 +116,7 @@ class ThemeAsset
self.folder = ActiveSupport::Inflector.transliterate(self.folder).gsub(/(\s)+/, '_').gsub(/^\//, '').gsub(/\/$/, '').downcase self.folder = ActiveSupport::Inflector.transliterate(self.folder).gsub(/(\s)+/, '_').gsub(/^\//, '').gsub(/\/$/, '').downcase
# folder should begin by a root folder # folder should begin by a root folder
if (self.folder =~ /^(stylesheets|javascripts|images|media|fonts)/).nil? if (self.folder =~ /^(stylesheets|javascripts|images|medias|fonts)/).nil?
self.folder = File.join(self.content_type.to_s.pluralize, self.folder) self.folder = File.join(self.content_type.to_s.pluralize, self.folder)
end end
end end
@ -132,7 +132,7 @@ class ThemeAsset
def escape_shortcut_urls(text) def escape_shortcut_urls(text)
return if text.blank? return if text.blank?
text.gsub(/[("'](\/(stylesheets|javascripts|images|media)\/((.+)\/)*([a-z_\-0-9]+)\.[a-z]{2,3})[)"']/) do |path| text.gsub(/[("'](\/(stylesheets|javascripts|images|medias)\/((.+)\/)*([a-z_\-0-9]+)\.[a-z]{2,3})[)"']/) do |path|
sanitized_path = path.gsub(/[("')]/, '').gsub(/^\//, '') sanitized_path = path.gsub(/[("')]/, '').gsub(/^\//, '')

View File

@ -61,8 +61,7 @@ class AssetUploader < CarrierWave::Uploader::Base
def self.content_types def self.content_types
{ {
:image => ['image/jpeg', 'image/pjpeg', 'image/gif', 'image/png', 'image/x-png', 'image/jpg', 'image/x-icon'], :image => ['image/jpeg', 'image/pjpeg', 'image/gif', 'image/png', 'image/x-png', 'image/jpg', 'image/x-icon'],
:video => [/^video/, 'application/x-shockwave-flash', 'application/x-swf'], :media => [/^video/, 'application/x-shockwave-flash', 'application/x-swf', /^audio/, 'application/ogg', 'application/x-mp3'],
:audio => [/^audio/, 'application/ogg', 'application/x-mp3'],
:pdf => ['application/pdf', 'application/x-pdf'], :pdf => ['application/pdf', 'application/x-pdf'],
:stylesheet => ['text/css'], :stylesheet => ['text/css'],
:javascript => ['text/javascript', 'text/js', 'application/x-javascript', 'application/javascript'], :javascript => ['text/javascript', 'text/js', 'application/x-javascript', 'application/javascript'],

View File

@ -42,10 +42,10 @@
%ul.list.theme-assets %ul.list.theme-assets
= render :partial => 'asset', :collection => @assets[:fonts] = render :partial => 'asset', :collection => @assets[:fonts]
- if @assets[:media] - if @assets[:medias]
%br %br
%h3!= t('.media') %h3!= t('.medias')
%ul.list.theme-assets %ul.list.theme-assets
= render :partial => 'asset', :collection => @assets[:media] = render :partial => 'asset', :collection => @assets[:medias]

View File

@ -10,6 +10,5 @@
# end # end
ActiveSupport::Inflector.inflections do |inflect| ActiveSupport::Inflector.inflections do |inflect|
inflect.irregular 'media', 'media'
end end

View File

@ -172,7 +172,7 @@ en:
css_and_js: Style and javascript css_and_js: Style and javascript
fonts: Fonts fonts: Fonts
images: Images images: Images
media: Media medias: Medias
no_items: "There are no files for now. Just click <a href=\"%{url}\">here</a> to create the first one." no_items: "There are no files for now. Just click <a href=\"%{url}\">here</a> to create the first one."
asset: asset:
updated_at: Updated at updated_at: Updated at

View File

@ -171,7 +171,7 @@ fr:
snippets: Snippets snippets: Snippets
css_and_js: Style et javascript css_and_js: Style et javascript
images: Images images: Images
media: Media medias: Médias
fonts: Polices fonts: Polices
no_items: "Il n'existe pas de fichiers. Vous pouvez commencer par créer un <a href='%{url}'>ici</a>." no_items: "Il n'existe pas de fichiers. Vous pouvez commencer par créer un <a href='%{url}'>ici</a>."
asset: asset:

View File

@ -172,7 +172,7 @@ pt-BR:
css_and_js: CSS e Javascript css_and_js: CSS e Javascript
fonts: Fontes fonts: Fontes
images: Imagens images: Imagens
media: Mídia medias: Mídia
no_items: "Ainda não existem arquivos. Clique <a href=\"%{url}\">aqui</a> para criar o primeiro." no_items: "Ainda não existem arquivos. Clique <a href=\"%{url}\">aqui</a> para criar o primeiro."
asset: asset:
updated_at: Atualizado em updated_at: Atualizado em

View File

@ -1,13 +1,15 @@
BOARD: BOARD:
x moving to mongoid 2.0.0 rc.6 - duostack version
x accepts_nested_attributes (javascript part) - bugs
x check the theme uploader - editable_elements slug becomes nil
x release new version of CustomFields, ActsAsTree gems - pull requests #31 et #32
- editable_elements: inheritable: false (Mattias)
- 2 different sites on the same main domain (one in www, the other one in something else) (Raphael Costa)
BACKLOG: BACKLOG:
- add metadata to sites
- validation for custom fields - validation for custom fields
- new custom field types: - new custom field types:
- belongs_to => association - belongs_to => association
@ -191,3 +193,8 @@ x notify accounts when new instance of models (opt): none, one or many accounts.
x emails x emails
x tests x tests
x fix bug issue about (custom fields) x fix bug issue about (custom fields)
x moving to mongoid 2.0.0 rc.6
x accepts_nested_attributes (javascript part)
x check the theme uploader
x release new version of CustomFields, ActsAsTree gems
x add metadata to sites

View File

@ -10,7 +10,7 @@ module Locomotive
} }
end end
# Removees whitespace and quote charactets from the input # Removes whitespace and quote charactets from the input
def sanitized_string(string) def sanitized_string(string)
string.strip.gsub(/"/, '') string.strip.gsub(/"/, '')
end end