Skip to content
This repository was archived by the owner on Mar 19, 2020. It is now read-only.

Commit 78453a9

Browse files
author
Yuma Soga
committed
Add some libs and Fix bugs: #39 .
1 parent 61a9399 commit 78453a9

File tree

17 files changed

+3185
-85
lines changed

17 files changed

+3185
-85
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,3 +46,6 @@ bower.json
4646

4747
# Ignore node_modules
4848
node_modules/
49+
50+
# Ignore master key for decrypting credentials and more.
51+
/config/master.key

Gemfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ gem 'coffee-rails', '~> 4.2.1'
1212
# See https://github.com/rails/execjs#readme for more supported runtimes
1313
# gem 'therubyracer', platforms: :ruby
1414

15+
gem 'sprockets-rails'
16+
1517
# Use jquery as the JavaScript library
1618
gem 'jquery-rails'
1719
gem 'jquery-ui-rails'

Gemfile.lock

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -353,6 +353,7 @@ DEPENDENCIES
353353
simplecov
354354
slack-notifier
355355
spring
356+
sprockets-rails
356357
sqlite3
357358
timecop
358359
toastr-rails

app/assets/javascripts/application.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,10 @@
1313
//= require jquery
1414
//= require rails-ujs
1515
//= require turbolinks
16+
//= require popper
1617
//= require bootstrap
17-
//= require_tree .
18+
//= require scrollreveal.min.js
1819
//= require toastr
19-
//= require popper
20+
//= require jquery.magnific-popup.min.js
21+
22+
//= require_tree .
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
(($) ->
2+
'use strict'
3+
# Start of use strict
4+
# Smooth scrolling using jQuery easing
5+
$('a.js-scroll-trigger[href*="#"]:not([href="#"])').click ->
6+
if location.pathname.replace(/^\//, '') == @pathname.replace(/^\//, '') and location.hostname == @hostname
7+
target = $(@hash)
8+
target = if target.length then target else $('[name=' + @hash.slice(1) + ']')
9+
if target.length
10+
$('html, body').animate { scrollTop: target.offset().top - 57 }, 1000, 'easeInOutExpo'
11+
return false
12+
return
13+
# Closes responsive menu when a scroll trigger link is clicked
14+
$('.js-scroll-trigger').click ->
15+
$('.navbar-collapse').collapse 'hide'
16+
return
17+
# Activate scrollspy to add active class to navbar items on scroll
18+
$('body').scrollspy
19+
target: '#mainNav'
20+
offset: 57
21+
# Collapse Navbar
22+
23+
navbarCollapse = ->
24+
if $('#mainNav').offset().top > 100
25+
$('#mainNav').addClass 'navbar-shrink'
26+
else
27+
$('#mainNav').removeClass 'navbar-shrink'
28+
return
29+
30+
# Collapse now if page is not at top
31+
$(document).on 'turbolinks:load', navbarCollapse
32+
# Collapse the navbar when page is scrolled
33+
$(window).scroll navbarCollapse
34+
# Scroll reveal calls
35+
window.sr = ScrollReveal()
36+
sr.reveal '.sr-icons', {
37+
duration: 600
38+
scale: 0.3
39+
distance: '0px'
40+
}, 200
41+
sr.reveal '.sr-button',
42+
duration: 1000
43+
delay: 200
44+
sr.reveal '.sr-contact', {
45+
duration: 600
46+
scale: 0.3
47+
distance: '0px'
48+
}, 300
49+
# Magnific popup calls
50+
$('.popup-gallery').magnificPopup
51+
delegate: 'a'
52+
type: 'image'
53+
tLoading: 'Loading image #%curr%...'
54+
mainClass: 'mfp-img-mobile'
55+
gallery:
56+
enabled: true
57+
navigateByImgClick: true
58+
preload: [
59+
0
60+
1
61+
]
62+
image: tError: '<a href="%url%">The image #%curr%</a> could not be loaded.'
63+
return
64+
) jQuery
65+
# End of use strict

app/assets/javascripts/creative.js

Lines changed: 0 additions & 75 deletions
This file was deleted.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
$ ->
2+
console.log('No Events')
3+
$(document).on 'turbolinks:load', callTurbolinks_load_event
4+
5+
callTurbolinks_load_event = ->
6+
console.log('turbolinks:load called!')
7+
return

app/assets/javascripts/staticpages.coffee

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@
22
# All this logic will automatically be available in application.js.
33
# You can use CoffeeScript in this file: http://coffeescript.org/
44

5-
document.addEventListener 'turbolinks:load', ->
6-
componentHandler.upgradeDom()
7-
85
# ((d, s, id) ->
96
# js = undefined
107
# fjs = d.getElementsByTagName(s)[0]
@@ -30,4 +27,4 @@ document.addEventListener 'turbolinks:load', ->
3027
# fjs.parentNode.insertBefore js, fjs
3128
# return
3229
# )(document, 'script', 'twitter-wjs')
33-
# return
30+
# return

app/assets/javascripts/twitter.coffee

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
12
twttr_events_bound = false
23

34
$ ->
@@ -9,11 +10,26 @@ bindTwitterEventHandlers = ->
910
twttr_events_bound = true
1011

1112
renderTweetButtons = ->
12-
$('.twitter-follow-button').each ->
13+
$('.twitter-share-button').each ->
1314
button = $(this)
1415
button.attr('data-url', document.location.href) unless button.data('url')?
1516
button.attr('data-text', document.title) unless button.data('text')?
1617
twttr.widgets.load()
1718

1819
loadTwitterSDK = (callback) ->
1920
$.getScript('//platform.twitter.com/widgets.js', callback)
21+
22+
23+
document.addEventListener 'turbolinks:load', ->
24+
!((d, s, id) ->
25+
js = undefined
26+
fjs = d.getElementsByTagName(s)[0]
27+
p = if /^http:/.test(d.location) then 'http' else 'https'
28+
if !d.getElementById(id)
29+
js = d.createElement(s)
30+
js.id = id
31+
js.src = p + '://platform.twitter.com/widgets.js'
32+
fjs.parentNode.insertBefore js, fjs
33+
return
34+
)(document, 'script', 'twitter-wjs')
35+
return

app/assets/stylesheets/application.scss

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717

1818
@import "toastr";
1919

20+
@import "magnific-popup.css";
21+
2022
@import "bootstrap-creative/creative";
2123
@import "pages";
2224
@import "posts";

config/credentials.yml.enc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
93UJISKB7KDNP4+U59DLd7AtYZM2XBaJ73Z2KymZ6uWVm8rT2gd3vN8HkMy4A4ZmOUq8Q7y9Y4iPBhgQoBT990vG4Uvjjntcy5svtdFaGqwb+rp/Vge69FIzloXBYK46Xjgm2hD/gkZKfjru/j5eKmBJeRPbKgezsmFdfFwZVo+wTLoevaLf+X0cezrKzNX3nBB15ZHqe+A2//Sj7cxxO8flgOaeCm3Ukvathdrzv3OI9TfSepdA8CqXPunX55FW+qShgl41R5qZrZ01umwIJW+uCSItG3/bmQ2BKHAK9/TrRiSDUmSit5IxSP3B0ktwJH5Rdt0jSoWLWxr54Aj3K6cyiTbO1cM2BhbYugBTxsHl6Mbx5aXtyOY2wuROvK7TzXnO3w/b00s21fEJLd6/8uZ/fzXd0IPE5YEk--+6JTITAbwvy6yF68--e8oPyx0l4g2Sm+EWUuWwsg==

config/environments/production.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
config.eager_load = true
1515

1616
# Full error reports are disabled and caching is turned on.
17-
config.consider_all_requests_local = false
17+
config.consider_all_requests_local = true
1818
config.action_controller.perform_caching = true
1919

2020
# Ensures that a master key has been made available in either ENV["RAILS_MASTER_KEY"]
@@ -23,14 +23,14 @@
2323

2424
# Disable serving static files from the `/public` folder by default since
2525
# Apache or NGINX already handles this.
26-
config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present?
26+
config.public_file_server.enabled = true
2727

2828
# Compress JavaScripts and CSS.
2929
config.assets.js_compressor = :uglifier
3030
# config.assets.css_compressor = :sass
3131

3232
# Do not fallback to assets pipeline if a precompiled asset is missed.
33-
config.assets.compile = false
33+
config.assets.compile = true
3434

3535
# `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb
3636

0 commit comments

Comments
 (0)