<% #-- # Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies) # Copyright (C) 2008 Johan Sørensen # Copyright (C) 2008 Tor Arne Vestbø # Copyright (C) 2009 Fabio Akita # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . #++ %> <% comment ||= nil -%> <% sha1 ||= nil -%> <% parent ||= nil -%>

<%= t("views.comments.add_title") %>:

<% if logged_in? -%> <%= error_messages_for :comment -%> <% form_for(:comment, :url => new_polymorphic_comment_path(parent, comment || Comment.new)) do |f| -%> <% if sha1 -%> <%= f.hidden_field :sha1, :value => sha1 -%> <% end -%>

<%= f.label :body, t("views.comments.body") -%> (<%= markdown_hint -%>)
<%= f.text_area :body, :class => "text medium" -%>

<%= render_markdown_help %>
<%- if comment_applies_to_merge_request?(parent) -%>

<%= f.label :state, 'Status' %>
<%= f.select :state, statuses_for_merge_request_for_select(parent), :selected => parent.status_tag.to_s, :include_blank => true -%>

<%- if !parent.watched_by?(current_user) -%> <%= label_tag(:add_to_favorites, "Start watching") %>: <%= check_box_tag(:add_to_favorites, "on") %>
If you later on want to stop watching this <%= parent.class.human_name -%>, simply click the button on the merge request labelled "Stop watching" at the top of the page <%- end -%>

<%- end -%>

<%- if MergeRequest === parent && (logged_in? && parent.resolvable_by?(current_user)) -%> <%= f.submit t("views.comments.update_or_add") -%> <% else -%> <%= f.submit t("views.comments.add") -%> <% end -%>

<% end -%> <% else -%>

<%= link_to t("views.sessions.login"), new_sessions_path -%> or <%= link_to t("views.users.create"), new_user_path -%> to post a comment

<% end -%>