gallery fully working.
This commit is contained in:
parent
b889aad4f8
commit
c1d0d780bf
6 changed files with 25 additions and 7 deletions
1
Gemfile
1
Gemfile
|
@ -1,4 +1,5 @@
|
|||
source 'https://rubygems.org'
|
||||
|
||||
gem 'jekyll'
|
||||
gem 'exifr'
|
||||
gem 'jekyll-paginate'
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
#!/usr/bin/env ruby
|
||||
|
||||
require 'exifr'
|
||||
|
||||
puts "Gallery title?"
|
||||
gallery_title = gets.chomp
|
||||
gallery_slug = gallery_title.downcase.strip.gsub(' ', '-').gsub(/[^\w-]/, '')
|
||||
|
@ -21,6 +23,7 @@ out += "gallery-date: #{Time.now.to_s}\n"
|
|||
basename = File.basename(image, '.jpg')
|
||||
filename = year.to_s+"-"+month.to_s+"-"+basename
|
||||
t = " - basename: #{basename}\n"
|
||||
t += " date: #{EXIFR::JPEG.new(image).date_time}\n"
|
||||
t += " thumb-src: /assets/#{filename}_t.jpg\n"
|
||||
t += " mid-src: /assets/#{filename}_m.jpg\n"
|
||||
t += " image-src: /assets/#{filename}.jpg\n"
|
||||
|
|
|
@ -8,7 +8,7 @@ layout: default
|
|||
</header>
|
||||
<ul>
|
||||
{% for gallery in page.galleries %}
|
||||
<li><a href="/photos/{{gallery['slug']}}">{{gallery['title']}}</a></li>
|
||||
<li><a href="/photos/{{gallery['slug']}}">{{gallery['title']}}</a> - {{gallery['date']}}</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</article>
|
||||
|
|
|
@ -7,6 +7,7 @@ image-name:
|
|||
|
||||
<article>
|
||||
<header>
|
||||
<p class="subheading">Back to <a href="/photos">Photos</a></p>
|
||||
<h1 class="post-title">{{page.gallery['title']}}</h1>
|
||||
</header>
|
||||
|
||||
|
|
|
@ -42,14 +42,16 @@ module Jekyll
|
|||
gallery_index = Array.new()
|
||||
@galleries = site.pages.select { |page|
|
||||
page.path =~ /^photos\/(.*)\.yaml$/ }
|
||||
@galleries.each { |gallery|
|
||||
@galleries_sorted = @galleries.sort_by { |g| g['gallery-date'] }
|
||||
@galleries_sorted.reverse.each { |gallery|
|
||||
index_record = Hash.new()
|
||||
index_record['title'] = gallery['gallery-title']
|
||||
index_record['slug'] = gallery['gallery-slug']
|
||||
index_record['key'] = gallery['gallery-key']
|
||||
index_record['date'] = gallery['gallery-date'].strftime("%Y-%m-%d")
|
||||
gallery_index.push(index_record)
|
||||
gallery_page = index_record.clone
|
||||
gallery_page['images'] = gallery['images']
|
||||
gallery_page['images'] = gallery['images'].sort_by{|g| g['date']}
|
||||
site.pages << GalleryPage.new(site, site.source,
|
||||
"photos/#{gallery['gallery-slug']}",
|
||||
gallery_page)
|
||||
|
|
|
@ -229,6 +229,12 @@
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Gallery Styling
|
||||
*/
|
||||
|
||||
.gallery {
|
||||
list-style-type: none;
|
||||
}
|
||||
|
@ -236,11 +242,16 @@
|
|||
.gallery li {
|
||||
float: left;
|
||||
padding: 10px;
|
||||
width: 160px;
|
||||
height: 160px;
|
||||
text-align: center;
|
||||
@include media-query($on_palm) {
|
||||
width: 110px;
|
||||
height: 110px;
|
||||
}
|
||||
}
|
||||
|
||||
.gallery li img {
|
||||
width: 150px;
|
||||
@include media-query($on_palm) {
|
||||
width: 125px;
|
||||
}
|
||||
max-width: 100%;
|
||||
max-height: 100%;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue