Skip to content

Commit

Permalink
Support MWDK
Browse files Browse the repository at this point in the history
  • Loading branch information
cayb0rg committed Oct 25, 2023
1 parent f12ff5a commit a09ecac
Show file tree
Hide file tree
Showing 5 changed files with 4,719 additions and 3,677 deletions.
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"version": "1.2.0",
"dependencies": {
"angular-sortable-view": "^0.0.13",
"materia-widget-development-kit": "2.5.2"
"materia-widget-development-kit": "~3.0.0"
},
"devDependencies": {
"angular": "1.6.9",
Expand All @@ -20,9 +20,9 @@
"jest-coffee-preprocessor": "^1.0.0"
},
"scripts": {
"start": "webpack-dev-server",
"build-dev": "webpack",
"build": "webpack -p",
"start": "mwdk-start",
"build": "mwdk-build-prod",
"build-dev": "mwdk-build-dev",
"test": "TZ='America/New_York' jest --verbose",
"test-ci": "TZ='America/New_York' CI=true jest --ci --useStderr --coverage --coverageReporters text-summary cobertura",
"test-dev": "TZ='America/New_York' jest --coverage --coverageReporters text-summary lcov"
Expand Down
13 changes: 7 additions & 6 deletions src/creator.coffee
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# Create an angular module to house our controller
SurveyWidget = angular.module 'SurveyWidgetCreator', ['ngMaterial', 'ngMessages', 'ngAnimate', 'ngSanitize', 'angular-sortable-view', 'ngAria']
angular.module 'SurveyWidgetCreator', ['ngMaterial', 'ngMessages', 'ngAnimate', 'ngSanitize', 'angular-sortable-view', 'ngAria']

SurveyWidget.config ['$mdThemingProvider', ($mdThemingProvider) ->
.config ['$mdThemingProvider', ($mdThemingProvider) ->
$mdThemingProvider.theme('default')
.primaryPalette('teal')
.accentPalette('blue-grey')
]
SurveyWidget.controller 'SurveyWidgetController', [ '$scope','$mdToast','$mdDialog','$sanitize','$compile', 'Resource', 'sanitizeHelper', '$timeout', ($scope, $mdToast, $mdDialog, $sanitize, $compile, Resource, sanitizeHelper, $timeout) ->
.controller 'SurveyWidgetController', [ '$scope','$mdToast','$mdDialog','$sanitize','$compile', 'Resource', 'sanitizeHelper', '$timeout', ($scope, $mdToast, $mdDialog, $sanitize, $compile, Resource, sanitizeHelper, $timeout) ->

$scope.acceptedMediaTypes = ['image']
mediaRef = null
Expand Down Expand Up @@ -391,7 +391,7 @@ SurveyWidget.controller 'SurveyWidgetController', [ '$scope','$mdToast','$mdDial
Materia.CreatorCore.start $scope
]

SurveyWidget.factory 'Resource', ['$sanitize', 'sanitizeHelper', ($sanitize, sanitizeHelper) ->
.factory 'Resource', ['$sanitize', 'sanitizeHelper', ($sanitize, sanitizeHelper) ->
buildQset: (title, questions, groups, OneQuestionAtATime) ->
qsetItems = []
qset = {}
Expand Down Expand Up @@ -440,7 +440,7 @@ SurveyWidget.factory 'Resource', ['$sanitize', 'sanitizeHelper', ($sanitize, san
return processed
]

SurveyWidget.directive 'focusMe', ['$timeout', '$parse', ($timeout, $parse) ->
.directive 'focusMe', ['$timeout', '$parse', ($timeout, $parse) ->
link: (scope, element, attrs) ->
model = $parse(attrs.focusMe)
scope.$watch model, (value) ->
Expand All @@ -450,7 +450,7 @@ SurveyWidget.directive 'focusMe', ['$timeout', '$parse', ($timeout, $parse) ->
value
]

SurveyWidget.service 'sanitizeHelper', [() ->
.service 'sanitizeHelper', [() ->
SANITIZE_CHARACTERS =
'&' : '&',
'>' : '>',
Expand All @@ -474,3 +474,4 @@ SurveyWidget.service 'sanitizeHelper', [() ->
sanitize: sanitize
desanitize: desanitize
]
angular.bootstrap(document, ['SurveyWidgetCreator'])
14 changes: 7 additions & 7 deletions src/creator.html
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,9 @@
<script src="//ajax.googleapis.com/ajax/libs/angular_material/1.1.8/angular-material.min.js"></script>
<script src="vendor/angular-sortable-view.min.js"></script>

<!-- MAIN CREATOR SCRIPT -->
<script src="creator.js"></script>
</head>

<body ng-app="SurveyWidgetCreator">
<body>
<md-content id="container" ng-controller="SurveyWidgetController">

<md-toolbar>
Expand Down Expand Up @@ -67,7 +65,7 @@
Question {{$index + 1}}
</label>
</span>

<div class="question-body">
<span class='question-input-container'>
<input ng-model="card.question"
Expand All @@ -80,7 +78,7 @@
<div ng-messages="questionForm.question.$error">
<div ng-message="required">Question text is required.</div>
</div>

</span>
<button class="icon-container"
ng-hide="card.assets.length > 0"
Expand All @@ -89,7 +87,7 @@
ng-click="beginMediaImport(cardIndex)">
<md-tooltip md-direction="below">Add Image</md-tooltip>
<i class="material-icons">add_photo_alternate</i>
</button>
</button>
</div>

<div class="card-buttons">
Expand Down Expand Up @@ -403,7 +401,7 @@
</div>
</div>



<!-- Type Info Dialog -->
<div style="visibility: hidden">
Expand Down Expand Up @@ -469,5 +467,7 @@ <h2>Edit Groups</h2>
</div>
</md-content>

<!-- MAIN CREATOR SCRIPT -->
<script src="creator.js"></script>
</body>
</html>
45 changes: 21 additions & 24 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ const outputPath = path.join(__dirname, 'build')
const widgetWebpack = require('materia-widget-development-kit/webpack-widget')

const rules = widgetWebpack.getDefaultRules()
const entries = widgetWebpack.getDefaultEntries()
const copy = widgetWebpack.getDefaultCopyList()

const customCopy = copy.concat([
Expand All @@ -24,22 +23,23 @@ const customCopy = copy.concat([
}
])

entries['scorescreen.js'] = [
srcPath+'scorescreen.coffee'
]

entries['scorescreen.css'] = [
srcPath+'scorescreen.html',
srcPath+'scorescreen.scss'
]

entries['guides/creator.temp.html'] = [
srcPath+'_guides/creator.md'
]

entries['guides/player.temp.html'] = [
srcPath+'_guides/player.md'
]
const entries = {
'player': [
path.join(srcPath, 'player.html'),
path.join(srcPath, 'player.coffee'),
path.join(srcPath, 'player.scss')
],
'creator': [
path.join(srcPath, 'creator.html'),
path.join(srcPath, 'creator.coffee'),
path.join(srcPath, 'creator.scss'),
],
'scoreScreen': [
path.join(srcPath, 'scoreScreen.html'),
path.join(srcPath, 'scoreScreen.coffee'),
path.join(srcPath, 'scoreScreen.scss'),
]
}

// this is needed to prevent html-loader from causing issues with
// style tags in the player using angular
Expand All @@ -51,9 +51,6 @@ let customHTMLAndReplaceRule = {
loader: 'file-loader',
options: { name: '[name].html' }
},
{
loader: 'extract-loader'
},
{
loader: 'string-replace-loader',
options: { multiple: widgetWebpack.materiaJSReplacements }
Expand All @@ -71,10 +68,10 @@ let customRules = [
rules.loaderDoNothingToJs,
rules.loaderCompileCoffee,
rules.copyImages,
customHTMLAndReplaceRule, // <--- replaces "rules.loadHTMLAndReplaceMateriaScripts"
rules.loadAndPrefixCSS,
rules.loadAndPrefixSASS,
rules.loadAndCompileMarkdown
rules.loadHTMLAndReplaceMateriaScripts,
rules.loadAndPrefixSASS, // <--- replaces "rules.loadHTMLAndReplaceMateriaScripts"
// rules.loadAndPrefixCSS,
// rules.loadAndCompileMarkdown
]


Expand Down
Loading

0 comments on commit a09ecac

Please sign in to comment.