railsfrance/railsfrance.org

View on GitHub
app/views/questions/show.html.haml

Summary

Maintainability
Test Coverage
- feed("RailsFrance » Réponses", question_url(@question, :atom))
- set_meta_tags title: @question.title, description: @question.description.truncate(150)
%section.worldMap
  %header#sectionHeader
    %hgroup
      %h1
        %span 
          Les
        Questions
  %nav#secondaryNav
    %div#secondaryNavContainer
      %ul
        %li
          =link_to "RSS", question_url(@question, :atom), class: "navButton rss", target: "_blank"
        %li
          = link_to "Retour aux questions", questions_path, class: "navButton back"
        - if can? :update, @question
          %li
            = link_to "Editer", edit_question_path(@question), class: "navButton"
  .theContent
    %aside.votesContainer
      - if user_signed_in?
        - if can? :vote, @question
          = link_to "Vote up", vote_question_path(vote: "up"), class: "voteUp"
          .votesNumber
            #{@question.votes}
          = link_to "Vote down", vote_question_path(vote: "down"), class: "voteDown"
        -else
          = link_to "Vote up", "#", class: "voteUp disabled"
          .votesNumber
            #{@question.votes}
          = link_to "Vote down", "#", class: "voteDown disabled"
      -else
        = link_to "Vote up", "#", class: "voteUp disabled"
        .votesNumber
          #{@question.votes}
        = link_to "Vote down", "#", class: "voteDown disabled"
    %article#theQuestion
      %hgroup
        %h1
          = @question.title
      %div.theQuestionContent.userMarkdown
        = markdown @question.description
        = tag_box @question.tags
        .postHourUser
          %span
            - if @question.created_at != @question.updated_at
              Editée il y a #{distance_of_time_in_words_to_now(@question.updated_at)}
            - else
              Posée il y a #{distance_of_time_in_words_to_now(@question.created_at)}
          par #{link_to @question.user_username, user_path(@question.user)}
          = image_tag @question.user.gravatar_url
    %section#questionAnswer
      - if @answers.empty?
        %p.noAnwser
          Aucune réponse
      - else
        %ul.answersList.theContentList
          = render @answers
        .pagination
          = paginate @answers
      = simple_form_for @answer, url: question_answers_path(@question), html: { method: :post, class: "answerForm" } do |f|
        = f.input :description, as: :wysiwyg, required: false
        %p.markdownLink La syntaxe #{link_to "Markdown", "http://github.github.com/github-flavored-markdown/", target: "_blank", id: "markdownHelp"} est supportée
        = f.button :submit
      = render 'markdown/markdown'