Skip to content

Commit 9ebe751

Browse files
committed
Merge remote-tracking branch 'origin/master' into race
2 parents b46b116 + 9f9bc99 commit 9ebe751

File tree

3 files changed

+92
-14
lines changed

3 files changed

+92
-14
lines changed

lib/jekyll-admin/data_file.rb

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class DataFile
1616
def initialize(id)
1717
@id ||= File.extname(id).empty? ? "#{id}.yml" : id
1818
end
19-
alias_method :path, :id
19+
alias_method :relative_path, :id
2020

2121
def exists?
2222
@exists ||= File.exist?(absolute_path)
@@ -52,15 +52,15 @@ def title
5252
@title ||= Jekyll::Utils.titleize_slug(slug.tr("_", "-"))
5353
end
5454

55-
# Return path relative to configured `data_dir`
56-
def relative_path
57-
id.sub("/#{DataFile.data_dir}/", "")
55+
# Returns path relative to site source
56+
def path
57+
ensure_leading_slash(File.join(DataFile.data_dir, relative_path))
5858
end
5959

60-
# Return the absolute path to given data file
6160
def absolute_path
62-
sanitized_path id
61+
sanitized_path(path)
6362
end
63+
alias_method :file_path, :absolute_path
6464

6565
# Mimics Jekyll's native to_liquid functionality by returning a hash
6666
# of data file metadata
@@ -69,13 +69,10 @@ def to_liquid
6969
end
7070

7171
def self.all
72-
data_dir = sanitized_path DataFile.data_dir
73-
files = Dir["#{data_dir}/**/*.{#{EXTENSIONS.join(",")}}"].reject do |d|
74-
File.directory?(d)
75-
end
76-
77-
files.map do |path|
78-
new path_without_site_source(path)
72+
data_dir = Jekyll.sanitized_path(JekyllAdmin.site.source, DataFile.data_dir)
73+
data_dir = Pathname.new(data_dir)
74+
Dir["#{data_dir}/**/*.{#{EXTENSIONS.join(",")}}"].map do |path|
75+
new(Pathname.new(path).relative_path_from(data_dir).to_s)
7976
end
8077
end
8178

spec/jekyll-admin/data_file_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
let(:data_dir) { "_data" }
33
let(:relative_path) { "data_file.yml" }
44
let(:absolute_path) { in_source_dir(relative_path) }
5-
let(:id) { "/#{data_dir}/data_file.yml" }
5+
let(:id) { "data_file.yml" }
66

77
subject { described_class.new(id) }
88

src/constants/lang/es.js

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
// mensajes en linea
2+
export const getDeleteMessage = (filename) =>
3+
`¿Estás seguro que quieres borrar "${filename}" ?`;
4+
5+
export const getLeaveMessage = () =>
6+
"¿Hay cambios en esta página que no han sido guardados. ¿Seguro que quieres salir?";
7+
8+
export const getNotFoundMessage = (type) =>
9+
`No se encontraron ${type}.`;
10+
11+
export const getOverrideMessage = (filename) =>
12+
`${filename} sera reemplazado. ¿Gustas continuar?`;
13+
14+
// mensajes de notificación
15+
export const getParserErrorMessage = () => "Error de parsing";
16+
17+
export const getSuccessMessage = () => "‘Éxito";
18+
19+
export const getErrorMessage = () => "Error";
20+
21+
export const getUploadSuccessMessage = (filename) =>
22+
`${filename} ha sido subido.`;
23+
24+
export const getUploadErrorMessage = () =>
25+
"Ocurrió un error subiendo el archivo.";
26+
27+
export const getFetchErrorMessage = (filename) =>
28+
`No se pudo descargar ${filename}`;
29+
30+
export const getUpdateErrorMessage = (filename) =>
31+
`No se pudo actualizar ${filename}`;
32+
33+
export const getDeleteErrorMessage = (filename) =>
34+
`No se pudo borrar ${filename}`;
35+
36+
// mensajes de validación
37+
export const getTitleRequiredMessage = () =>
38+
"Se requiere de un título.";
39+
40+
export const getFilenameRequiredMessage = () =>
41+
"Se requiere de un nombre de archivo.";
42+
43+
export const getContentRequiredMessage = () =>
44+
"Se requiere contenido.";
45+
46+
export const getFilenameNotValidMessage = () =>
47+
"El nombre del archivo no es válido.";
48+
49+
// títulos en la barra lateral
50+
export const sidebar = {
51+
pages: 'Páginas',
52+
posts: 'Artículos',
53+
datafiles: 'Archivos de Datos',
54+
staticfiles: 'Archivos Estáticos',
55+
configuration: 'Configuración'
56+
};
57+
58+
// Etiquetas en los botones
59+
export const labels = {
60+
save: {
61+
label: 'Guardar',
62+
triggeredLabel: 'Guardado'
63+
},
64+
create: {
65+
label: 'Crear',
66+
triggeredLabel: 'Creado'
67+
},
68+
delete: {
69+
label: 'Borrar'
70+
},
71+
view: {
72+
label: 'Ver'
73+
},
74+
upload: {
75+
label: 'Subir archivo'
76+
},
77+
viewToggle: {
78+
label: 'Cambiar interface al editor GUI',
79+
triggeredLabel: 'Cambiar interface al editor Raw'
80+
}
81+
};

0 commit comments

Comments
 (0)