Skip to content

Commit

Permalink
Merge pull request #128 from ucfopen/dev/2.4.0
Browse files Browse the repository at this point in the history
Dev/2.4.0
  • Loading branch information
clpetersonucf authored Jan 3, 2022
2 parents 5053470 + 9a2779d commit e49cfcc
Show file tree
Hide file tree
Showing 16 changed files with 309 additions and 127 deletions.
7 changes: 4 additions & 3 deletions .babelrc
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,16 @@
[
"@babel/preset-env",
{
useBuiltIns: "usage",
corejs: 3,
"useBuiltIns": "usage",
"corejs": 3
// debug: true, // outputs polyfills and browserlist
// targets: 'defaults' // allows .browserslistrc to work
}
],
"jest"
],
"plugins": [
'babel-plugin-angularjs-annotate'
"@babel/plugin-proposal-optional-chaining",
"babel-plugin-angularjs-annotate"
]
}
36 changes: 36 additions & 0 deletions .github/workflows/npm-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created
# For more information see: https://help.github.com/actions/language-and-framework-guides/publishing-nodejs-packages

name: Materia-Server-Client-Assets
on:
push:
tags:
- 'v[0-9]+.[0-9]+.[0-9]+*'

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: 12
- run: yarn install
- run: yarn prettier:run
- run: yarn prettier:detectchanges
- run: yarn test:ci
- run: yarn build

publish-npm:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: 12
registry-url: https://registry.npmjs.org/
- run: yarn install
- run: npm publish
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
28 changes: 0 additions & 28 deletions .travis.yml

This file was deleted.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "materia-server-client-assets",
"version": "2.3.0",
"version": "2.4.0-alpha3",
"license": "AGPL-3.0",
"description": "Materia Server Client Assets contains all the javascript and css for Materia Server and the Materia Widget Development Kit.",
"author": "University of Central Florida, Center for Distributed Learning",
Expand Down Expand Up @@ -57,7 +57,7 @@
"coverageThreshold": {
"global": {
"statements": 43,
"branches": 32,
"branches": 31,
"functions": 48,
"lines": 43
}
Expand Down
6 changes: 6 additions & 0 deletions src/css/core.scss
Original file line number Diff line number Diff line change
Expand Up @@ -637,6 +637,12 @@ h3 {
}
}
}

button.action_button {
margin-top: 10px;
padding: 5px 8px;
font-size: 15px;
}
}

#notifications_link {
Expand Down
47 changes: 44 additions & 3 deletions src/css/partials/_lti_embed_preview.scss
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,6 @@
margin-bottom: 2em;
}

.button {
}

.widget_info {
display: flex;
align-items: center;
Expand All @@ -48,4 +45,48 @@
}
}
}

.container.not_an_owner {
width: 85%;

.widget_icon img {
width: 46px;
height: 46px;
margin: 5px;
}

h3 {
margin: 5px 0;
}

ul {
padding: 0;
text-align: left;
list-style-type: none;
}

.instance_owner {
position: relative;
padding: 15px;
margin-bottom: 2px;

background: #fcfcfc;
font-weight: bold;
}

.button {
position: absolute;
font-size: 15px;
padding: 4px 6px;
top: 10px;
right: 15px;
}

.button.disabled {
background: #a8a8a8;
color: #000;
border: solid 1px #6d6d6d;
cursor: default;
}
}
}
13 changes: 13 additions & 0 deletions src/css/partials/_widget_share_modal.scss
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,19 @@
padding: 15px 0 0 0;
}

.user_perm.highlight {
animation: pulse 1s alternate infinite;
}

@keyframes pulse {
0% {
background-color: none;
}
100% {
background-color: #ffffff;
}
}

.user_perm .options {
position: absolute;
right: 0;
Expand Down
38 changes: 23 additions & 15 deletions src/js/controllers/ctrl-media-import.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,19 @@ app.controller('MediaImportCtrl', function ($scope, $window, $timeout) {

// generic media type definitions and substitutions for compatibility
const MIME_MAP = {
//generic types, preferred
// generic types, preferred
image: ['image/jpg', 'image/jpeg', 'image/gif', 'image/png'],
audio: ['audio/mp3', 'audio/mpeg', 'audio/mpeg3'],
video: [], //placeholder
//incompatibility prevention, not preferred
video: [], // placeholder
model: ['model/obj'],

// incompatibility prevention, not preferred
jpg: ['image/jpg'],
jpeg: ['image/jpeg'],
gif: ['image/gif'],
png: ['image/png'],
mp3: ['audio/mp3', 'audio/mpeg', 'audio/mpeg3'],
obj: ['application/octet-stream', 'model/obj'],
}

const REQUESTED_FILE_TYPES = $window.location.hash.substring(1).split(',')
Expand Down Expand Up @@ -117,11 +120,13 @@ app.controller('MediaImportCtrl', function ($scope, $window, $timeout) {
const uploadFile = (e) => {
const file =
(e.target.files && e.target.files[0]) || (e.dataTransfer.files && e.dataTransfer.files[0])

if (file) _getFileData(file, _upload)
}

// load and/or select file from list of previous uploads.
const _loadAllMedia = (file_id) => {
// load and/or select file for labelling
// result is a array of objects containing each assets information.
COMS.send('assets_get', []).then((result) => {
if (!result || result.msg || result.length == 0) return

Expand All @@ -134,7 +139,6 @@ app.controller('MediaImportCtrl', function ($scope, $window, $timeout) {
MIME_MAP[type].forEach((subtype) => {
extractedTypes = [...extractedTypes, subtype.split('/')[1]]
})

allowedFileExtensions = [...allowedFileExtensions, ...extractedTypes]
}
})
Expand All @@ -148,6 +152,7 @@ app.controller('MediaImportCtrl', function ($scope, $window, $timeout) {
) {
return
}

if (allowedFileExtensions.indexOf(res.type) > -1) {
// the id used for asset url is actually remote_url
// if it exists, use it instead
Expand Down Expand Up @@ -186,16 +191,17 @@ app.controller('MediaImportCtrl', function ($scope, $window, $timeout) {

const _thumbnailUrl = (data, type) => {
switch (type) {
case 'jpg': // intentional case fall-through
case 'jpeg': // intentional case fall-through
case 'png': // intentional case fall-through
case 'gif': // intentional case fall-through
return `${MEDIA_URL}/${data}/thumbnail`

case 'mp3': // intentional case fall-through
case 'wav': // intentional case fall-through
case 'ogg': // intentional case fall-through
return '/img/audio.png'
case 'jpg':
case 'jpeg':
case 'png':
case 'gif':
return `${MEDIA_URL}/${data}/thumbnail` // image types return a thumbnail version of the image
case 'obj':
return '/img/model.png' // model formats return the placeholder model thumbnail
case 'mp3':
case 'wav':
case 'ogg':
return '/img/audio.png' // audio formats return the placeholder audio thumbnail
}
}

Expand Down Expand Up @@ -268,6 +274,7 @@ app.controller('MediaImportCtrl', function ($scope, $window, $timeout) {
// upload to either local server or s3
const _upload = (fileData) => {
const fd = new FormData()

fd.append('name', fileData.name)
fd.append('Content-Type', fileData.mime)
fd.append('file', _dataURItoBlob(fileData.src, fileData.mime), fileData.name)
Expand All @@ -276,6 +283,7 @@ app.controller('MediaImportCtrl', function ($scope, $window, $timeout) {

request.onload = (oEvent) => {
const res = JSON.parse(request.response) //parse response string

if (res.error) {
alert(`Error code ${res.error.code}: ${res.error.message}`)
$window.parent.Materia.Creator.onMediaImportComplete(null)
Expand Down
21 changes: 20 additions & 1 deletion src/js/controllers/ctrl-my-widgets-collaboration.js
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ app.controller('MyWidgetsCollaborationController', function (
last: user.last,
gravatar: user.gravatar,
access: String(ACCESS.VISIBLE),
highlight: $scope.pending_collaborator ? true : false,
})

$timeout(() => {
Expand Down Expand Up @@ -224,7 +225,7 @@ app.controller('MyWidgetsCollaborationController', function (
]).then((returnData) => {
if (returnData === true) {
$scope.$emit('collaborators.update', '')
$scope.show.collaborationModal = false
$scope.hideModal()
if (remove_widget) {
WidgetSrv.removeWidget(widget_id)
}
Expand All @@ -241,6 +242,8 @@ app.controller('MyWidgetsCollaborationController', function (
}
}

if ($scope.pending_collaborator != undefined) $scope.pending_collaborator = null

Please.$apply()
})
}
Expand Down Expand Up @@ -283,4 +286,20 @@ app.controller('MyWidgetsCollaborationController', function (
// Initialize

$scope.$watch('inputs.userSearchInput', (input) => _searchFor(input))

// once initilization is complete - check to see if a pending collaborator exists
// if so, grab info about collaborator and add them to the list via manually calling _searchMatchClick
$timeout(() => {
if ($scope.pending_collaborator && $scope.pending_collaborator != null) {
Materia.Coms.Json.send('user_get', [[$scope.pending_collaborator]]).then((result) => {
if (result) {
result[0].gravatar = UserServ.getAvatar(result[0], 50)

$scope.searchResults.matches.push(result[0])

_searchMatchClick(result[0])
}
})
}
})
})
18 changes: 18 additions & 0 deletions src/js/controllers/ctrl-my-widgets-selected.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ app.controller('MyWidgetsSelectedController', function (
this.$parent.hideModal()
}

$scope.handleDialogClose = () => {
if ($scope.pending_collaborator != undefined) $scope.pending_collaborator = null
}

const _exportPopup = () => {
// Do not show modal disabled
$scope.show.exportModal = true
Expand Down Expand Up @@ -217,6 +221,20 @@ app.controller('MyWidgetsSelectedController', function (
Please.$apply()
})

// is widget done loading? check to see if there's a pending collaborator
$scope.$on('widget.loadingCompleted', () => {
if ($scope.pending_collaborator) _showCollaboration()
})

// notification has announced that we should add a collaborator, but we're already on the my widgets page
$scope.$on('notification.directAddPendingCollaborator', (event, broadcast) => {
$scope.pending_collaborator = broadcast.from_id

if (!$scope.selected.widget || $scope.selected.widget.id != broadcast.item_id)
$scope.setSelected(broadcast.item_id)
else _showCollaboration()
})

$scope.removeExpires = _removeExpires
$scope.setupPickers = _setupPickers
$scope.showCollaboration = _showCollaboration
Expand Down
Loading

0 comments on commit e49cfcc

Please sign in to comment.