sharing_tags 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (37) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/images/sharing_tags/icons/facebook.svg +12 -0
  3. data/app/assets/images/sharing_tags/icons/google.svg +12 -0
  4. data/app/assets/images/sharing_tags/icons/odnoklassniki.svg +11 -0
  5. data/app/assets/images/sharing_tags/icons/twitter.svg +12 -0
  6. data/app/assets/images/sharing_tags/icons/vkontakte.svg +10 -0
  7. data/app/assets/javascripts/sharing_tags.js.coffee +2 -0
  8. data/app/assets/javascripts/sharing_tags/links.js.coffee +1 -0
  9. data/app/assets/javascripts/sharing_tags/share.coffee +13 -2
  10. data/app/assets/javascripts/sharing_tags/share/facebook.coffee +37 -0
  11. data/app/assets/stylesheets/sharing_tags.css.sass +20 -0
  12. data/app/assets/stylesheets/sharing_tags/icons.css.sass +6 -0
  13. data/app/views/sharing_tags/button/_facebook.html.slim +2 -0
  14. data/app/views/sharing_tags/button/_google.html.slim +2 -0
  15. data/app/views/sharing_tags/button/_odnoklassniki.html.slim +2 -0
  16. data/app/views/sharing_tags/button/_twitter.html.slim +2 -0
  17. data/app/views/sharing_tags/button/_vkontakte.html.slim +2 -0
  18. data/app/views/sharing_tags/buttons.html.slim +3 -0
  19. data/app/views/sharing_tags/{_open_graphs.html.slim → meta/_open_graphs.html.slim} +0 -0
  20. data/app/views/sharing_tags/{_schema_tags.html.slim → meta/_schema_tags.html.slim} +0 -0
  21. data/app/views/sharing_tags/{_twitter_card.html.slim → meta/_twitter_card.html.slim} +0 -0
  22. data/app/views/sharing_tags/meta_tags.html.slim +3 -3
  23. data/lib/generators/sharing_tags/install/install_generator.rb +64 -3
  24. data/lib/generators/sharing_tags/install/templates/POST_INSTALL +3 -0
  25. data/lib/sharing_tags/action_controller/helpers.rb +4 -0
  26. data/lib/sharing_tags/action_view/button_helper.rb +26 -8
  27. data/lib/sharing_tags/version.rb +1 -1
  28. data/spec/generators/install_generator_spec.rb +24 -3
  29. data/spec/helpers/button_helper_spec.rb +220 -0
  30. data/spec/javascripts/fixtures/facebook.json +15 -0
  31. data/spec/javascripts/sharing_tags/share/facebook_share_spec.coffee +86 -0
  32. data/spec/javascripts/sharing_tags/sharing_tags_spec.coffee +6 -6
  33. data/spec/teaspoon_env.rb +1 -1
  34. data/spec/views/{facebook_meta_tags_erb_spec.rb → meta_tags/facebook_meta_tags_erb_spec.rb} +0 -0
  35. data/spec/views/{meta_tags_erb_spec.rb → meta_tags/meta_tags_erb_spec.rb} +0 -0
  36. metadata +31 -11
  37. data/spec/helpers/share_link_helper_spec.rb +0 -141
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 15a3570cb3592d651f7f2381b4afe5177ee9d8b6
4
- data.tar.gz: b4e3e9d2278551f4a82b82505d721bbc61a5a87b
3
+ metadata.gz: 7c68b7e6d6ea6c6b14a0c9d8941dafb74656cf86
4
+ data.tar.gz: 0101e259f4e610bcd60f5711b606b2c9742f2beb
5
5
  SHA512:
6
- metadata.gz: 7c8b64a0c2b281dd60369be5ce4151be7bd8a8f503547b9f5d1468e2f71398294874515bbe0e8ed0d712e8431ee8f15bd6ba5396c57af3970bf75aed209d8316
7
- data.tar.gz: b015f781dce51ac9718562cce9180ff8551b6d4aa6cc91739e9b7d765e362ef6da957b156a5743bb352dde4bb83b4481bd087785009e2c4ac61be3fb456ef269
6
+ metadata.gz: bcf785bf5ce8826b4a8c8c5dd0b5d7bd048fd7429ff7ad22e4e4a79c019a05b636668212f9d008daf9cdc4934fa0f29ae39a3a26c42b7598a9ad580eef9d81ed
7
+ data.tar.gz: 84c3523b9d729616a604f289de47d49fe816277265553f4dffb16e2ce48111ca748cc483cf3be4a856dc5eebf4a548bd5972d0cd54771363fd5713358fe98fe2
@@ -0,0 +1,12 @@
1
+ <?xml version="1.0" encoding="UTF-8" standalone="no"?>
2
+ <svg width="35px" height="35px" viewBox="0 0 35 35" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:sketch="http://www.bohemiancoding.com/sketch/ns">
3
+ <title>Facebook</title>
4
+ <desc>Facebook social icon</desc>
5
+ <defs></defs>
6
+ <g stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" sketch:type="MSPage">
7
+ <g sketch:type="MSLayerGroup">
8
+ <path d="M17.605,34.085 C26.999,34.085 34.614,26.471 34.614,17.077 C34.614,7.685 26.999,0.07 17.605,0.07 C8.212,0.07 0.598,7.685 0.598,17.077 C0.598,26.471 8.212,34.085 17.605,34.085" id="Fill-172" fill="#5071AA" sketch:type="MSShapeGroup"></path>
9
+ <path d="M13.502,14.198 L15.261,14.198 L15.261,12.489 C15.261,11.735 15.28,10.573 15.827,9.853 C16.404,9.091 17.195,8.573 18.557,8.573 C20.775,8.573 21.709,8.889 21.709,8.889 L21.27,11.494 C21.27,11.494 20.537,11.283 19.853,11.283 C19.169,11.283 18.557,11.528 18.557,12.211 L18.557,14.198 L21.361,14.198 L21.165,16.742 L18.557,16.742 L18.557,25.581 L15.261,25.581 L15.261,16.742 L13.502,16.742 L13.502,14.198" id="Fill-173" fill="#FFFFFF" sketch:type="MSShapeGroup"></path>
10
+ </g>
11
+ </g>
12
+ </svg>
@@ -0,0 +1,12 @@
1
+ <?xml version="1.0" encoding="UTF-8" standalone="no"?>
2
+ <svg width="35px" height="35px" viewBox="0 0 35 35" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:sketch="http://www.bohemiancoding.com/sketch/ns">
3
+ <title>Google+ Share</title>
4
+ <desc>Google+ social icon</desc>
5
+ <defs></defs>
6
+ <g stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" sketch:type="MSPage">
7
+ <g id="Google+" sketch:type="MSLayerGroup">
8
+ <path d="M17.63,34.085 C27.024,34.085 34.638,26.47 34.638,17.077 C34.638,7.684 27.024,0.07 17.63,0.07 C8.237,0.07 0.622,7.684 0.622,17.077 C0.622,26.47 8.237,34.085 17.63,34.085" id="Fill-176" fill="#3E4140" sketch:type="MSShapeGroup"></path>
9
+ <path d="M25.825,15.835 L23.774,15.835 L23.774,13.784 L22.124,13.784 L22.124,15.835 L20.074,15.835 L20.074,17.485 L22.124,17.485 L22.124,19.536 L23.774,19.536 L23.774,17.485 L25.825,17.485 L25.825,15.835 L25.825,15.835 Z M18.161,18.319 C17.685,17.982 16.775,17.162 16.775,16.68 C16.775,16.115 16.937,15.838 17.786,15.174 C18.657,14.492 19.274,13.535 19.274,12.423 C19.274,11.098 18.684,9.807 17.576,9.38 L19.246,9.38 L20.425,8.529 L15.157,8.529 C12.796,8.529 10.574,10.318 10.574,12.389 C10.574,14.507 12.184,16.217 14.586,16.217 C14.753,16.217 14.915,16.213 15.074,16.202 C14.918,16.5 14.806,16.837 14.806,17.185 C14.806,17.774 15.123,18.251 15.523,18.641 C15.221,18.641 14.928,18.65 14.611,18.65 C11.686,18.65 9.434,20.512 9.434,22.444 C9.434,24.346 11.902,25.536 14.827,25.536 C18.161,25.536 20.003,23.645 20.003,21.742 C20.003,20.216 19.553,19.303 18.161,18.319 L18.161,18.319 Z M15.348,15.679 C13.991,15.639 12.701,14.161 12.467,12.38 C12.232,10.597 13.143,9.234 14.5,9.274 C15.856,9.315 17.146,10.744 17.38,12.526 C17.614,14.308 16.705,15.72 15.348,15.679 L15.348,15.679 Z M14.816,24.695 C12.794,24.695 11.334,23.416 11.334,21.878 C11.334,20.371 13.146,19.117 15.167,19.139 C15.639,19.144 16.079,19.22 16.478,19.349 C17.575,20.113 18.362,20.543 18.584,21.413 C18.626,21.59 18.649,21.771 18.649,21.956 C18.649,23.494 17.659,24.695 14.816,24.695 L14.816,24.695 Z" id="Fill-177" fill="#FFFFFF" sketch:type="MSShapeGroup"></path>
10
+ </g>
11
+ </g>
12
+ </svg>
@@ -0,0 +1,11 @@
1
+ <?xml version="1.0"?>
2
+ <svg width="35px" height="35px" viewBox="0 0 116 117" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
3
+ <title>Odnoklassniki Share</title>
4
+ <desc>Odnoklassniki share social icon</desc>
5
+ <g name="Layer 1" opacity="1">
6
+ <g >
7
+ <desc shapeID="1" type="0" basicInfo-basicType="0" basicInfo-roundedRectRadius="12" basicInfo-polygonSides="6" basicInfo-starPoints="5" bounding="rect(-57.7161,-57.9851,115.432,115.97)" text="" font-familyName="" font-pixelSize="20" font-bold="0" font-underline="0" font-alignment="1" strokeStyle="0" markerStart="0" markerEnd="0" shadowEnabled="0" shadowOffsetX="0" shadowOffsetY="2" shadowBlur="4" shadowOpacity="160" blurEnabled="0" blurRadius="4" transform="matrix(1,0,0,1,57.9747,58.5361)" pers-center="0,0" pers-size="0,0" pers-start="0,0" pers-end="0,0" locked="0" mesh="" flag=""/>
8
+ <path id="shapePath1" d="M57.9768,0.551071 C26.1,0.551071 0.258617,26.5124 0.258617,58.5372 C0.258617,90.562 26.1,116.521 57.9768,116.521 C89.8515,116.521 115.691,90.562 115.691,58.5372 C115.691,26.5124 89.8515,0.551071 57.9768,0.551071 M36.905,35.9014 C38.6963,24.0332 50.1119,18.1194 59.7808,19.7779 C71.1666,21.7314 77.3658,32.251 75.9894,41.9435 C72.2729,68.1955 32.9523,62.0509 36.905,35.9014 M76.9255,93.8705 C73.0749,97.8094 68.9648,94.1846 65.9694,91.2908 C63.3953,88.803 60.3063,85.6847 57.613,83.5667 C50.5863,91.0087 44.8785,99.9467 39.1069,95.0011 C32.1929,89.068 45.7699,80.3736 49.0822,75.2485 C45.6337,74.4748 39.8238,72.594 37.0922,70.5059 C34.3522,68.4071 33.848,63.5918 37.1582,61.2024 C41.1279,58.3342 43.7914,61.4952 48.4802,63.0126 C66.2353,68.7533 73.1047,52.6683 78.3593,62.0979 C82.8396,70.1404 67.5926,73.6904 65.7673,74.9322 C73.0962,81.9766 82.4865,88.1917 76.9255,93.8705 M55.9239,31.1973 C45.2486,31.9518 46.0358,47.4747 56.7791,47.3401 C67.3139,47.2118 67.1884,30.4022 55.9239,31.1973 Z" style="stroke:none;fill-rule:evenodd;fill:#ed812b;fill-opacity:1;"/>
9
+ </g>
10
+ </g>
11
+ </svg>
@@ -0,0 +1,12 @@
1
+ <?xml version="1.0" encoding="UTF-8" standalone="no"?>
2
+ <svg width="35px" height="35px" viewBox="0 0 35 35" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:sketch="http://www.bohemiancoding.com/sketch/ns">
3
+ <title>Twitter Share</title>
4
+ <desc>Twitter share social icon</desc>
5
+ <defs></defs>
6
+ <g stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" sketch:type="MSPage">
7
+ <g sketch:type="MSLayerGroup">
8
+ <path d="M17.558,34.085 C26.951,34.085 34.565,26.471 34.565,17.077 C34.565,7.685 26.951,0.07 17.558,0.07 C8.164,0.07 0.549,7.685 0.549,17.077 C0.549,26.471 8.164,34.085 17.558,34.085" id="Fill-168" fill="#68C6E1" sketch:type="MSShapeGroup"></path>
9
+ <path d="M26.09,12.622 C25.464,12.9 24.79,13.088 24.083,13.172 C24.805,12.74 25.359,12.055 25.62,11.239 C24.944,11.639 24.197,11.93 23.399,12.086 C22.763,11.407 21.854,10.983 20.848,10.983 C18.919,10.983 17.354,12.548 17.354,14.478 C17.354,14.752 17.384,15.018 17.444,15.274 C14.539,15.128 11.964,13.738 10.239,11.621 C9.938,12.139 9.766,12.74 9.766,13.38 C9.766,14.592 10.383,15.662 11.321,16.289 C10.749,16.272 10.209,16.113 9.737,15.853 L9.737,15.896 C9.737,17.59 10.942,19.003 12.542,19.323 C12.249,19.405 11.94,19.446 11.621,19.446 C11.396,19.446 11.176,19.425 10.963,19.384 C11.408,20.772 12.698,21.783 14.228,21.81 C13.032,22.748 11.524,23.307 9.887,23.307 C9.605,23.307 9.326,23.291 9.053,23.259 C10.6,24.249 12.438,24.828 14.411,24.828 C20.841,24.828 24.356,19.503 24.356,14.884 C24.356,14.732 24.353,14.58 24.347,14.431 C25.03,13.938 25.623,13.323 26.09,12.622" id="Fill-169" fill="#FFFFFF" sketch:type="MSShapeGroup"></path>
10
+ </g>
11
+ </g>
12
+ </svg>
@@ -0,0 +1,10 @@
1
+ <?xml version="1.0"?>
2
+ <svg width="35px" height="35px" viewBox="0 0 116 117" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
3
+ <desc iVinci="yes" version="4.6" gridStep="20" showGrid="no" snapToGrid="no" codePlatform="0"/>
4
+ <g id="Layer1" name="Layer 1" opacity="1">
5
+ <g id="Shape1">
6
+ <desc shapeID="1" type="0" basicInfo-basicType="0" basicInfo-roundedRectRadius="12" basicInfo-polygonSides="6" basicInfo-starPoints="5" bounding="rect(-57.4257,-58.156,114.851,116.312)" text="" font-familyName="" font-pixelSize="20" font-bold="0" font-underline="0" font-alignment="1" strokeStyle="0" markerStart="0" markerEnd="0" shadowEnabled="0" shadowOffsetX="0" shadowOffsetY="2" shadowBlur="4" shadowOpacity="160" blurEnabled="0" blurRadius="4" transform="matrix(1,0,0,1,58.335,58.5361)" pers-center="0,0" pers-size="0,0" pers-start="0,0" pers-end="0,0" locked="0" mesh="" flag=""/>
7
+ <path id="shapePath1" d="M58.3361,0.380089 C26.6188,0.380089 0.909306,26.4184 0.909306,58.5372 C0.909306,90.656 26.6188,116.692 58.3361,116.692 C90.0469,116.692 115.761,90.656 115.761,58.5372 C115.761,26.4184 90.0469,0.380089 58.3361,0.380089 M86.4687,64.4702 C91.2978,68.9371 94.6655,72.5769 96.5716,75.3852 C97.463,76.7894 97.7481,78.0355 97.429,79.1212 C97.112,80.2048 96.3802,80.7476 95.2378,80.7476 L82.6564,81.3226 C80.8757,81.4508 78.7164,80.3651 76.1742,78.0675 C73.632,75.77 71.9173,73.8528 71.0259,72.3204 C70.5175,71.4292 69.5963,70.9162 68.2625,70.788 C66.9286,70.664 66.0691,71.3009 65.6883,72.7051 L65.3075,77.6849 C65.1799,78.7044 64.7991,79.4717 64.1651,79.9825 C63.5269,80.4933 62.9887,80.7797 62.544,80.846 C62.0973,80.9079 61.3676,81.0041 60.3507,81.1324 C57.0469,81.2606 54.1557,81.1003 51.6773,80.6515 C49.1989,80.2048 46.9418,79.2815 44.9101,77.8773 C42.8763,76.471 41.2552,75.195 40.0469,74.0452 C38.8407,72.8953 37.0941,71.0445 34.8071,68.4904 C28.5803,59.5545 23.9404,51.8283 20.8897,45.3182 C19.7452,42.7642 19.1113,40.5927 18.9815,38.806 C19.4921,38.2952 20.4451,37.9767 21.8428,37.8485 C23.2426,37.7202 25.2743,37.6882 27.942,37.7523 C30.6119,37.8164 32.1989,37.8485 32.7074,37.8485 C33.9796,37.7202 34.9965,38.4234 35.7602,39.9558 C38.9364,47.1028 42.0509,52.6576 45.0994,56.6158 C47.1332,58.5308 48.4692,58.2123 49.1032,55.6583 C49.3585,55.6583 49.4861,52.5315 49.4861,46.2757 C49.6116,42.3154 48.0225,39.8276 44.7208,38.806 C45.4824,36.7627 48.1501,35.7411 52.7261,35.7411 C53.8707,35.7411 55.2684,35.8052 56.9213,35.9313 C58.5722,36.0596 59.4614,36.1237 59.587,36.1237 C63.4014,36.1237 65.3075,37.654 65.3075,40.721 C65.3075,41.1035 65.2437,42.0311 65.1182,43.4973 C64.9905,44.9656 64.8948,46.3697 64.831,47.7119 C64.7672,49.052 64.7352,50.4562 64.7352,51.9245 C64.7352,53.3928 64.9267,54.6367 65.3075,55.6604 C65.6883,56.6799 66.1968,57.319 66.8328,57.5754 C67.5306,57.0625 68.2008,56.5837 68.8347,56.1392 C69.4708,55.6904 70.1388,54.9573 70.8366,53.9357 C71.5365,52.9141 72.0747,52.1468 72.4577,51.6381 C72.8385,51.1252 73.4086,50.1698 74.1723,48.7635 C74.9361,47.3593 75.3807,46.4659 75.5062,46.0834 C75.6339,45.7008 76.0785,44.7112 76.8401,43.1147 C77.6038,41.5182 77.9846,40.721 77.9846,40.721 L78.2697,40.146 C78.7781,38.9962 79.193,38.3272 79.51,38.1349 C79.8269,37.9446 80.6226,37.8485 81.8926,37.8485 L93.7124,37.8485 C95.1101,37.8485 95.9355,37.8805 96.1908,37.9446 C96.444,38.0088 96.8269,38.2952 97.3332,38.806 C98.2246,39.9558 97.429,42.4436 94.9506,46.2757 C92.4743,50.1057 90.0916,53.2966 87.8025,55.8528 C84.6263,59.4263 84.1817,62.2988 86.4687,64.4702 Z" style="stroke:none;fill-rule:evenodd;fill:#6b82a7;fill-opacity:1;"/>
8
+ </g>
9
+ </g>
10
+ </svg>
@@ -0,0 +1,2 @@
1
+ #= require sharing_tags/share
2
+ #= require sharing_tags/links
@@ -5,6 +5,7 @@ $(document).on 'click', "@sharing_tags_share", (event) ->
5
5
  SharingTags.share(
6
6
  self.data('network'),
7
7
  mobile: device?.mobile() # for mobile devices
8
+ page_url: self.attr("href")
8
9
  url: self.data 'share-url'
9
10
  title: self.data 'title'
10
11
  message: self.data 'description'
@@ -4,6 +4,10 @@ class @SharingTags
4
4
  share_object = if attributes?.mobile then SharingTags.MobileShare else SharingTags.Share
5
5
  share_object[network]?(attributes, callback)
6
6
 
7
+ #=require sharing_tags/share/facebook
8
+ class @Error extends Error
9
+ constructor: -> super
10
+
7
11
  class @Share
8
12
 
9
13
  @facebook: ({url}, callback) ->
@@ -56,8 +60,12 @@ class @SharingTags
56
60
 
57
61
  class @MobileShare extends @Share
58
62
 
59
- @facebook: ({url}, callback) ->
60
- super
63
+ @facebook: ({url, return_url, app_id}, callback) ->
64
+ if app_id
65
+ return_url = url if !return_url
66
+ @_share("http://www.facebook.com/dialog/share", href: url, redirect_uri: return_url, app_id: app_id, display: 'touch', callback)
67
+ else
68
+ super
61
69
 
62
70
  @twitter: ({title, url, message}, callback) ->
63
71
  # todo: fix adding hash tags
@@ -70,6 +78,9 @@ class @SharingTags
70
78
  # ), 1
71
79
  super
72
80
 
81
+ @_share: ->
82
+ super
83
+
73
84
  @_checkSharing: (share_url, share_window, iteration)=>
74
85
  # console.log("check mobile sharing", share_url, share_window, iteration)
75
86
  return true if iteration >= 1
@@ -0,0 +1,37 @@
1
+ class @SharingTags.BaseShare
2
+
3
+ url: null
4
+ title: null
5
+ description: null
6
+
7
+ constructor: ({@url, @title, @description})->
8
+ unless @url && @title && @description
9
+ throw new SharingTags.Error("Error could not initialize sharing class, with params:#{ " #{arg}: '#{val}'" for arg, val of arguments[0]}")
10
+
11
+ open_popup: ->
12
+
13
+ class @SharingTags.FacebookShare extends @SharingTags.BaseShare
14
+
15
+ # available providers: sharer, fb_ui, dialog
16
+ @default_provider: "fb_ui"
17
+ @provider: "fb_ui"
18
+
19
+ app_id: null
20
+ return_url: null
21
+ provider: null
22
+
23
+ constructor: ({@app_id, @return_url, @provider})->
24
+ super
25
+
26
+ share: ()->
27
+
28
+ sharer: ->
29
+ # @open_popup("http://www.facebook.com/sharer.php", u: @url)
30
+
31
+ fb_ui: ->
32
+
33
+ dialog: ->
34
+
35
+
36
+ # call trigger
37
+
@@ -0,0 +1,20 @@
1
+ .sharing_tags-buttons
2
+ list-style-type: none
3
+ padding: 0px
4
+ margin: 0px
5
+
6
+ &__item
7
+ float: left
8
+
9
+ img
10
+ display: inline-block
11
+
12
+ a
13
+ display: inline-block
14
+ vertical-align: middle
15
+ text-align: center
16
+ font-size: 0
17
+ width: auto
18
+
19
+ &:hover
20
+ opacity: 0.8
@@ -0,0 +1,6 @@
1
+ //facebook.svg
2
+ //google.svg
3
+ //linkedin.svg
4
+ //odnoklassniki.svg
5
+ //twitter.svg
6
+ //vkontakte.svg
@@ -0,0 +1,2 @@
1
+ = link_to_facebook_share do
2
+ = image_tag 'sharing_tags/icons/facebook.svg'
@@ -0,0 +1,2 @@
1
+ = link_to_google_share do
2
+ = image_tag 'sharing_tags/icons/google.svg'
@@ -0,0 +1,2 @@
1
+ = link_to_odnoklassniki_share do
2
+ = image_tag 'sharing_tags/icons/odnoklassniki.svg'
@@ -0,0 +1,2 @@
1
+ = link_to_twitter_share do
2
+ = image_tag 'sharing_tags/icons/twitter.svg'
@@ -0,0 +1,2 @@
1
+ = link_to_vkontakte_share do
2
+ = image_tag 'sharing_tags/icons/vkontakte.svg'
@@ -0,0 +1,3 @@
1
+ ul.sharing_tags-buttons
2
+ - networks.each do |network|
3
+ li.sharing_tags-buttons__item= render "sharing_tags/button/#{network}"
@@ -1,11 +1,11 @@
1
1
  / Open graph markup for Facebook
2
- = render "sharing_tags/open_graphs", meta: sharing_tags.facebook if sharing_tags.facebook.present?
2
+ = render "sharing_tags/meta/open_graphs", meta: sharing_tags.facebook if sharing_tags.facebook.present?
3
3
 
4
4
  / Twitter Card data
5
- = render "sharing_tags/twitter_card", meta: sharing_tags.twitter if sharing_tags.twitter.present?
5
+ = render "sharing_tags/meta/twitter_card", meta: sharing_tags.twitter if sharing_tags.twitter.present?
6
6
 
7
7
  / Schema.org markup for Google+
8
- = render "sharing_tags/schema_tags", meta: sharing_tags.google if sharing_tags.google.present?
8
+ = render "sharing_tags/meta/schema_tags", meta: sharing_tags.google if sharing_tags.google.present?
9
9
 
10
10
  / Vkontakte https://vk.com/dev/share_details
11
11
  / TODO:
@@ -6,13 +6,74 @@ module SharingTags
6
6
 
7
7
  source_root File.expand_path('../templates', __FILE__)
8
8
 
9
+ desc "Installs the SharingTags initializer into your application."
10
+
11
+ class_option :partials,
12
+ type: :boolean,
13
+ aliases: "-p",
14
+ default: false,
15
+ desc: "Copy links partial"
16
+
9
17
  def copy_initializer_file
10
- template 'initializer.rb', 'config/initializers/sharing_tags.rb'
18
+
19
+ if File.exists?("config/initializers/sharing_tags.rb")
20
+ say_skipped("create initializer sharing_tags.rb")
21
+ else
22
+ template 'initializer.rb', 'config/initializers/sharing_tags.rb'
23
+ end
24
+ end
25
+
26
+ def add_javascripts
27
+ source_file = "app/assets/javascripts/application.js"
28
+ skip_js = false
29
+
30
+ # todo: move to method
31
+ if File.exists? source_file
32
+ original_js = File.binread(source_file)
33
+
34
+ update_application_js = ->(source) do
35
+ if original_js.include?(source)
36
+ skip_js = true
37
+ else
38
+ insert_into_file source_file, "\n//= require '#{source}'", :after => %r{\Z}
39
+ end
40
+ end
41
+
42
+ update_application_js["sharing_tags/share"]
43
+ update_application_js["sharing_tags/links"]
44
+ else
45
+ skip_js = true
46
+ end
47
+
48
+ say_skipped("insert into #{source_file}") if skip_js
11
49
  end
12
50
 
13
- # todo: add javascript files to applications.js
14
- # todo add styles application.css
51
+ def add_styles
52
+ source_file = "app/assets/stylesheets/application.css"
15
53
 
54
+ if File.exists? source_file
55
+ insert_into_file source_file, :before => "*/" do
56
+ "\n *= require 'sharing_tags'\n\n"
57
+ end
58
+ else
59
+ say_skipped("insert into #{source_file}")
60
+ end
61
+ end
62
+
63
+ def add_layout
64
+ # todo add = render_sharing_tags to head
65
+ # and add = sharing_tags_buttons to body
66
+ end
67
+
68
+ def display_post_install
69
+ readme "POST_INSTALL" if behavior == :invoke
70
+ end
71
+
72
+ private
73
+
74
+ def say_skipped(message)
75
+ say_status("skipped", message, :yellow)
76
+ end
16
77
  end
17
78
  end
18
79
  end
@@ -0,0 +1,3 @@
1
+ +============================================================================+
2
+ Congratulations! SharingTags was successfully installed. Documentation and more
3
+ can be found at: https://github.com/Kr00lIX/sharing_tags
@@ -4,4 +4,8 @@ module SharingTags::ActionController::Helpers
4
4
  SharingTags.config.within_context_params(view_context)
5
5
  end
6
6
 
7
+ def sharing_tags_context(name, *attrs)
8
+ SharingTags.config.switch_context(name, *attrs)
9
+ end
10
+
7
11
  end
@@ -1,19 +1,30 @@
1
1
  module SharingTags::ActionView::ButtonHelper
2
2
 
3
- def link_to_facebook_share(name = "Facebook", &block)
4
- share_link_to name, :facebook, [], &block
3
+ def sharing_tags_buttons(*networks)
4
+ options = networks.extract_options!
5
+ networks = SharingTags::Network.lists if networks.empty?
6
+ # todo: add params for switching context
7
+ render template: "sharing_tags/buttons", locals: {networks: networks, options: options}
5
8
  end
6
9
 
7
- def link_to_vkontakte_share(name = "Vkontakte", &block)
8
- share_link_to name, :vkontakte, [:title, :description, :image], &block
10
+ def link_to_facebook_share(name_or_options = nil, &block)
11
+ share_link_to name_or_options, :facebook, [], &block
9
12
  end
10
13
 
11
- def link_to_odnoklassniki_share(name = "Odnoklassniki", &block)
12
- share_link_to name, :odnoklassniki, [:title, :description], &block
14
+ def link_to_vkontakte_share(name_or_options = nil, &block)
15
+ share_link_to name_or_options, :vkontakte, [:title, :description, :image], &block
13
16
  end
14
17
 
15
- def link_to_twitter_share(name = "Twitter", &block)
16
- share_link_to name, :twitter, [:title, :description], &block
18
+ def link_to_google_share(name_or_options = nil, &block)
19
+ share_link_to name_or_options, :google, [], &block
20
+ end
21
+
22
+ def link_to_odnoklassniki_share(name_or_options = nil, &block)
23
+ share_link_to name_or_options, :odnoklassniki, [:title, :description], &block
24
+ end
25
+
26
+ def link_to_twitter_share(name_or_options = nil, &block)
27
+ share_link_to name_or_options, :twitter, [:title, :description], &block
17
28
  end
18
29
 
19
30
  private
@@ -36,7 +47,14 @@ module SharingTags::ActionView::ButtonHelper
36
47
 
37
48
  link_to params.page_url, name_or_options, &block
38
49
  else
50
+ name_or_options = default_name(network) if name_or_options.nil?
51
+
39
52
  link_to name_or_options, params.page_url, data: data_attrs, role: "sharing_tags_share", target: "_blank", &block
40
53
  end
41
54
  end
55
+
56
+ def default_name(network)
57
+ image_tag "sharing_tags/icons/#{network}.svg"
58
+ end
59
+
42
60
  end
@@ -1,3 +1,3 @@
1
1
  module SharingTags
2
- VERSION = "0.0.5"
2
+ VERSION = "0.0.6"
3
3
  end
@@ -9,11 +9,13 @@ describe SharingTags::Generators::InstallGenerator, type: :generator do
9
9
 
10
10
  before do
11
11
  prepare_destination
12
- run_generator
13
12
  end
14
13
 
15
14
  describe 'initializer' do
16
- let(:initializer) { content_for('config/initializers/sharing_tags.rb') }
15
+ before do
16
+ run_generator
17
+ end
18
+
17
19
  subject { file 'config/initializers/sharing_tags.rb' }
18
20
 
19
21
  it "creates a sharing_tags initializer" do
@@ -31,7 +33,19 @@ describe SharingTags::Generators::InstallGenerator, type: :generator do
31
33
  end
32
34
 
33
35
  describe 'assets' do
34
- pending
36
+
37
+ describe "javascripts" do
38
+ pending
39
+ end
40
+
41
+ describe "stylesheets" do
42
+
43
+ it "expect add require styles for existing file"
44
+ it "expect skip if style added "
45
+ it "expect skip if file doesnot exists"
46
+
47
+ end
48
+
35
49
  # subject { file 'app/controllers/sessions_controller.rb'}
36
50
 
37
51
  # it { is_expected_to have_method :index }
@@ -42,7 +56,14 @@ describe SharingTags::Generators::InstallGenerator, type: :generator do
42
56
  # subject { file 'app/views/sessions/new.html.erb'}
43
57
  #
44
58
  # it { is_expected_to have_correct_syntax }
59
+ end
45
60
 
61
+ describe "after install" do
62
+ it "expect has a message" do
63
+ # expect { run_generator }.to output(/Congratulations/).to_stderr_from_any_process
64
+ # expect { run_generator }.to output(/Congratulations/).to_stdout_from_any_process
65
+ # expect { run_generator }.to output(/Congratulations/).to_stdout
66
+ end
46
67
  end
47
68
  end
48
69
 
@@ -0,0 +1,220 @@
1
+
2
+ RSpec.describe SharingTags::ActionView::ButtonHelper, :type => :helper do
3
+
4
+ describe "#link_to_facebook_share" do
5
+ before do
6
+ SharingTags.configure do
7
+ facebook do
8
+ title "fb title"
9
+ description "fb desc"
10
+ share_url "http://c.d"
11
+ page_url "http://a.b"
12
+ image "http://img.png"
13
+ end
14
+ end
15
+ end
16
+
17
+ subject { helper.link_to_facebook_share }
18
+
19
+ it "generate default text share link" do
20
+ is_expected.to have_tag "a", with: {href: "http://a.b", role: "sharing_tags_share"}
21
+ is_expected.to have_tag "a", with: {"data-share-url" => "http://c.d"}
22
+ is_expected.to have_tag "img", with: {src: "/assets/sharing_tags/icons/facebook.svg"}
23
+
24
+ is_expected.to have_tag("a", without: {
25
+ "data-share-url" => "http://c.d",
26
+ "data-title" => "fb title",
27
+ "data-description" => "fb desc",
28
+ "data-image" => "http://img.png",
29
+ "data-network" => "facebook"
30
+ })
31
+ end
32
+
33
+ it "generate default text sharing link for block" do
34
+ expect(helper.link_to_facebook_share { "Text block" }).to have_tag "a", text: "Text block", with: {href: "http://a.b", role: "sharing_tags_share"}
35
+ expect(helper.link_to_facebook_share { "Text block" }).to have_tag "a", text: "Text block", with: {"data-share-url" => "http://c.d"}
36
+ end
37
+ end
38
+
39
+ describe "#link_to_vkontakte_share" do
40
+ before do
41
+ SharingTags.configure do
42
+ vkontakte do
43
+ title "vk title"
44
+ description "vk desc"
45
+ share_url "http://vk.share?utm_source=vk"
46
+ page_url "http://vk.share"
47
+ image "http://img.png"
48
+ end
49
+ end
50
+ end
51
+
52
+ subject { helper.link_to_vkontakte_share }
53
+
54
+
55
+ it "generate default text share link" do
56
+ is_expected.to have_tag "a", with: {href: "http://vk.share", role: "sharing_tags_share"}
57
+ is_expected.to have_tag("a", with: {
58
+ "data-share-url" => "http://vk.share?utm_source=vk",
59
+ "data-title" => "vk title",
60
+ "data-description" => "vk desc",
61
+ "data-image" => "http://img.png",
62
+ "data-network" => "vkontakte"
63
+ })
64
+ end
65
+
66
+ it "generate default text sharing link for block" do
67
+ expect(helper.link_to_vkontakte_share { "Text block" }).to have_tag "a", text: "Text block", with: {href: "http://vk.share", role: "sharing_tags_share"}
68
+ expect(helper.link_to_vkontakte_share { "Text block" }).to have_tag("a", with: {
69
+ "data-share-url" => "http://vk.share?utm_source=vk",
70
+ "data-title" => "vk title",
71
+ "data-description" => "vk desc",
72
+ "data-image" => "http://img.png",
73
+ "data-network" => "vkontakte"
74
+ })
75
+
76
+ end
77
+ end
78
+
79
+ describe "#link_to_odnoklassniki_share" do
80
+ before do
81
+ SharingTags.configure do
82
+ odnoklassniki do
83
+ title "od title"
84
+ description "od desc"
85
+ share_url "http://od.share?utm_source=od"
86
+ page_url "http://od.share"
87
+ image "http://img.png"
88
+ end
89
+ end
90
+ end
91
+
92
+ subject { helper.link_to_odnoklassniki_share }
93
+
94
+ it "generate default text share link" do
95
+ is_expected.to have_tag "a", with: {href: "http://od.share", role: "sharing_tags_share"}
96
+ is_expected.to have_tag("a", with: {
97
+ "data-share-url" => "http://od.share?utm_source=od",
98
+ "data-title" => "od title",
99
+ "data-description" => "od desc",
100
+ "data-network" => "odnoklassniki"
101
+ })
102
+ is_expected.to have_tag "img", with: {src: "/assets/sharing_tags/icons/odnoklassniki.svg"}
103
+ is_expected.to have_tag("a", without: {
104
+ "data-image" => "http://img.png"
105
+ })
106
+ end
107
+
108
+ it "generate default text sharing link for block" do
109
+ expect(helper.link_to_odnoklassniki_share { "Text block" }).to have_tag "a", text: "Text block", with: {href: "http://od.share", role: "sharing_tags_share"}
110
+ end
111
+
112
+ # it "generate default text sharing link for block" do
113
+ # pending
114
+ # expect(
115
+ # helper.link_to_odnoklassniki_share(role: "ya-target", data: {target: "main"}) { "Text" }
116
+ # ).to have_tag("a", text: "Text block",
117
+ # with: {href: "http://od.share", role: "ya-target sharing_tags_share"})
118
+ #
119
+ # expect(helper.link_to_odnoklassniki_share).to have_tag("a", with: {
120
+ # "data-share-url" => "http://od.share?utm_source=od",
121
+ # "data-title" => "od title",
122
+ # "data-description" => "od desc",
123
+ # 'data-target' => "main"
124
+ # })
125
+ # end
126
+
127
+
128
+ end
129
+
130
+ describe "#link_to_twitter_share" do
131
+ before do
132
+ SharingTags.configure do
133
+ twitter do
134
+ link_params utm_source: "tw"
135
+
136
+ title "tw title"
137
+ description "tw desc"
138
+ page_url "http://tw.share"
139
+ image "http://img.png"
140
+ end
141
+ end
142
+ end
143
+
144
+ subject { helper.link_to_twitter_share }
145
+
146
+ it "generate default text share link" do
147
+ is_expected.to have_tag "a", with: {href: "http://tw.share", role: "sharing_tags_share"}
148
+ is_expected.to have_tag("a", with: {
149
+ "data-share-url" => "http://tw.share?utm_source=tw",
150
+ "data-title" => "tw title",
151
+ "data-description" => "tw desc",
152
+ "data-network" => "twitter"
153
+ })
154
+ is_expected.to have_tag("a", without: {
155
+ "data-image" => "http://img.png"
156
+ })
157
+ expect(helper.link_to_twitter_share).to have_tag "img", with: {src: "/assets/sharing_tags/icons/twitter.svg"}
158
+ end
159
+
160
+ it "generate default text sharing link for block" do
161
+ expect(helper.link_to_twitter_share { "Twitter block" }).to have_tag "a", text: "Twitter block", with: {href: "http://tw.share", role: "sharing_tags_share"}
162
+ end
163
+ end
164
+
165
+ describe "#link_to_google_share" do
166
+ before do
167
+ SharingTags.configure do
168
+ google do
169
+ link_params utm_source: "gg"
170
+
171
+ title "gg title"
172
+ description "gg desc"
173
+ page_url "http://gg.share"
174
+ image "img.png"
175
+ end
176
+ end
177
+ end
178
+
179
+ subject { helper.link_to_google_share }
180
+
181
+ it "generate default text share link" do
182
+ is_expected.to have_tag "a", with: {href: "http://gg.share", role: "sharing_tags_share"}
183
+ is_expected.to have_tag("a", with: {
184
+ "data-share-url" => "http://gg.share?utm_source=gg",
185
+ "data-network" => "google"
186
+ },
187
+ without: {
188
+ "data-image" => "img.png",
189
+ "data-title" => "gg title",
190
+ "data-description" => "gg desc"
191
+ })
192
+ is_expected.to have_tag "img", with: {src: "/assets/sharing_tags/icons/google.svg"}
193
+ end
194
+
195
+ it "generate default text sharing link for block" do
196
+ expect(helper.link_to_google_share { "Google block" }).to have_tag "a", text: "Google block", with: {href: "http://gg.share", role: "sharing_tags_share"}
197
+ end
198
+ end
199
+
200
+ describe "#sharing_tags_buttons" do
201
+ before do
202
+ SharingTags.configure do
203
+ title "Title"
204
+ description "Desc"
205
+ page_url "http://link.share"
206
+ image "http://img.png"
207
+ end
208
+ end
209
+
210
+ it "generate links with default networks" do
211
+ expect(helper.sharing_tags_buttons).to have_tag "a"
212
+ # have all network links
213
+ end
214
+
215
+ it "generate links for facebook, vkontakte, twitter" do
216
+ expect(helper.sharing_tags_buttons).to have_tag "a"
217
+ end
218
+
219
+ end
220
+ end
@@ -0,0 +1,15 @@
1
+ {
2
+ "full": {
3
+ "url": "http://full.url",
4
+ "title": "Title full",
5
+ "description": "Description",
6
+ "app_id": "123",
7
+ "return_url": "http://return.url"
8
+ },
9
+
10
+ "partial": {
11
+ "url": "http://partial.url",
12
+ "title": "Partial title",
13
+ "description": "Description"
14
+ }
15
+ }
@@ -0,0 +1,86 @@
1
+ #=require sharing_tags/share
2
+ #=require sharing_tags/share/facebook
3
+
4
+ fixture.preload("facebook.json")
5
+
6
+ describe "SharingTags.FacebookShare", ->
7
+
8
+ subject = SharingTags.FacebookShare
9
+
10
+ beforeEach ->
11
+ @fb_fixture = fixture.load("facebook.json")[0]
12
+
13
+ it "expect defined class", ->
14
+ expect( SharingTags ).toBeDefined()
15
+ expect( SharingTags.FacebookShare ).toBeDefined()
16
+
17
+ describe "init sharing variables", ->
18
+ beforeEach ->
19
+ @fb_partial = @fb_fixture.partial
20
+ expect(@fb_partial).toBeDefined()
21
+ @fb_full = @fb_fixture.full
22
+ expect(@fb_full).toBeDefined()
23
+
24
+ it "expect init with main variables variables", ->
25
+ @share = new subject(@fb_partial)
26
+
27
+ expect( @share.url ).toBe @fb_partial.url
28
+ expect( @share.title ).toBe @fb_partial.title
29
+ expect( @share.description ).toBe @fb_partial.description
30
+
31
+ expect( @share.app_id ).not.toBeDefined()
32
+ expect( @share.return_url ).not.toBeDefined()
33
+
34
+ it "expect init full variables", ->
35
+ @share = new subject(@fb_full)
36
+
37
+ expect( @share.url ).toBe @fb_full.url
38
+ expect( @share.title ).toBe @fb_full.title
39
+ expect( @share.description ).toBe @fb_full.description
40
+ expect( @share.app_id ).toBe @fb_full.app_id
41
+ expect( @share.return_url ).toBe @fb_full.return_url
42
+
43
+ it "expect error if init without url", ->
44
+ delete @fb_partial.url
45
+ expect(=> new subject(@fb_partial)).toThrow(SharingTags.Error(), /Error could not initialize sharing class/)
46
+
47
+ it "expect error if init without title", ->
48
+ delete @fb_partial.title
49
+ expect(=> new subject(@fb_partial)).toThrow(SharingTags.Error(), /Error could not initialize sharing class/)
50
+
51
+ it "expect error if init without description", ->
52
+ delete @fb_partial.description
53
+ expect(=> new subject(@fb_partial)).toThrow(SharingTags.Error(), /Error could not initialize sharing class/)
54
+
55
+ describe "share provider", ->
56
+ it "expect use default provider"
57
+ it "expect change default provider"
58
+ it "expect change provider on initialize"
59
+
60
+
61
+ describe "callback", ->
62
+ it "set global callback"
63
+ it "set callback with initializer"
64
+
65
+ describe "events", ->
66
+ it "expect trigger event start sharing"
67
+ it "expect trigger event after sharing"
68
+
69
+ # describe "mobile version", ->
70
+ # beforeEach ->
71
+ # spyOn(SharingTags.MobileShare, "_share")
72
+ # spyOn(SharingTags.Share, "_share")
73
+ #
74
+ # it "expect call share mobile version when app_id defined", ->
75
+ # share_params = url: "share url", return_url: "return url", app_id: "app id"
76
+ # callback = -> "callback"
77
+ # SharingTags.MobileShare.facebook(share_params, callback)
78
+ # expect(SharingTags.MobileShare._share).toHaveBeenCalled()
79
+ # expect(SharingTags.MobileShare._share).toHaveBeenCalledWith("http://www.facebook.com/dialog/share", href: "share url", redirect_uri: "return url", app_id: "app id", display: 'touch', callback)
80
+ #
81
+ ## it "expect call share desktop version without app_id", ->
82
+ ## SharingTags.MobileShare.facebook(url: "share_url")
83
+ ## expect(SharingTags.Share._share).toHaveBeenCalled()
84
+ ## expect(SharingTags.MobileShare._share).toHaveBeenCalled()
85
+ ## spyOn(SharingTags.MobileShare, "_share")
86
+ #
@@ -23,10 +23,10 @@ describe "Sharing Tags", ->
23
23
  SharingTags.share('facebook')
24
24
  expect(SharingTags.Share.facebook).toHaveBeenCalled()
25
25
 
26
- it "vkontakte"
27
- it "twitter"
28
- it "google"
29
- it "odnoklassniki"
30
- it "mailru"
31
- it "linkedin"
26
+ # it "vkontakte"
27
+ # it "twitter"
28
+ # it "google"
29
+ # it "odnoklassniki"
30
+ # it "mailru"
31
+ # it "linkedin"
32
32
 
data/spec/teaspoon_env.rb CHANGED
@@ -170,7 +170,7 @@ Teaspoon.configure do |config|
170
170
  # Which coverage reports Istanbul should generate. Correlates directly to what Istanbul supports.
171
171
  #
172
172
  # Available: text-summary, text, html, lcov, lcovonly, cobertura, teamcity
173
- #coverage.reports = ["text-summary", "html"]
173
+ # coverage.reports = ["text-summary", "html"]
174
174
 
175
175
  # The path that the coverage should be written to - when there's an artifact to write to disk.
176
176
  # Note: Relative to `config.root`.
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sharing_tags
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Anatoliy Kovalchuk
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-04-10 00:00:00.000000000 Z
11
+ date: 2015-04-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -281,14 +281,30 @@ files:
281
281
  - README.md
282
282
  - Rakefile
283
283
  - Todo.md
284
+ - app/assets/images/sharing_tags/icons/facebook.svg
285
+ - app/assets/images/sharing_tags/icons/google.svg
286
+ - app/assets/images/sharing_tags/icons/odnoklassniki.svg
287
+ - app/assets/images/sharing_tags/icons/twitter.svg
288
+ - app/assets/images/sharing_tags/icons/vkontakte.svg
289
+ - app/assets/javascripts/sharing_tags.js.coffee
284
290
  - app/assets/javascripts/sharing_tags/links.js.coffee
285
291
  - app/assets/javascripts/sharing_tags/share.coffee
286
- - app/views/sharing_tags/_open_graphs.html.slim
287
- - app/views/sharing_tags/_schema_tags.html.slim
288
- - app/views/sharing_tags/_twitter_card.html.slim
292
+ - app/assets/javascripts/sharing_tags/share/facebook.coffee
293
+ - app/assets/stylesheets/sharing_tags.css.sass
294
+ - app/assets/stylesheets/sharing_tags/icons.css.sass
295
+ - app/views/sharing_tags/button/_facebook.html.slim
296
+ - app/views/sharing_tags/button/_google.html.slim
297
+ - app/views/sharing_tags/button/_odnoklassniki.html.slim
298
+ - app/views/sharing_tags/button/_twitter.html.slim
299
+ - app/views/sharing_tags/button/_vkontakte.html.slim
300
+ - app/views/sharing_tags/buttons.html.slim
301
+ - app/views/sharing_tags/meta/_open_graphs.html.slim
302
+ - app/views/sharing_tags/meta/_schema_tags.html.slim
303
+ - app/views/sharing_tags/meta/_twitter_card.html.slim
289
304
  - app/views/sharing_tags/meta_tags.html.slim
290
305
  - bin/rspec
291
306
  - lib/generators/sharing_tags/install/install_generator.rb
307
+ - lib/generators/sharing_tags/install/templates/POST_INSTALL
292
308
  - lib/generators/sharing_tags/install/templates/initializer.rb
293
309
  - lib/sharing_tags.rb
294
310
  - lib/sharing_tags/action_controller/filters.rb
@@ -362,8 +378,10 @@ files:
362
378
  - spec/dummy/vendor/assets/stylesheets/.keep
363
379
  - spec/generators/install_generator_spec.rb
364
380
  - spec/helpers/asset_helper_spec.rb
381
+ - spec/helpers/button_helper_spec.rb
365
382
  - spec/helpers/meta_tags_helper_spec.rb
366
- - spec/helpers/share_link_helper_spec.rb
383
+ - spec/javascripts/fixtures/facebook.json
384
+ - spec/javascripts/sharing_tags/share/facebook_share_spec.coffee
367
385
  - spec/javascripts/sharing_tags/sharing_tags_spec.coffee
368
386
  - spec/javascripts/spec_helper.coffee
369
387
  - spec/models/configuration_spec.rb
@@ -373,8 +391,8 @@ files:
373
391
  - spec/spec_helper.rb
374
392
  - spec/support/generator_support.rb
375
393
  - spec/teaspoon_env.rb
376
- - spec/views/facebook_meta_tags_erb_spec.rb
377
- - spec/views/meta_tags_erb_spec.rb
394
+ - spec/views/meta_tags/facebook_meta_tags_erb_spec.rb
395
+ - spec/views/meta_tags/meta_tags_erb_spec.rb
378
396
  homepage: https://github.com/Kr00lIX/sharing_tags
379
397
  licenses:
380
398
  - MIT
@@ -457,8 +475,10 @@ test_files:
457
475
  - spec/dummy/vendor/assets/stylesheets/.keep
458
476
  - spec/generators/install_generator_spec.rb
459
477
  - spec/helpers/asset_helper_spec.rb
478
+ - spec/helpers/button_helper_spec.rb
460
479
  - spec/helpers/meta_tags_helper_spec.rb
461
- - spec/helpers/share_link_helper_spec.rb
480
+ - spec/javascripts/fixtures/facebook.json
481
+ - spec/javascripts/sharing_tags/share/facebook_share_spec.coffee
462
482
  - spec/javascripts/sharing_tags/sharing_tags_spec.coffee
463
483
  - spec/javascripts/spec_helper.coffee
464
484
  - spec/models/configuration_spec.rb
@@ -468,5 +488,5 @@ test_files:
468
488
  - spec/spec_helper.rb
469
489
  - spec/support/generator_support.rb
470
490
  - spec/teaspoon_env.rb
471
- - spec/views/facebook_meta_tags_erb_spec.rb
472
- - spec/views/meta_tags_erb_spec.rb
491
+ - spec/views/meta_tags/facebook_meta_tags_erb_spec.rb
492
+ - spec/views/meta_tags/meta_tags_erb_spec.rb
@@ -1,141 +0,0 @@
1
-
2
- RSpec.describe SharingTags::ActionView::ButtonHelper, :type => :helper do
3
-
4
- describe "#link_to_facebook_share" do
5
- before do
6
- SharingTags.configure do
7
- facebook do
8
- title "fb title"
9
- description "fb desc"
10
- share_url "http://c.d"
11
- page_url "http://a.b"
12
- image "http://img.png"
13
- end
14
- end
15
- end
16
-
17
- it "generate default text share link" do
18
- expect(helper.link_to_facebook_share).to have_tag "a", text: "Facebook", with: {href: "http://a.b", role: "sharing_tags_share"}
19
- expect(helper.link_to_facebook_share).to have_tag "a", with: {"data-share-url" => "http://c.d"}
20
- expect(helper.link_to_facebook_share).to have_tag "a", without: {"data-share-url" => "http://c.d"}
21
- expect(helper.link_to_facebook_share).to have_tag("a", without: {
22
- "data-title" => "fb title",
23
- "data-description" => "fb desc",
24
- "data-image" => "http://img.png"
25
- })
26
- end
27
-
28
- it "generate default text sharing link for block" do
29
- expect(helper.link_to_facebook_share { "Text block" }).to have_tag "a", text: "Text block", with: {href: "http://a.b", role: "sharing_tags_share"}
30
- end
31
- end
32
-
33
- describe "#link_to_vkontakte_share" do
34
- before do
35
- SharingTags.configure do
36
- vkontakte do
37
- title "vk title"
38
- description "vk desc"
39
- share_url "http://vk.share?utm_source=vk"
40
- page_url "http://vk.share"
41
- image "http://img.png"
42
- end
43
- end
44
- end
45
-
46
- it "generate default text share link" do
47
- expect(helper.link_to_vkontakte_share).to have_tag "a", text: "Vkontakte", with: {href: "http://vk.share", role: "sharing_tags_share"}
48
- expect(helper.link_to_vkontakte_share).to have_tag("a", with: {
49
- "data-share-url" => "http://vk.share?utm_source=vk",
50
- "data-title" => "vk title",
51
- "data-description" => "vk desc",
52
- "data-image" => "http://img.png"
53
- })
54
- end
55
-
56
- it "generate default text sharing link for block" do
57
- expect(helper.link_to_vkontakte_share { "Text block" }).to have_tag "a", text: "Text block", with: {href: "http://vk.share", role: "sharing_tags_share"}
58
- end
59
- end
60
-
61
- describe "#link_to_odnoklassniki_share" do
62
- before do
63
- SharingTags.configure do
64
- odnoklassniki do
65
- title "od title"
66
- description "od desc"
67
- share_url "http://od.share?utm_source=od"
68
- page_url "http://od.share"
69
- image "http://img.png"
70
- end
71
- end
72
- end
73
-
74
-
75
- it "generate default text share link" do
76
- expect(helper.link_to_odnoklassniki_share).to have_tag "a", text: "Odnoklassniki", with: {href: "http://od.share", role: "sharing_tags_share"}
77
- expect(helper.link_to_odnoklassniki_share).to have_tag("a", with: {
78
- "data-share-url" => "http://od.share?utm_source=od",
79
- "data-title" => "od title",
80
- "data-description" => "od desc"
81
- })
82
- expect(helper.link_to_odnoklassniki_share).to have_tag("a", without: {
83
- "data-image" => "http://img.png"
84
- })
85
- end
86
-
87
- it "generate default text sharing link for block" do
88
- expect(helper.link_to_odnoklassniki_share { "Text block" }).to have_tag "a", text: "Text block", with: {href: "http://od.share", role: "sharing_tags_share"}
89
- end
90
-
91
- it "generate default text sharing link for block" do
92
- pending
93
- expect(
94
- helper.link_to_odnoklassniki_share(role: "ya-target", data: {target: "main"}) { "Text" }
95
- ).to have_tag("a", text: "Text block",
96
- with: {href: "http://od.share", role: "ya-target sharing_tags_share"})
97
-
98
- expect(helper.link_to_odnoklassniki_share).to have_tag("a", with: {
99
- "data-share-url" => "http://od.share?utm_source=od",
100
- "data-title" => "od title",
101
- "data-description" => "od desc",
102
- 'data-target' => "main"
103
- })
104
- end
105
-
106
-
107
- end
108
-
109
- describe "#link_to_twitter_share" do
110
- before do
111
- SharingTags.configure do
112
- twitter do
113
- link_params utm_source: "tw"
114
-
115
- title "tw title"
116
- description "tw desc"
117
- page_url "http://tw.share"
118
- image "http://img.png"
119
- end
120
- end
121
- end
122
-
123
-
124
- it "generate default text share link" do
125
- expect(helper.link_to_twitter_share).to have_tag "a", text: "Twitter", with: {href: "http://tw.share", role: "sharing_tags_share"}
126
- expect(helper.link_to_twitter_share).to have_tag("a", with: {
127
- "data-share-url" => "http://tw.share?utm_source=tw",
128
- "data-title" => "tw title",
129
- "data-description" => "tw desc"
130
- })
131
- expect(helper.link_to_twitter_share).to have_tag("a", without: {
132
- "data-image" => "http://img.png"
133
- })
134
- end
135
-
136
- it "generate default text sharing link for block" do
137
- expect(helper.link_to_twitter_share { "Twitter block" }).to have_tag "a", text: "Twitter block", with: {href: "http://tw.share", role: "sharing_tags_share"}
138
- end
139
-
140
- end
141
- end