Skip to content

Commit e5d65e7

Browse files
obulkinlasley
authored andcommitted
web_widget_darkroom: Modal, fixes, cleanup * Fix bugs involving the crop and pan functionality by modifying crop and zoom plugins and Darkroom widget * Add Darkroom modal to normal image widget, using darkroom.modal wizard model to provide backend support for modal view * Remove res.users view changes introduced for demo purposes (not needed due to modal functionality) * Clean up existing code, removing many unnecessary DarkroomJS files
1 parent 112eba3 commit e5d65e7

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+2158
-3507
lines changed

web_widget_darkroom/README.rst

+47-43
Original file line numberDiff line numberDiff line change
@@ -1,83 +1,87 @@
1-
.. image:: https://img.shields.io/badge/license-AGPL--3-blue.svg
1+
.. image:: https://img.shields.io/badge/license-LGPL--3-blue.svg
22
:target: http://www.gnu.org/licenses/lgpl-3.0-standalone.html
33
:alt: License: LGPL-3
44

5-
======================
6-
Odoo DarkroomJS Widget
7-
======================
5+
================================
6+
DarkroomJS Image Editing for Web
7+
================================
88

9-
This module provides a `DarkroomJS`_ web widget for use with images fields.
9+
This module provides a `DarkroomJS`_ (v2.0.1) web widget for use with image
10+
fields. It also adds a Darkroom button to the normal image widget, which can
11+
be used to edit the image via Darkroom in a modal.
1012

1113
.. _DarkroomJS: https://github.com/MattKetmo/darkroomjs
1214

13-
This widget will allow you to perform the following actions on images:
15+
The widget currently supports the following operations and can be extended to
16+
allow others:
1417

15-
* Zoom
16-
* Rotate
17-
* Crop
18-
* Step back in history client-side (before save)
18+
* Zoom and pan
19+
* Rotate
20+
* Crop
21+
* Step back in history client-side (before save)
1922

20-
2123
Usage
2224
=====
2325

24-
To use this module, you need to:
25-
26-
* Install web_widget_darkroom
27-
* Add the to any One2many image relation by using the `darkroom` widget. Options can be passed through to Darkroom using the `options` key::
26+
After installing the module, you can use it in the following ways:
2827

29-
<field name="image_id" widget="darkroom"
30-
options="{'minWidth': 100}" />
28+
* Specify the ``darkroom`` widget when adding an image field to a view.
29+
Configuration values can be provided using the ``options`` attribute::
3130

32-
The Odoo DarkroomJS widget passes options directly through to Darkroom, which are copied from the source below::
31+
<field name="image" widget="darkroom" options="{'minWidth': 100}"/>
3332

34-
// Default options
35-
defaults: {
36-
// Canvas properties (dimension, ratio, color)
37-
minWidth: null,
38-
minHeight: null,
39-
maxWidth: null,
40-
maxHeight: null,
41-
ratio: null,
42-
backgroundColor: '#fff',
33+
The widget passes options directly through to DarkroomJS, which supports the
34+
following:
4335

44-
// Plugins options
45-
plugins: {},
36+
* minWidth
37+
* minHeight
38+
* maxWidth
39+
* maxHeight
40+
* ratio (aspect ratio)
41+
* backgroundColor
4642

47-
// Post-initialisation callback
48-
initialize: function() { /* noop */ }
49-
},
43+
* Open a form view that contains an image in edit mode and hover over the
44+
image widget. You should see a Darkoom button that can be clicked to open
45+
the image in a Darkroom modal, where it can be edited and the changes can be
46+
saved.
5047

48+
.. image:: /web_widget_darkroom/static/description/modal_screenshot_1.png
49+
:alt: Darkroom Modal Screenshot 1
50+
:class: img-thumbnail
51+
:height: 260
5152

53+
.. image:: /web_widget_darkroom/static/description/modal_screenshot_2.png
54+
:alt: Darkroom Modal Screenshot 2
55+
:class: img-thumbnail col-xs-offset-1
56+
:height: 260
5257

53-
Known Issues/Roadmap
54-
====================
55-
56-
* Plugins are not able to be added without inheriting, then redefining the widget in the registry due to JS inheritance.
57-
** This is not scalable because there would need to be an explicit dependency chain in order to avoid registry overwrite.
58-
58+
Known Issues / Roadmap
59+
======================
5960

61+
* Darkroom modals are currently not supported during record creation
6062

6163
Bug Tracker
6264
===========
6365

64-
Bugs are tracked on `GitHub Issues
65-
<https://github.com/OCA/{project_repo}/issues>`_. In case of trouble, please
66-
check there if your issue has already been reported. If you spotted it first,
67-
help us smashing it by providing a detailed and welcomed feedback.
66+
Bugs are tracked on `GitHub Issues <https://github.com/OCA/web/issues>`_. In
67+
case of trouble, please check there if your issue has already been reported.
68+
If you spotted it first, help us smash it by providing detailed and welcome
69+
feedback.
6870

6971
Credits
7072
=======
7173

7274
Images
7375
------
7476

75-
* Odoo Community Association: `Icon <https://github.com/OCA/maintainer-tools/blob/master/template/module/static/description/icon.svg>`_.
77+
* Odoo Community Association:
78+
`Icon <https://github.com/OCA/maintainer-tools/blob/master/template/module/static/description/icon.svg>`_.
7679

7780
Contributors
7881
------------
7982

8083
* Dave Lasley <[email protected]>
84+
* Oleg Bulkin <[email protected]>
8185

8286
Maintainer
8387
----------

web_widget_darkroom/__init__.py

100755100644
+3-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
# -*- coding: utf-8 -*-
2-
# Copyright 2016 LasLabs Inc.
2+
# Copyright 2016-2017 LasLabs Inc.
33
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html).
4+
5+
from . import wizards

web_widget_darkroom/__openerp__.py

100755100644
+16-18
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,26 @@
11
# -*- coding: utf-8 -*-
2-
# Copyright 2016 LasLabs Inc.
2+
# Copyright 2016-2017 LasLabs Inc.
33
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html).
44

55
{
6-
"name": "Web Darkroom Image Widget",
7-
"summary": "Widget provides a dynamic, editable canvas for use on any"
8-
" One2many image field in backend form views.",
9-
"version": "9.0.1.0.1",
10-
"category": "Web",
11-
"website": "https://laslabs.com/",
12-
"author": "LasLabs, Odoo Community Association (OCA)",
13-
"license": "LGPL-3",
14-
"application": False,
15-
"installable": True,
16-
"depends": [
17-
"web",
6+
'name': 'Web DarkroomJS Image Editing',
7+
'summary': 'Provides web widget for image editing and adds it to standard'
8+
' image widget as modal',
9+
'version': '9.0.1.0.1',
10+
'category': 'Web',
11+
'website': 'https://laslabs.com/',
12+
'author': 'LasLabs, Odoo Community Association (OCA)',
13+
'license': 'LGPL-3',
14+
'application': False,
15+
'installable': True,
16+
'depends': [
17+
'web',
1818
],
19-
"data": [
19+
'data': [
2020
'views/assets.xml',
21+
'wizards/darkroom_modal.xml',
2122
],
2223
'qweb': [
23-
"static/src/xml/field_templates.xml",
24+
'static/src/xml/field_templates.xml',
2425
],
25-
'demo': [
26-
'demo/res_users.xml',
27-
]
2826
}

web_widget_darkroom/demo/res_users.xml

-24
This file was deleted.
Loading
Loading

web_widget_darkroom/static/lib/darkroomjs/.editorconfig

-9
This file was deleted.

web_widget_darkroom/static/lib/darkroomjs/.gitignore

-5
This file was deleted.

web_widget_darkroom/static/lib/darkroomjs/CHANGELOG.md

-23
This file was deleted.

web_widget_darkroom/static/lib/darkroomjs/LICENSE

-18
This file was deleted.

web_widget_darkroom/static/lib/darkroomjs/README.md

-88
This file was deleted.

web_widget_darkroom/static/lib/darkroomjs/bower.json

-31
This file was deleted.

0 commit comments

Comments
 (0)