Skip to content

Commit

Permalink
Merge pull request #1122 from dimagi/jls/drop-MediaUploader
Browse files Browse the repository at this point in the history
Remove MediaUploader
  • Loading branch information
orangejenny authored Sep 17, 2024
2 parents c554517 + c02c9ab commit 81a02d4
Show file tree
Hide file tree
Showing 11 changed files with 186 additions and 270 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ _rjs:
rm -r _build/src/exclude.js _build/src/templates _build/src/less-style
find _build/ -maxdepth 1 -mindepth 1 -not -name src -not -name lib -not -name README.md -not -name node_modules | xargs rm -rf
# https://github.com/guybedford/require-css/issues/133
cd _build/node_modules && ls . | grep -v MediaUploader | xargs rm -r
cd _build/node_modules && ls . | xargs rm -r
mkdir -p _build/node_modules/jstree/dist/themes/default
cp node_modules/jstree/dist/themes/default/*.png \
node_modules/jstree/dist/themes/default/*.gif \
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ If not present, bundled versions will be loaded. -->
```

See
[here](https://github.com/dimagi/commcare-hq/blob/master/corehq/apps/app_manager/templates/app_manager/v1/form_designer.html)
[here](https://github.com/dimagi/commcare-hq/blob/master/corehq/apps/app_manager/static/app_manager/js/forms/form_designer.js)
and `tests/main.js` for example options usage.

Vellum targets modern browsers. IE8 and earlier are not supported.
Expand Down
33 changes: 0 additions & 33 deletions build.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,38 +76,6 @@
'exclude'
]
},
// Components (and their dependencies) that can be requested
// asynchronously after Vellum has already finished loading, because
// they're not necessary for initial operation.

// // At the moment, this bundle doesn't get used as expected.
// {
// create: true,
// name: 'deferred-components',
// include: [
// // core
// 'codemirror',
// 'diff-match-patch',
// 'CryptoJS',
// 'vellum/expressionEditor',
//
// // uploader
// 'file-uploader',
//
// // form
// 'vellum/writer',
// 'vellum/exporter'
// ],
// exclude: [
// 'exclude',
// 'global-deps',
// // required by things other than the expression editor, ensure
// // that they're not bundled here, otherwise separate bundles
// // is useless
// 'xpath',
// 'vellum/util'
// ]
// },

// Local dependencies that don't change often, except for new ones being
// added.
Expand All @@ -126,7 +94,6 @@
// https://github.com/guybedford/require-less/issues/48
'css/css!../node_modules/codemirror/lib/codemirror',
'css/css!../node_modules/jstree/dist/themes/default/style',
'css/css!yui-combo',
'css/css!../node_modules/at.js/dist/css/jquery.atwho'
],
exclude: [
Expand Down
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
"@bracken/require-less": "0.1.6",
"at.js": "1.5.4",
"Caret.js": "INTELOGIE/Caret.js#0.3.1",
"MediaUploader": "dimagi/MediaUploader#master",
"XMLWriter": "dimagi/XMLWriter#master",
"bootstrap": "3.4.1",
"codemirror": "5.61.1",
Expand Down Expand Up @@ -55,7 +54,7 @@
},
"main": "src/main.js",
"scripts": {
"testserver": "`npm bin`/http-server -p ${VELLUM_PORT:-8088}",
"testserver": "http-server -p ${VELLUM_PORT:-8088}",
"test:mocha": "node_modules/mocha-headless-chrome/bin/start -f http://localhost:${VELLUM_PORT:-8088}/?useBuilt=true -t 500000",
"test:lint": "jshint src && jshint --config tests/.jshintrc tests",
"test": "npm run test:mocha && npm run test:lint"
Expand Down
23 changes: 0 additions & 23 deletions src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,19 +49,12 @@ requirejs.config({
'underscore': '../node_modules/underscore/underscore',
'XMLWriter': '../node_modules/XMLWriter/XMLWriter',

// todo: should convert xpath submodule to AMD
'xpath': '../node_modules/xpath/dist/js-xpath',

'langCodes': '../node_modules/langcodes/langs.json',

'save-button': '../lib/SaveButton',

'yui-base': '../node_modules/MediaUploader/yui-base',
'yui-combo': '../node_modules/MediaUploader/yui-combo',
'yui-loader': '../node_modules/MediaUploader/yui-loader',
'yui-uploader': '../node_modules/MediaUploader/yui-uploader',

'file-uploader': '../node_modules/MediaUploader/hqmedia.upload_controller',
'jsdiff': '../node_modules/jsdiff/diff',
'markdown-it': '../node_modules/markdown-it/dist/markdown-it',
'caretjs': '../node_modules/Caret.js/dist/jquery.caret',
Expand Down Expand Up @@ -98,22 +91,6 @@ requirejs.config({
exports: 'SaveButton'
},

'yui-base': {
exports: 'YUI'
},
'yui-loader': {
deps: ['yui-base'],
exports: 'YUI'
},
'yui-uploader': {
deps: ['yui-base', 'yui-loader', 'css!yui-combo'],
exports: 'YUI'
},
'file-uploader': {
deps: ['yui-uploader', 'underscore', 'jquery'],
exports: 'HQMediaFileUploadController'
},

'xpath': {
exports: 'xpath'
},
Expand Down
1 change: 0 additions & 1 deletion src/templates/multimedia_errors.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<% if (errors.length > 0) { %>
<div class="alert alert-danger">
<h5><%-gettext("Errors found")%></h5>
<% for (var e = 0; e < errors.length; e++) {
var error = errors[e]; %>
<p><%- error %></p>
Expand Down
48 changes: 6 additions & 42 deletions src/templates/multimedia_modal.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,9 @@ <h4 class="modal-title"><%-gettext("Upload")%> <%= mediaType %></h4>
<%-gettext("Select new")%> <%= mediaType %>
</label>
<div class="col-sm-8">
<div class="hqm-select-files-container">
<button class="hqm-select btn btn-primary" type="button"><%-gettext("Select File")%></button>
</div>
<div class="hqm-queue"></div>
<button class="btn btn-primary" type="button"><%-gettext("Select File")%></button>
<input type="file" class="hide" />
<div class="hqm-upload-status"></div>
</div>
</div>
<div class="form-group hqm-existing hide">
Expand All @@ -24,48 +23,13 @@ <h4 class="modal-title"><%-gettext("Upload")%> <%= mediaType %></h4>
<div class="col-sm-8 hqm-existing-controls">
</div>
</div>
<div class="hqm-upload-form">
<fieldset class="hqm-sharing hide">
<legend><%-gettext("Multimedia Sharing Options")%></legend>
<div class="form-group">
<label class="control-label col-sm-4" for="fd-mm-<%= mediaType %>-license"><%-gettext("License")%></label>
<div class="col-sm-8">
<select name="license" id="fd-mm-<%= mediaType %>-license">
<option value="cc-nc"><%-gettext("Creative Commons Attribution, Non-Commercial")%></option>
<option value="cc-nd"><%-gettext("Creative Commons Attribution, No Derivatives")%></option>
<option value="cc" selected="selected"><%-gettext("Creative Commons Attribution")%></option>
<option value="cc-nc-sa"><%-gettext("Creative Commons Attribution, Non-Commercial, and Share Alike")%></option>
<option value="cc-nc-nd"><%-gettext("Creative Commons Attribution, Non-Commercial, and No Derivatives")%></option>
<option value="cc-sa"><%-gettext("Creative Commons Attribution, Share Alike")%></option>
</select>
</div>
</div>
<div class="form-group">
<label class="col-sm-4 control-label" for="fd-mm-<%= mediaType %>-author"><%-gettext("Author")%></label>
<div class="col-sm-8">
<input type="text"
name="author"
id="fd-mm-<%= mediaType %>-author"
placeholder="<%-gettext("Enter the name of the author.")%>" />
</div>
</div>
<div class="form-group">
<label class="col-sm-4 control-label" for="fd-mm-<%= mediaType %>-attribution">
<%-gettext("Attribution Notes")%>
</label>
<div class="col-sm-8">
<textarea name="attribution-notes"
id="fd-mm-<%= mediaType %>-attribution"
rows="2"></textarea>
</div>
</div>
</fieldset>
</div>
</div>
<div class="modal-footer">
<a class="btn btn-default" data-dismiss="modal"><%-gettext("Close")%></a>
<a class="btn btn-default disabled hqm-upload hqm-upload-confirm">
<i class="fa-solid fa-cloud-arrow-up"></i> <%-gettext("Begin Upload")%>
<i class="fa-solid fa-cloud-arrow-up"></i>
<i class="fa-solid fa-spin fa-refresh hide"></i>
<%-gettext("Begin Upload")%>
</a>
</div>
</div>
Expand Down
24 changes: 0 additions & 24 deletions src/templates/multimedia_queue.html

This file was deleted.

12 changes: 12 additions & 0 deletions src/templates/multimedia_upload_status.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<div style="clear: both;">
<div class="alert alert-success" style="margin-bottom: 2px; margin-top: 10px;">
<i class="fa fa-check"></i> <%= file_name %> <strong>[<%= file_size %> MB]</strong>
</div>
<p class="text-success hqm-begin">
<%=gettext("Ready to upload. Click <strong>Begin Upload</strong> below to start.")%>
</p>
<p class="text-danger hqm-error hide">
<span class="label label-danger"><%-gettext("There were errors.")%></span>
</p>
<div class="hqm-errors"></div>
</div>
Loading

0 comments on commit 81a02d4

Please sign in to comment.