Skip to content

Commit

Permalink
web_widget_darkroom: Modal, fixes, cleanup * Fix bugs involving the c…
Browse files Browse the repository at this point in the history
…rop 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
  • Loading branch information
obulkin authored and lasley committed Aug 14, 2017
1 parent 112eba3 commit e5d65e7
Show file tree
Hide file tree
Showing 57 changed files with 2,158 additions and 3,507 deletions.
90 changes: 47 additions & 43 deletions web_widget_darkroom/README.rst
Original file line number Diff line number Diff line change
@@ -1,83 +1,87 @@
.. image:: https://img.shields.io/badge/license-AGPL--3-blue.svg
.. image:: https://img.shields.io/badge/license-LGPL--3-blue.svg
:target: http://www.gnu.org/licenses/lgpl-3.0-standalone.html
:alt: License: LGPL-3

======================
Odoo DarkroomJS Widget
======================
================================
DarkroomJS Image Editing for Web
================================

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

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

This widget will allow you to perform the following actions on images:
The widget currently supports the following operations and can be extended to
allow others:

* Zoom
* Rotate
* Crop
* Step back in history client-side (before save)
* Zoom and pan
* Rotate
* Crop
* Step back in history client-side (before save)


Usage
=====

To use this module, you need to:

* Install web_widget_darkroom
* Add the to any One2many image relation by using the `darkroom` widget. Options can be passed through to Darkroom using the `options` key::
After installing the module, you can use it in the following ways:

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

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

// Default options
defaults: {
// Canvas properties (dimension, ratio, color)
minWidth: null,
minHeight: null,
maxWidth: null,
maxHeight: null,
ratio: null,
backgroundColor: '#fff',
The widget passes options directly through to DarkroomJS, which supports the
following:

// Plugins options
plugins: {},
* minWidth
* minHeight
* maxWidth
* maxHeight
* ratio (aspect ratio)
* backgroundColor

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

.. image:: /web_widget_darkroom/static/description/modal_screenshot_1.png
:alt: Darkroom Modal Screenshot 1
:class: img-thumbnail
:height: 260

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

Known Issues/Roadmap
====================

* Plugins are not able to be added without inheriting, then redefining the widget in the registry due to JS inheritance.
** This is not scalable because there would need to be an explicit dependency chain in order to avoid registry overwrite.

Known Issues / Roadmap
======================

* Darkroom modals are currently not supported during record creation

Bug Tracker
===========

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

Credits
=======

Images
------

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

Contributors
------------

* Dave Lasley <[email protected]>
* Oleg Bulkin <[email protected]>

Maintainer
----------
Expand Down
4 changes: 3 additions & 1 deletion web_widget_darkroom/__init__.py
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# -*- coding: utf-8 -*-
# Copyright 2016 LasLabs Inc.
# Copyright 2016-2017 LasLabs Inc.
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html).

from . import wizards
34 changes: 16 additions & 18 deletions web_widget_darkroom/__openerp__.py
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,28 +1,26 @@
# -*- coding: utf-8 -*-
# Copyright 2016 LasLabs Inc.
# Copyright 2016-2017 LasLabs Inc.
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html).

{
"name": "Web Darkroom Image Widget",
"summary": "Widget provides a dynamic, editable canvas for use on any"
" One2many image field in backend form views.",
"version": "9.0.1.0.1",
"category": "Web",
"website": "https://laslabs.com/",
"author": "LasLabs, Odoo Community Association (OCA)",
"license": "LGPL-3",
"application": False,
"installable": True,
"depends": [
"web",
'name': 'Web DarkroomJS Image Editing',
'summary': 'Provides web widget for image editing and adds it to standard'
' image widget as modal',
'version': '9.0.1.0.1',
'category': 'Web',
'website': 'https://laslabs.com/',
'author': 'LasLabs, Odoo Community Association (OCA)',
'license': 'LGPL-3',
'application': False,
'installable': True,
'depends': [
'web',
],
"data": [
'data': [
'views/assets.xml',
'wizards/darkroom_modal.xml',
],
'qweb': [
"static/src/xml/field_templates.xml",
'static/src/xml/field_templates.xml',
],
'demo': [
'demo/res_users.xml',
]
}
24 changes: 0 additions & 24 deletions web_widget_darkroom/demo/res_users.xml

This file was deleted.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 0 additions & 9 deletions web_widget_darkroom/static/lib/darkroomjs/.editorconfig

This file was deleted.

5 changes: 0 additions & 5 deletions web_widget_darkroom/static/lib/darkroomjs/.gitignore

This file was deleted.

23 changes: 0 additions & 23 deletions web_widget_darkroom/static/lib/darkroomjs/CHANGELOG.md

This file was deleted.

18 changes: 0 additions & 18 deletions web_widget_darkroom/static/lib/darkroomjs/LICENSE

This file was deleted.

88 changes: 0 additions & 88 deletions web_widget_darkroom/static/lib/darkroomjs/README.md

This file was deleted.

31 changes: 0 additions & 31 deletions web_widget_darkroom/static/lib/darkroomjs/bower.json

This file was deleted.

Loading

0 comments on commit e5d65e7

Please sign in to comment.