Skip to content

Commit

Permalink
Use new-style assets.
Browse files Browse the repository at this point in the history
  • Loading branch information
jace committed Mar 25, 2013
1 parent efcc59a commit 02c1c9e
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 17 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,5 @@ instance/production.py
instance/development.py
packed.js
packed.css
baseframe-packed.js
baseframe-packed.css
31 changes: 14 additions & 17 deletions hasjob/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,31 +4,28 @@
from flask import Flask
from flask.ext.mail import Mail
from flask.ext.lastuser import LastUser
from flask.ext.assets import Environment
from baseframe import baseframe, Version
from baseframe import assets as assets_registry
from baseframe import assets as assets
import coaster.app
from ._version import __version__


# First, make an app and config it

app = Flask(__name__, instance_relative_config=True)
app.register_blueprint(baseframe)
mail = Mail()
lastuser = LastUser()

# Second, setup assets
version = Version(__version__)
assets = Environment(app)
assets_registry['jquery-ui.js'][version] = 'js/libs/jquery-ui-1.10.0.custom.js'
assets_registry['jQRangeSlider.js'][version] = 'js/libs/jQRangeSlider-min.js'
assets_registry['jquery.textarea.expander.js'][version] = 'js/libs/jquery.textarea-expander.js'
assets_registry['jquery.oembed.js'][version] = 'js/libs/jquery.oembed.js'
assets_registry['hasjob.js'][version] = 'js/scripts.js'
assets_registry['hasjob.css'][version] = 'css/screen.css'
assets_registry['jquery-ui.css'][version] = 'css/jquery-ui.css'
assets_registry['range-slider.css'][version] = 'css/range-slider.css'
assets['jquery-ui.js'][version] = 'js/libs/jquery-ui-1.10.0.custom.js'
assets['jQRangeSlider.js'][version] = 'js/libs/jQRangeSlider-min.js'
assets['jquery.textarea.expander.js'][version] = 'js/libs/jquery.textarea-expander.js'
assets['jquery.oembed.js'][version] = 'js/libs/jquery.oembed.js'
assets['hasjob.js'][version] = 'js/scripts.js'
assets['hasjob.css'][version] = 'css/screen.css'
assets['jquery-ui.css'][version] = 'css/jquery-ui.css'
assets['range-slider.css'][version] = 'css/range-slider.css'

# Third, after config, import the models and views

Expand All @@ -46,8 +43,8 @@ def init_for(env):
uploads_configure()
mail.init_app(app)
lastuser.init_app(app)
assets.register('js_all', assets_registry.require('jquery.js', 'jquery-ui.js', 'jQRangeSlider.js',
'jquery.textarea.expander.js', 'jquery.tinymce.js', 'jquery.form.js',
'jquery.oembed.js', 'baseframe-networkbar.js', 'range-slider.js', 'hasjob.js'))
assets.register('css_all', assets_registry.require('baseframe-networkbar.css',
'range-slider.css', 'jquery-ui.css','hasjob.css'))
baseframe.init_app(app, requires=[
'jquery-ui', 'jQRangeSlider',
'jquery.textarea.expander', 'jquery.tinymce', 'jquery.form',
'jquery.oembed', 'baseframe-networkbar', 'range-slider', 'hasjob',
])
5 changes: 5 additions & 0 deletions hasjob/templates/inc/layout.html
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,11 @@
{% endblock %}
</footer>

<script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<script type="text/javascript">
if (typeof jQuery === 'undefined')
document.write('<script type="text/javascript" src="{{ url_for("baseframe.static", filename="js/jquery-1.8.3.min.js") }}"><\/script>');
</script>
{% assets "js_all" -%}
<script type="text/javascript" src="{{ ASSET_URL }}"></script>
{% endassets -%}
Expand Down

0 comments on commit 02c1c9e

Please sign in to comment.