Some job stuff and some Mixpanel stuff.

master
Nick Sergeant 2013-10-21 15:22:47 -04:00
parent a598dfc65e
commit fb73e76535
11 changed files with 120 additions and 56 deletions

View File

@ -37,7 +37,7 @@
<section class="jobs">
<ul>
<li ng-repeat="job in filteredJobs|startFrom:currentPage * pageSize|limitTo:pageSize">
<a href="{[{ job.url }]}?aff=dbe7e" class="group">
<a href="{[{ job.url }]}?aff=dbe7e" class="group job-link">
<img ng-show="job.company.logo" ng-src="{[{ job.company.logo }]}" />
<span class="left">
<span class="job">{[{ job.title }]}</span>
@ -59,15 +59,12 @@
</div>
{% endblock %}
{% block ad %}{% endblock %}
{% block aside-top %}
<div class="job-twitter">
<a href="https://twitter.com/sniptjobs" class="twitter-follow-button" data-show-count="false" data-size="large">Follow @sniptjobs</a>
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+'://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js,fjs);}}(document, 'script', 'twitter-wjs');</script>
</div>
<div class="post-job">
<a href="http://www.authenticjobs.com/post/?aff=dbe7e" class="btn btn-large btn-success">Post a job</a>
<a id="post-job" href="http://www.authenticjobs.com/post/?aff=dbe7e" class="btn btn-large btn-success">Post a job</a>
<p>
We use <a href="http://www.authenticjobs.com?aff=dbe7e">Authentic Jobs</a> for our job board provider. Once you post your ad, it will appear on Snipt within 30 minutes.
We use <a class="job-link" href="http://www.authenticjobs.com?aff=dbe7e">Authentic Jobs</a> for our job board provider. Once you post your ad, it will appear on Snipt within 30 minutes.
</p>
</div>
{% endblock %}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1369,6 +1369,10 @@ article.snipt {
header {
border-color: #FFFBF3;
min-height: 0;
h1 {
margin: 8px 15px 8px 15px;
}
}
&:after {
display: none;

File diff suppressed because one or more lines are too long

View File

@ -1,3 +1,5 @@
'use strict';
var snipt = {
module: function() {
var modules = {};
@ -37,4 +39,30 @@ jQuery(function($) {
root.app = app;
if (root.user_id) {
root.mixpanel.identify(root.user_id);
root.mixpanel.alias(root.user);
root.mixpanel.people.set({
$username: root.user,
$email: root.user_email,
$ip: root.user_ip
});
}
if (root.location.pathname === '/account/stats/') {
root.mixpanel.track('Viewing stats page');
}
if (root.location.pathname === '/pro/') {
root.mixpanel.track('Viewing Pro page');
}
if (root.location.pathname === '/pro/signup/') {
root.mixpanel.track('Viewing Pro signup page');
}
if (root.location.pathname === '/jobs/') {
root.mixpanel.track('Viewing jobs page');
}
root.mixpanel.track_links('#hate-ads', '"Hate ads" link clicked');
root.mixpanel.track_links('#post-job', '"Post a job" link clicked');
}).call(this);

View File

@ -17,13 +17,16 @@
});
// Controllers.
controllers.JobSearchController = function($http, $scope, filterFilter) {
controllers.JobSearchController = function($http, $scope, filterFilter, $timeout) {
$scope.currentPage = 0;
$scope.pageSize = 10;
$http.get('/jobs-json/').then(function(response) {
$scope.jobs = response.data;
$scope.filterJobs();
$timeout(function() {
window.mixpanel.track_links('.job-link', 'Job link clicked');
});
});
$scope.filterJobs = function() {

View File

@ -54,6 +54,9 @@
},
copy: function() {
window.mixpanel.track('Copying snipt');
$('textarea', this.$copyModal).remove();
window.ui_halted = true;
@ -83,6 +86,8 @@
},
edit: function() {
window.mixpanel.track('Editing snipt');
window.editing = true;
window.ui_halted = true;
@ -253,6 +258,9 @@
return false;
},
embed: function() {
window.mixpanel.track('Embedding snipt');
$('textarea', this.$embedModal).remove();
window.ui_halted = true;
@ -645,6 +653,8 @@
},
addNewSnipt: function() {
window.mixpanel.track('Adding snipt');
var $articleNewSnipt = $('article#new-snipt');
if ($articleNewSnipt.length === 0) {

View File

@ -18,14 +18,18 @@
AccountStorage.getAccount().then(function(response) {
$scope.$root.account = response.data;
});
$scope.$root.$watch('account.list_view', function(oldView, newView) {
if (oldView !== newView) {
AccountStorage.saveAccount($scope.$root.account, ['list_view']).then(function(response) {
$scope.$root.account = response.data;
});
}
$scope.$root.$watch('account.list_view', function(newView, oldView) {
if (oldView !== newView) {
if (newView === 'N') {
window.mixpanel.track('Switched to normal view');
} else {
window.mixpanel.track('Switched to compact view');
}
AccountStorage.saveAccount($scope.$root.account, ['list_view']).then(function(response) {
$scope.$root.account = response.data;
});
}
});
});
};

View File

@ -14,5 +14,5 @@
</div>
</section>
<div class="go-pro">
<a href="/pro/" class="btn btn-success">Hate ads? Go Pro &raquo;</a>
<a href="/pro/" id="hate-ads" class="btn btn-success">Hate ads? Go Pro &raquo;</a>
</div>

View File

@ -69,6 +69,14 @@
<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/jquery-ui.min.js"></script>
<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/angularjs/1.0.6/angular.min.js"></script>
<!-- start Mixpanel -->
<script type="text/javascript">
(function(e,b){if(!b.__SV){var a,f,i,g;window.mixpanel=b;a=e.createElement("script");a.type="text/javascript";a.async=!0;a.src=("https:"===e.location.protocol?"https:":"http:")+'//cdn.mxpnl.com/libs/mixpanel-2.2.min.js';f=e.getElementsByTagName("script")[0];f.parentNode.insertBefore(a,f);b._i=[];b.init=function(a,e,d){function f(b,h){var a=h.split(".");2==a.length&&(b=b[a[0]],h=a[1]);b[h]=function(){b.push([h].concat(Array.prototype.slice.call(arguments,0)))}}var c=b;"undefined"!==
typeof d?c=b[d]=[]:d="mixpanel";c.people=c.people||[];c.toString=function(b){var a="mixpanel";"mixpanel"!==d&&(a+="."+d);b||(a+=" (stub)");return a};c.people.toString=function(){return c.toString(1)+".people (stub)"};i="disable track track_pageview track_links track_forms register register_once alias unregister identify name_tag set_config people.set people.set_once people.increment people.append people.track_charge people.clear_charges people.delete_user".split(" ");for(g=0;g<i.length;g++)f(c,i[g]);
b._i.push([a,e,d])};b.__SV=1.2}})(document,window.mixpanel||[]);
mixpanel.init("f755aa7068c055698c49ff0307370fa6");
</script>
<!-- end Mixpanel -->
</head>
<body class="{% block body-class %}{% endblock %} {% if request.user.profile.is_pro %}is-pro{% endif %}">
<!-- AdPacks.com Ad Code -->
@ -208,9 +216,11 @@
<section class="main group" id="main">
{% block aside %}
<aside class="main">
{% if not request.user.profile.is_pro %}
{% include 'ad.html' %}
{% endif %}
{% block ad %}
{% if not request.user.profile.is_pro %}
{% include 'ad.html' %}
{% endif %}
{% endblock %}
{% block aside-top %}{% endblock %}
{% block aside-inner %}{% endblock %}
<nav class="footer">
@ -382,6 +392,35 @@
{% block extra-scripts %}{% endblock %}
{% block inline-js %}
<script type="text/javascript">
{% block js %}
window.user = '{{ request.user.username }}';
window.user_id = {% firstof request.user.id 'null' %};
window.user_ip = '{{ request.META.REMOTE_ADDR }}';
window.user_profile_id = {% firstof request.user.profile.id 'null' %};
window.user_email = '{{ request.user.email }}';
{% if public %}
window.pub = {{ public|lower }};
{% else %}
window.pub = null;
{% endif %}
window.api_key = '{{ request.user.api_key.key }}';
{% endblock %}
{% if request.user.profile.is_pro %}
window.user_is_pro = true;
{% else %}
window.user_is_pro = false;
{% endif %}
window.default_editor = '{{ request.user.profile.get_default_editor_display|lower }}';
window.editor_theme = '{{ request.user.profile.editor_theme }}';
</script>
{% endblock %}
{% if debug %}
<script type="text/javascript" src="{{ STATIC_URL }}js/libs/underscore.js"></script>
<script type="text/javascript" src="{{ STATIC_URL }}js/libs/json2.js"></script>
@ -403,32 +442,6 @@
<script type="text/javascript" src="{{ STATIC_URL }}js/snipt-all.min.js?62"></script>
{% endif %}
{% block inline-js %}
<script type="text/javascript">
{% block js %}
window.user = '{{ request.user.username }}';
window.user_id = {% firstof request.user.id 'null' %};
window.user_profile_id = {% firstof request.user.profile.id 'null' %};
{% if public %}
window.pub = {{ public|lower }};
{% else %}
window.pub = null;
{% endif %}
window.api_key = '{{ request.user.api_key.key }}';
{% endblock %}
{% if request.user.profile.is_pro %}
window.user_is_pro = true;
{% else %}
window.user_is_pro = false;
{% endif %}
window.default_editor = '{{ request.user.profile.get_default_editor_display|lower }}';
window.editor_theme = '{{ request.user.profile.editor_theme }}';
</script>
{% endblock %}
{% if has_snipts and detail %}
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>
{% endif %}