Skip to content

Commit

Permalink
1. Added linkedin.
Browse files Browse the repository at this point in the history
2. Linking to a specific post.
  • Loading branch information
Avatar4eg committed Sep 16, 2016
1 parent 5847dee commit 1f65cda
Show file tree
Hide file tree
Showing 9 changed files with 142 additions and 52 deletions.
22 changes: 16 additions & 6 deletions js/forum/dist/extension.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ System.register('avatar4eg/share-social/components/ShareModal', ['flarum/app', '
var height = 500;
var top = $(window).height() / 2 - height / 2;
var left = $(window).width() / 2 - width / 2;
var window_params = 'width=' + width + ', height= ' + height + ', top=' + top + ', left=' + left + ', status=no, scrollbars=no, resizable=no';

return [m('div', { className: 'Modal-body ShareSocialModal' }, [m('div', { className: 'Form Form--centered' }, [m('div', { className: 'Form-group' }, m('ul', { className: 'ShareList' }, [this.socialButtons.map(function (key) {
switch (key) {
Expand All @@ -157,7 +158,7 @@ System.register('avatar4eg/share-social/components/ShareModal', ['flarum/app', '
icon: 'facebook fa-lg fa-fw',
children: app.translator.trans(parent.addPrefix(key + '_button')),
onclick: function onclick() {
window.open('//facebook.com/sharer/sharer.php?u=' + share_url, app.title, 'width=' + width + ', height= ' + height + ', top=' + top + ', left=' + left + ', status=no, scrollbars=no, resizable=no');
window.open('//facebook.com/sharer/sharer.php?u=' + share_url, app.title, window_params);
}
}));
case 'vkontakte':
Expand All @@ -166,7 +167,7 @@ System.register('avatar4eg/share-social/components/ShareModal', ['flarum/app', '
icon: 'vk fa-lg fa-fw',
children: app.translator.trans(parent.addPrefix(key + '_button')),
onclick: function onclick() {
window.open('//vk.com/share.php?url=' + share_url + '&title=' + share_title + '&description=' + share_description, app.title, 'width=' + width + ', height= ' + height + ', top=' + top + ', left=' + left + ', status=no, scrollbars=no, resizable=no');
window.open('//vk.com/share.php?url=' + share_url + '&title=' + share_title + '&description=' + share_description, app.title, window_params);
}
}));
case 'twitter':
Expand All @@ -175,7 +176,7 @@ System.register('avatar4eg/share-social/components/ShareModal', ['flarum/app', '
icon: 'twitter fa-lg fa-fw',
children: app.translator.trans(parent.addPrefix(key + '_button')),
onclick: function onclick() {
window.open('//twitter.com/share?url=' + share_url + '&text=' + share_title, app.title, 'width=' + width + ', height= ' + height + ', top=' + top + ', left=' + left + ', status=no, scrollbars=no, resizable=no');
window.open('//twitter.com/share?url=' + share_url + '&text=' + share_title, app.title, window_params);
}
}));
case 'google_plus':
Expand All @@ -184,7 +185,7 @@ System.register('avatar4eg/share-social/components/ShareModal', ['flarum/app', '
icon: 'google-plus fa-lg fa-fw',
children: app.translator.trans(parent.addPrefix(key + '_button')),
onclick: function onclick() {
window.open('//plus.google.com/share?url=' + share_url, app.title, 'width=' + width + ', height= ' + height + ', top=' + top + ', left=' + left + ', status=no, scrollbars=no, resizable=no');
window.open('//plus.google.com/share?url=' + share_url, app.title, window_params);
}
}));
case 'odnoklassniki':
Expand All @@ -193,7 +194,7 @@ System.register('avatar4eg/share-social/components/ShareModal', ['flarum/app', '
icon: 'odnoklassniki fa-lg fa-fw',
children: app.translator.trans(parent.addPrefix(key + '_button')),
onclick: function onclick() {
window.open('//connect.ok.ru/offer?url=' + share_url, app.title, 'width=' + width + ', height= ' + height + ', top=' + top + ', left=' + left + ', status=no, scrollbars=no, resizable=no');
window.open('//connect.ok.ru/offer?url=' + share_url, app.title, window_params);
}
}));
case 'my_mail':
Expand All @@ -202,7 +203,16 @@ System.register('avatar4eg/share-social/components/ShareModal', ['flarum/app', '
icon: 'at fa-lg fa-fw',
children: app.translator.trans(parent.addPrefix(key + '_button')),
onclick: function onclick() {
window.open('//connect.mail.ru/share?url=' + share_url + '&title=' + share_title + '&description=' + share_description, app.title, 'width=' + width + ', height= ' + height + ', top=' + top + ', left=' + left + ', status=no, scrollbars=no, resizable=no');
window.open('//connect.mail.ru/share?url=' + share_url + '&title=' + share_title + '&description=' + share_description, app.title, window_params);
}
}));
case 'linkedin':
return m('li', { className: 'ShareItem' }, Button.component({
className: 'Button Button--rounded Share--' + key,
icon: 'linkedin fa-lg fa-fw',
children: app.translator.trans(parent.addPrefix(key + '_button')),
onclick: function onclick() {
window.open('//linkedin.com/shareArticle?mini=true&url=' + share_url + '&title=' + share_title + '&summary=' + share_description, app.title, window_params);
}
}));
default:
Expand Down
24 changes: 18 additions & 6 deletions js/forum/src/components/ShareModal.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ export default class ShareModal extends Modal {
const height = 500;
const top = $(window).height() / 2 - height / 2;
const left = $(window).width() / 2 - width / 2;
const window_params = 'width=' + width + ', height= ' + height + ', top=' + top + ', left=' + left + ', status=no, scrollbars=no, resizable=no';

return [
m('div', {className: 'Modal-body ShareSocialModal'}, [
Expand All @@ -47,7 +48,7 @@ export default class ShareModal extends Modal {
icon: 'facebook fa-lg fa-fw',
children: app.translator.trans(parent.addPrefix(key + '_button')),
onclick: () => {
window.open('//facebook.com/sharer/sharer.php?u=' + share_url, app.title, 'width=' + width + ', height= ' + height + ', top=' + top + ', left=' + left + ', status=no, scrollbars=no, resizable=no');
window.open('//facebook.com/sharer/sharer.php?u=' + share_url, app.title, window_params);
}
})
);
Expand All @@ -58,7 +59,7 @@ export default class ShareModal extends Modal {
icon: 'vk fa-lg fa-fw',
children: app.translator.trans(parent.addPrefix(key + '_button')),
onclick: function onclick() {
window.open('//vk.com/share.php?url=' + share_url + '&title=' + share_title + '&description=' + share_description, app.title, 'width=' + width + ', height= ' + height + ', top=' + top + ', left=' + left + ', status=no, scrollbars=no, resizable=no');
window.open('//vk.com/share.php?url=' + share_url + '&title=' + share_title + '&description=' + share_description, app.title, window_params);
}
})
);
Expand All @@ -69,7 +70,7 @@ export default class ShareModal extends Modal {
icon: 'twitter fa-lg fa-fw',
children: app.translator.trans(parent.addPrefix(key + '_button')),
onclick: () => {
window.open('//twitter.com/share?url=' + share_url + '&text=' + share_title, app.title, 'width=' + width + ', height= ' + height + ', top=' + top + ', left=' + left + ', status=no, scrollbars=no, resizable=no');
window.open('//twitter.com/share?url=' + share_url + '&text=' + share_title, app.title, window_params);
}
})
);
Expand All @@ -80,7 +81,7 @@ export default class ShareModal extends Modal {
icon: 'google-plus fa-lg fa-fw',
children: app.translator.trans(parent.addPrefix(key + '_button')),
onclick: () => {
window.open('//plus.google.com/share?url=' + share_url, app.title, 'width=' + width + ', height= ' + height + ', top=' + top + ', left=' + left + ', status=no, scrollbars=no, resizable=no');
window.open('//plus.google.com/share?url=' + share_url, app.title, window_params);
}
})
);
Expand All @@ -91,7 +92,7 @@ export default class ShareModal extends Modal {
icon: 'odnoklassniki fa-lg fa-fw',
children: app.translator.trans(parent.addPrefix(key + '_button')),
onclick: () => {
window.open('//connect.ok.ru/offer?url=' + share_url, app.title, 'width=' + width + ', height= ' + height + ', top=' + top + ', left=' + left + ', status=no, scrollbars=no, resizable=no');
window.open('//connect.ok.ru/offer?url=' + share_url, app.title, window_params);
}
})
);
Expand All @@ -102,7 +103,18 @@ export default class ShareModal extends Modal {
icon: 'at fa-lg fa-fw',
children: app.translator.trans(parent.addPrefix(key + '_button')),
onclick: () => {
window.open('//connect.mail.ru/share?url=' + share_url + '&title=' + share_title + '&description=' + share_description, app.title, 'width=' + width + ', height= ' + height + ', top=' + top + ', left=' + left + ', status=no, scrollbars=no, resizable=no');
window.open('//connect.mail.ru/share?url=' + share_url + '&title=' + share_title + '&description=' + share_description, app.title, window_params);
}
})
);
case 'linkedin':
return m('li', {className: 'ShareItem'},
Button.component({
className: 'Button Button--rounded Share--' + key,
icon: 'linkedin fa-lg fa-fw',
children: app.translator.trans(parent.addPrefix(key + '_button')),
onclick: () => {
window.open('//linkedin.com/shareArticle?mini=true&url=' + share_url + '&title=' + share_title + '&summary=' + share_description, app.title, window_params);
}
})
);
Expand Down
4 changes: 4 additions & 0 deletions less/forum/extension.less
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@
.Button--color(#fff, #168DE2);
}

.Share--linkedin {
.Button--color(#fff, #0077B5);
}

.fa-lg {
font-size: 1.33333333em;
line-height: 0.75em;
Expand Down
3 changes: 3 additions & 0 deletions locale/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ avatar4eg-share-social:
google_plus_label: => avatar4eg-share-social.ref.google_plus
odnoklassniki_label: => avatar4eg-share-social.ref.odnoklassniki
my_mail_label: => avatar4eg-share-social.ref.my_mail
linkedin_label: => avatar4eg-share-social.ref.linkedin
metatags_label: Metatags:
open_graph_label: Open Graph
twitter_card_label: Twitter Cards
Expand All @@ -22,6 +23,7 @@ avatar4eg-share-social:
google_plus_button: => avatar4eg-share-social.ref.google_plus
odnoklassniki_button: => avatar4eg-share-social.ref.odnoklassniki
my_mail_button: => avatar4eg-share-social.ref.my_mail
linkedin_button: => avatar4eg-share-social.ref.linkedin

ref:
facebook: Facebook
Expand All @@ -30,4 +32,5 @@ avatar4eg-share-social:
google_plus: Google+
odnoklassniki: Odnoklassniki
my_mail: My World
linkedin: LinkedIn
share: Share
3 changes: 3 additions & 0 deletions locale/es.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ avatar4eg-share-social:
google_plus_label: => avatar4eg-share-social.ref.google_plus
odnoklassniki_label: => avatar4eg-share-social.ref.odnoklassniki
my_mail_label: => avatar4eg-share-social.ref.my_mail
linkedin_label: => avatar4eg-share-social.ref.linkedin
metatags_label: Metatags:
open_graph_label: Open Graph
twitter_card_label: Twitter Cards
Expand All @@ -22,6 +23,7 @@ avatar4eg-share-social:
google_plus_button: => avatar4eg-share-social.ref.google_plus
odnoklassniki_button: => avatar4eg-share-social.ref.odnoklassniki
my_mail_button: => avatar4eg-share-social.ref.my_mail
linkedin_button: => avatar4eg-share-social.ref.linkedin

ref:
facebook: Facebook
Expand All @@ -30,4 +32,5 @@ avatar4eg-share-social:
google_plus: Google+
odnoklassniki: Odnoklassniki
my_mail: My World
linkedin: LinkedIn
share: Compartir
3 changes: 3 additions & 0 deletions locale/ru.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ avatar4eg-share-social:
google_plus_label: => avatar4eg-share-social.ref.google_plus
odnoklassniki_label: => avatar4eg-share-social.ref.odnoklassniki
my_mail_label: => avatar4eg-share-social.ref.my_mail
linkedin_label: => avatar4eg-share-social.ref.linkedin
metatags_label: Метатеги:
open_graph_label: Open Graph
twitter_card_label: Twitter Cards
Expand All @@ -22,6 +23,7 @@ avatar4eg-share-social:
google_plus_button: => avatar4eg-share-social.ref.google_plus
odnoklassniki_button: => avatar4eg-share-social.ref.odnoklassniki
my_mail_button: => avatar4eg-share-social.ref.my_mail
linkedin_button: => avatar4eg-share-social.ref.linkedin

ref:
facebook: Facebook
Expand All @@ -30,4 +32,5 @@ avatar4eg-share-social:
google_plus: Google+
odnoklassniki: Одноклассники
my_mail: Мой Мир
linkedin: LinkedIn
share: Поделиться
2 changes: 1 addition & 1 deletion migrations/2016_06_20_000000_add_settings_social_list.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@
},

'down' => function (ConnectionInterface $db) {
$db->table('settings')->delete('avatar4eg.share-social.list');
$db->table('settings')->where('key', 'avatar4eg.share-social.list')->delete();
}
];
18 changes: 18 additions & 0 deletions migrations/2016_09_14_000000_add_linkedin_to_list.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?php
namespace Avatar4eg\ShareSocial\Migration;

use Illuminate\Database\ConnectionInterface;

return [
'up' => function (ConnectionInterface $db) {
$db->table('settings')->where('key', 'avatar4eg.share-social.list')->update([
'value' => '["facebook","vkontakte","twitter","google_plus","odnoklassniki","my_mail","linkedin"]'
]);
},

'down' => function (ConnectionInterface $db) {
$db->table('settings')->where('key', 'avatar4eg.share-social.list')->update([
'value' => '["facebook","vkontakte","twitter","google_plus","odnoklassniki","my_mail"]'
]);
}
];
Loading

1 comment on commit 1f65cda

@dav-is
Copy link

@dav-is dav-is commented on 1f65cda Sep 19, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great improvement in redundancies. Nice work.

Please sign in to comment.