mirror of
https://github.com/codeninjasllc/discourse.git
synced 2025-03-22 04:45:46 -04:00
Add email as a sharing option
This commit is contained in:
parent
4413d2a92b
commit
48d5cb02c2
4 changed files with 20 additions and 4 deletions
app
assets/javascripts/discourse
models
config/locales
|
@ -19,13 +19,17 @@ Discourse.ShareLink = Discourse.Model.extend({
|
|||
|
||||
iconClass: function() {
|
||||
return Discourse.ShareLink.iconClasses[this.get('target')];
|
||||
}.property('target'),
|
||||
|
||||
openInPopup: function() {
|
||||
return( this.get('target') != 'email' );
|
||||
}.property('target')
|
||||
|
||||
});
|
||||
|
||||
Discourse.ShareLink.reopenClass({
|
||||
|
||||
supportedTargets: ['twitter', 'facebook', 'google+'],
|
||||
supportedTargets: ['twitter', 'facebook', 'google+', 'email'],
|
||||
|
||||
urlFor: function(target,link,title) {
|
||||
switch(target) {
|
||||
|
@ -35,6 +39,8 @@ Discourse.ShareLink.reopenClass({
|
|||
return this.facebookUrl(link,title);
|
||||
case 'google+':
|
||||
return this.googlePlusUrl(link);
|
||||
case 'email':
|
||||
return this.emailUrl(link,title);
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -50,10 +56,15 @@ Discourse.ShareLink.reopenClass({
|
|||
return ("https://plus.google.com/share?url=" + encodeURIComponent(link));
|
||||
},
|
||||
|
||||
emailUrl: function(link, title) {
|
||||
return ("mailto:?to=&subject=" + encodeURIComponent('[' + Discourse.SiteSettings.title + '] ' + title) + "&body=" + encodeURIComponent(link));
|
||||
},
|
||||
|
||||
iconClasses: {
|
||||
twitter: 'icon-twitter',
|
||||
facebook: 'icon-facebook-sign',
|
||||
'google+': 'icon-google-plus'
|
||||
'google+': 'icon-google-plus',
|
||||
email: 'icon-envelope-alt'
|
||||
},
|
||||
|
||||
popupHeights: {
|
||||
|
|
|
@ -1 +1,5 @@
|
|||
<a href="#" {{action sharePopup target href}} {{bindAttr title="title"}}><i {{bindAttr class=":icon iconClass"}}></i></a>
|
||||
{{#if openInPopup}}
|
||||
<a href="#" {{action sharePopup target href}} {{bindAttr title="title"}}><i {{bindAttr class=":icon iconClass"}}></i></a>
|
||||
{{else}}
|
||||
<a {{bindAttr href="href"}} {{bindAttr title="title"}} target="_blank"><i {{bindAttr class=":icon iconClass"}}></i></a>
|
||||
{{/if}}
|
|
@ -19,7 +19,7 @@ class SiteSetting < ActiveRecord::Base
|
|||
client_setting(:traditional_markdown_linebreaks, false)
|
||||
client_setting(:top_menu, 'latest|hot|new|unread|favorited|categories')
|
||||
client_setting(:post_menu, 'like|edit|flag|delete|share|bookmark|reply')
|
||||
client_setting(:share_links, 'twitter|facebook|google+')
|
||||
client_setting(:share_links, 'twitter|facebook|google+|email')
|
||||
client_setting(:track_external_right_clicks, false)
|
||||
client_setting(:must_approve_users, false)
|
||||
client_setting(:ga_tracking_code, "")
|
||||
|
|
|
@ -11,6 +11,7 @@ en:
|
|||
twitter: 'share this link on Twitter'
|
||||
facebook: 'share this link on Facebook'
|
||||
google+: 'share this link on Google+'
|
||||
email: 'send this link in an email'
|
||||
|
||||
edit: 'edit the title and category of this topic'
|
||||
not_implemented: "That feature hasn't been implemented yet, sorry!"
|
||||
|
|
Loading…
Reference in a new issue