* csv/pdf links in place in the UI

This commit is contained in:
Seth Call 2015-12-04 09:27:28 -06:00
parent 5049e3f813
commit 3adeef4dee
9 changed files with 92 additions and 7 deletions

View File

@ -128,7 +128,8 @@
jkLike : 'jkLike',
jkFollow : 'jkFollow',
jkFavorite : 'jkFavorite',
jkComment : 'jkComment'
jkComment : 'jkComment',
fileDownload: "DownloadFile"
};
// JamTrack categories and actions:
@ -143,7 +144,12 @@
var jamTrackSessionLabels = {
nonSession: 'NonSession',
inSession: 'InSession'
}
}
var fileDownloads = {
jamtrack_csv: 'JamTrackCSV',
jamtrack_pdf: 'JamTrackPDF'
}
function translatePlatformForGA(platform) {
assertOneOf(platform, context.JK.OS);
@ -184,6 +190,11 @@
}
}
function trackFileDownload(type) {
assertOneOf(type, fileDownloads)
context.ga('send', 'event', categories.fileDownload, type)
}
function trackRegister(asMusician, registrationType) {
assertBoolean(asMusician);
assertOneOf(registrationType, registrationTypes);
@ -452,6 +463,7 @@
GA.AudioTestFailReasons = audioTestFailReasons;
GA.AudioTestDataReasons = audioTestDataReasons;
GA.NetworkTestFailReasons = networkTestFailReasons;
GA.FileDownloadTypes = fileDownloads;
GA.trackRegister = trackRegister;
GA.trackDownload = trackDownload;
GA.trackFTUECompletion = trackFTUECompletion;
@ -477,6 +489,7 @@
GA.trackJKSocial = trackJKSocial;
GA.virtualPageView = virtualPageView;
GA.trackTiming = trackTiming;
GA.trackFileDownload = trackFileDownload;
context.JK.GA = GA;

View File

@ -0,0 +1,15 @@
context = window
rest = context.JK.Rest()
@JamTrackCSVLink = React.createClass({
render: () ->
`<a href="https://s3.amazonaws.com/jamkazam-public/public/lists/all-jamkazam-jamtracks.csv" onClick={this.csvClick}>as a CSV file</a>`
csvClick: (e) ->
window.JK.GA.trackFileDownload(window.JK.GA.FileDownloadTypes.jamtrack_csv);
window.JK.popExternalLink($(e.target).attr('href'))
e.preventDefault()
})

View File

@ -86,6 +86,10 @@ rest = context.JK.Rest()
<button className="search-by-filter-btn button-orange" onClick={this.searchByFilter}>SEARCH</button>
</div>
</div>
<div className="download-all para">
Or download the entire JamTracks catalog <JamTrackCSVLink/> or <JamTrackPdfLink/> to easily browse everything we have.
</div>
</div>
<div className="about">

View File

@ -0,0 +1,15 @@
context = window
rest = context.JK.Rest()
@JamTrackPdfLink = React.createClass({
render: () ->
`<a href="https://s3.amazonaws.com/jamkazam-public/public/lists/all-jamkazam-jamtracks.pdf" onClick={this.pdfClick}>as a PDF file</a>`
pdfClick: (e) ->
window.JK.GA.trackFileDownload(window.JK.GA.FileDownloadTypes.jamtrack_pdf);
window.JK.popExternalLink($(e.target).attr('href'))
e.preventDefault()
})

View File

@ -212,6 +212,7 @@ MIX_MODES = context.JK.MIX_MODES
<div className="controls">
<JamTrackAutoComplete onSearch={this.search} />
<button className={searchClasses} name="search" onClick={this.userSearch}>{searchText}</button>
<div className="download-all">Download JamTracks catalog<br/><JamTrackCSVLink/> or <JamTrackPdfLink/></div>
</div>
<div className="content-body-scroller">
{artistSection}

View File

@ -4,6 +4,7 @@
.jamtrack-filter.filter-head {
padding-left:6px;
@include border_box_sizing;
.easydropdown.dropdown {
width:150px;
@ -18,6 +19,15 @@
.filter-element.wrapper:nth-child(3) {
margin-left:10px;
}
.filter-element.wrapper:nth-child(4) {
float:right;
.download-all {
font-size:11px;
margin-top: 0px;
margin-right: 34px;
}
}
}
}
#jamtrackSearch, #jamtrackFilter {
@ -26,6 +36,19 @@
height:100%;
}
.download-all {
float:right;
font-size:12px;
color:#cccccc;
margin-top:6px;
margin-right:46px;
text-align:right;
line-height:120%;
div {
display:inline;
}
}
.filter-element.desc {
margin-left:15px;

View File

@ -167,13 +167,17 @@
.para {
color: #cccccc;
}
h2.browse-jamtracks {
margin-top:30px;
}
}
.download-all {
margin-top: 64px;
line-height: 150%;
}
}
.video-container-container {

View File

@ -15,7 +15,7 @@
=select_tag("#{filter_label}_order_by", options_for_select(Search::F_SORT_OPTS), {:class => "#{filter_label}-order-by easydropdown" } )
-elsif :jamtrack !=filter_label
=content_tag(:div, 'Order By:', :class => 'filter-element desc')
=select_tag("#{filter_label}_order_by", options_for_select(Search::M_ORDERINGS), {:class => "#{filter_label}-order-by easydropdown"} )
=select_tag("#{filter_label}_order_by", options_for_select(Search::M_ORDERINGS), {:class => "#{filter_label}-order-by easydropdown"} )
=content_tag(:div, :class => 'filter-element wrapper') do
/ -if (:band==filter_label || :jamtrack==filter_label)
/ =content_tag(:div, 'Genre:', :class => 'filter-element desc')
@ -28,10 +28,18 @@
=content_tag(:div, :class => 'filter-element wrapper') do
-if :musician==filter_label || :jamtrack==filter_label
/ =content_tag(:div, 'Instrument:', :class => 'filter-element desc instrument-selector')
=select_tag("#{filter_label}_instrument", options_for_select([['Any Instrument', '']].concat(JamRuby::Instrument.order('description').collect { |ii| [ii.description, ii.id] })), {:class=> "easydropdown"}) |
=select_tag("#{filter_label}_instrument", options_for_select([['Any Instrument', '']].concat(JamRuby::Instrument.order('description').collect { |ii| [ii.description, ii.id] })), {:class=> "easydropdown"})
-if :feed==filter_label
/ =content_tag(:div, 'Include Dates:', :class => 'filter-element desc')
=select_tag("#{filter_label}_date", options_for_select(Search::DATE_OPTS), {:class => "easydropdown"})
=select_tag("#{filter_label}_date", options_for_select(Search::DATE_OPTS), {:class => "easydropdown"})
=content_tag(:div, :class=> 'filter-element wrapper') do
-if :jamtrack==filter_label
.download-all
Download JamTracks catalog
%br
=react_component "JamTrackCSVLink", {}
or
=react_component "JamTrackPdfLink", {}
=content_tag(:div, :class => 'filter-element wrapper') do
-if :feed==filter_label
=content_tag(:div, 'Show:', :class => 'filter-element desc')

View File

@ -275,8 +275,10 @@ namespace :jam_tracks do
Prawn::Document.generate(pdf_file) do
text "All JamKazam JamTracks", align: :center, size:18, inline_format: true
text "Current JamTracks Catalog by JamKazam", align: :center, size:18, inline_format: true
move_down 20
text "Last Updated: #{Time.now.strftime('%m/%d/%Y')}"
move_down 10
text "This PDF was downloaded from <link href=\"https://s3.amazonaws.com/jamkazam-public/public/lists/all-jamkazam-jamtracks.pdf\"><color rgb='0000FF'>here</color></link>.", inline_format: true, font_size:12
move_down 10
text "The CSV version can be downloaded from <link href=\"https://s3.amazonaws.com/jamkazam-public/public/lists/all-jamkazam-jamtracks.csv\"><color rgb='0000FF'>here</color></link>. It also contains instrument info.", inline_format: true, font_size:12