Skip to content

Commit

Permalink
Merge 27bd3e1 into f31ea96
Browse files Browse the repository at this point in the history
  • Loading branch information
baylee-d committed Nov 30, 2017
2 parents f31ea96 + 27bd3e1 commit 61cb6e4
Show file tree
Hide file tree
Showing 10 changed files with 283 additions and 74 deletions.
3 changes: 2 additions & 1 deletion app/file-detail/controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ import { A } from '@ember/array';
import Controller from '@ember/controller';
import { mimeTypes } from 'ember-osf/const/mime-types';
import outsideClick from 'ember-osf/utils/outside-click';
import Analytics from 'ember-osf/mixins/analytics';

export default Controller.extend({
export default Controller.extend(Analytics, {
currentUser: service(),
toast: service(),
revision: null,
Expand Down
11 changes: 10 additions & 1 deletion app/file-detail/route.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,20 @@
import { hash } from 'rsvp';
import Route from '@ember/routing/route';
import { inject as service } from '@ember/service';
import Analytics from 'ember-osf/mixins/analytics';

export default Route.extend(Analytics, {
currentUser: service(),

export default Route.extend({
model(params) {
return hash({
file: this.store.findRecord('file', params.file_id),
user: this.store.findRecord('file', params.file_id).then(file => file.get('user')).then(user => user.reload()),
});
},
afterModel(model, transition) {
if (model.user.id !== this.get('currentUser.currentUserId')) {
transition.send('track', 'page view', 'track', 'Quick Files - File detail page view');
}
},
});
12 changes: 6 additions & 6 deletions app/file-detail/template.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -33,22 +33,22 @@
<br>
<div class='input-group'>
<span class='input-group-btn share-btn-container'>
<button type='button' class='btn btn-default btn-md' onclick={{action 'share'}}>
<button type='button' class='btn btn-default btn-md' onclick={{action 'click' 'button' 'Quick Files - Share file'}} {{action 'share'}}>
<div class='fa fa-copy'></div>
</button>
</span>
<input readonly='true' type='text' class='form-control' value='{{{mfrUrl}}}' id='sharePaneUrl'>
<div class='share-buttons'>
<a href='{{twitterUrl}}' target='_blank'>
<a href='{{twitterUrl}}' target='_blank' onclick={{action 'click' 'link' 'Quick Files - Share file on Twitter' preventDefault=false}}>
<i aria-hidden='true' class='fa fa-twitter'></i>
</a>
<a href='{{facebookUrl}}' target='_blank'>
<a href='{{facebookUrl}}' target='_blank' onclick={{action 'click' 'link' 'Quick Files - Share file on Facebook' preventDefault=false}}>
<i aria-hidden='true' class='fa fa-facebook'></i>
</a>
<a href='{{linkedInUrl}}' target='_blank' data-toggle='tooltip' data-placement='bottom' data-original-title='Disable adblock for full sharing functionality'>
<a href='{{linkedInUrl}}' target='_blank' data-toggle='tooltip' data-placement='bottom' data-original-title='Disable adblock for full sharing functionality' onclick={{action 'click' 'link' 'Quick Files - Share file on LinkedIn' preventDefault=false}}>
<i aria-hidden='true' class='fa fa-linkedin'></i>
</a>
<a href='{{emailUrl}}' target='_blank'>
<a href='{{emailUrl}}' target='_blank' onclick={{action 'click' 'link' 'Quick Files - Share file in email' preventDefault=false}}>
<i aria-hidden='true' class='fa fa-envelope'></i>
</a>
</div>
Expand All @@ -68,7 +68,7 @@
</button>
</div>
<div class='btn-group m-l-xs m-t-xs'>
<button class='btn btn-sm btn-primary' onclick={{action 'download' model.file.currentVersion}}>
<button class='btn btn-sm btn-primary' onclick={{unless edit (action 'click' 'button' 'Quick Files - Download')}} {{action 'download' model.file.currentVersion}}>
Download
</button>
</div>
Expand Down
3 changes: 2 additions & 1 deletion app/user-quickfiles/controller.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { computed } from '@ember/object';
import Controller from '@ember/controller';
import Analytics from 'ember-osf/mixins/analytics';

export default Controller.extend({
export default Controller.extend(Analytics, {
title: computed('model.fullName', function() {
return `${this.get('model.fullName')}'s Quick Files`;
}),
Expand Down
11 changes: 10 additions & 1 deletion app/user-quickfiles/route.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,16 @@
import Route from '@ember/routing/route';
import { inject as service } from '@ember/service';
import Analytics from 'ember-osf/mixins/analytics';

export default Route.extend(Analytics, {
currentUser: service(),

export default Route.extend({
model(params) {
return this.store.findRecord('user', params.user_id);
},
afterModel(model, transition) {
if (model.id !== this.get('currentUser.currentUserId')) {
transition.send('track', 'view', 'track', 'Quick Files - Main page view');
}
},
});
18 changes: 18 additions & 0 deletions config/environment.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,16 @@ module.exports = function(environment) {
includeTimezone: 'all',
outputFormat: 'YYYY-MM-DD h:mm A z',
},
metricsAdapters: [
{
name: 'GoogleAnalytics',
environments: ['all'],
config: {
id: process.env.GOOGLE_ANALYTICS_ID
}
},
],
FB_APP_ID: process.env.FB_APP_ID,
};

if (environment === 'development') {
Expand All @@ -40,6 +50,8 @@ module.exports = function(environment) {
// ENV.APP.LOG_TRANSITIONS = true;
// ENV.APP.LOG_TRANSITIONS_INTERNAL = true;
// ENV.APP.LOG_VIEW_LOOKUPS = true;

ENV.metricsAdapters[0].config.cookieDomain = 'none';
}

if (environment === 'test') {
Expand All @@ -53,5 +65,11 @@ module.exports = function(environment) {
ENV.APP.rootElement = '#ember-testing';
}

if (environment !== 'production') {
// Fallback to throwaway defaults if the environment variables are not set
ENV.metricsAdapters[0].config.id = ENV.metricsAdapters[0].config.id || 'UA-84580271-1';
ENV.FB_APP_ID = ENV.FB_APP_ID || '1039002926217080';
}

return ENV;
};
1 change: 1 addition & 0 deletions tests/unit/file-detail/controller-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ moduleFor('controller:file-detail', 'Unit | Controller | file detail', {
needs: [
'service:currentUser',
'service:toast',
'service:metrics',
],
});

Expand Down
5 changes: 3 additions & 2 deletions tests/unit/user-quickfiles/controller-test.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { moduleFor, test } from 'ember-qunit';

moduleFor('controller:user-quickfiles', 'Unit | Controller | user quickfiles', {
// Specify the other units that are required for this test.
// needs: ['controller:foo']
needs: [
'service:metrics',
],
});

// Replace this with your real tests.
Expand Down
6 changes: 4 additions & 2 deletions tests/unit/user-quickfiles/route-test.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import { moduleFor, test } from 'ember-qunit';

moduleFor('route:user-quickfiles', 'Unit | Route | user quickfiles', {
// Specify the other units that are required for this test.
// needs: ['controller:foo']
needs: [
'service:currentUser',
'service:metrics',
],
});

test('it exists', function(assert) {
Expand Down
Loading

0 comments on commit 61cb6e4

Please sign in to comment.