kinney 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (92) hide show
  1. data/README.markdown +2 -2
  2. data/Rakefile +4 -0
  3. data/app/admin/clips.rb +40 -1
  4. data/app/assets/javascripts/kinney/admin/video_preview.js +1 -1
  5. data/app/controllers/kinney/tracker_controller.rb +0 -34
  6. data/app/helpers/kinney/general_helper.rb +1 -1
  7. data/app/models/kinney/clip.rb +5 -2
  8. data/app/models/kinney/person.rb +11 -11
  9. data/app/views/{kinney/tracker → admin/kinney_clips}/_video_engagement_chart.html.erb +15 -0
  10. data/app/views/{kinney/tracker/analyze.html.erb → admin/kinney_clips/analyze_tracker.html.erb} +5 -3
  11. data/app/views/kinney/clips/show.html.erb +1 -1
  12. data/app/views/kinney/people/index.html.erb +4 -3
  13. data/app/views/kinney/sitemap/index.xml.builder +1 -1
  14. data/config/routes.rb +1 -1
  15. data/lib/kinney/version.rb +1 -1
  16. data/test/dummy/db/development.sqlite3 +0 -0
  17. data/test/dummy/db/test.sqlite3 +0 -0
  18. data/test/dummy/log/development.log +33694 -0
  19. data/test/dummy/log/test.log +29895 -0
  20. data/test/dummy/tmp/cache/assets/CBF/9B0/sprockets%2Fe283548d3ef4505c82279198e09b53fa +0 -0
  21. data/test/dummy/tmp/cache/assets/D0B/560/sprockets%2F33db47d8bb65ee7457b03336420a55fd +0 -0
  22. data/test/functional/kinney/admin_clips_controller_test.rb +24 -0
  23. data/test/functional/kinney/clips_controller_test.rb +5 -3
  24. data/test/functional/kinney/people_controller_test.rb +5 -3
  25. data/test/functional/kinney/tracker_controller_test.rb +0 -6
  26. data/test/integration/admin_clip_test.rb +14 -11
  27. data/test/integration/admin_images_test.rb +8 -7
  28. data/test/integration/clips_index_test.rb +9 -6
  29. data/test/integration/clips_show_test.rb +11 -8
  30. data/test/integration/microdata_test.rb +40 -0
  31. data/test/integration/navigation_test.rb +7 -5
  32. data/test/integration/people_index_test.rb +7 -4
  33. data/test/integration/people_show_test.rb +14 -12
  34. data/test/support/test_with_cassette.rb +38 -0
  35. data/test/test_helper.rb +18 -2
  36. data/test/unit/clip_test.rb +5 -0
  37. data/test/vcr_cassettes/admin_clip/add_a_description_for_a_clip.yml +272 -0
  38. data/test/vcr_cassettes/admin_clip/admin_user_can_create_new_clip.yml +114 -0
  39. data/test/vcr_cassettes/admin_clip/display_whether_there_is_a_VTT_file_for_a_clip.yml +613 -0
  40. data/test/vcr_cassettes/admin_clip/do_not_allow_submission_of_clip_if_there_is_no_webvtt_file.yml +567 -0
  41. data/test/vcr_cassettes/admin_images/user_should_not_be_able_to_create_slug.yml +967 -0
  42. data/test/vcr_cassettes/admin_images/user_should_see_associated_name_for_image_on_index_view.yml +561 -0
  43. data/test/vcr_cassettes/admin_images/user_should_see_associated_name_for_image_on_show_view.yml +162 -0
  44. data/test/vcr_cassettes/admin_images/user_should_see_image_for_valid_image_on_edit_page.yml +186 -0
  45. data/test/vcr_cassettes/admin_images/user_should_see_image_for_valid_image_on_new_image_page.yml +374 -0
  46. data/test/vcr_cassettes/admin_images/user_should_see_image_for_valid_image_on_show_page.yml +193 -0
  47. data/test/vcr_cassettes/clips_controller/should_assign_a_webvtt_variable.yml +154 -0
  48. data/test/vcr_cassettes/clips_controller/should_assign_title_for_a_show_view.yml +136 -0
  49. data/test/vcr_cassettes/clips_controller/should_get_show.yml +136 -0
  50. data/test/vcr_cassettes/clips_index/clicking_on_a_video_thumbnail_should_go_to_a_video_clip.yml +154 -0
  51. data/test/vcr_cassettes/clips_show/should_expand/collapse_the_transcript.yml +154 -0
  52. data/test/vcr_cassettes/clips_show/should_have_link_to_other_videos_by_the_same_person.yml +136 -0
  53. data/test/vcr_cassettes/clips_show/should_have_link_to_profile.yml +136 -0
  54. data/test/vcr_cassettes/clips_show/should_not_see_More_videos_on_topics_with_link_under_video.yml +136 -0
  55. data/test/vcr_cassettes/clips_show/should_not_see_Video_Topics_section_on_page.yml +136 -0
  56. data/test/vcr_cassettes/clips_show/should_show_basic_information_about_a_clip.yml +136 -0
  57. data/test/vcr_cassettes/clips_show/should_show_other_clips_related_by_topic.yml +136 -0
  58. data/test/vcr_cassettes/clips_show/should_show_the_transcript.yml +154 -0
  59. data/test/vcr_cassettes/microdata/clip_show_view_should_have_microdata.yml +136 -0
  60. data/test/vcr_cassettes/microdata/person_show_view_should_have_microdata.yml +399 -0
  61. data/test/vcr_cassettes/navigation/there_should_be_a_link_to_People_in_the_global_navigation.yml +267 -0
  62. data/test/vcr_cassettes/people_controller/should_get_index.yml +267 -0
  63. data/test/vcr_cassettes/people_controller/should_get_show.yml +399 -0
  64. data/test/vcr_cassettes/people_controller/show_view_should_have_a_title.yml +399 -0
  65. data/test/vcr_cassettes/people_index/links_to_show_view_for_person_with_video.yml +663 -0
  66. data/test/vcr_cassettes/people_index/links_to_show_view_for_person_without_video.yml +267 -0
  67. data/test/vcr_cassettes/people_index/shows_people.yml +267 -0
  68. data/test/vcr_cassettes/people_index/sort_profile_images.yml +267 -0
  69. data/test/vcr_cassettes/people_show/if_there_is_only_one_image_and_it_is_a_top_pick_then_do_not_show_the_image_section_of_the_page.yml +135 -0
  70. data/test/vcr_cassettes/people_show/should_display_a_map_if_the_location_the_person_grew_up_is_known.yml +399 -0
  71. data/test/vcr_cassettes/people_show/should_display_the_information_like_description__interview_date_and_time_below_video_clip.yml +136 -0
  72. data/test/vcr_cassettes/people_show/should_give_a_link_to_other_videos_with_the_same_person.yml +534 -0
  73. data/test/vcr_cassettes/people_show/should_not_display_a_map_if_the_location_the_person_grew_up_is_not_known.yml +135 -0
  74. data/test/vcr_cassettes/people_show/should_not_see_the_top_pick_image_with_the_other_images.yml +399 -0
  75. data/test/vcr_cassettes/people_show/should_provide_a_link_to_a_video_as_an_image_and_make_it_a_top_pick.yml +399 -0
  76. data/test/vcr_cassettes/people_show/should_provide_a_link_to_other_videos_as_text_links.yml +399 -0
  77. data/test/vcr_cassettes/people_show/should_show_a_top_pick_image_near_the_biography.yml +399 -0
  78. data/test/vcr_cassettes/people_show/should_show_name_suffix_if_present.yml +135 -0
  79. data/test/vcr_cassettes/people_show/shows_person_content.yml +399 -0
  80. metadata +180 -59
  81. checksums.yaml +0 -7
  82. data/test/dummy/tmp/cache/assets/D36/B10/sprockets%2F3a3013990e54d3e944c21c6a9ed0b5de +0 -0
  83. data/test/dummy/tmp/cache/assets/D55/830/sprockets%2Fbd750c0ba01430d321ae77fbc2b238f9 +0 -0
  84. data/test/dummy/tmp/capybara/capybara-201209271510033933274391.html +0 -13
  85. data/test/dummy/tmp/capybara/capybara-201209271512386994415403.html +0 -13
  86. data/test/dummy/tmp/capybara/capybara-201209271515157873796042.html +0 -165
  87. data/test/dummy/tmp/capybara/capybara-201209271517053504547394.html +0 -165
  88. data/test/dummy/tmp/capybara/capybara-201209271520578220954785.html +0 -165
  89. data/test/dummy/tmp/capybara/capybara-201209271522457231789910.html +0 -165
  90. data/test/dummy/tmp/capybara/capybara-201209271524374294425819.html +0 -165
  91. data/test/dummy/tmp/capybara/capybara-201209271526597280429369.html +0 -165
  92. data/test/dummy/tmp/capybara/capybara-201209271529595570902080.html +0 -165
data/README.markdown CHANGED
@@ -2,12 +2,12 @@
2
2
 
3
3
  An oral history video clips site packaged as a Rails gem.
4
4
 
5
+ [![Build Status](https://travis-ci.org/jronallo/kinney.png)](https://travis-ci.org/jronallo/kinney)
6
+
5
7
  # Story
6
8
 
7
9
  This code was originally part of a site (currently unreleased) created for the [Student Leadership Initiative](http://news.lib.ncsu.edu/scrc/category/student-leaders/). The codename for the internal project is Sleader, so this project was named Kinney.
8
10
 
9
- Abstracting the code out into this Rails Engine is currently incomplete and possibly unusable, but it is ongoing. We are currently in the process of moving over to using this plugin for our own work.
10
-
11
11
  # Install
12
12
 
13
13
  1. Create a fresh Rails application
data/Rakefile CHANGED
@@ -4,6 +4,10 @@ begin
4
4
  rescue LoadError
5
5
  puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
6
6
  end
7
+
8
+ require 'single_test'
9
+ SingleTest.load_tasks
10
+
7
11
  begin
8
12
  require 'rdoc/task'
9
13
  rescue LoadError
data/app/admin/clips.rb CHANGED
@@ -29,10 +29,14 @@ ActiveAdmin.register Kinney::Clip do
29
29
  div(:style => 'width:480px;height:272px') do
30
30
  render :partial => '/kinney/video', :locals => {:clip => clip}
31
31
  end
32
- end
32
+ end
33
33
  end
34
34
  active_admin_comments
35
35
  end
36
+
37
+ action_item :only => [:show, :edit] do
38
+ link_to 'Video Analytics', analyze_tracker_admin_kinney_clip_path(kinney_clip.filename)
39
+ end
36
40
 
37
41
  controller do
38
42
  cache_sweeper Kinney::MetaSweeper
@@ -42,4 +46,39 @@ ActiveAdmin.register Kinney::Clip do
42
46
  @clips = Kinney::Clip.where('quotes IS NOT NULL')
43
47
  end
44
48
 
49
+ member_action :analyze_tracker, :method => :get do
50
+ @clip = Kinney::Clip.find_by_filename(params[:id])
51
+ @kinney_clip = @clip
52
+ # This is all a mess and could definitely be cleaned up!
53
+ @uuids = Kinney::Tracker.where(:video => params[:id]).pluck(:uuid).uniq
54
+ @all_seconds = []
55
+ @uuids.each do |uuid|
56
+ @all_seconds << Kinney::Tracker.where(:video => params[:id], :uuid => uuid).pluck(:seconds).flatten.uniq
57
+ end
58
+ @all_seconds.flatten!
59
+ @all_seconds = @all_seconds.map{|second| second.to_i}
60
+
61
+ @highest_value = 0
62
+
63
+ # @seconds should be a hash like this {'second' => 1, 'value' => 2}
64
+ # We start off with a hash which is the length of the duration of the clip, and
65
+ # then for every unique occurrence of that second in a tracker we increment the
66
+ # value by 1.
67
+ @temp_seconds = Hash[(0..@clip.duration).map{|num| [num, 0]}]
68
+
69
+ @all_seconds.each do |n|
70
+ @temp_seconds[n] += 1 if @temp_seconds[n]
71
+ end
72
+ @seconds = @temp_seconds.map do |k,v|
73
+ if v > @highest_value
74
+ @highest_value = v
75
+ end
76
+ {'second' => k,
77
+ 'value' => v}
78
+ end.sort_by{|second| second["second"]}
79
+
80
+ end
81
+
82
+
83
+
45
84
  end
@@ -30,7 +30,7 @@ $(document).ready(function() {
30
30
  }
31
31
  }
32
32
 
33
- if ($('.admin_kinney_clips').length > 0) {
33
+ if ($('body.admin_kinney_clips.edit,body.admin_kinney_clips.new').length > 0) {
34
34
  // WEBVTT must be present to submit form
35
35
  $('body.admin_kinney_clips #kinney_clip_submit_action input').attr('disabled', 'disabled');
36
36
  $('#vtt_result').html('<div class="alert">Give focus to the filename. You will not be able to save until there is a WEBVTT file.</div>');
@@ -1,6 +1,5 @@
1
1
  module Kinney
2
2
  class TrackerController < KinneyController
3
- before_filter :authenticate_admin_user!, :only => :analyze
4
3
 
5
4
  def track
6
5
  if request.xhr?
@@ -14,38 +13,5 @@ module Kinney
14
13
  end
15
14
  end
16
15
 
17
- def analyze
18
- @clip = Clip.where(:filename => params[:video]).first
19
- # This is all a mess and could definitely be cleaned up!
20
- @uuids = Tracker.where(:video => params[:video]).pluck(:uuid).uniq
21
- @all_seconds = []
22
- @uuids.each do |uuid|
23
- @all_seconds << Tracker.where(:video => params[:video], :uuid => uuid).pluck(:seconds).flatten.uniq
24
- end
25
- @all_seconds.flatten!
26
- @all_seconds = @all_seconds.map{|second| second.to_i}
27
-
28
- @highest_value = 0
29
-
30
- # @seconds should be a hash like this {'second' => 1, 'value' => 2}
31
- # We start off with a hash which is the length of the duration of the clip, and
32
- # then for every unique occurrence of that second in a tracker we increment the
33
- # value by 1.
34
- @temp_seconds = Hash[(0..@clip.duration).map{|num| [num, 0]}]
35
-
36
- @all_seconds.each do |n|
37
- @temp_seconds[n] += 1
38
- end
39
- @seconds = @temp_seconds.map do |k,v|
40
- if v > @highest_value
41
- @highest_value = v
42
- end
43
- {'second' => k,
44
- 'value' => v}
45
- end.sort_by{|second| second["second"]}
46
-
47
-
48
-
49
- end
50
16
  end
51
17
  end
@@ -17,7 +17,7 @@ module Kinney
17
17
 
18
18
  def meta_description
19
19
  if @meta_description
20
- %Q{<meta name="description" content="#{@meta_description}">}.html_safe
20
+ %Q{<meta name="description" content="#{h @meta_description}">}.html_safe
21
21
  end
22
22
  end
23
23
 
@@ -59,8 +59,7 @@ module Kinney
59
59
  hash.to_json
60
60
  end
61
61
  # end elasticsearch end
62
-
63
-
62
+
64
63
 
65
64
  def self.top_picks
66
65
  where(:top_pick => true)
@@ -73,6 +72,10 @@ module Kinney
73
72
  def title_and_last_names
74
73
  "#{title} #{people_names}"
75
74
  end
75
+
76
+ def title_with_full_people_names
77
+ "#{title} with #{full_people_names}"
78
+ end
76
79
 
77
80
  def topic_names
78
81
  topics.map{|topic| topic.name}
@@ -3,18 +3,18 @@ module Kinney
3
3
  attr_accessible :accomplishments, :activities, :biography, :citations,
4
4
  :currently, :first_name, :graduating_class, :last_name, :middle_name,
5
5
  :nickname, :term, :term_date_ranges, :name_suffix, :location
6
-
6
+
7
7
  validates :last_name, :presence => true
8
8
  validates_uniqueness_of :last_name, :scope => :first_name
9
-
9
+
10
10
  has_many :clip_people
11
11
  has_many :clips, :through => :clip_people
12
12
  has_many :person_images
13
13
  has_many :images, :through => :person_images
14
-
14
+
15
15
  extend FriendlyId
16
16
  friendly_id :full_name, :use => [:slugged, :history]
17
-
17
+
18
18
  default_scope order('last_name asc')
19
19
 
20
20
  # tire for elasticsearch
@@ -22,10 +22,10 @@ module Kinney
22
22
  include Tire::Model::Callbacks
23
23
  index_name "kinney_#{Rails.env}"
24
24
  mapping do
25
- indexes :id, :index => :not_analyzed
25
+ indexes :id, :index => :not_analyzed
26
26
  indexes :filename, :index => :not_analyzed
27
27
  indexes :accomplishments, :analyzer => 'snowball'
28
- indexes :activities, :analyzer => 'snowbalwilliaml'
28
+ indexes :activities, :analyzer => 'snowball'
29
29
  indexes :biography, :analyzer => 'snowball'
30
30
  indexes :citations, :analyzer => 'snowball'
31
31
  indexes :graduating_class, :analyzer => 'date'
@@ -42,7 +42,7 @@ module Kinney
42
42
  }
43
43
  }
44
44
  }
45
-
45
+
46
46
  def self.with_clips
47
47
  joins(:clips).group("kinney_people.id HAVING count(kinney_clips.id) > 0")
48
48
  end
@@ -62,11 +62,11 @@ module Kinney
62
62
  includes(:person_images).where(:kinney_person_images => {:person_id => nil})
63
63
  end
64
64
 
65
-
65
+
66
66
  def to_label
67
67
  "#{last_name}, #{first_name}"
68
68
  end
69
-
69
+
70
70
  def full_name
71
71
  fn = ''
72
72
  fn << first_name if !first_name.blank?
@@ -75,7 +75,7 @@ module Kinney
75
75
  fn << ', ' + name_suffix if !name_suffix.blank?
76
76
  fn
77
77
  end
78
-
78
+
79
79
  def short_bio
80
80
  HTML_Truncator.truncate(biography, 20).html_safe
81
81
  end
@@ -100,6 +100,6 @@ module Kinney
100
100
  read_more_link_params_hash
101
101
 
102
102
  end
103
-
103
+
104
104
  end
105
105
  end
@@ -115,8 +115,23 @@ text {
115
115
  font-family: Arial;
116
116
  font-size: 9pt;
117
117
  }
118
+
119
+
120
+ #video_and_time {
121
+ margin-top: 50px;
122
+ }
123
+ div.video {
124
+ width: 400px;
125
+ float:left;
126
+ }
118
127
  #current_time p{
119
128
  font-size: 5em;
120
129
  line-height: 2em;
130
+ float: left;
131
+ margin-left: 200px;
132
+ }
133
+ #debugging {
134
+ clear:both;
135
+ padding-top: 300px;
121
136
  }
122
137
  </style>
@@ -5,14 +5,16 @@
5
5
 
6
6
  <%= render :partial => 'video_engagement_chart' %>
7
7
 
8
- <div class="row">
9
- <div class="span6">
8
+ <div id="video_and_time">
9
+ <div class="video">
10
10
  <%= render :partial => '/kinney/video', :locals => {:clip => @clip} %>
11
11
  </div>
12
- <div class="span6" id="current_time"><p></p>
12
+ <div id="current_time"><p></p>
13
13
  </div>
14
14
  </div>
15
15
 
16
+ <div id="debugging">
16
17
  <%= @all_seconds.sort.inspect %><br>
17
18
  <%= @temp_seconds.inspect %><br>
18
19
  <%= @seconds.to_json %>
20
+ </div>
@@ -1,4 +1,4 @@
1
- <% @title = @clip.title %>
1
+ <% @title = @clip.title_with_full_people_names %>
2
2
 
3
3
  <%= render :partial => '/layouts/kinney/social_setup' %>
4
4
 
@@ -12,13 +12,14 @@
12
12
 
13
13
  <ul class="thumbnails sortable_thumbs">
14
14
  <% @people_with_images.each do |person| %>
15
- <li class="span2 sortable_thumb">
16
- <%= link_to(person, :class => :thumbnail) do %>
15
+ <li class="span2 sortable_thumb" itemscope itemtype="http://schema.org/Person">
16
+ <%= link_to(person, :class => :thumbnail, :itemprop => :url) do %>
17
17
  <div class="block">
18
18
  <%= kinney_image_small(person.image, person) %>
19
19
  <div class="caption">
20
20
  <div class="clearfix">
21
- <%= person.nickname %> <span class="last_name"><%= person.last_name %></span><%= ', ' + person.name_suffix if !person.name_suffix.blank? %>
21
+ <span itemprop="name"><%= person.nickname %> <span class="last_name"><%= person.last_name %></span><%= ', ' + person.name_suffix if !person.name_suffix.blank? %>
22
+ </span>
22
23
  <div>
23
24
  <span class="grad_class"><%= person.graduating_class %></span>
24
25
  </div>
@@ -27,7 +27,7 @@ xml.urlset "xmlns" => "http://www.sitemaps.org/schemas/sitemap/0.9", "xmlns:vide
27
27
  end
28
28
  xml.video :video do |video|
29
29
  xml.video :thumbnail_loc, clip.png
30
- xml.video :title, clip.title
30
+ xml.video :title, clip.people_with_title
31
31
  xml.video :description, clip.description
32
32
  xml.video :content_loc, clip.mp4
33
33
  xml.video :duration, clip.duration
data/config/routes.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  Kinney::Engine.routes.draw do
2
2
 
3
3
  post "tracker/track", :to => 'tracker#track'
4
- match "tracker/analyze/:video", :to => 'tracker#analyze'
4
+ # match "tracker/analyze/:video", :to => 'tracker#analyze', :via => :get, :as => 'tracker_analyze'
5
5
 
6
6
  match "search", :as => :search, :to => 'search#index'
7
7
  match "about", :as => :about, :to => 'pages#about'
@@ -1,3 +1,3 @@
1
1
  module Kinney
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
Binary file
Binary file