Browse Source

Configured Django for loading Ember App

Rafał Pitoń 10 years ago
parent
commit
d5166c2945

+ 8 - 3
misago/conf/defaults.py

@@ -33,7 +33,6 @@ MISAGO_BASE_DIR = os.path.dirname(os.path.dirname(__file__))
 
 # Assets Pipeline
 # See http://django-pipeline.readthedocs.org/en/latest/configuration.html
-
 PIPELINE_CSS = {
     'misago': {
         'source_filenames': (
@@ -58,6 +57,7 @@ PIPELINE_JS = {
     },
     'misago': {
         'source_filenames': (
+            'misago/js/templates/*.hbs',
             'misago/js/application.js',
             'misago/js/router.js',
         ),
@@ -100,12 +100,15 @@ MISAGO_JS_LIB_PROD = (
     'misago/ember/ember-data.prod-1.0.0.b14.js',
 )
 
-STATICFILES_STORAGE = 'pipeline.storage.PipelineStorage'
-
 PIPELINE_COMPILERS = (
     'pipeline.compilers.less.LessCompiler',
 )
 
+PIPELINE_TEMPLATE_EXT = '.hbs'
+PIPELINE_TEMPLATE_FUNC = 'Ember.Handlebars.compile'
+PIPELINE_TEMPLATE_NAMESPACE = 'window.Ember.TEMPLATES'
+PIPELINE_TEMPLATE_SEPARATOR = '/'
+
 PIPELINE_CSS_COMPRESSOR = 'pipeline.compressors.yuglify.YuglifyCompressor'
 PIPELINE_JS_COMPRESSOR = 'pipeline.compressors.yuglify.YuglifyCompressor'
 
@@ -115,6 +118,8 @@ STATICFILES_FINDERS = (
     'pipeline.finders.PipelineFinder',
 )
 
+STATICFILES_STORAGE = 'pipeline.storage.PipelineStorage'
+
 
 # Application definition
 

+ 3 - 1
misago/static/misago/js/application.js

@@ -1 +1,3 @@
-window.Misago = Ember.Application.create();
+window.Misago = Ember.Application.create({
+  rootElement: '#main'
+});

+ 3 - 0
misago/static/misago/js/templates/application.hbs

@@ -0,0 +1,3 @@
+<p>If you see this, Ember.js renders application template.</p>
+
+{{outlet}}

+ 5 - 1
misago/templates/misago/base.html

@@ -22,7 +22,11 @@
   </head>
   <body>
 
-    {% block content %}{% endblock %}
+    <noscript>
+      {% block content %}{% endblock content %}
+    </noscript>
+
+    <section id="main"></section>
 
     {% javascript 'misago_lib' %}
     {% javascript 'misago' %}

+ 19 - 0
misago/templates/misago/index.html

@@ -0,0 +1,19 @@
+{% extends "misago/base.html" %}
+{% load i18n %}
+
+
+{% block title %}
+{% if misago_settings.forum_index_title %}
+{{ misago_settings.forum_index_title }}
+{% else %}
+{{ misago_settings.forum_name }}
+{% endif %}
+{% endblock title %}
+
+
+{% block meta-description %}{{ misago_settings.forum_index_meta_description }}{% endblock meta-description %}
+
+
+{% block content %}
+<p>If you see this, ember failed to render application template.</p>
+{% endblock content %}