Skip to content

Commit

Permalink
added link to "title suggestion" in comment editor (publiclab#2155)
Browse files Browse the repository at this point in the history
  • Loading branch information
ViditChitkara authored and jywarren committed Jan 29, 2018
1 parent 1f036bb commit 051ecb2
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion app/views/comments/_form.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,16 @@
$('#comment-form .control-group .help-block ').remove()
$('#comment-form .control-group').append('<span class="help-block ">Error: there was a problem.</span>')
})

function insertTitleSuggestionTemplate() {
var element = $('#text-input');
var currentText = $('#text-input').val().trim();
var template = "\n[propose:title]Propose your title here[/propose]";
if(currentText.length == 0)
template = "[propose:title]Propose your title here[/propose]";
var newText = currentText+template;
element.val(newText);
}
</script>

<div class="control-group">
Expand All @@ -105,7 +115,8 @@
<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="$('#who-is-notified-form').toggle()"><%= t('comments._form.notifications') %></a> |
<a onClick = "insertTitleSuggestionTemplate()">Propose Title</a>
</span>
</div>

Expand Down

0 comments on commit 051ecb2

Please sign in to comment.