--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/cms/corpus_module/corpus.info Fri Nov 06 15:37:47 2015 +0100
@@ -0,0 +1,4 @@
+name = Corpus Client
+description = Corpus de la Parole Client
+core = 7.x
+version = 7.41
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/cms/corpus_module/corpus.module Fri Nov 06 15:37:47 2015 +0100
@@ -0,0 +1,54 @@
+<?php
+define('CORPUS_URL', 'corpus');
+define('CORPUS_APP', 'app-client');
+
+/**
+ * Implements hook_menu().
+ */
+function corpus_menu() {
+
+ $items[CORPUS_URL] = array(
+ 'title' => 'Corpus de la Parole',
+ 'access callback' => TRUE,
+ 'page callback' => 'corpus_page',
+ 'type' => MENU_CALLBACK
+ );
+
+ return $items;
+}
+
+/**
+ * The page callback function. Loads the Ember app
+ */
+function corpus_page() {
+
+ $app = CORPUS_APP;
+ $path = drupal_get_path('module', 'corpus') . '/' . $app;
+
+ $element = array(
+ '#tag' => 'base', // The #tag is the html tag - <link />
+ '#attributes' => array( // Set up an array of attributes inside the tag
+ 'href' => '/corpus/',
+ ),
+ );
+ drupal_add_html_head($element, 'ember_init_base');
+
+ $element = array(
+ '#tag' => 'meta', // The #tag is the html tag - <link />
+ '#attributes' => array( // Set up an array of attributes inside the tag
+ 'name' => 'app-client/config/environment',
+ 'content' => '%7B%22rootElement%22%3A%22%23corpus-app%22%2C%22modulePrefix%22%3A%22app-client%22%2C%22environment%22%3A%22production%22%2C%22baseURL%22%3A%22/corpus%22%2C%22locationType%22%3A%22auto%22%2C%22APP%22%3A%7B%22baseStatic%22%3A%22/modules/corpus/app-client/%22%2C%22name%22%3A%22app-client%22%2C%22version%22%3A%220.0.0+e8ebf770%22%7D%2C%22contentSecurityPolicyHeader%22%3A%22Content-Security-Policy-Report-Only%22%2C%22contentSecurityPolicy%22%3A%7B%22default-src%22%3A%22%27none%27%22%2C%22script-src%22%3A%22%27self%27%22%2C%22font-src%22%3A%22%27self%27%22%2C%22connect-src%22%3A%22%27self%27%22%2C%22img-src%22%3A%22%27self%27%22%2C%22style-src%22%3A%22%27self%27%22%2C%22media-src%22%3A%22%27self%27%22%7D%2C%22exportApplicationGlobal%22%3Afalse%7D'
+ ),
+ );
+
+ drupal_add_html_head($element, 'ember_init');
+
+ drupal_add_js("{$path}/assets/vendor.js");
+ drupal_add_css("{$path}/assets/vendor.css");
+ drupal_add_css("{$path}/assets/{$app}.css");
+
+ drupal_add_js("{$path}/assets/{$app}.js", array('type' => 'file', 'scope' => 'footer'));
+ // drupal_add_js("{$path}/dist/assets/{$app}.js");
+
+ return "<div id='corpus-app'></div>";
+}