Skip to content
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

[#31516] Start a JLayout Social #1550

Closed
wants to merge 19 commits into from
Closed

Conversation

wilsonge
Copy link
Contributor

This starts the process of making some features not already in the CMS available as JLayouts. This starts with:

  • Facebook Like
  • Twitter Share
  • Twitter Follow
  • Twitter Hashtag
  • Twitter Mention
  • Google +1

Tracker: http://joomlacode.org/gf/project/joomla/tracker/?action=TrackerItemEdit&tracker_item_id=31516

Screenshot

image

Note including them in articles is _NOT_ included in this PR - this is just demonstrating their use

Layout Params

Google+1

  • data-size small, medium, standard, tall Size of the icon - default standard.
  • data-annotation inline, bubble, none The style of annotation to appear - default inline.
  • data-width integer The width of the icon - default 300
  • data-href URL The URL for the like to link to. By default the current URL (JUri::current())
  • show-count true/false Show/Hide the number of people who have +1'd the page
  • language Language string recognized by google Defaults to the locale according to the language (https://github.com/joomla/joomla-cms/blob/master/libraries/joomla/language/language.php#L1213).

Facebook Like

  • appid integer The appid if one exists for the like to link with
  • data-href URL The URL for the like to link to. By default the current URL (JUri::current())
  • data-width integer The width of the icon - default 450
  • show-faces true/false Shows the faces of others who have liked the page. Default true.
  • data-layout standard, button_count, box_count Layout of button. Default standard.
  • data-action 'empty attribute'/like, recommend Verb for the button. Default empty (which is "like").
  • data-colorscheme light, dark Color scheme. Default like
  • language Language string recognized by fb Defaults to the locale according to the language (https://github.com/joomla/joomla-cms/blob/master/libraries/joomla/language/language.php#L1213).

Twitter

Follow

  • show-count true/false Show the number of users followed. Default false
  • user Valid Twitter user The user for twitter. If not entered will give a JLog priority warning.

Share

To be written up (see code for now)

Hashtag

To be written up (see code for now)

Mention

To be written up (see code for now)

Issues

  • Is my new language file in a good location and with a good name?
  • Twitter hashtag langs don't seem to work at the moment (the other twitter views do)
  • Is the location of the social layouts package in a good place?

Testers

  • Check multiple instances of each icon work
  • Check each icon work
  • Check parameters work as expected
  • Check multilingual aspect

Suggested code:

$layout = new JLayoutFile('social.google');
echo $layout->render(array());
$layout2 = new JLayoutFile('social.twitter.share');
echo $layout2->render(array());
$layout3 = new JLayoutFile('social.facebook');
echo $layout3->render(array());
$layout4 = new JLayoutFile('social.twitter.follow;);
echo $layout4->render(array('user'=>'GW1992'));  // or similar for a twitter username (please don't spam mine :P)

@elinw
Copy link
Contributor

elinw commented Jul 16, 2013

I love this. Where do you think we should store parameters?

@wilsonge
Copy link
Contributor Author

Just to put up what we're just talking about on skype. Personally a new section where the Component options are set (so Global Config but not actually in Global Config). Called Layouts. Starting with one tab (social). This then gets expanded as more JLayouts are introduced.

@mbabker
Copy link
Contributor

mbabker commented Jul 16, 2013

Feel free to borrow code out of https://github.com/mbabker/Yet-Another-Social-Plugin/blob/master/yetanothersocial.php if need be, I've spent a little time figuring out the language implementations. Could be improved on, but it's a good start.

@wilsonge
Copy link
Contributor Author

Hmm what you have is interesting there but is specific to an article - but
clearly JLayout isn't (thinking of K2 etc. which already has a Facebook
etc. button). So I guess you have to get the global language/logged in user
language....

Having said that I might well hijack those language setting functions you
have - cause all I need to change are the inputs :)

Thanks Michael - actually that's going to be a great help!!

On 16 July 2013 01:49, Michael Babker notifications@github.com wrote:

Feel free to borrow code out of
https://github.com/mbabker/Yet-Another-Social-Plugin/blob/master/yetanothersocial.phpif need be, I've spent a little time figuring out the language
implementations. Could be improved on, but it's a good start.


Reply to this email directly or view it on GitHubhttps://github.com//pull/1550#issuecomment-21014508
.

@wilsonge
Copy link
Contributor Author

@mbabker thanks for the plugin link. It actually gave me some great ideas to refactor the Layouts. Hopefully in a much better position now!

@phproberto
Copy link
Contributor

Have you looked at:
http://filamentgroup.com/lab/socialcount/

Maybe now is too late but I love the idea of only require 3KB for sharing. I'd never use the "old" share buttons but this jQuery plugin is awesome.

@wilsonge
Copy link
Contributor Author

In a word - no :P

I did initially for G+ and facebook use the inline javascript. But I was unhappy with the fact you were including it with every use of the button. For example in cases where you might have the fb like button in a module and then again in a blog post.

Loading it in the head with JDocument gave me a way out of that.

If you can find a way around this though I'm more than happy to consider it. I'd rather get it right now then face the consequences later on!

P.S. Also just reading the comments of your link there that plugin breaks on mobiles (well definitely iPhones - I just tested it on mine) and on IE10 (just tested that as well). I get the idea though :)

@phproberto
Copy link
Contributor

Yes. I went to the github project to check issues and the plugin seems abandoned :(

About your PR I tested it and all seems to work fine. In my opinion layouts are in the best place and hashtag language worked fine here. So no issues

Are Twitter translations really required? I tested it in spanish and worked perfect before creating the language file.

@wilsonge
Copy link
Contributor Author

RE: language files - I'm not sure. Some of them I don't think are. The twitter website puts these things in the link tags https://twitter.com/about/resources/buttons but then just the data-language tag seems to set everything up fine (good to hear the language on the hashtags worked for you!)

Either way I still need the file for my two error messages if people don't include a hashtag for the hashtag layout and a user for the follow/mention layout.

@elinw
Copy link
Contributor

elinw commented Jul 28, 2013

For the code try

render(array()); $layout2 = new JLayoutFile('social.twitter.share'); echo $layout2->render(array()); $layout3 = new JLayoutFile('social.facebook'); echo $layout3->render(array()); $layout4 = new JLayoutFile('social.twitter.follow'); echo $layout4->render(array('user'=>'GW1992')); ?>

I'd suggest making a super JLayout that then includes all of them in a block. I'd be game for including these default off as a simple on/ff block. I do think we need to think about complex storing of params but for right now we could do it on a per site basis and let webmaster, implementers and developers go to town with more complex.

@wilsonge
Copy link
Contributor Author

Also I was thinking as a default user if one isn't set perhaps we should use the Joomla twitter feed rather than throwing an error?

@wilsonge
Copy link
Contributor Author

Will work on super JLayout block

@wilsonge
Copy link
Contributor Author

wilsonge commented Aug 9, 2013

Ok as discussed on skype I'm not going to have a master layout. However I am going to put in a JHtml class to call these functions. Just committed these now.

@wilsonge wilsonge closed this Aug 9, 2013
@wilsonge wilsonge reopened this Aug 16, 2013
@brianteeman
Copy link
Contributor

What is the status with this @wilsonge

@wilsonge
Copy link
Contributor Author

feature still pending awaiting testers. i'll move it across to target staging later

Fix comment about the default memory limit in daemon.php
@roland-d
Copy link
Contributor

@test The PR cannot be applied:
D:\wamp\www\joomla-cms>curl https://github.com/joomla/joomla-cms/pull/1550.diff
| git apply -R
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 18317 0 18317 0 0 26623 0 --:--:-- --:--:-- --:--:-- 32534
error: language/en-GB/en-GB.layout_social.ini: No such file or directory
error: layouts/social/facebook.php: No such file or directory
error: layouts/social/google.php: No such file or directory
error: layouts/social/index.html: No such file or directory
error: layouts/social/twitter/follow.php: No such file or directory
error: layouts/social/twitter/hashtag.php: No such file or directory
error: layouts/social/twitter/index.html: No such file or directory
error: layouts/social/twitter/mention.php: No such file or directory
error: layouts/social/twitter/share.php: No such file or directory
error: libraries/cms/html/social.php: No such file or directory


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/1550.

@wilsonge
Copy link
Contributor Author

Well somethings very wrong with your git then :P Because none of those files do exist yet. They are supposed to be created by this PR

@wilsonge wilsonge changed the title Start a JLayout Social [#31516] Start a JLayout Social Nov 29, 2014
@wilsonge
Copy link
Contributor Author

Because this is so old it's targeted at master I've created a fresh version targeting staging at #5252 - try that and see how you go.

Closing this one as a result

@wilsonge wilsonge closed this Nov 29, 2014
@wilsonge wilsonge deleted the jlayoutsocial branch June 17, 2015 21:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants