Skip to content
Merged
Show file tree
Hide file tree
Changes from 17 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
1 change: 1 addition & 0 deletions .meteor/packages
Original file line number Diff line number Diff line change
Expand Up @@ -84,3 +84,4 @@ useraccounts:core
useraccounts:flow-routing
vsivsi:file-collection
zimme:active-route
aramk:quill
2 changes: 2 additions & 0 deletions .meteor/versions
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ apinf:autoform-bs-datepicker@1.1.2
apinf:create-role-if-undefined@0.1.1
apinf:first-admin@0.1.2
apinf:restivus-swagger@0.2.1
aramk:quill@0.1.1
arillo:flow-router-helpers@0.5.2
autoupdate@1.3.12
babel-compiler@6.13.0
Expand Down Expand Up @@ -152,6 +153,7 @@ templating-tools@1.0.5
tmeasday:publish-counts@0.8.0
todda00:friendly-slugs@0.6.0
tracker@1.1.1
trever:quill@0.0.5
twbs:bootstrap@3.3.6
u2622:persistent-session@0.4.4
ui@1.0.12
Expand Down
2 changes: 2 additions & 0 deletions branding/client/branding.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ <h3 class="panel-title">
{{> afQuickField name='siteSlogan' }}
{{> afQuickField name='colors' }}
{{> afQuickField name='siteFooter' }}
{{> afQuickField name='privacyPolicy' type="quill" }}
{{> afQuickField name='termsOfUse' type="quill" }}
{{> afQuickField name='socialMedia' }}
<div id="form-buttons">
<button type="submit" class="btn btn-primary">
Expand Down
14 changes: 14 additions & 0 deletions branding/client/lib/router.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,17 @@ FlowRouter.route('/settings/branding', {
BlazeLayout.render('masterLayout', { main: 'branding' });
},
});

FlowRouter.route('/privacy-policy', {
name: 'privacyPolicy',
action () {
BlazeLayout.render('masterLayout', { main: 'privacyPolicy' });
},
});

FlowRouter.route('/terms-of-use', {
name: 'termsOfUse',
action () {
BlazeLayout.render('masterLayout', { main: 'termsOfUse' });
},
});
10 changes: 10 additions & 0 deletions branding/client/privacy_policy/privacyPolicy.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<template name="privacyPolicy">
{{# if branding.privacyPolicyExists }}
<div class="container">
<h1>{{ branding.siteTitle }} {{_ "privacyPolicy_title" }}</h1>
{{{ branding.privacyPolicy }}}
</div>
{{ else }}
{{> notFound }}
{{/ if }}
</template>
17 changes: 17 additions & 0 deletions branding/client/privacy_policy/privacyPolicy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { Template } from 'meteor/templating';
import Branding from '/branding/collection';

Template.privacyPolicy.onCreated(function () {
// Get reference to template instance
const instance = this;

// Subscription to branding collection
instance.subscribe('branding');
});

Template.privacyPolicy.helpers({
branding () {
// Get Branding collection content
return Branding.findOne();
},
});
10 changes: 10 additions & 0 deletions branding/client/terms_of_use/termsOfUse.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<template name="termsOfUse">
{{# if branding.termsOfUseExists }}
<div class="container">
<h1>{{ branding.siteTitle }} {{_ "termsOfUse_title" }}</h1>
{{{ branding.termsOfUse }}}
</div>
{{ else }}
{{> notFound }}
{{/ if }}
</template>
17 changes: 17 additions & 0 deletions branding/client/terms_of_use/termsOfUse.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { Template } from 'meteor/templating';
import Branding from '/branding/collection';

Template.termsOfUse.onCreated(function () {
// Get reference to template instance
const instance = this;

// Subscription to branding collection
instance.subscribe('branding');
});

Template.termsOfUse.helpers({
branding () {
// Get Branding collection content
return Branding.findOne();
},
});
24 changes: 24 additions & 0 deletions branding/collection/helpers.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import Branding from './';

Branding.helpers({
privacyPolicyExists () {
const privacyPolicy = this.privacyPolicy;

// If editor is empty (has only this empty div)
// see https://github.com/quilljs/quill/issues/1235
if (privacyPolicy === '<div><br></div>') {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rather than using a template helper to check for <div><br></div>, lets try an AutoForm.onSubmit hook to look for that string. If the privacyPolicy === '<div><br></div>', then set the field value to undefined.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For GitHub cross-reference, here is the Quill issue from this PR comment: slab/quill#1235

return false;
}
return true;
},
termsOfUseExists () {
const termsOfUse = this.termsOfUse;

// If editor is empty (has only this empty div)
// see https://github.com/quilljs/quill/issues/1235
if (termsOfUse === '<div><br></div>') {
return false;
}
return true;
},
});
14 changes: 14 additions & 0 deletions branding/collection/schema.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,20 @@ Branding.schema = new SimpleSchema({
type: String,
optional: true,
},
privacyPolicy: {
type: String,
optional: true,
autoform: {
rows: 5,
},
},
termsOfUse: {
type: String,
optional: true,
autoform: {
rows: 5,
},
},
socialMedia: {
type: [Object],
optional: true,
Expand Down
12 changes: 12 additions & 0 deletions core/lib/i18n/en.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -357,6 +357,8 @@
"homeBody_section3_text": "APinf is powered by API Umbrella and builds a dashboard on top of the API Umbrella features. The solution is fully open source licensed with MIT. It is written in Meteor.js and D3. We like to collaborate, to listen to our users and want to encourage people to become contributors.",
"homeBody_section3_text_extra": "Find us in ",
"homeFooter_dashboardLink_text": "Dashboard",
"homeFooter_privacyPolicy_text": "Privacy Policy",
"homeFooter_termsOfUse_text": "Terms of Use",
"homeFooter_signIn": "Sign In",
"homeFooter_signUp": "Sign Up",
"importApiConfiguration_errorMessage": "Config file must be either in .YAML, .YML, .JSON or .TXT format.",
Expand Down Expand Up @@ -454,6 +456,7 @@
"organizationSettingsDelete_text_information": "The organization information will be removed and this action cannot be undone.",
"organizationSettingsDelete_title": "Delete the Organization profile",
"organizationSettingsDelete_panelTitle": "Delete",
"privacyPolicy_title": "Privacy Policy",
"profile_Header": "Profile",
"profile_UpdateButton": "Update",
"profile_setUsername": "Please set your username.",
Expand Down Expand Up @@ -605,6 +608,14 @@
"siteSlogan": {
"label": "Site slogan"
},
"privacyPolicy": {
"label": "Privacy Policy",
"placeholder": "Add your privacy policy here"
},
"termsOfUse": {
"label": "Terms of Use",
"placeholder": "Add your terms of use here"
},
"colors": {
"label": "Colors",
"primary": {
Expand Down Expand Up @@ -932,6 +943,7 @@
"statusCodeCountsChart_title": "HTTP Status Codes",
"statusCodeCountsChart_help_text": "You can use this chart to see the HTTP responses generated by your API for the requests it receives for a specific time period. You can filter the chart with response type for a single API or a combination of them. The overview information and other charts will be updated when you interact with HTTP Status Codes.",
"swaggerUi_swaggerDocumentInvalidText": "Swagger document is not valid.",
"termsOfUse_title": "Terms of Use",
"timeFrameSelectPicker_from": "from",
"timeFrameSelectPicker_to": "to",
"updatePassword_legend_text": "Update password",
Expand Down
20 changes: 19 additions & 1 deletion home/client/footer/homeFooter.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,29 @@
{{/ each }}
</ul>
</div>
<div class="col-lg-8 col-lg-push-1">
<div class="col-lg-5">
<p class="footer-text">
{{ branding.siteFooter }}
</p>
</div>
<div class="col-lg-3">
<ul class="list-inline">
{{# if branding.privacyPolicyExists }}
<li>
<a href="{{ pathFor 'privacyPolicy' }}">
{{_ "homeFooter_privacyPolicy_text" }}
</a>
</li>
{{/ if }}
{{# if branding.termsOfUseExists }}
<li>
<a href="{{ pathFor 'termsOfUse' }}">
{{_ "homeFooter_termsOfUse_text" }}
</a>
</li>
{{/ if }}
</ul>
</div>
<div class="col-lg-2">
<ul class="list-inline quicklinks">
{{# if currentUser }}
Expand Down
3 changes: 3 additions & 0 deletions users/client/lib/accounts_config.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ AccountsTemplates.configure({
positiveValidation: false,
positiveFeedback: true,
showValidating: true,
// Privacy Policy and Terms of Use
privacyUrl: 'privacy-policy',
termsUrl: 'terms-of-use',
});

// rearranging the fields on Sign-Up, so that username comes first.
Expand Down