").attr("id", editorId),
- setupEditor = function (editor, textarea) {
- var session = editor.getSession();
- editor.setTheme("ace/theme/tomorrow");
- editor.$blockScrolling = Infinity;
- editor.setOption("scrollPastEnd", true);
- session.setMode("ace/mode/markdown");
- session.setValue(textarea.val());
- session.setUseWrapMode(true);
- session.on('change', function(){
- textarea.val(session.getValue());
- });
- editor.renderer.setShowGutter(false);
- session.setTabSize(4);
- session.setUseSoftTabs(true);
- },
- $formGroup = $(el).closest(".form-group"),
- $textarea = $formGroup.find("textarea");
- $formGroup.append(reportDiv);
- setupEditor(ace.edit(editorId), $textarea);
- console.log(i, el, $formGroup, $textarea);
- });
-};
-
-
-$(function () {
- loadEditors();
-});
diff --git a/static/src/js/site.js b/static/src/js/site.js
new file mode 100644
index 00000000..844bff22
--- /dev/null
+++ b/static/src/js/site.js
@@ -0,0 +1,37 @@
+/* global window ace */
+window.jQuery = window.$ = require('jquery');
+
+const $ = window.$;
+
+require('bootstrap');
+
+const loadEditors = () => {
+ const $editors = $('.modal-body textarea, #id_body, #id_comment, #id_message, #id_text, #id_abstract, #id_additional_notes, #id_content_override, #id_description, #id_biography');
+ $editors.each((i, el) => {
+ const editorId = `markdown-editor-${i}`;
+ const reportDiv = $('
').attr('id', editorId);
+ const setupEditor = (editor, textarea) => {
+ const session = editor.getSession();
+ editor.setTheme('ace/theme/tomorrow');
+ editor.$blockScrolling = Infinity;
+ editor.setOption('scrollPastEnd', true);
+ session.setMode('ace/mode/markdown');
+ session.setValue(textarea.val());
+ session.setUseWrapMode(true);
+ session.on('change', () => {
+ textarea.val(session.getValue());
+ });
+ editor.renderer.setShowGutter(false);
+ session.setTabSize(4);
+ session.setUseSoftTabs(true);
+ };
+ const $formGroup = $(el).closest('.form-group');
+ const $textarea = $formGroup.find('textarea');
+ $formGroup.append(reportDiv);
+ setupEditor(ace.edit(editorId), $textarea);
+ });
+};
+
+$(() => {
+ loadEditors();
+});
diff --git a/static/src/less/site.less b/static/src/less/site.less
index 98c4faee..da96c552 100644
--- a/static/src/less/site.less
+++ b/static/src/less/site.less
@@ -1,14 +1,7 @@
-// ~ uses paths in node_modules based on default webpack configuration
-@import "~bootstrap/less/bootstrap.less";
-@import "~font-awesome/less/font-awesome.less";
+@import "bootstrap";
+@import "font-awesome";
-// Override some of the variables in bootstrap and font-awesome, @@@ put in own file
-@fa-font-path: "~font-awesome/fonts/";
-@icon-font-path: "~bootstrap/fonts/";
-
-@font-family-sans-serif: "Helvetica Neue", Helvetica, Arial, sans-serif;
-@font-family-serif: Georgia, "Times New Roman", Times, serif;
-@font-family-monospace: Menlo, Monaco, Consolas, "Courier New", monospace;
+@import "variables.less";
// Account
@import "account.less";
diff --git a/static/src/less/variables.less b/static/src/less/variables.less
new file mode 100644
index 00000000..822d64f6
--- /dev/null
+++ b/static/src/less/variables.less
@@ -0,0 +1,3 @@
+@font-family-sans-serif: "Helvetica Neue", Helvetica, Arial, sans-serif;
+@font-family-serif: Georgia, "Times New Roman", Times, serif;
+@font-family-monospace: Menlo, Monaco, Consolas, "Courier New", monospace;
diff --git a/static/webpack.config.js b/static/webpack.config.js
deleted file mode 100644
index ed508438..00000000
--- a/static/webpack.config.js
+++ /dev/null
@@ -1,65 +0,0 @@
-var ExtractTextPlugin = require("extract-text-webpack-plugin");
-var HtmlWebpackPlugin = require("html-webpack-plugin");
-var path = require("path");
-var webpack = require("webpack");
-var projectTemplatesRoot = "../../pinaxcon/templates/";
-
-module.exports = {
- context: path.resolve(__dirname, "src"),
- entry: {
- app: "./js/main.js"
- },
- output: {
- path: path.resolve(__dirname, "dist"),
- filename: "js/site.js?[hash]",
- publicPath: "/site_media/static"
- },
- module: {
- loaders: [
- {
- test: /\.(gif|png|ico|jpg|svg)$/,
- include: [
- path.resolve(__dirname, "src/images")
- ],
- loader: "file-loader?name=/images/[name].[ext]"
- },
- { test: /\.less$/, loader: ExtractTextPlugin.extract("style-loader", "css-loader!less-loader") },
- {
- test: /\.(woff|woff2|ttf|eot|svg)(\?v=[0-9]\.[0-9]\.[0-9])?$/,
- include: [
- path.resolve(__dirname, "/src/fonts"),
- path.resolve(__dirname, "../node_modules")
- ],
- loader: "file-loader?name=/fonts/[name].[ext]?[hash]"
- },
- { test: /\.jsx?$/, loader: "babel-loader", query: {compact: false} },
- ]
- },
- resolve: {
- extensions: ["", ".js", ".jsx"],
- },
- plugins: [
- new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/),
- new ExtractTextPlugin("css/site.css?[hash]"),
- new HtmlWebpackPlugin({
- filename: projectTemplatesRoot + "_styles.html",
- templateContent: function(templateParams, compilation) {
- var link = "";
- for (var css in templateParams.htmlWebpackPlugin.files.css) {
- link += "\n"
- }
- return link;
- }
- }),
- new HtmlWebpackPlugin({
- filename: projectTemplatesRoot + "_scripts.html",
- templateContent: function(templateParams, compilation) {
- var script = "";
- for (var js in templateParams.htmlWebpackPlugin.files.js) {
- script += "\n"
- }
- return script;
- }
- })
- ]
-};