-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Emoji encoding 3123 #3161
Emoji encoding 3123 #3161
Changes from 8 commits
278243b
c71b392
1e08b0b
953c96e
bcc07ef
6d294ed
012a920
b0377da
5ecdc9d
83a0ffb
a3a2514
ceb6b67
b012269
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -64,51 +64,13 @@ | |
</script> | ||
|
||
<%= javascript_include_tag "dragdrop" %> | ||
<script src="/lib/emoji.js" type="text/javascript"></script> | ||
<script src="/assets/emoji.js" type="text/javascript"></script> | ||
<script> | ||
$('#comment-form').bind('ajax:beforeSend', function(event){ | ||
$("#text-input").prop('disabled',true) | ||
$("#comment-form .btn-primary").button('loading',true); | ||
}); | ||
|
||
(function() { | ||
|
||
var at_config = { | ||
at: "@", | ||
callbacks: { | ||
remoteFilter: function(query, callback) { | ||
$.getJSON("/api/srch/profiles?srchString=" + query, {}, function(data) { | ||
if (data.hasOwnProperty('items') && data.items.length > 0) { | ||
callback(data.items.map(function(i) { return i.docTitle })); | ||
} | ||
}); | ||
} | ||
}, | ||
limit: 20 | ||
}, | ||
hashtags_config = { | ||
at: "#", | ||
callbacks: { | ||
remoteFilter: function(query, callback) { | ||
if (query != ''){ | ||
$.post('/tag/suggested/' + query, {}, function(response) { | ||
callback(response.map(function(tagnames){ return tagnames })); | ||
}); | ||
} | ||
} | ||
}, | ||
limit: 20 | ||
}, | ||
emojis_config = { | ||
at: ':', | ||
data: Object.keys(emoji).map(function(name){ return {'name': name, 'value': emoji[name]} }), | ||
displayTpl: "<li>${value} ${name}</li>", | ||
insertTpl: ":${name}:", | ||
limit: 100 | ||
} | ||
|
||
$('textarea#text-input').atwho(at_config).atwho(hashtags_config).atwho(emojis_config); | ||
|
||
$('#comment-form').bind('ajax:success', function(e, data, status, xhr){ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you confirm that the error message here still works without the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think adding it back in may be easier than testing it... i know you can get it to error either by turning off your locally running app OR by submitting a real unicode emoji (not just a There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hi @jywarren, I moved the code for error message back into the function athwho_autocomplete script! Quick question --- so the public folder is in .gitignore-- how do we then make sure we're including /lib/emoji.js? I just realized it wasn't getting included when I made that code change above then freaked out momentarily because "emoji " wasn't defined then realized it was because the file is in .gitignore so I had to go add it in again. Thanks again for all of your help! I'll go ahead and push up changes--we just need to make sure that /lib/emoji.js gets included and it's currently in .gitignore. |
||
$('#text-input').prop('disabled',false); | ||
$('#text-input').val(''); | ||
|
@@ -127,8 +89,6 @@ | |
$('#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(); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
development: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hi, this is looking great, but would you mind removing the this file from your PR, as it's unrelated to your changes? Thanks! |
||
adapter: sqlite3 | ||
database: development.sqlite | ||
|
||
production: | ||
adapter: sqlite3 | ||
database: production.sqlite | ||
|
||
test: | ||
adapter: sqlite3 | ||
database: test.sqlite |
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I'd prefer not to include the entire emoji.js file here, and to leave it in the
/lib/
folder. These files are compiled together, and I think we can treat the emoji file as a static asset, so the system doesn't have to process it (since it's so big!). But we should includecomment-autocomplete.js
here -- i actually don't see that one in the PR, did you forget to add it?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @jywarren I think that I did a poor job naming the emoji script, in that it is named the same as the file that held the emoji json. In this version of the code, emoji.js is the script living in app/assets/javascripts/emoji.js that includes within it the defined emojis (not being read from public, just defined in a var), and deleted the file from public/lib/emoji.js since it would not be needed. I can remove the require statement from application.js.
I'm not sure about the comment-autocomplete.js? I had not done anything with that, when I add it in to application.js I get the error
couldn't find file 'comment-autocomplete.js' with type 'application/javascript'
so perhaps I need to fetch more recent changes and do a rebase? I believe I have the config/database.yml.sqlite removed properly now so once I clear up the details above, I'll resubmit.Thanks again for all of your help! And the callout in the community checkin, it is really wonderful to have the opportunity to work with you on this :)