el id del sitio puede contener puntos
This commit is contained in:
parent
b3a7e3c2ea
commit
4c50eb786e
2 changed files with 4 additions and 9 deletions
|
@ -56,20 +56,15 @@ class Site
|
||||||
|
|
||||||
# Obtener el nombre del sitio
|
# Obtener el nombre del sitio
|
||||||
def name
|
def name
|
||||||
@name ||= @jekyll.config['source'].split('/').last
|
@name ||= File.basename(@jekyll.config['source'])
|
||||||
end
|
end
|
||||||
|
alias :id :name
|
||||||
|
alias :to_s :name
|
||||||
|
|
||||||
def name_with_i18n(lang)
|
def name_with_i18n(lang)
|
||||||
[name, lang].join('/')
|
[name, lang].join('/')
|
||||||
end
|
end
|
||||||
|
|
||||||
# El id es el sitio sin puntos, para no confundir al routeador de
|
|
||||||
# rails
|
|
||||||
def id
|
|
||||||
@id ||= name.tr('.', '-')
|
|
||||||
end
|
|
||||||
alias :to_s :id
|
|
||||||
|
|
||||||
def read
|
def read
|
||||||
@jekyll.read
|
@jekyll.read
|
||||||
end
|
end
|
||||||
|
|
|
@ -9,7 +9,7 @@ Rails.application.routes.draw do
|
||||||
|
|
||||||
get '/sites/:site_id/public/:type/:basename', to: 'sites#send_public_file'
|
get '/sites/:site_id/public/:type/:basename', to: 'sites#send_public_file'
|
||||||
|
|
||||||
resources :sites, only: [ :index, :show ] do
|
resources :sites, only: [:index, :show], constraints: { site_id: /[^\/]+/, id: /[^\/]+/ } do
|
||||||
resources :posts
|
resources :posts
|
||||||
resources :templates
|
resources :templates
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue