app/views/elabs/comments/_form.html.haml in elabs-4.0.0 vs app/views/elabs/comments/_form.html.haml in elabs-5.0.0

- old
+ new

@@ -1,43 +1,47 @@ -# You must provide an url for the form -%h2= _('Leave a comment') +- unless user_is_author_of(entity) + %h2= _('Leave a comment') -%p= _('You want to react to this content or ask something to the author? Just leave a comment here!') + %p= _('You want to react to this content or ask something to the author? Just leave a comment here!') -.alert.alert--info - %p= _("Note that the comments are not publicly visible, so don't worry if you don't see yours.") - %p= _("All the information you give will only be visible to the author. We don't share anything with anyone.") + .alert.alert--info + %p= _("Note that the comments are not publicly visible, so don't worry if you don't see yours.") + %p= _("All the information you give will only be visible to the author. We don't share anything with anyone.") -= form_for new_comment, url: url do |f| - - if new_comment.errors.any? - .error - %h2= format(n_('An error prevented your comment from being saved:', - '%<nb>i errors prevented your comment from being saved:', - new_comment.errors.count), nb: new_comment.errors.count) - %ul - - new_comment.errors.full_messages.each do |message| - %li= message + = form_for new_comment, url: url do |f| + - if new_comment.errors.any? + .error + %h2= format(n_('An error prevented your comment from being saved:', + '%<nb>i errors prevented your comment from being saved:', + new_comment.errors.count), nb: new_comment.errors.count) + %ul + - new_comment.errors.full_messages.each do |message| + %li= message - - if user_signed_in? - .alert.alert--info - -# haml-lint:disable LineLength - = format(_('This comment will be posted as "%<name>s". By submitting this comment, you agree to be recontacted by the author.'), - name: current_user.username) - -# haml-lint:enable LineLength - - else + - if user_signed_in? + .alert.alert--info + -# haml-lint:disable LineLength + = format(_('This comment will be posted as "%<name>s". By submitting this comment, you agree to be recontacted by the author.'), + name: current_user.username) + -# haml-lint:enable LineLength + - else + .field + = f.label :name + .field-input= f.text_field :name, required: true + .field + = f.label :email + .field-input= f.text_field :email, required: true, type: :email + .field + .field-input + = f.check_box :allow_contact + = f.label :allow_contact, _('I agree to be recontacted') .field - = f.label :name - .field-input= f.text_field :name, required: true - .field - = f.label :email - .field-input= f.text_field :email, required: true - .field - .field-input - = f.check_box :allow_contact - = f.label :allow_contact, _('I agree to be recontacted') - .field - = f.label :comment - .field-input= f.text_area :comment, required: true - .actions - .actions-buttons - = f.submit 'Save', class: 'btn btn--save' + = f.label :comment + .field-input= f.text_area :comment, required: true, class: 'textarea--large' + + = render 'elabs/layouts/form_honeypot', field: 'body' + + .actions + .actions-buttons + = f.submit 'Save', class: 'btn btn--save'