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

Automatic menu for pages and load in background #38

Open
wants to merge 3 commits into
base: gh-pages
Choose a base branch
from
Open
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
8 changes: 4 additions & 4 deletions _config.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
url: https://y7kim.github.io
baseurl: /agency-jekyll-theme/
url: http://localhost:4000
baseurl:

# Site settings
title: Awesome Title
Expand Down Expand Up @@ -50,7 +50,7 @@ social:
url:
- title: stack-overflow
url: http://stackoverflow.com/questions/tagged/jekyll
- title: bitbucket
- title: bitbucket
url: http://bitbucket.org/jekyll
- title: github
url: http://github.com/jekyll
Expand All @@ -62,4 +62,4 @@ address:

# Build settings
markdown: kramdown
permalink: pretty
permalink: pretty
2 changes: 1 addition & 1 deletion _includes/footer.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@
</div>
</div>
</div>
</footer>
</footer>
20 changes: 6 additions & 14 deletions _includes/header.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,21 +18,14 @@
<li class="hidden">
<a href="#page-top"></a>
</li>
{% assign sorted_pages = (site.pages | sort: 'order') %}
{% for sec in sorted_pages %}
{% if sec.section and sec.title %}
<li>
<a class="page-scroll" href="#services">Services</a>
</li>
<li>
<a class="page-scroll" href="#portfolio">Portfolio</a>
</li>
<li>
<a class="page-scroll" href="#about">About</a>
</li>
<li>
<a class="page-scroll" href="#team">Team</a>
</li>
<li>
<a class="page-scroll" href="#contact">Contact</a>
<a class="page-scroll" href="#{{ sec.section }}">{{ sec.title }}</a>
</li>
{% endif %}
{% endfor %}
</ul>
</div>
<!-- /.navbar-collapse -->
Expand All @@ -55,4 +48,3 @@
{% if page.title %}<a class="page-link" href="{{ page.url | prepend: site.baseurl }}">{{ page.title }}</a>{% endif %}
{% endfor %}
-->

74 changes: 74 additions & 0 deletions _includes/js.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,77 @@

<!-- Custom Theme JavaScript -->
<script src="{{ "/js/agency.js" | prepend: site.baseurl }}"></script>

<script type="text/javascript">

// How to force async functions to execute sequentially
// by using deferred pipe chaining.

// The master deferred.
var dfd = $.Deferred(), // Master deferred
dfdNext = dfd; // Next deferred in the chain
x = 0, // Loop index
values = [],

// Simulates $.ajax, but with predictable behaviour.
// You only need to understand that higher 'value' param
// will finish earlier.
simulateAjax = function (value) {
var dfdAjax = $.Deferred();

setTimeout(
function () {
dfdAjax.resolve(value);
},
1000 - (value * 100)
);

return dfdAjax.promise();
},

// This would be a user function that makes an ajax request.
// In normal code you'd be using $.ajax instead of simulateAjax.
requestAjax = function (value) {
return simulateAjax(value);
};

// Start the pipe chain. You should be able to do
// this anywhere in the program, even
// at the end,and it should still give the same results.
dfd.resolve();

{% assign sorted_pages = (site.pages | sort: 'order') %}
{% for sec in sorted_pages %}
//# Do something.
{% if sec.url and sec.title %}
dfdNext = dfdNext.pipe(function () {
return jQuery.get("{{ sec.url }}", function(data) {
// Process the response here.
$('#sections').append(data);
});

});
{% comment %}
function get_page_{{ forloop.index }}(){
jQuery.ajax({url:"{{ sec.url }}",success: function(data) {
//console.log(data);
// window.alert("{{ sec.section }}")
$('#sections').append(data);
{% if forloop.last == false %}
get_page_{{ forloop.index | plus: 1 }}();
{% endif %}
},async: true});
}
if (get_pages) {
get_pages = false;
get_page_{{ forloop.index }}();
}
{% endcomment %}
{% endif %}
{% endfor %}
jQuery.ajax({url:"{{ "modals" | prepend: site.baseurl }}",success: function(data) {
//console.log(data);
// window.alert("{{ sec.section }}")
$('#sections').append(data);
},async: true});
</script>
12 changes: 5 additions & 7 deletions _layouts/default.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,13 @@
<body id="page-top" class="index">

{% include header.html %}
{% include services.html %}
{% include portfolio_grid.html %}
{% include about.html %}
{% include team.html %}
{% include clients.html %}
{% include contact.html %}
<div id="sections">
</div>
{% include footer.html %}
{% comment %}
{% include modals.html %}
{% endcomment %}
{% include js.html %}

</body>
</html>
</html>
38 changes: 38 additions & 0 deletions _layouts/modal.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<!-- Portfolio Modal -->
<div class="portfolio-modal modal fade" id="portfolioModal{{ page.modal-id }}" tabindex="-1" role="dialog" aria-hidden="true">
<div class="modal-content">
<div class="close-modal" data-dismiss="modal">
<div class="lr">
<div class="rl">
</div>
</div>
</div>
<div class="container">
<div class="row">
<div class="col-lg-8 col-lg-offset-2">
<div class="modal-body">
<h2>{{ page.title }}</h2>
<hr class="star-primary">
<img src="img/portfolio/{{ post.img }}" class="img-responsive img-centered" alt="{{ post.alt }}">
<p>{{ page.description }}</p>
<ul class="list-inline item-details">
<li>Client:
<strong><a href="http://startbootstrap.com">{{ page.client }}</a>
</strong>
</li>
<li>Date:
<strong><a href="http://startbootstrap.com">{{ page.project-date }}</a>
</strong>
</li>
<li>Service:
<strong><a href="http://startbootstrap.com">{{ page.category }}</a>
</strong>
</li>
</ul>
<button type="button" class="btn btn-default" data-dismiss="modal"><i class="fa fa-times"></i> Close</button>
</div>
</div>
</div>
</div>
</div>
</div>
7 changes: 7 additions & 0 deletions _layouts/section.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<section id="{{ page.section }}" class="bg-light-gray">
<div class="container">
<div class="row">
{{ content }}
</div>
</div>
</section>
Empty file added js/background.js
Empty file.
5 changes: 4 additions & 1 deletion _includes/modals.html → modals.html
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
---
title: Portfolio
---
<!-- Portfolio Modals -->
{% for post in site.posts %}
<div class="portfolio-modal modal fade" id="portfolioModal{{ post.modal-id }}" tabindex="-1" role="dialog" aria-hidden="true">
Expand All @@ -14,7 +17,7 @@
<div class="modal-body">
<h2>{{ post.title }}</h2>
<hr class="star-primary">
<img src="img/portfolio/{{ post.img }}" class="img-responsive img-centered" alt="{{ post.alt }}">
<img src="/img/portfolio/{{ post.img }}" class="img-responsive img-centered" alt="{{ post.alt }}">
<p>{{ post.description }}</p>
<ul class="list-inline item-details">
<li>Client:
Expand Down
11 changes: 7 additions & 4 deletions _includes/about.html → page/about.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
---
layout: section
title: About
section: about
order: 998
---
<!-- About Section -->
<section id="about">
<div class="container">

<div class="row">
<div class="col-lg-12 text-center">
<h2 class="section-heading">About</h2>
Expand Down Expand Up @@ -76,5 +81,3 @@ <h4>Be Part
</ul>
</div>
</div>
</div>
</section>
6 changes: 5 additions & 1 deletion _includes/clients.html → page/clients.html
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
---
title: Clients
order: 998
---
<!-- Clients Aside -->
<aside class="clients">
<div class="container">
Expand All @@ -24,4 +28,4 @@
</div>
</div>
</div>
</aside>
</aside>
11 changes: 7 additions & 4 deletions _includes/contact.html → page/contact.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
<section id="contact">
<div class="container">
---
layout: section
title: Contact
section: contact
order: 999
---

<div class="row">
<div class="col-lg-12 text-center">
<h2 class="section-heading">Contact Us</h2>
Expand Down Expand Up @@ -39,5 +44,3 @@ <h3 class="section-subheading text-muted">Lorem ipsum dolor sit amet consectetur
</form>
</div>
</div>
</div>
</section>
11 changes: 7 additions & 4 deletions _includes/portfolio_grid.html → page/portfolio_grid.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
---
layout: section
title: Portfolio
section: portfolio
order: 200
---
<!-- Portfolio Grid Section -->
<section id="portfolio" class="bg-light-gray">
<div class="container">

<div class="row">
<div class="col-lg-12 text-center">
<h2 class="section-heading">Portfolio</h2>
Expand All @@ -25,5 +30,3 @@ <h4>{{ post.title }}</h4>
</div>
{% endfor %}
</div>
</div>
</section>
11 changes: 7 additions & 4 deletions _includes/services.html → page/services.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
---
layout: section
title: Services
section: services
order: 100
---
<!-- Services Section -->
<section id="services">
<div class="container">

<div class="row">
<div class="col-lg-12 text-center">
<h2 class="section-heading">Services</h2>
Expand Down Expand Up @@ -33,5 +38,3 @@ <h4 class="service-heading">Web Security</h4>
<p class="text-muted">Lorem ipsum dolor sit amet, consectetur adipisicing elit. Minima maxime quam architecto quo inventore harum ex magni, dicta impedit.</p>
</div>
</div>
</div>
</section>
10 changes: 6 additions & 4 deletions _includes/team.html → page/team.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
---
layout: section
title: Team
section: team
order: 900
---
<!-- Team Section -->
<section id="team" class="bg-light-gray">
<div class="container">
<div class="row">
<div class="col-lg-12 text-center">
<h2 class="section-heading">Our Amazing Team</h2>
Expand Down Expand Up @@ -33,5 +37,3 @@ <h4>{{ member.name }}</h4>
<p class="large text-muted">Lorem ipsum dolor sit amet, consectetur adipisicing elit. Aut eaque, laboriosam veritatis, quos non quis ad perspiciatis, totam corporis ea, alias ut unde.</p>
</div>
</div>
</div>
</section>