lentil 1.0.3 → 1.0.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f0f1ba3dca5c251d625e3c36995d80f2a24d4115
4
- data.tar.gz: 632b1928bb0b974c7039a25ef2a3c416b997feb6
3
+ metadata.gz: ecf47629d42a05f5914f948f28629c5dddf4dc05
4
+ data.tar.gz: 48b6252b34c140ff7cb8acba38e278dd04e4b3a9
5
5
  SHA512:
6
- metadata.gz: 0842afb191afa661db3a5f0997b3e1c6d406e9a217bf235ab545fc35e508ed09a601f87441931f6b47d6832b641c3660d6276152ccab89a6073ae0871e286651
7
- data.tar.gz: 0690cdcb63ca66a1258faebb2cb84849b92aa5577dc0f7faaf6b51ccff8b64f9748db5a1e34d86e38ffeb857d39ae91fdd96efda14052647997165c2285a25a5
6
+ metadata.gz: f250e5e6eaed99ad29dbbeda37705989a9981754a125563c2701db2bc04ab82686a4299b1fe4b1d9f81f15007b4cd81046319609e616a21d006af5fada71997a
7
+ data.tar.gz: 5eed5ff3c8f9e2a158dfaba7e5e4a570c7d8fe90c7326a6100e8baa13b24d4a08b187774e57a6910847d13a6fb4a3370e0c88739e02f84ea1dc32ffd81954459
data/README.md CHANGED
@@ -17,6 +17,8 @@ Although we are using this gem in production, **this gem should be considered an
17
17
 
18
18
  ## Installation
19
19
 
20
+ > lentil is also available through the pre-packaged [Social Media Combine](https://github.com/NCSU-Libraries/Social-Media-Combine) for easier setup alongside Twitter harvesting software.
21
+
20
22
  lentil requires Ruby 2.3.1 or greater.
21
23
 
22
24
  ### Create a new Rails app with Rails 4.2.x
@@ -48,7 +48,7 @@ function pushimageurl(imageId) {
48
48
  // push the url for the displayed image to the browser
49
49
  window.history.pushState(null, null, replacementUrl);
50
50
 
51
- Lentil.ga_track(['_trackPageview', replacementUrl]);
51
+ Lentil.ga_track(['pageview', replacementUrl]);
52
52
 
53
53
  // listen for popstate (back/forward button)
54
54
  window.onpopstate = function(){
@@ -13,9 +13,10 @@ $(function () {
13
13
  // In production it tracks the event to Google. It expects an array of everything that
14
14
  // should be sent to Google.
15
15
  ga_track: function(values){
16
+
16
17
  <% if Rails.env == 'production' %>
17
- if (typeof _gaq !== "undefined") {
18
- _gaq.push(values);
18
+ if (typeof ga !== "undefined") {
19
+ window.ga.apply('window', ['send'].concat(values));
19
20
  }
20
21
  <% else %>
21
22
  console.log(values);
@@ -29,33 +30,33 @@ $(function () {
29
30
  // click on image
30
31
  $(document.body).on('click', '.images .fancybox', function(){
31
32
  var image_id = $(this).parent().attr('id');
32
- Lentil.ga_track(['_trackEvent', 'image', 'click', image_id]);
33
+ Lentil.ga_track(['event', 'image', 'click', image_id]);
33
34
  });
34
35
 
35
36
  // share button
36
37
  $(document.body).on('click', '.share', function(){
37
- var image_id = $(this).data('imageId');
38
- Lentil.ga_track(['_trackEvent', 'image_view', 'share', image_id]);
38
+ var image_id = $(this).attr('data-image-id');
39
+ Lentil.ga_track(['event', 'image_view', 'share', image_id]);
39
40
  });
40
41
  // facebook
41
42
  $(document.body).on('click', '.facebook', function(){
42
- var image_id = $(this).data('imageId');
43
- Lentil.ga_track(['_trackEvent', 'image_view', 'facebook', image_id]);
43
+ var image_id = $(this).attr('data-image-id');
44
+ Lentil.ga_track(['event', 'image_view', 'facebook', image_id]);
44
45
  });
45
46
  // twitter
46
47
  $(document.body).on('click', '.twitter', function(){
47
- var image_id = $(this).data('imageId');
48
- Lentil.ga_track(['_trackEvent', 'image_view', 'twitter', image_id]);
48
+ var image_id = $(this).attr('data-image-id');
49
+ Lentil.ga_track(['event', 'image_view', 'twitter', image_id]);
49
50
  });
50
51
  // email
51
52
  $(document.body).on('click', '.email', function(){
52
- var image_id = $(this).data('imageId');
53
- Lentil.ga_track(['_trackEvent', 'image_view', 'email', image_id]);
53
+ var image_id = $(this).attr('data-image-id');
54
+ Lentil.ga_track(['event', 'image_view', 'email', image_id]);
54
55
  });
55
56
 
56
57
  // like
57
58
  $(document.body).on('click', '.like-btn', function(){
58
- var image_id = $(this).data('imageId');
59
+ var image_id = $(this).attr('data-image-id');
59
60
  var like_state;
60
61
  if ($(this).hasClass('already-clicked')) {
61
62
  like_state = 'unlike';
@@ -63,18 +64,18 @@ $(function () {
63
64
  like_state = 'like';
64
65
  }
65
66
 
66
- Lentil.ga_track(['_trackEvent', 'image_view', like_state, image_id]);
67
+ Lentil.ga_track(['event', 'image_view', like_state, image_id]);
67
68
  });
68
69
 
69
70
  // flag
70
71
  $(document.body).on('click', '.flag-btn', function(){
71
- var image_id = $(this).data('imageId');
72
- Lentil.ga_track(['_trackEvent', 'image_view', 'flag', image_id]);
72
+ var image_id = $(this).attr('data-image-id');
73
+ Lentil.ga_track(['event', 'image_view', 'flag', image_id]);
73
74
  });
74
75
 
75
76
  // picking a battle image
76
77
  $(document.body).on('click', '.battle-form', function(){
77
78
  var image_id = $(this).attr('value');
78
- Lentil.ga_track(['_trackEvent', 'battle_view', 'pick', image_id]);
79
+ Lentil.ga_track(['event', 'battle_view', 'pick', image_id]);
79
80
  });
80
81
  });
@@ -1,3 +1,3 @@
1
1
  module Lentil
2
- VERSION = "1.0.3"
2
+ VERSION = "1.0.4"
3
3
  end
@@ -9,9 +9,9 @@ class EventTrackingBattleTest < ActionDispatch::IntegrationTest
9
9
  first_image = all('.battle-form').first()
10
10
  image_id = first_image['value']
11
11
  first_image.click
12
- assert_equal("_trackEvent,battle_view,pick,#{image_id}", console_message)
12
+ assert_equal("event,battle_view,pick,#{image_id}", console_message)
13
13
  find('.battle-result-arrow-wrap') # this should wait for the ajax to finish
14
14
  browser_end
15
15
  end
16
16
  end
17
- end
17
+ end
@@ -13,28 +13,28 @@ class EventTrackingTest < ActionDispatch::IntegrationTest
13
13
  test "should trigger an event for clicking on an image" do
14
14
  visit(lentil.images_path)
15
15
  find("#image_#{@image.id} a.fancybox").click
16
- assert_equal("_trackEvent,image,click,image_#{@image.id}", console_messages[-2])
17
- assert_equal("_trackPageview,/lentil/images/#{@image.id}", console_message)
16
+ assert_equal("event,image,click,image_#{@image.id}", console_messages[-2])
17
+ assert_equal("pageview,/lentil/images/#{@image.id}", console_message)
18
18
  end
19
19
 
20
20
  test "should trigger an event for clicking on the share button" do
21
21
  visit(lentil.image_path(@image))
22
22
  find('.share').click
23
- assert_equal("_trackEvent,image_view,share,#{@image.id}", console_message)
23
+ assert_equal("event,image_view,share,#{@image.id}", console_message)
24
24
  end
25
25
 
26
26
  test "should trigger an event for clicking on the facebook share link" do
27
27
  visit(lentil.image_path(@image))
28
28
  find('.share').click
29
29
  find('.facebook').click
30
- assert_equal("_trackEvent,image_view,facebook,#{@image.id}", console_message)
30
+ assert_equal("event,image_view,facebook,#{@image.id}", console_message)
31
31
  end
32
32
 
33
33
  test "should trigger an event for clicking on the twitter share link" do
34
34
  visit(lentil.image_path(@image))
35
35
  find('.share').click
36
36
  find('.twitter').click
37
- assert_equal("_trackEvent,image_view,twitter,#{@image.id}", console_message)
37
+ assert_equal("event,image_view,twitter,#{@image.id}", console_message)
38
38
  end
39
39
 
40
40
  # FIXME: This fails due to the mailto link.
@@ -42,16 +42,16 @@ class EventTrackingTest < ActionDispatch::IntegrationTest
42
42
  # visit(lentil.image_path(@image))
43
43
  # find('.share').click
44
44
  # find('.email').click
45
- # assert_equal("_trackEvent,image_view,email,#{@image.id}", console_message)
45
+ # assert_equal("event,image_view,email,#{@image.id}", console_message)
46
46
  # end
47
47
 
48
48
  test "should trigger an event for liking and unliking an image" do
49
49
  visit(lentil.image_path(@image))
50
50
  find('.like-btn.initial-state', :visible => true).click
51
- assert_equal("_trackEvent,image_view,like,#{@image.id}", console_message)
51
+ assert_equal("event,image_view,like,#{@image.id}", console_message)
52
52
  find('.like-btn.already-clicked', :visible => true).click
53
53
  find('.like-btn.initial-state', :visible => true)
54
- assert_equal("_trackEvent,image_view,unlike,#{@image.id}", console_message)
54
+ assert_equal("event,image_view,unlike,#{@image.id}", console_message)
55
55
  end
56
56
 
57
57
  # TODO: Not currently implemented
@@ -61,13 +61,13 @@ class EventTrackingTest < ActionDispatch::IntegrationTest
61
61
  # visit lentil.images_path
62
62
  # visit lentil.image_path(@image)
63
63
  # find('.like-btn.already-clicked').click
64
- # assert_equal("_trackEvent,image_view,unlike,#{@image.id}", console_message)
64
+ # assert_equal("event,image_view,unlike,#{@image.id}", console_message)
65
65
  # end
66
66
 
67
67
  test "clicking the flag button" do
68
68
  visit lentil.image_path(@image)
69
69
  find('.flag-btn', :visible => true).click
70
- assert_equal("_trackEvent,image_view,flag,#{@image.id}", console_message)
70
+ assert_equal("event,image_view,flag,#{@image.id}", console_message)
71
71
  end
72
72
 
73
73
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lentil
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.3
4
+ version: 1.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jason Casden
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2016-11-06 00:00:00.000000000 Z
14
+ date: 2016-12-07 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: rails
@@ -41,6 +41,20 @@ dependencies:
41
41
  - - "~>"
42
42
  - !ruby/object:Gem::Version
43
43
  version: '4.2'
44
+ - !ruby/object:Gem::Dependency
45
+ name: jquery-ui-rails
46
+ requirement: !ruby/object:Gem::Requirement
47
+ requirements:
48
+ - - "~>"
49
+ - !ruby/object:Gem::Version
50
+ version: '5.0'
51
+ type: :runtime
52
+ prerelease: false
53
+ version_requirements: !ruby/object:Gem::Requirement
54
+ requirements:
55
+ - - "~>"
56
+ - !ruby/object:Gem::Version
57
+ version: '5.0'
44
58
  - !ruby/object:Gem::Dependency
45
59
  name: activeadmin
46
60
  requirement: !ruby/object:Gem::Requirement
@@ -509,14 +523,14 @@ dependencies:
509
523
  requirements:
510
524
  - - "~>"
511
525
  - !ruby/object:Gem::Version
512
- version: 1.11.0
526
+ version: '1.12'
513
527
  type: :development
514
528
  prerelease: false
515
529
  version_requirements: !ruby/object:Gem::Requirement
516
530
  requirements:
517
531
  - - "~>"
518
532
  - !ruby/object:Gem::Version
519
- version: 1.11.0
533
+ version: '1.12'
520
534
  - !ruby/object:Gem::Dependency
521
535
  name: yard
522
536
  requirement: !ruby/object:Gem::Requirement