SUSE/hackweek

View on GitHub
app/views/comments/_form.html.haml

Summary

Maintainability
Test Coverage
= render :partial => 'comments/help'

= form_for [parent, comment], html: { role: "form" } do |f|
  %p
    .comment-form-heading
      %ul.nav.nav-tabs
        %li.active.show-source{ role: :presentation }
          %a{ href: "#markdown-source#{id}", role: :tab, data: { toggle: :tab } } Edit
        %li.show-preview{ role: :presentation }
          %a{ href: "#markdown-preview#{id}", role: :tab, data: { toggle: :tab } } Preview
      .btnbar
        = render 'shared/editor_buttons'
    .comment-form-body
      .tab-content
        .tab-pane.active.fade.in{ role: 'tab-pane', id: "markdown-source#{id}" }
          = f.text_area :text, :placeholder => "Your comment. You can use markdown.", :class => 'form-control input-lg markdown-source-text', :required => "required"
        .tab-pane.fade{ role: 'tab-pane', id: "markdown-preview#{id}" }
          .loading-spinner
            = icon('fas', 'spinner pulse 3x')
          .preview-contents.hidden
    %p
      = f.submit(class: "btn btn-success pull-right")