diff --git a/app/views/templates/comment.jst b/app/views/templates/comment.jst index d6b355387..e42f601a7 100644 --- a/app/views/templates/comment.jst +++ b/app/views/templates/comment.jst @@ -18,9 +18,7 @@ -
- <%= text %> -
from markdown + text = text || "" + return mentionify( + hashtagify( + markdownify(text) + ) + ) + } + + function markdownify(text){ + //markdown returns falsy when it performs no substitutions, apparently... + return markdown.toHTML(text) || text + } + + function hashtagify(text){ + var utf8WordCharcters =/(\s|^|>)#([\u0080-\uFFFF|\w|-]+|<3)/g + return text.replace(utf8WordCharcters, function(hashtag, preceeder, tagText) { + return preceeder + "#" + tagText + "" + }) + } + + function mentionify(text) { + var mentionRegex = /@\{([^;]+); ([^\}]+)\}/g + return text.replace(mentionRegex, function(mentionText, fullName, diasporaId) { + var personId = _.find(model.get("mentioned_people"), function(person){ + return person.diaspora_id == diasporaId + }).id + + + return "" + fullName + "" + }) + return text + } + } +}) + + +app.views.StatusMessage = app.views.Content.extend({ + template_name : "#status-message-template" +}); + +app.views.Reshare = app.views.Content.extend({ + template_name : "#reshare-template" +}); + +app.views.ActivityStreams__Photo = app.views.Content.extend({ + template_name : "#activity-streams-photo-template" +}); + diff --git a/public/javascripts/app/views/post_content_view.js b/public/javascripts/app/views/post_content_view.js deleted file mode 100644 index 8c47cb2d0..000000000 --- a/public/javascripts/app/views/post_content_view.js +++ /dev/null @@ -1,61 +0,0 @@ -(function(){ - var postContentView = app.views.StreamObject.extend({ - presenter : function(){ - var model = this.model - return _.extend(this.defaultPresenter(), { - text : metafyText(model.get("text")) - }) - - function metafyText(text) { - //we want it to return at least a
from markdown - text = text || "" - return mentionify( - hashtagify( - markdownify(text) - ) - ) - } - - function markdownify(text){ - //markdown returns falsy when it performs no substitutions, apparently... - return markdown.toHTML(text) || text - } - - function hashtagify(text){ - var utf8WordCharcters =/(\s|^|>)#([\u0080-\uFFFF|\w|-]+|<3)/g - return text.replace(utf8WordCharcters, function(hashtag, preceeder, tagText) { - return preceeder + "#" + tagText + "" - }) - } - - function mentionify(text) { - var mentionRegex = /@\{([^;]+); ([^\}]+)\}/g - return text.replace(mentionRegex, function(mentionText, fullName, diasporaId) { - var personId = _.find(model.get("mentioned_people"), function(person){ - return person.diaspora_id == diasporaId - }).id - - - return "" + fullName + "" - }) - return text - } - } - }) - - - app.views.StatusMessage = postContentView.extend({ - template_name : "#status-message-template" - }); - - app.views.Reshare = postContentView.extend({ - template_name : "#reshare-template" - }); - - app.views.ActivityStreams__Photo = postContentView.extend({ - template_name : "#activity-streams-photo-template" - }); -})(); - - -
from markdown + text = text || "" + return mentionify( + hashtagify( + markdownify(text) + ) + ) + } + + function markdownify(text){ + //markdown returns falsy when it performs no substitutions, apparently... + return markdown.toHTML(text) || text + } + + function hashtagify(text){ + var utf8WordCharcters =/(\s|^|>)#([\u0080-\uFFFF|\w|-]+|<3)/g + return text.replace(utf8WordCharcters, function(hashtag, preceeder, tagText) { + return preceeder + "#" + tagText + "" + }) + } + + function mentionify(text) { + var mentionRegex = /@\{([^;]+); ([^\}]+)\}/g + return text.replace(mentionRegex, function(mentionText, fullName, diasporaId) { + var personId = _.find(model.get("mentioned_people"), function(person){ + return person.diaspora_id == diasporaId + }).id + + + return "" + fullName + "" + }) + return text + } + } +}) + + +app.views.StatusMessage = app.views.Content.extend({ + template_name : "#status-message-template" +}); + +app.views.Reshare = app.views.Content.extend({ + template_name : "#reshare-template" +}); + +app.views.ActivityStreams__Photo = app.views.Content.extend({ + template_name : "#activity-streams-photo-template" +}); + diff --git a/public/javascripts/app/views/post_content_view.js b/public/javascripts/app/views/post_content_view.js deleted file mode 100644 index 8c47cb2d0..000000000 --- a/public/javascripts/app/views/post_content_view.js +++ /dev/null @@ -1,61 +0,0 @@ -(function(){ - var postContentView = app.views.StreamObject.extend({ - presenter : function(){ - var model = this.model - return _.extend(this.defaultPresenter(), { - text : metafyText(model.get("text")) - }) - - function metafyText(text) { - //we want it to return at least a
from markdown - text = text || "" - return mentionify( - hashtagify( - markdownify(text) - ) - ) - } - - function markdownify(text){ - //markdown returns falsy when it performs no substitutions, apparently... - return markdown.toHTML(text) || text - } - - function hashtagify(text){ - var utf8WordCharcters =/(\s|^|>)#([\u0080-\uFFFF|\w|-]+|<3)/g - return text.replace(utf8WordCharcters, function(hashtag, preceeder, tagText) { - return preceeder + "#" + tagText + "" - }) - } - - function mentionify(text) { - var mentionRegex = /@\{([^;]+); ([^\}]+)\}/g - return text.replace(mentionRegex, function(mentionText, fullName, diasporaId) { - var personId = _.find(model.get("mentioned_people"), function(person){ - return person.diaspora_id == diasporaId - }).id - - - return "" + fullName + "" - }) - return text - } - } - }) - - - app.views.StatusMessage = postContentView.extend({ - template_name : "#status-message-template" - }); - - app.views.Reshare = postContentView.extend({ - template_name : "#reshare-template" - }); - - app.views.ActivityStreams__Photo = postContentView.extend({ - template_name : "#activity-streams-photo-template" - }); -})(); - - -