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

Fix: #39 bugs, and Add some missing JS libraries. #41

Merged
merged 1 commit into from
Jul 18, 2018
Merged
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
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,6 @@ bower.json

# Ignore node_modules
node_modules/

# Ignore master key for decrypting credentials and more.
/config/master.key
2 changes: 2 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ gem 'coffee-rails', '~> 4.2.1'
# See https://github.com/rails/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby

gem 'sprockets-rails'

# Use jquery as the JavaScript library
gem 'jquery-rails'
gem 'jquery-ui-rails'
Expand Down
1 change: 1 addition & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,7 @@ DEPENDENCIES
simplecov
slack-notifier
spring
sprockets-rails
sqlite3
timecop
toastr-rails
Expand Down
7 changes: 5 additions & 2 deletions app/assets/javascripts/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@
//= require jquery
//= require rails-ujs
//= require turbolinks
//= require popper
//= require bootstrap
//= require_tree .
//= require scrollreveal.min.js
//= require toastr
//= require popper
//= require jquery.magnific-popup.min.js

//= require_tree .
65 changes: 65 additions & 0 deletions app/assets/javascripts/creative.coffee
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
(($) ->
'use strict'
# Start of use strict
# Smooth scrolling using jQuery easing
$('a.js-scroll-trigger[href*="#"]:not([href="#"])').click ->
if location.pathname.replace(/^\//, '') == @pathname.replace(/^\//, '') and location.hostname == @hostname
target = $(@hash)
target = if target.length then target else $('[name=' + @hash.slice(1) + ']')
if target.length
$('html, body').animate { scrollTop: target.offset().top - 57 }, 1000, 'easeInOutExpo'
return false
return
# Closes responsive menu when a scroll trigger link is clicked
$('.js-scroll-trigger').click ->
$('.navbar-collapse').collapse 'hide'
return
# Activate scrollspy to add active class to navbar items on scroll
$('body').scrollspy
target: '#mainNav'
offset: 57
# Collapse Navbar

navbarCollapse = ->
if $('#mainNav').offset().top > 100
$('#mainNav').addClass 'navbar-shrink'
else
$('#mainNav').removeClass 'navbar-shrink'
return

# Collapse now if page is not at top
$(document).on 'turbolinks:load', navbarCollapse
# Collapse the navbar when page is scrolled
$(window).scroll navbarCollapse
# Scroll reveal calls
window.sr = ScrollReveal()
sr.reveal '.sr-icons', {
duration: 600
scale: 0.3
distance: '0px'
}, 200
sr.reveal '.sr-button',
duration: 1000
delay: 200
sr.reveal '.sr-contact', {
duration: 600
scale: 0.3
distance: '0px'
}, 300
# Magnific popup calls
$('.popup-gallery').magnificPopup
delegate: 'a'
type: 'image'
tLoading: 'Loading image #%curr%...'
mainClass: 'mfp-img-mobile'
gallery:
enabled: true
navigateByImgClick: true
preload: [
0
1
]
image: tError: '<a href="%url%">The image #%curr%</a> could not be loaded.'
return
) jQuery
# End of use strict
75 changes: 0 additions & 75 deletions app/assets/javascripts/creative.js

This file was deleted.

7 changes: 7 additions & 0 deletions app/assets/javascripts/js-check.coffee
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
$ ->
console.log('No Events')
$(document).on 'turbolinks:load', callTurbolinks_load_event

callTurbolinks_load_event = ->
console.log('turbolinks:load called!')
return
5 changes: 1 addition & 4 deletions app/assets/javascripts/staticpages.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@
# All this logic will automatically be available in application.js.
# You can use CoffeeScript in this file: http://coffeescript.org/

document.addEventListener 'turbolinks:load', ->
componentHandler.upgradeDom()

# ((d, s, id) ->
# js = undefined
# fjs = d.getElementsByTagName(s)[0]
Expand All @@ -30,4 +27,4 @@ document.addEventListener 'turbolinks:load', ->
# fjs.parentNode.insertBefore js, fjs
# return
# )(document, 'script', 'twitter-wjs')
# return
# return
18 changes: 17 additions & 1 deletion app/assets/javascripts/twitter.coffee
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

twttr_events_bound = false

$ ->
Expand All @@ -9,11 +10,26 @@ bindTwitterEventHandlers = ->
twttr_events_bound = true

renderTweetButtons = ->
$('.twitter-follow-button').each ->
$('.twitter-share-button').each ->
button = $(this)
button.attr('data-url', document.location.href) unless button.data('url')?
button.attr('data-text', document.title) unless button.data('text')?
twttr.widgets.load()

loadTwitterSDK = (callback) ->
$.getScript('//platform.twitter.com/widgets.js', callback)


document.addEventListener 'turbolinks:load', ->
!((d, s, id) ->
js = undefined
fjs = d.getElementsByTagName(s)[0]
p = if /^http:/.test(d.location) then 'http' else 'https'
if !d.getElementById(id)
js = d.createElement(s)
js.id = id
js.src = p + '://platform.twitter.com/widgets.js'
fjs.parentNode.insertBefore js, fjs
return
)(document, 'script', 'twitter-wjs')
return
2 changes: 2 additions & 0 deletions app/assets/stylesheets/application.scss
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@

@import "toastr";

@import "magnific-popup.css";

@import "bootstrap-creative/creative";
@import "pages";
@import "posts";
Expand Down
1 change: 1 addition & 0 deletions config/credentials.yml.enc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
93UJISKB7KDNP4+U59DLd7AtYZM2XBaJ73Z2KymZ6uWVm8rT2gd3vN8HkMy4A4ZmOUq8Q7y9Y4iPBhgQoBT990vG4Uvjjntcy5svtdFaGqwb+rp/Vge69FIzloXBYK46Xjgm2hD/gkZKfjru/j5eKmBJeRPbKgezsmFdfFwZVo+wTLoevaLf+X0cezrKzNX3nBB15ZHqe+A2//Sj7cxxO8flgOaeCm3Ukvathdrzv3OI9TfSepdA8CqXPunX55FW+qShgl41R5qZrZ01umwIJW+uCSItG3/bmQ2BKHAK9/TrRiSDUmSit5IxSP3B0ktwJH5Rdt0jSoWLWxr54Aj3K6cyiTbO1cM2BhbYugBTxsHl6Mbx5aXtyOY2wuROvK7TzXnO3w/b00s21fEJLd6/8uZ/fzXd0IPE5YEk--+6JTITAbwvy6yF68--e8oPyx0l4g2Sm+EWUuWwsg==
6 changes: 3 additions & 3 deletions config/environments/production.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
config.eager_load = true

# Full error reports are disabled and caching is turned on.
config.consider_all_requests_local = false
config.consider_all_requests_local = true
config.action_controller.perform_caching = true

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

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

# Compress JavaScripts and CSS.
config.assets.js_compressor = :uglifier
# config.assets.css_compressor = :sass

# Do not fallback to assets pipeline if a precompiled asset is missed.
config.assets.compile = false
config.assets.compile = true

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

Expand Down
Loading