Skip to content

Commit

Permalink
Merge branch 'release/0.1.0' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
EduardoJM committed Dec 26, 2021
2 parents 748f542 + c8130db commit 01f7828
Show file tree
Hide file tree
Showing 21 changed files with 807 additions and 433 deletions.
21 changes: 21 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,35 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: Set up Python 3.9
uses: actions/setup-python@v1
with:
python-version: 3.9

- name: Install Node.js
uses: actions/setup-node@v1
with:
node-version: 12

- name: Install Node.js Dependencies
run: yarn

- name: Build Widget JavaScript
run: yarn gulp js:widget

- name: Build Inline JavaScript
run: yarn gulp js:inline

- name: Build SCSS
run: yarn gulp scss

- name: Install pypa/build
run: python -m pip install build --user

- name: Build a binary wheel and a source tarball
run: python -m build --sdist --wheel --outdir dist/

- name: Publish distribution to PyPI
uses: pypa/gh-action-pypi-publish@master
with:
Expand Down
25 changes: 24 additions & 1 deletion gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ const version = require('./package.json').version;
const JS_WIDGET_INPUT = './src/ImageUploaderWidget.ts';
const JS_WIDGET_NAME = 'image-uploader.js';
const JS_WIDGET_NAME_MIN = 'image-uploader.min.js';
const JS_INLINE_INPUT = './src/ImageUploaderInline.ts';
const JS_INLINE_NAME = 'image-uploader-inline.js';
const JS_INLINE_NAME_MIN = 'image-uploader-inline.min.js';
const JS_OUTPUT = './image_uploader_widget/static/admin/js';
const SCSS_NAME = 'image-uploader.css';
const SCSS_NAME_MIN = 'image-uploader.min.css';
Expand All @@ -36,7 +39,7 @@ function onError(err) {
this.emit('end');
}

gulp.task('js', (callback) => {
gulp.task('js:widget', (callback) => {
pump([
gulp.src(JS_WIDGET_INPUT),
babel({
Expand All @@ -56,6 +59,26 @@ gulp.task('js', (callback) => {
], callback);
});

gulp.task('js:inline', (callback) => {
pump([
gulp.src(JS_INLINE_INPUT),
babel({
presets: ['@babel/preset-env', '@babel/preset-typescript'],
plugins: [
'babel-plugin-remove-import-export',
'@babel/plugin-proposal-class-properties',
]
}),
rename(JS_INLINE_NAME),
header(HEADER),
gulp.dest(JS_OUTPUT),
uglify().on('error', onError),
rename(JS_INLINE_NAME_MIN),
header(HEADER),
gulp.dest(JS_OUTPUT),
], callback);
});

gulp.task('scss-expanded', (callback) => {
pump([
gulp.src(SCSS_INPUT),
Expand Down
3 changes: 1 addition & 2 deletions image_uploader_widget/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,9 @@ class ImageUploaderInline(admin.StackedInline):
@property
def media(self):
extra = '' if settings.DEBUG else '.min'
js = ['vendor/jquery/jquery%s.js' % extra, 'jquery.init.js', 'image_uploader_inline.js']
return forms.Media(
js = [
'admin/js/%s' % url for url in js
'admin/js/image-uploader-inline%s.js' % extra
],
css = {
'screen': [
Expand Down
Binary file not shown.
24 changes: 24 additions & 0 deletions image_uploader_widget/locale/pt_BR/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
msgid ""
msgstr ""
"Project-Id-Version: image_uploader_widget\n"
"Report-Msgid-Bugs-To: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: pt_BR\n"
"Plural-Forms: nplurals=2; plural=(n > 1);\n"

msgid "Drop your image here or click to select one..."
msgstr "Solte sua imagem aqui ou clique para selecionar uma..."

msgid "Drop your image here..."
msgstr "Solte sua imagem aqui..."

msgid "Drop your images here or click to select..."
msgstr "Solte suas imagens aqui ou clique para selecionar..."

msgid "Drop your images here..."
msgstr "Solte suas imagens aqui..."

msgid "Add image"
msgstr "Adicionar Imagem"
203 changes: 0 additions & 203 deletions image_uploader_widget/static/admin/js/image_uploader_inline.js

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{% load i18n admin_urls static %}

<div
class="iuw-inline-admin-formset inline-group"
id="{{ inline_admin_formset.formset.prefix }}-group"
Expand Down Expand Up @@ -31,13 +32,16 @@
</div>
{% endfor %}
<div class="iuw-add-image-btn">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 14 14" id="libre-wysiwyg-upload"><path d="m 5.0586355,4.60044 -1.652941,0 L 7.0000435,1 l 3.5942325,3.60044 -1.6529415,0 0,4.37796 -3.882699,0 0,-4.37796 z m -2.987854,5.27805 0,3.12151 9.8584365,0 0,-3.12151 -9.8584365,0 z m 1.603136,1.99765 -0.436893,0 0,-0.87379 0.436893,0 0,0.87379 z m 0.793689,0 -0.436893,0 0,-0.87379 0.436893,0 0,0.87379 z m 0.771845,0 -0.436893,0 0,-0.87379 0.436893,0 0,0.87379 z m 5.1068145,0.0728 c -0.281503,0 -0.5097075,-0.2282 -0.5097075,-0.50971 0,-0.2815 0.2282045,-0.50971 0.5097075,-0.50971 0.281505,0 0.50971,0.22821 0.50971,0.50971 0,0.28151 -0.228205,0.50971 -0.50971,0.50971 z"/></svg>
<!-- TODO: add a config here -->
Add
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" width="100%" height="100%"><path xmlns="http://www.w3.org/2000/svg" d="M21 15v3h3v2h-3v3h-2v-3h-3v-2h3v-3h2zm.008-12c.548 0 .992.445.992.993V13h-2V5H4v13.999L14 9l3 3v2.829l-3-3L6.827 19H14v2H2.992A.993.993 0 0 1 2 20.007V3.993A1 1 0 0 1 2.992 3h18.016zM8 7a2 2 0 1 1 0 4 2 2 0 0 1 0-4z"></path></svg>
<span>{% translate 'Add image' %}</span>
</div>
<div class="iuw-empty">
<!-- TODO: add a config here -->
Click here to select a file!
<svg xmlns="http://www.w3.org/2000/svg" fill="currentColor" class="bi bi-cloud-upload" viewBox="0 0 16 16" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" width="100%" height="100%"><path xmlns="http://www.w3.org/2000/svg" fill-rule="evenodd" d="M4.406 1.342A5.53 5.53 0 0 1 8 0c2.69 0 4.923 2 5.166 4.579C14.758 4.804 16 6.137 16 7.773 16 9.569 14.502 11 12.687 11H10a.5.5 0 0 1 0-1h2.688C13.979 10 15 8.988 15 7.773c0-1.216-1.02-2.228-2.313-2.228h-.5v-.5C12.188 2.825 10.328 1 8 1a4.53 4.53 0 0 0-2.941 1.1c-.757.652-1.153 1.438-1.153 2.055v.448l-.445.049C2.064 4.805 1 5.952 1 7.318 1 8.785 2.23 10 3.781 10H6a.5.5 0 0 1 0 1H3.781C1.708 11 0 9.366 0 7.318c0-1.763 1.266-3.223 2.942-3.593.143-.863.698-1.723 1.464-2.383z"></path><path xmlns="http://www.w3.org/2000/svg" fill-rule="evenodd" d="M7.646 4.146a.5.5 0 0 1 .708 0l3 3a.5.5 0 0 1-.708.708L8.5 5.707V14.5a.5.5 0 0 1-1 0V5.707L5.354 7.854a.5.5 0 1 1-.708-.708l3-3z"></path></svg>
<span>{% translate 'Drop your images here or click to select...' %}</span>
</div>
<div class="iuw-drop-label">
<svg xmlns="http://www.w3.org/2000/svg" fill="currentColor" class="bi bi-cloud-upload" viewBox="0 0 16 16" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" width="100%" height="100%"><path xmlns="http://www.w3.org/2000/svg" fill-rule="evenodd" d="M4.406 1.342A5.53 5.53 0 0 1 8 0c2.69 0 4.923 2 5.166 4.579C14.758 4.804 16 6.137 16 7.773 16 9.569 14.502 11 12.687 11H10a.5.5 0 0 1 0-1h2.688C13.979 10 15 8.988 15 7.773c0-1.216-1.02-2.228-2.313-2.228h-.5v-.5C12.188 2.825 10.328 1 8 1a4.53 4.53 0 0 0-2.941 1.1c-.757.652-1.153 1.438-1.153 2.055v.448l-.445.049C2.064 4.805 1 5.952 1 7.318 1 8.785 2.23 10 3.781 10H6a.5.5 0 0 1 0 1H3.781C1.708 11 0 9.366 0 7.318c0-1.763 1.266-3.223 2.942-3.593.143-.863.698-1.723 1.464-2.383z"></path><path xmlns="http://www.w3.org/2000/svg" fill-rule="evenodd" d="M7.646 4.146a.5.5 0 0 1 .708 0l3 3a.5.5 0 0 1-.708.708L8.5 5.707V14.5a.5.5 0 0 1-1 0V5.707L5.354 7.854a.5.5 0 1 1-.708-.708l3-3z"></path></svg>
<span>{% translate 'Drop your images here...' %}</span>
</div>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{% load i18n %}
<div class="iuw-root" {% if not widget.required %}data-candelete="true"{% endif %} {% if widget.is_initial %} data-raw="{{ widget.value.url }}"{% endif %}>
<input type="file" name="{{ widget.name }}" {% for name, value in widget.attrs.items %}{% if value is not False %} {{ name }}{% if value is not True %}="{{ value|stringformat:'s' }}"{% endif %}{% endif %}{% endfor %} />

<div class="iuw-drop-label">
<svg xmlns="http://www.w3.org/2000/svg" fill="currentColor" class="bi bi-cloud-upload" viewBox="0 0 16 16" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" width="100%" height="100%"><path xmlns="http://www.w3.org/2000/svg" fill-rule="evenodd" d="M4.406 1.342A5.53 5.53 0 0 1 8 0c2.69 0 4.923 2 5.166 4.579C14.758 4.804 16 6.137 16 7.773 16 9.569 14.502 11 12.687 11H10a.5.5 0 0 1 0-1h2.688C13.979 10 15 8.988 15 7.773c0-1.216-1.02-2.228-2.313-2.228h-.5v-.5C12.188 2.825 10.328 1 8 1a4.53 4.53 0 0 0-2.941 1.1c-.757.652-1.153 1.438-1.153 2.055v.448l-.445.049C2.064 4.805 1 5.952 1 7.318 1 8.785 2.23 10 3.781 10H6a.5.5 0 0 1 0 1H3.781C1.708 11 0 9.366 0 7.318c0-1.763 1.266-3.223 2.942-3.593.143-.863.698-1.723 1.464-2.383z"></path><path xmlns="http://www.w3.org/2000/svg" fill-rule="evenodd" d="M7.646 4.146a.5.5 0 0 1 .708 0l3 3a.5.5 0 0 1-.708.708L8.5 5.707V14.5a.5.5 0 0 1-1 0V5.707L5.354 7.854a.5.5 0 1 1-.708-.708l3-3z"></path></svg>
<span>{% translate 'Drop your image here...' %}</span>
</div>
<div class="iuw-empty">
<svg xmlns="http://www.w3.org/2000/svg" fill="currentColor" class="bi bi-cloud-upload" viewBox="0 0 16 16" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" width="100%" height="100%"><path xmlns="http://www.w3.org/2000/svg" fill-rule="evenodd" d="M4.406 1.342A5.53 5.53 0 0 1 8 0c2.69 0 4.923 2 5.166 4.579C14.758 4.804 16 6.137 16 7.773 16 9.569 14.502 11 12.687 11H10a.5.5 0 0 1 0-1h2.688C13.979 10 15 8.988 15 7.773c0-1.216-1.02-2.228-2.313-2.228h-.5v-.5C12.188 2.825 10.328 1 8 1a4.53 4.53 0 0 0-2.941 1.1c-.757.652-1.153 1.438-1.153 2.055v.448l-.445.049C2.064 4.805 1 5.952 1 7.318 1 8.785 2.23 10 3.781 10H6a.5.5 0 0 1 0 1H3.781C1.708 11 0 9.366 0 7.318c0-1.763 1.266-3.223 2.942-3.593.143-.863.698-1.723 1.464-2.383z"></path><path xmlns="http://www.w3.org/2000/svg" fill-rule="evenodd" d="M7.646 4.146a.5.5 0 0 1 .708 0l3 3a.5.5 0 0 1-.708.708L8.5 5.707V14.5a.5.5 0 0 1-1 0V5.707L5.354 7.854a.5.5 0 1 1-.708-.708l3-3z"></path></svg>
<span>{% translate 'Drop your image here or click to select one...' %}</span>
</div>

{% if not widget.required %}
<input type="checkbox" name="{{ widget.checkbox_name }}" id="{{ widget.checkbox_id }}" />
{% endif %}
</div>
Loading

0 comments on commit 01f7828

Please sign in to comment.