Skip to content
This repository has been archived by the owner on Aug 21, 2024. It is now read-only.

Commit

Permalink
Setup Asset Pipeline Using django-compressor
Browse files Browse the repository at this point in the history
Change-Id: Id1885c07e1086defc61e9f1e1f6b5409820229f2
  • Loading branch information
Clinton Blackburn committed Jun 20, 2014
1 parent 601f290 commit 1e724eb
Show file tree
Hide file tree
Showing 92 changed files with 11,453 additions and 272 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,6 @@ tramp
Thumbs.db
Desktop.ini

.idea
.idea/
analytics_dashboard/assets/
node_modules/
8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,15 @@ Getting Started
---------------

1. Get the code (e.g. clone the repository).
2. Install the requirements:
2. Install the Python requirements:

$ pip install -r requirements/local.txt

3. Run the server:
3. Change to the Django project directory.

$ cd analytics_dashboard

4. Run the server:

./manage.py runserver

Expand Down
8 changes: 7 additions & 1 deletion analytics_dashboard/analytics_dashboard/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@

########## GENERAL CONFIGURATION
# See: https://docs.djangoproject.com/en/dev/ref/settings/#time-zone
TIME_ZONE = 'America/Los_Angeles'
TIME_ZONE = 'America/New_York'

# See: https://docs.djangoproject.com/en/dev/ref/settings/#language-code
LANGUAGE_CODE = 'en-us'
Expand Down Expand Up @@ -102,6 +102,11 @@
STATICFILES_FINDERS = (
'django.contrib.staticfiles.finders.FileSystemFinder',
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
'compressor.finders.CompressorFinder',
)

COMPRESS_PRECOMPILERS = (
('text/x-scss', 'django_libsass.SassCompiler'),
)
########## END STATIC FILE CONFIGURATION

Expand Down Expand Up @@ -245,6 +250,7 @@
INSTALLED_APPS += (
# Database migration helpers:
'south',
'compressor',
)
# Don't need to use South when setting up a test database.
SOUTH_TESTS_MIGRATE = False
Expand Down
1 change: 0 additions & 1 deletion analytics_dashboard/static/css/analytics_dashboard.css

This file was deleted.

9 changes: 0 additions & 9 deletions analytics_dashboard/static/css/bootstrap.min.css

This file was deleted.

Binary file not shown.
228 changes: 0 additions & 228 deletions analytics_dashboard/static/fonts/glyphicons-halflings-regular.svg

This file was deleted.

Binary file not shown.
Binary file not shown.
6 changes: 0 additions & 6 deletions analytics_dashboard/static/js/bootstrap.min.js

This file was deleted.

8 changes: 8 additions & 0 deletions analytics_dashboard/static/sass/analytics_dashboard.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
@import "../vendor/bootstrap/stylesheets/bootstrap";

// When upgrading Font Awesome, remember to set $fa-font-path to "../../vendor/font-awesome/fonts".
@import "../vendor/font-awesome/scss/font-awesome";

body {
padding-top: 60px; /* 60px to make the container go all the way to the bottom of the topbar */
}
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
//= require bootstrap/affix
//= require bootstrap/alert
//= require bootstrap/button
//= require bootstrap/carousel
//= require bootstrap/collapse
//= require bootstrap/dropdown
//= require bootstrap/tab
//= require bootstrap/transition
//= require bootstrap/scrollspy
//= require bootstrap/modal
//= require bootstrap/tooltip
//= require bootstrap/popover
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
/* ========================================================================
* Bootstrap: affix.js v3.1.1
* http://getbootstrap.com/javascript/#affix
* ========================================================================
* Copyright 2011-2014 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* ======================================================================== */


+function ($) {
'use strict';

// AFFIX CLASS DEFINITION
// ======================

var Affix = function (element, options) {
this.options = $.extend({}, Affix.DEFAULTS, options)
this.$window = $(window)
.on('scroll.bs.affix.data-api', $.proxy(this.checkPosition, this))
.on('click.bs.affix.data-api', $.proxy(this.checkPositionWithEventLoop, this))

this.$element = $(element)
this.affixed =
this.unpin =
this.pinnedOffset = null

this.checkPosition()
}

Affix.RESET = 'affix affix-top affix-bottom'

Affix.DEFAULTS = {
offset: 0
}

Affix.prototype.getPinnedOffset = function () {
if (this.pinnedOffset) return this.pinnedOffset
this.$element.removeClass(Affix.RESET).addClass('affix')
var scrollTop = this.$window.scrollTop()
var position = this.$element.offset()
return (this.pinnedOffset = position.top - scrollTop)
}

Affix.prototype.checkPositionWithEventLoop = function () {
setTimeout($.proxy(this.checkPosition, this), 1)
}

Affix.prototype.checkPosition = function () {
if (!this.$element.is(':visible')) return

var scrollHeight = $(document).height()
var scrollTop = this.$window.scrollTop()
var position = this.$element.offset()
var offset = this.options.offset
var offsetTop = offset.top
var offsetBottom = offset.bottom

if (this.affixed == 'top') position.top += scrollTop

if (typeof offset != 'object') offsetBottom = offsetTop = offset
if (typeof offsetTop == 'function') offsetTop = offset.top(this.$element)
if (typeof offsetBottom == 'function') offsetBottom = offset.bottom(this.$element)

var affix = this.unpin != null && (scrollTop + this.unpin <= position.top) ? false :
offsetBottom != null && (position.top + this.$element.height() >= scrollHeight - offsetBottom) ? 'bottom' :
offsetTop != null && (scrollTop <= offsetTop) ? 'top' : false

if (this.affixed === affix) return
if (this.unpin) this.$element.css('top', '')

var affixType = 'affix' + (affix ? '-' + affix : '')
var e = $.Event(affixType + '.bs.affix')

this.$element.trigger(e)

if (e.isDefaultPrevented()) return

this.affixed = affix
this.unpin = affix == 'bottom' ? this.getPinnedOffset() : null

this.$element
.removeClass(Affix.RESET)
.addClass(affixType)
.trigger($.Event(affixType.replace('affix', 'affixed')))

if (affix == 'bottom') {
this.$element.offset({ top: scrollHeight - offsetBottom - this.$element.height() })
}
}


// AFFIX PLUGIN DEFINITION
// =======================

var old = $.fn.affix

$.fn.affix = function (option) {
return this.each(function () {
var $this = $(this)
var data = $this.data('bs.affix')
var options = typeof option == 'object' && option

if (!data) $this.data('bs.affix', (data = new Affix(this, options)))
if (typeof option == 'string') data[option]()
})
}

$.fn.affix.Constructor = Affix


// AFFIX NO CONFLICT
// =================

$.fn.affix.noConflict = function () {
$.fn.affix = old
return this
}


// AFFIX DATA-API
// ==============

$(window).on('load', function () {
$('[data-spy="affix"]').each(function () {
var $spy = $(this)
var data = $spy.data()

data.offset = data.offset || {}

if (data.offsetBottom) data.offset.bottom = data.offsetBottom
if (data.offsetTop) data.offset.top = data.offsetTop

$spy.affix(data)
})
})

}(jQuery);
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
/* ========================================================================
* Bootstrap: alert.js v3.1.1
* http://getbootstrap.com/javascript/#alerts
* ========================================================================
* Copyright 2011-2014 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* ======================================================================== */


+function ($) {
'use strict';

// ALERT CLASS DEFINITION
// ======================

var dismiss = '[data-dismiss="alert"]'
var Alert = function (el) {
$(el).on('click', dismiss, this.close)
}

Alert.prototype.close = function (e) {
var $this = $(this)
var selector = $this.attr('data-target')

if (!selector) {
selector = $this.attr('href')
selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') // strip for ie7
}

var $parent = $(selector)

if (e) e.preventDefault()

if (!$parent.length) {
$parent = $this.hasClass('alert') ? $this : $this.parent()
}

$parent.trigger(e = $.Event('close.bs.alert'))

if (e.isDefaultPrevented()) return

$parent.removeClass('in')

function removeElement() {
$parent.trigger('closed.bs.alert').remove()
}

$.support.transition && $parent.hasClass('fade') ?
$parent
.one($.support.transition.end, removeElement)
.emulateTransitionEnd(150) :
removeElement()
}


// ALERT PLUGIN DEFINITION
// =======================

var old = $.fn.alert

$.fn.alert = function (option) {
return this.each(function () {
var $this = $(this)
var data = $this.data('bs.alert')

if (!data) $this.data('bs.alert', (data = new Alert(this)))
if (typeof option == 'string') data[option].call($this)
})
}

$.fn.alert.Constructor = Alert


// ALERT NO CONFLICT
// =================

$.fn.alert.noConflict = function () {
$.fn.alert = old
return this
}


// ALERT DATA-API
// ==============

$(document).on('click.bs.alert.data-api', dismiss, Alert.prototype.close)

}(jQuery);
Loading

0 comments on commit 1e724eb

Please sign in to comment.