-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.rb
108 lines (81 loc) · 2.3 KB
/
config.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
# Slim Template Engine
require 'slim'
require 'uglifier'
require 'rack/google_analytics'
set :slim, pretty: true
# Localization
activate :i18n, langs: [:en]
I18n.enforce_available_locales = false
# Pretty URLs
#activate :directory_indexes
#set :index_file, 'profile.html'
# GZip compression
activate :gzip
# Reload the browser automatically whenever files change
activate :livereload
config[:file_watcher_ignore] += [ /.idea\// ]
# Stylesheets Directory
set :css_dir, 'assets/stylesheets'
# Javascripts Directory
set :js_dir, 'assets/javascripts'
# Images Directory
set :images_dir, 'assets/images'
# Fonts Directory
set :fonts_dir, 'assets/fonts'
# Use relative URLs
set :relative_links, true
#set :environment, :build
# Google Analytics
#use Rack::GoogleAnalytics, :web_property_id => 'UA-3312587-3'
# Build-specific configuration
configure :build do
# Minify HTML
activate :minify_html
# Minify CSS
activate :minify_css
# Minify JS
activate :minify_javascript, :compressor => Uglifier.new()
# Enable cache buster
activate :asset_hash
# Use relative Assets
activate :relative_assets
end
# Custom Helpers
helpers do
# Page Title
def page_title
current_page.data.title ? "#{I18n.t(current_page.data.title)} | #{I18n.t('profile.nickname')}" : I18n.t('profile.nickname')
end
# Active Menu Item
def current_menu(page)
'active' if @page_id == page
end
# Home Page
def homepage?
@page_id == '/' || @page_id == 'index.html'
end
def homepage_logo_class
'hidden-xs invisible' if homepage?
end
# Full Name
def full_name
"#{I18n.t('profile.first_name')} #{I18n.t('profile.last_name')}"
end
# Duration Date
def duration_date(m1, y1, m2, y2)
html = ""
html += "#{I18n.t('month.'+m1)}" if m1 != ''
html += " #{y1} - " if y1 != ''
html += "#{I18n.t('month.'+m2)}" if m2 != ''
html += " #{y2}" if y2 != ''
html
end
# Contact Person
def contact_person(contact = {})
html = ""
html += (contact.email) == '' ? "#{I18n.t('xp.'+contact.person)}, #{I18n.t('xp.upon_request')}" : "<a href='mailto:#{contact.email}'>#{I18n.t('xp.'+contact.person)}</a>"
html += (contact.phone) == '' ? '' : ", <span>#{contact.phone}</span>"
html += ", <a href='http://#{contact.website}' target='_blank'>#{contact.website}</a>"
html
end
end