|
1 |
| -.. image:: https://img.shields.io/badge/license-AGPL--3-blue.svg |
| 1 | +.. image:: https://img.shields.io/badge/license-LGPL--3-blue.svg |
2 | 2 | :target: http://www.gnu.org/licenses/lgpl-3.0-standalone.html
|
3 | 3 | :alt: License: LGPL-3
|
4 | 4 |
|
5 |
| -====================== |
6 |
| -Odoo DarkroomJS Widget |
7 |
| -====================== |
| 5 | +================================ |
| 6 | +DarkroomJS Image Editing for Web |
| 7 | +================================ |
8 | 8 |
|
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. |
10 | 12 |
|
11 | 13 | .. _DarkroomJS: https://github.com/MattKetmo/darkroomjs
|
12 | 14 |
|
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: |
14 | 17 |
|
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) |
19 | 22 |
|
20 |
| - |
21 | 23 | Usage
|
22 | 24 | =====
|
23 | 25 |
|
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: |
28 | 27 |
|
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:: |
31 | 30 |
|
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}"/> |
33 | 32 |
|
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: |
43 | 35 |
|
44 |
| - // Plugins options |
45 |
| - plugins: {}, |
| 36 | + * minWidth |
| 37 | + * minHeight |
| 38 | + * maxWidth |
| 39 | + * maxHeight |
| 40 | + * ratio (aspect ratio) |
| 41 | + * backgroundColor |
46 | 42 |
|
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. |
50 | 47 |
|
| 48 | + .. image:: /web_widget_darkroom/static/description/modal_screenshot_1.png |
| 49 | + :alt: Darkroom Modal Screenshot 1 |
| 50 | + :class: img-thumbnail |
| 51 | + :height: 260 |
51 | 52 |
|
| 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 |
52 | 57 |
|
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 | +====================== |
59 | 60 |
|
| 61 | +* Darkroom modals are currently not supported during record creation |
60 | 62 |
|
61 | 63 | Bug Tracker
|
62 | 64 | ===========
|
63 | 65 |
|
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. |
68 | 70 |
|
69 | 71 | Credits
|
70 | 72 | =======
|
71 | 73 |
|
72 | 74 | Images
|
73 | 75 | ------
|
74 | 76 |
|
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>`_. |
76 | 79 |
|
77 | 80 | Contributors
|
78 | 81 | ------------
|
79 | 82 |
|
80 | 83 |
|
| 84 | + |
81 | 85 |
|
82 | 86 | Maintainer
|
83 | 87 | ----------
|
|
0 commit comments