Skip to content

Commit

Permalink
delete defunct function, fix indentation & spacing publiclab#8670
Browse files Browse the repository at this point in the history
  • Loading branch information
noi5e committed Dec 29, 2020
1 parent f34bc6b commit 68f820c
Showing 1 changed file with 49 additions and 64 deletions.
113 changes: 49 additions & 64 deletions app/views/comments/_form.html.erb
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
<div class="comment-form-wrapper" style="background-color:#f8f8f8; border: 1px solid #e7e7e7;padding: 18px;">
<div class="card-body">
<form class="comment-form" id="comment-form" data-remote="true" action="/comment/create/<%= @node.nid %><%= "?type=question" if local_assigns[:type]=="question" %>" <% if local_assigns[:aid].blank? %>method="post"<% end %>>

<% if current_user && current_user.id == @node.uid %>
<span class="pull-right" style="color:#ccc;"><a target="_blank" href="https://publiclab.org/comment-templates">Add a template</a></span>
<span class="pull-right" style="color:#ccc;">
<a target="_blank" href="https://publiclab.org/comment-templates">Add a template</a>
</span>
<% end %>

<h4 style="margin-top:0;"><%= title %></h4>

<style>
#imagebar {
width:100%;
Expand All @@ -19,16 +18,11 @@
padding-top: 10px;
}
</style>


<%= render :partial => "editor/toolbar" %>
<% if local_assigns[:reply_to].present? %>
<%= hidden_field_tag :reply_to, local_assigns[:reply_to] %>
<% end %>

<div class="form-group dropzone">

<%
body = body || params[:body]
# Look for comment templates
Expand All @@ -45,11 +39,9 @@
<% end %>
<textarea aria-label="Comment Text" 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 float-right">
<div id="create_progress-bar" class="progress-bar progress-bar-striped progress-bar-animated" style="width: 0%;"></div>
</div>

<p>
<span id="create_uploading" class="uploading" style="display:none;">
<%= translation('comments._form.uploading') %>
Expand All @@ -71,61 +63,54 @@
</label>
</span>
</p>
</div>
</div>
<div id="preview" style="background: white; display: none;">
</div>
<script>
jQuery(document).ready(function() {
$E.initialize();
});
$D = {
uid: <%= current_user.uid if current_user %>,
type: 'comment'
};

function handleClick() {
$D.selected = $(event.target.closest('div.comment-form-wrapper'));
$E.refresh();
}
</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"><%= translation('comments._form.publish') %></button>
<% if local_assigns[:comment] %>
<a class="btn btn-outline-secondary 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())">
<%= translation('comments._form.preview') %>
</a>
<a class="btn btn-outline-secondary" onClick="$('#c<%= comment.cid %>show').toggle();$('#c<%= comment.cid %>edit').toggle()"><%= translation('comments._form.cancel') %></a>
<% else %>
<a class="btn btn-outline-secondary preview-btn>" id="post_comment" data-previewing-text="Hide Preview" onClick="handleClick();$E.toggle_preview()"><%= translation('comments._form.preview') %></a>
<% end %>

</div>
</div>

<div id="preview" style="background: white; display: none;">
</div>
<script>
jQuery(document).ready(function() {
$E.initialize();
});
$D = {
uid: <%= current_user.uid if current_user %>,
type: 'comment'
};

function handleClick() {
$D.selected = $(event.target.closest('div.comment-form-wrapper'));
console.log($D.selected);
$E.refresh();
}

$('#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"><%= translation('comments._form.publish') %></button>
<% if local_assigns[:comment] %>
<a class="btn btn-outline-secondary 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())">
<%= translation('comments._form.preview') %>
</a>
<a class="btn btn-outline-secondary" onClick="$('#c<%= comment.cid %>show').toggle();$('#c<%= comment.cid %>edit').toggle()"><%= translation('comments._form.cancel') %></a>
<% else %>
<a class="btn btn-outline-secondary preview-btn>" id="post_comment" data-previewing-text="Hide Preview" onClick="handleClick();$E.toggle_preview()"><%= translation('comments._form.preview') %></a>
<% end %>

<span style="color:#888;"> &nbsp;
<br class="d-md-none" /><%= raw translation('comments._form.logged_in', :username => current_user.username) %> &nbsp;
<a aria-label="Authoring Help" target="_blank" href="/wiki/authoring-help#Formatting"><i class="fa fa-question-circle"></i></a> &nbsp;
<a onClick="changeNotificationIcon('#who-is-notified-form', '#bell')"><i id="bell" class="fa fa-bell-o"></i></a>
</span>
</div>
<span style="color:#888;"> &nbsp;
<br class="d-md-none" /><%= raw translation('comments._form.logged_in', :username => current_user.username) %> &nbsp;
<a aria-label="Authoring Help" target="_blank" href="/wiki/authoring-help#Formatting"><i class="fa fa-question-circle"></i></a> &nbsp;
<a onClick="changeNotificationIcon('#who-is-notified-form', '#bell')"><i id="bell" class="fa fa-bell-o"></i></a>
</span>
</div>

<p id="who-is-notified-form" style="display:none;color:#888;">
<%= translation('comments._form.email_notifications') %>
</p>
<p id="who-is-notified-form" style="display:none;color:#888;">
<%= translation('comments._form.email_notifications') %>
</p>
</form>
</div>
</div>

0 comments on commit 68f820c

Please sign in to comment.