diff --git a/app/models/post/template_field.rb b/app/models/post/template_field.rb index 890d8c28..b11f31c6 100644 --- a/app/models/post/template_field.rb +++ b/app/models/post/template_field.rb @@ -107,6 +107,20 @@ class Post contents.fetch('open', value.count < 2) end + # Determina si los valores del campo serán públicos después + # + # XXX Esto es solo una indicación, el theme Jekyll tiene que + # respetarlos por su lado luego + def public? + # Todos los campos son públicos a menos que se indique lo + # contrario + simple? || contents.fetch('public', true) + end + + def private? + !public? + end + def human h = key.humanize h = h + ' *' if required? diff --git a/app/views/posts/_form.haml b/app/views/posts/_form.haml index de6097d2..7e2b00d7 100644 --- a/app/views/posts/_form.haml +++ b/app/views/posts/_form.haml @@ -79,6 +79,8 @@ - next unless type = template.type .form-group = label_tag "post_#{template}", template.help.present? ? template.help : template.human + - if template.private? + %small.text-muted.form-text.pull-right= t('posts.private') - name = "post[#{template}]" - value = @post.new? ? template.values : @post.get_front_matter(template) - case type diff --git a/config/locales/en.yml b/config/locales/en.yml index 0a284415..d9b9573d 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -204,5 +204,6 @@ en: date: 'Post needs a valid date' invalid: 'This field is required!' open: 'Tip: You can add new options by typing them and pressing Enter' + private: 'The values of this field will remain private' select: placeholder: 'Type to filter available options' diff --git a/config/locales/es.yml b/config/locales/es.yml index cc46cdc8..a82e9404 100644 --- a/config/locales/es.yml +++ b/config/locales/es.yml @@ -200,5 +200,6 @@ es: date: 'Necesita una fecha' invalid: '¡Este campo es obligatorio!' open: 'Nota: Puedes agregar más opciones a medida que las escribes y presionas Entrar' + private: 'Los valores de este campo serán privados' select: placeholder: 'Empieza a escribir para filtrar las opciones disponibles'