Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugfix 32 broken agreement link #42

Merged
merged 6 commits into from
Dec 19, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,8 @@ QUEPID_DOMAIN=localhost

INTERCOM_APP_ID=
INTERCOM_API_KEY=

# Used to insert web links if populated.
TC_URL=
PRIVACY_URL=
COOKIES_URL=
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
* Update Elasticsearch logo. https://github.com/o19s/quepid/pull/38 by @moshebla
* Remove sqlite from gem, no longer used. https://github.com/o19s/quepid/pull/41 by @epugh fixes https://github.com/o19s/quepid/issues/40
* Better look and UI experience for the dev panel. https://github.com/o19s/quepid/pull/39 by @moshebla
* Show or don't show the T&C's link based on the Quepid configuration. https://github.com/o19s/quepid/pull/42 by @epugh fixes https://github.com/o19s/quepid/issues/44 by @flaxsearch.

## 6.0.2 - 11/26/2019
* Deprecate www.quepid.com/support in favor of linking to wiki. https://github.com/o19s/quepid/pull/18 by @epugh fixes https://github.com/o19s/quepid/issues/17
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,8 @@ Check out the [App Structure](docs/app_structure.md) file for more info on how Q

# Legal Pages

If you would like to have legal pages linked in the footer of the app, add the following `ENV` vars:
If you would like to have legal pages linked in the footer of the app, similar to behavior on http://app.quepid.com,
add the following `ENV` vars:

```
TC_URL # terms and condition
Expand Down
7 changes: 5 additions & 2 deletions app.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,13 @@
"SIDEKIQ_CONCURRENCY": {
"required": true
},
"STRIPE_PUBLISHABLE_KEY": {
"TC_URL": {
"required": true
},
"STRIPE_SECRET_KEY": {
"PRIVACY_URL": {
"required": true
},
"COOKIES_URL": {
"required": true
}
},
Expand Down
11 changes: 9 additions & 2 deletions app/assets/javascripts/controllers/signup.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,13 @@ angular.module('QuepidSecureApp')
.controller('SignupCtrl', [
'$scope', '$location',
'signupSvc',
function ($scope, $location, signupSvc) {
'configurationSvc',
function ($scope, $location, signupSvc, configurationSvc) {
$scope.hasTermsAndConditions = configurationSvc.hasTermsAndConditions();
if (configurationSvc.hasTermsAndConditions()){
$scope.termsAndConditionsUrl = configurationSvc.getTermsAndConditionsUrl();
}

$scope.submit = function (agree, name, username, pass, confirm) {
$scope.warnAgree = false;
$scope.warnEmail = false;
Expand All @@ -13,12 +19,13 @@ angular.module('QuepidSecureApp')
$scope.warnErr = false;
$scope.warnName = false;


if ( !name ) {
$scope.warnName = true;
return;
}

if( !agree ) {
if( $scope.hasTermsAndConditions && !agree ) {
$scope.warnAgree = true;
return;
}
Expand Down
1 change: 1 addition & 0 deletions app/assets/javascripts/secure.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
//= require utilitiesModule
//= require secureApp
//= require app
//= require services/configurationSvc
//= require services/secureRedirectSvc
//= require services/loginSvc
//= require services/userSvc
Expand Down
26 changes: 26 additions & 0 deletions app/assets/javascripts/services/configurationSvc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
'use strict';

angular.module('UtilitiesModule')
.service('configurationSvc', [
'$window', '$log',
function ConfigurationSvc() {
var termsAndConditionsUrl;

this.setTermsAndConditionsUrl = function (url) {
termsAndConditionsUrl = url;
};
this.hasTermsAndConditions = function () {
if (angular.isUndefined(termsAndConditionsUrl) || termsAndConditionsUrl === ''){
return false;
}
else {
return true;
}

};

this.getTermsAndConditionsUrl = function () {
return termsAndConditionsUrl;
};
}
]);
6 changes: 3 additions & 3 deletions app/assets/templates/views/signup.html
Original file line number Diff line number Diff line change
Expand Up @@ -98,11 +98,11 @@ <h2>Signup to get started!</h2>
/>
</div>

<div class="checkbox">
<div class="checkbox" ng-show="hasTermsAndConditions">
<label>
<input type="checkbox" ng-model="agree" required />
<input type="checkbox" ng-model="agree" required ng-if="hasTermsAndConditions"/>
Agree to
<a href="/agreement">terms &amp; conditions</a>?
<a ng-href="{{ termsAndConditionsUrl }}" target="_blank">terms &amp; conditions</a>?
</label>
</div>

Expand Down
2 changes: 1 addition & 1 deletion app/views/layouts/application.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>Quepid -- Relevant Search Solved</title>
<meta name="description" content="Tired of irrelevant search results? Use Quepid products & services to help improve the quality and relevancy of your search results.">
<meta name="description" content="Tired of irrelevant search results? Use Quepid to help improve the quality and relevancy of your search results.">
<meta name="viewport" content="width=device-width">

<%= stylesheet_link_tag 'application', media: 'all' %>
Expand Down
2 changes: 1 addition & 1 deletion app/views/layouts/home.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>Quepid -- Relevant Search Solved</title>
<meta name="description" content="Tired of irrelevant search results? Use Quepid products & services to help improve the quality and relevancy of your search results.">
<meta name="description" content="Tired of irrelevant search results? Use Quepid to help improve the quality and relevancy of your search results.">
<meta name="viewport" content="width=device-width">

<%= stylesheet_link_tag 'application', media: 'all' %>
Expand Down
6 changes: 4 additions & 2 deletions app/views/layouts/secure.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>Quepid -- Relevant Search Solved</title>
<meta name="description" content="Tired of irrelevant search results? Use Quepid products & services to help improve the quality and relevancy of your search results.">
<meta name="description" content="Tired of irrelevant search results? Use Quepid to help improve the quality and relevancy of your search results.">
<meta name="viewport" content="width=device-width">

<%= stylesheet_link_tag 'secure', media: 'all' %>
Expand All @@ -28,17 +28,19 @@

<script>
angular.module('QuepidSecureApp')
.run(function($log, userSvc, secureRedirectSvc) {
.run(function($log, userSvc, secureRedirectSvc, configurationSvc) {
var appDebug = '<%= Rails.env == 'development' ? 'true' : 'false' %>';
var debugPort = '<%= request.port %>';

if (appDebug === 'true') {
$log.debug("Activate debug mode");
secureRedirectSvc.debugServer(debugPort);
}
configurationSvc.setTermsAndConditionsUrl('<%= ENV['TC_URL'] %>');
});
</script>


<%= render 'layouts/common_js' %>
</body>
</html>
34 changes: 34 additions & 0 deletions spec/javascripts/angular/services/configurationSvc_spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
'use strict';

describe('Service: ConfigurationSvc', function () {

// load the service's module
beforeEach(module('UtilitiesModule'));

// instantiate service
var configurationSvc, windowMocker;
beforeEach(function(){
inject(function (_configurationSvc_) {
configurationSvc = _configurationSvc_;
});
});

it('exists', function () {
expect(!!configurationSvc).toBe(true);
});

it('reports if terms and conditions url was set', function () {
configurationSvc.setTermsAndConditionsUrl('https://quepid.com/agreement');
expect(configurationSvc.hasTermsAndConditions()).toBe(true);
expect(configurationSvc.getTermsAndConditionsUrl()).toEqual('https://quepid.com/agreement');
});

it('reports it doesnt have terms and conditions if not set, or blank', function () {

expect(configurationSvc.hasTermsAndConditions()).toBe(false);
configurationSvc.setTermsAndConditionsUrl('');
expect(configurationSvc.hasTermsAndConditions()).toBe(false);

});

});