From c2b14808f8e96b5e6953478bd790e272193f5dd9 Mon Sep 17 00:00:00 2001 From: Jake Howard Date: Thu, 9 Feb 2017 21:52:25 +0000 Subject: [PATCH 1/6] Add basic contact page --- content/pages/about.html | 1 - content/pages/contact.md | 13 +++++++++++++ content/pages/homepage.html | 2 +- pelicanconf.py | 4 +++- plugins/filters.py | 4 ++++ theme/static/src/js/app.js | 19 +++++++++++++++++++ theme/static/src/scss/index.scss | 4 ++++ 7 files changed, 44 insertions(+), 3 deletions(-) create mode 100644 content/pages/contact.md diff --git a/content/pages/about.html b/content/pages/about.html index c1fe46f..1a6c065 100644 --- a/content/pages/about.html +++ b/content/pages/about.html @@ -1,5 +1,4 @@ - diff --git a/content/pages/contact.md b/content/pages/contact.md new file mode 100644 index 0000000..7e1c60e --- /dev/null +++ b/content/pages/contact.md @@ -0,0 +1,13 @@ +--- +title: Contact Me +--- + +The fastest way to contact me is through twitter. Just tag me or send me a message and I'll respond as soon as possible! + +View Twitter + +## Need something more formal? + +If you need to contact me in a more formal capacity, send me an email! I aim to respond to all emails within 3 days. + +Send me an email! diff --git a/content/pages/homepage.html b/content/pages/homepage.html index 007dc67..d0069ca 100644 --- a/content/pages/homepage.html +++ b/content/pages/homepage.html @@ -25,7 +25,7 @@

I'm Jake. A software engineer with a passion for security and privacy. This is my website, a home for my projects, blog posts, and anything else for that matter.

- More Info + Contact diff --git a/pelicanconf.py b/pelicanconf.py index e3e5a2f..5525d61 100644 --- a/pelicanconf.py +++ b/pelicanconf.py @@ -7,6 +7,7 @@ sys.path.insert(0, os.path.realpath('./')) AUTHOR = "Jake Howard" SITENAME = "TheOrangeOne" SITEURL = "https://theorangeone.net" +CONTACT_EMAIL = "info@theorangeone.net" PATH = 'content' TIMEZONE = "Europe/London" DEFAULT_LANG = "en" @@ -111,7 +112,8 @@ JINJA_FILTERS = { "limit": filters.limit, "get_title": filters.get_title, "get_html_title": filters.get_html_title, - "get_image": filters.get_image + "get_image": filters.get_image, + "encode_text": filters.encode_text } JINJA_ENVIRONMENT = { diff --git a/plugins/filters.py b/plugins/filters.py index 402954d..d61bbfb 100644 --- a/plugins/filters.py +++ b/plugins/filters.py @@ -39,3 +39,7 @@ def get_html_title(instance): def get_image(instance): return get_attribute(instance, 'image') or (hasattr(instance, 'page') and get_attribute(instance.page, 'name')) or '' + + +def encode_text(text): + return " ".join([str(ord(c)) for c in text]) diff --git a/theme/static/src/js/app.js b/theme/static/src/js/app.js index df81682..9fb7c30 100644 --- a/theme/static/src/js/app.js +++ b/theme/static/src/js/app.js @@ -30,3 +30,22 @@ $('.navbar-brand').bind('click', function (event) { } event.preventDefault(); }); + +$('.panel-heading').bind('click', function () { + var ele = $(this); + if (ele.find('.panel-body').hasClass('ascii-hidden')) { + ele = ele.find('.panel-body'); + var raw_code = ele.text().split(' '); + + } +}); + +$('.protected-mailto').bind('click', function (evt) { + evt.preventDefault(); + var char_codes = $(this).data('value').split(' '); + var plain_text = [] + for(var i=0; i iframe { max-width: 100%; } + +.protected-mailto { + cursor: pointer; +} From 411870b4bdf6057c99bb52fb6254fa545f446038 Mon Sep 17 00:00:00 2001 From: Jake Howard Date: Fri, 10 Feb 2017 22:14:10 +0000 Subject: [PATCH 2/6] Add accounts to about page --- config/social.yml | 6 +++--- content/pages/about.html | 38 +++++++++++++++++++------------------- 2 files changed, 22 insertions(+), 22 deletions(-) diff --git a/config/social.yml b/config/social.yml index 25d2e5a..adafe70 100644 --- a/config/social.yml +++ b/config/social.yml @@ -49,13 +49,13 @@ accounts: - fa-trello freenode: - - Freenode IRC + - Freenode - TheOrangeOne - https://webchat.freenode.net/ - fa-rss atomio: - - AtomIO Slack + - Atom Slack - TheOrangeOne - https://atomio.slack.com/ - fa-slack @@ -76,7 +76,7 @@ accounts: - npm - TheOrangeOne - https://www.npmjs.com/~{0}/ - - fa-file-code-io + - fa-file-code-o footer_accounts: - github diff --git a/content/pages/about.html b/content/pages/about.html index 1a6c065..0a72404 100644 --- a/content/pages/about.html +++ b/content/pages/about.html @@ -13,35 +13,35 @@ -
+
-

Website

+

Personal Data

- My website is the culmination of all my knowledge, compiled into 1 place. It not only contains all my projects, but is itself is a project. + In the interest of privacy, there's very little personal information here.

- The site is primarily built with Pelican, a static site generator. This allows me to write nice clean, DRY content, and have it come out as clean, minified HTML. -

-

- The Javascript is built using Browserify, and the CSS is built using node-SCSS. Both are run as a build step when pelican builds. + The information that is here is eitther not personal enough to bother protecting, or has been selectively chosen as nothing bad.

-
+
-

Server

+

Accounts

- The website is hosted on part of my dedicated server from SoYouStart, running an Ubuntu Server VM with Dokku installed. + These are all the accounts I run, all to do with various things. Take a look!

-

- The prebuilt static files are served using a custom Express server, to make the site as fast and effective as possible. -

-
-
-
-
-
- View Source +
+
+ {% for key, account in ACCOUNTS.items() %} + + {% endfor %}
From 54ed5681fb371656589397a18674d911d2ebc977 Mon Sep 17 00:00:00 2001 From: Jake Howard Date: Sat, 11 Feb 2017 16:14:20 +0000 Subject: [PATCH 3/6] restructure theme and about page --- content/pages/about.html | 18 +++++++++++------- content/pages/contact.html | 27 +++++++++++++++++++++++++++ content/pages/contact.md | 13 ------------- content/pages/homepage.html | 2 +- theme/static/src/scss/functional.scss | 4 ++++ theme/static/src/scss/index.scss | 6 ++++++ 6 files changed, 49 insertions(+), 21 deletions(-) create mode 100644 content/pages/contact.html delete mode 100644 content/pages/contact.md diff --git a/content/pages/about.html b/content/pages/about.html index 0a72404..fabc2d2 100644 --- a/content/pages/about.html +++ b/content/pages/about.html @@ -1,5 +1,5 @@ - + @@ -15,7 +15,7 @@
-

Personal Data

+

Personal Data

In the interest of privacy, there's very little personal information here.

@@ -24,19 +24,18 @@

-
+

Accounts

These are all the accounts I run, all to do with various things. Take a look!

-
{% for key, account in ACCOUNTS.items() %}
-
+
+ +
diff --git a/content/pages/contact.html b/content/pages/contact.html new file mode 100644 index 0000000..4b5de2c --- /dev/null +++ b/content/pages/contact.html @@ -0,0 +1,27 @@ + + + + + +
+
+

+ The fastest way to contact me is through twitter. Just tag me or send me a message and I'll respond as soon as possible! +

+
+
+
+
+

Need something more formal?

+

+ If you need to contact me in a more formal capacity, send me an email! I aim to respond to all emails within 3 days. +

+
+
+
+ +
+ diff --git a/content/pages/contact.md b/content/pages/contact.md deleted file mode 100644 index 7e1c60e..0000000 --- a/content/pages/contact.md +++ /dev/null @@ -1,13 +0,0 @@ ---- -title: Contact Me ---- - -The fastest way to contact me is through twitter. Just tag me or send me a message and I'll respond as soon as possible! - -View Twitter - -## Need something more formal? - -If you need to contact me in a more formal capacity, send me an email! I aim to respond to all emails within 3 days. - -Send me an email! diff --git a/content/pages/homepage.html b/content/pages/homepage.html index d0069ca..007dc67 100644 --- a/content/pages/homepage.html +++ b/content/pages/homepage.html @@ -25,7 +25,7 @@

I'm Jake. A software engineer with a passion for security and privacy. This is my website, a home for my projects, blog posts, and anything else for that matter.

- Contact + More Info
diff --git a/theme/static/src/scss/functional.scss b/theme/static/src/scss/functional.scss index 58c9665..3d4f6a2 100644 --- a/theme/static/src/scss/functional.scss +++ b/theme/static/src/scss/functional.scss @@ -16,3 +16,7 @@ padding: 0 $grid-gutter-width / 2; } + +a.no-underline:hover { + text-decoration: inherit; +} diff --git a/theme/static/src/scss/index.scss b/theme/static/src/scss/index.scss index aa9feec..48f3735 100644 --- a/theme/static/src/scss/index.scss +++ b/theme/static/src/scss/index.scss @@ -114,3 +114,9 @@ header#header { .protected-mailto { cursor: pointer; } + +.service-box.account { + a:hover { + color: $brand-orange-dark; + } +} From 8078e69430f922f8a53b96e9442c5599b8eb3684 Mon Sep 17 00:00:00 2001 From: Jake Howard Date: Sat, 11 Feb 2017 16:16:11 +0000 Subject: [PATCH 4/6] Add tests for about page --- tests/tests_pages.py | 26 ++++++++++++++------------ theme/static/src/js/app.js | 14 +++----------- 2 files changed, 17 insertions(+), 23 deletions(-) diff --git a/tests/tests_pages.py b/tests/tests_pages.py index 2afd2ae..0838656 100644 --- a/tests/tests_pages.py +++ b/tests/tests_pages.py @@ -1,5 +1,6 @@ from tests import TestCase from config import social as social_settings +import pelicanconf as settings import os.path @@ -47,18 +48,6 @@ class AboutPageTestCase(TestCase): self.assertHeaderTitle(content, 'About') self.assertTitle(content, 'About') - def test_website_section(self): - content = self.client.get('about/index.html') - section = content.find('section', id='website') - subtitle = section.find('h2') - self.assertEqual('Website', self.get_children(subtitle)) - - def test_server_section(self): - content = self.client.get('about/index.html') - section = content.find('section', id='server') - subtitle = section.find('h2') - self.assertEqual('Server', self.get_children(subtitle)) - def test_github_card(self): content = self.client.get('about/index.html') tags = content.find_all('div', class_='github-card') @@ -67,6 +56,19 @@ class AboutPageTestCase(TestCase): self.assertEqual('medium', tag.attrs['data-theme']) self.assertEqual(social_settings['accounts']['github'][1], tag.attrs['data-github']) + def test_accounts(self): + content = self.client.get('about/index.html') + accounts = content.find_all('div', class_='account') + defined_accounts = [s for k, s in settings.ACCOUNTS.items()] + self.assertEqual(len(accounts), len(defined_accounts)) + site_names = [s['site'] for s in defined_accounts] + urls = [s['url'] for s in defined_accounts] + icons = [s['icon'] for s in defined_accounts] + for account in accounts: + self.assertIn(account.find('a').attrs['href'], urls) + self.assertIn(account.find('i').attrs['class'][-1], icons) + self.assertIn(self.get_children(account.find('h3')), site_names) + class Page404TestCase(TestCase): def test_title(self): diff --git a/theme/static/src/js/app.js b/theme/static/src/js/app.js index 9fb7c30..3b86b80 100644 --- a/theme/static/src/js/app.js +++ b/theme/static/src/js/app.js @@ -31,21 +31,13 @@ $('.navbar-brand').bind('click', function (event) { event.preventDefault(); }); -$('.panel-heading').bind('click', function () { - var ele = $(this); - if (ele.find('.panel-body').hasClass('ascii-hidden')) { - ele = ele.find('.panel-body'); - var raw_code = ele.text().split(' '); - - } -}); $('.protected-mailto').bind('click', function (evt) { evt.preventDefault(); var char_codes = $(this).data('value').split(' '); - var plain_text = [] - for(var i=0; i Date: Sat, 11 Feb 2017 20:27:32 +0000 Subject: [PATCH 5/6] Test contact page --- tests/__init__.py | 4 +++- tests/tests_common.py | 6 ++++++ tests/tests_pages.py | 14 ++++++++++++++ 3 files changed, 23 insertions(+), 1 deletion(-) diff --git a/tests/__init__.py b/tests/__init__.py index 1b8d62f..fb9ff31 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -9,7 +9,7 @@ class TestClient: def get(self, path, JS=True): file_path = self.build_path(path) content = "".join(open(file_path).readlines()) - if path.endswith('html'): + if file_path.endswith('html'): content = BeautifulSoup(content, 'html.parser') if JS: for script in content(["noscript"]): # Remove noscript tags @@ -19,6 +19,8 @@ class TestClient: def build_path(self, path): if path.startswith('/'): path = path[1:] + if path.endswith('/'): + path += 'index.html' return os.path.join(self.output_path, path) def exists(self, path): diff --git a/tests/tests_common.py b/tests/tests_common.py index b935074..2713db2 100644 --- a/tests/tests_common.py +++ b/tests/tests_common.py @@ -96,5 +96,11 @@ class TestClientTestCase(TestCase): def test_file_exists(self): self.assertTrue(self.client.exists('index.html')) + def test_build_path_without_index(self): + self.assertEqual( + self.client.build_path('foo/'), + self.client.build_path('foo/index.html') + ) + def test_file_doesnt_exist(self): self.assertFalse(self.client.exists('foo.bar')) diff --git a/tests/tests_pages.py b/tests/tests_pages.py index 0838656..a54d339 100644 --- a/tests/tests_pages.py +++ b/tests/tests_pages.py @@ -70,6 +70,20 @@ class AboutPageTestCase(TestCase): self.assertIn(self.get_children(account.find('h3')), site_names) +class ContactPageTestCase(TestCase): + def test_title(self): + content = self.client.get('contact/') + self.assertHeaderTitle(content, 'Contact Me') + self.assertTitle(content, 'Contact Me') + + def test_contact_links(self): + content = self.client.get('contact/') + links = content.find_all('section')[2].find_all('a') + self.assertEqual(links[1].attrs['href'], settings.ACCOUNTS['twitter']['url']) + decoded_value = ''.join([chr(int(c)) for c in links[0].attrs['data-value'].split(' ')]) + self.assertEqual(decoded_value, settings.CONTACT_EMAIL) + + class Page404TestCase(TestCase): def test_title(self): content = self.client.get('.404.html') From 32c981d51898ecb4008075cc614ef271dcbf956e Mon Sep 17 00:00:00 2001 From: Jake Howard Date: Sat, 11 Feb 2017 20:47:11 +0000 Subject: [PATCH 6/6] Fix codepen url --- config/social.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/social.yml b/config/social.yml index adafe70..c03384c 100644 --- a/config/social.yml +++ b/config/social.yml @@ -69,7 +69,7 @@ accounts: codepen: - CodePen - TheOrangeOne - - https://codepen.io/~{0}/ + - https://codepen.io/{0}/ - fa-codepen npm: