Permalink
Switch branches/tags
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
106 lines (86 sloc) 4.39 KB
<form id="comment-form" data-remote="true" class="well" <% if !local_assigns[:is_answer].blank? %> action= "/answers/create/<%= @node.nid %>" <% elsif !local_assigns[:aid].blank? %> action= "/comment/answer_create/<%= aid %>" <% else %> action="/comment/create/<%= @node.nid %><%= "?type=question" if local_assigns[:type]=="question" %>" <% end %> <% if local_assigns[:aid].blank? %>method="post"<% end %>>
<h4 style="margin-top:0;"><%= title %><% if current_user && current_user.id == @node.uid %> <small><a target="_blank" href="https://publiclab.org/comment-templates">Add a response template</a></small><% end %></h4>
<style>
#imagebar {
width:100%;
}
</style>
<% if params[:controller] == 'questions' %>
<%= render :partial => "editor/toolbar" %>
<% end %>
<div class="form-group dropzone">
<%
body = params[:body]
# Look for comment templates
if params[:body].nil? && @node && @node.has_power_tag('comment-template')
body = Node.find_by(slug: @node.power_tag('comment-template')).try(:body)
end
%>
<textarea style="border: 1px solid #bbb;border-bottom-left-radius: 0;border-bottom-right-radius: 0;border-bottom: 0;padding: 10px;" onFocus="editing=true" name="body" class="form-control" id="text-input" rows="6" cols="40" placeholder="<%= placeholder %>"><%= body %></textarea>
<div id="imagebar">
<div id="create_progress" style="display:none;" class="progress progress-striped active pull-right">
<div id="create_progress-bar" class="progress-bar" style="width: 0%;"></div>
</div>
<p>
<span id="create_uploading" class="uploading" style="display:none;">
<%= t('comments._form.uploading') %>
</span>
<span id="create_prompt" class="prompt">
<span style="padding-right:4px;float:left;" class="hidden-xs">
<%= raw t('comments._form.drag_and_drop') %>
</span>
<!-- http://stackoverflow.com/questions/11235206/twitter-bootstrap-form-file-element-upload-button -->
<label id="input_label" class="" for="fileinput">
<input id="fileinput" type="file" name="image[photo]" style="display:none;" />
<a class="hidden-xs">choose one</a>
<span class="visible-xs">
<i class="fa fa-upload"></i>
<a><%= t('comments._form.upload_image') %></a>
</span>
</label>
</span>
</p>
</div>
</div>
<div class="well col-md-11" id="preview" style="background:white;display: none">
</div>
<script>
jQuery(document).ready(function() {
$E.initialize();
});
$D = {
uid: <%= current_user.uid %>,
type: 'comment'
}
$('#input_label').click(function(e){
$E.initialize({});
});
</script>
<%= javascript_include_tag "dragdrop" %>
<script src="/emoji.js" type="text/javascript"></script>
<script src="/assets/atwho_autocomplete.js" type="text/javascript"></script>
<%= javascript_include_tag "comment.js" %>
<div class="control-group">
<button type="submit" class="btn btn-primary"><%= t('comments._form.publish') %></button>
<% if local_assigns[:comment] %>
<a class="btn btn-default preview-btn" onClick="$('#c<%= comment.cid %>preview').toggle();
$('#c<%= comment.cid %>text-input').toggle();
$('#c<%= comment.cid %>edit .preview-btn').button('toggle');
$E.generate_preview('c<%= comment.cid %>preview',$('#c<%= comment.cid %>text-input').val())">
<%= t('comments._form.preview') %>
</a>
<a class="btn btn-default" onClick="$('#c<%= comment.cid %>show').toggle();$('#c<%= comment.cid %>edit').toggle()"><%= t('comments._form.cancel') %></a>
<% else %>
<a id="preview-btn" class="btn btn-default" onClick="$E.toggle_preview(this.id)"><%= t('comments._form.preview') %></a>
<% end %>
<span style="color:#888;"> &nbsp;
<br class="visible-xs" /><%= raw t('comments._form.logged_in', :username => current_user.username) %> |
<a target="_blank" href="/wiki/authoring-help#Formatting"><%= t('comments._form.formatting') %></a> |
<a onClick="$('#who-is-notified-form').toggle()"><%= t('comments._form.notifications') %></a> |
<a onClick = "insertTitleSuggestionTemplate()">Propose Title</a>
</span>
</div>
<p id="who-is-notified-form" style="display:none;color:#888;">
<%= t('comments._form.email_notifications') %>
</p>
</form>