mirror of
https://github.com/OCA/web.git
synced 2025-02-22 13:21:25 +02:00
[MIG] web_widget_darkroom: Add migration changes
* Remove fabric.js CDN link, source from static/lib instead
* Update python imports (openerp -> odoo)
* Remove unnecessary require('_')
* Update overlay image classes to v10
* Fix typo in readme
* Change module version number to standard (10.0.1.0.0)
* Add DarkroomJS version number to lib files
* Downgrade fabric.js (1.7.15 -> 1.6.7)
* Add Darkroomjs issue to ReadMe
This commit is contained in:
committed by
Dave Lasley
parent
cf8f89d776
commit
bb2b144a2f
@@ -6,31 +6,31 @@
|
||||
DarkroomJS Image Editing for Web
|
||||
================================
|
||||
|
||||
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
|
||||
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
|
||||
.. _DarkroomJS: https://github.com/MattKetmo/darkroomjs
|
||||
|
||||
The widget currently supports the following operations and can be extended to
|
||||
The widget currently supports the following operations and can be extended to
|
||||
allow others:
|
||||
|
||||
* Zoom and pan
|
||||
* Rotate
|
||||
* Crop
|
||||
* Step back in history client-side (before save)
|
||||
|
||||
|
||||
Usage
|
||||
=====
|
||||
|
||||
After installing the module, you can use it in the following ways:
|
||||
|
||||
* Specify the ``darkroom`` widget when adding an image field to a view.
|
||||
* Specify the ``darkroom`` widget when adding an image field to a view.
|
||||
Configuration values can be provided using the ``options`` attribute::
|
||||
|
||||
<field name="image" widget="darkroom" options="{'minWidth': 100}"/>
|
||||
|
||||
The widget passes options directly through to DarkroomJS, which supports the
|
||||
The widget passes options directly through to DarkroomJS, which supports the
|
||||
following:
|
||||
|
||||
* minWidth
|
||||
@@ -40,9 +40,9 @@ After installing the module, you can use it in the following ways:
|
||||
* ratio (aspect ratio)
|
||||
* backgroundColor
|
||||
|
||||
* 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
|
||||
* Open a form view that contains an image in edit mode and hover over the
|
||||
image widget. You should see a Darkroom 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
|
||||
@@ -59,13 +59,15 @@ Known Issues / Roadmap
|
||||
======================
|
||||
|
||||
* Darkroom modals are currently not supported during record creation
|
||||
* Fabric.js >= 1.70 is not currently supported by DarkroomJS
|
||||
(`MattKetmo/darkroomjs#112 <https://github.com/MattKetmo/darkroomjs/issues/112>`_)
|
||||
|
||||
Bug Tracker
|
||||
===========
|
||||
|
||||
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
|
||||
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
|
||||
@@ -74,7 +76,7 @@ Credits
|
||||
Images
|
||||
------
|
||||
|
||||
* Odoo Community Association:
|
||||
* Odoo Community Association:
|
||||
`Icon <https://github.com/OCA/maintainer-tools/blob/master/template/module/static/description/icon.svg>`_.
|
||||
|
||||
Contributors
|
||||
@@ -82,6 +84,7 @@ Contributors
|
||||
|
||||
* Dave Lasley <dave@laslabs.com>
|
||||
* Oleg Bulkin <obulkin@laslabs.com>
|
||||
* Brent Hughes <brent.hughes@laslabs.com>
|
||||
|
||||
Maintainer
|
||||
----------
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
'name': 'Web DarkroomJS Image Editing',
|
||||
'summary': 'Provides web widget for image editing and adds it to standard'
|
||||
' image widget as modal',
|
||||
'version': '10.0.1.0.1',
|
||||
'version': '10.0.1.0.0',
|
||||
'category': 'Web',
|
||||
'website': 'https://laslabs.com/',
|
||||
'author': 'LasLabs, Odoo Community Association (OCA)',
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
/**
|
||||
* Copyright 2013 Matthieu Moquet
|
||||
* Copyright 2016-2017 LasLabs Inc.
|
||||
* Version 2.0.1
|
||||
* License MIT (https://opensource.org/licenses/MIT)
|
||||
**/
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
/**
|
||||
* Copyright 2013 Matthieu Moquet
|
||||
* Copyright 2016-2017 LasLabs Inc.
|
||||
* Version 2.0.1
|
||||
* License MIT (https://opensource.org/licenses/MIT)
|
||||
**/
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
/**
|
||||
* Copyright 2013 Matthieu Moquet
|
||||
* Copyright 2016-2017 LasLabs Inc.
|
||||
* Version 2.0.1
|
||||
* License MIT (https://opensource.org/licenses/MIT)
|
||||
**/
|
||||
|
||||
@@ -37,7 +38,7 @@
|
||||
if (protoProps) Darkroom.Utils.extend(child.prototype, protoProps);
|
||||
|
||||
child.__super__ = parent.prototype;
|
||||
|
||||
|
||||
return child;
|
||||
};
|
||||
})();
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
/**
|
||||
* Copyright 2013 Matthieu Moquet
|
||||
* Copyright 2016-2017 LasLabs Inc.
|
||||
* Version 2.0.1
|
||||
* License MIT (https://opensource.org/licenses/MIT)
|
||||
**/
|
||||
|
||||
|
||||
26123
web_widget_darkroom/static/lib/js/fabric.js
Executable file
26123
web_widget_darkroom/static/lib/js/fabric.js
Executable file
File diff suppressed because it is too large
Load Diff
@@ -11,7 +11,6 @@ odoo.define('web_widget_darkroom.darkroom_widget', function(require) {
|
||||
var common = require('web.form_common');
|
||||
var session = require('web.session');
|
||||
var utils = require('web.utils');
|
||||
var _ = require('_');
|
||||
|
||||
var QWeb = core.qweb;
|
||||
|
||||
|
||||
@@ -55,7 +55,7 @@ odoo.define('web_widget_darkroom.darkroom_modal_button', function(require) {
|
||||
imageWidget.do_action(modalAction, options);
|
||||
};
|
||||
|
||||
var $button = this.$('.oe_form_binary_image_darkroom_modal');
|
||||
var $button = this.$('.o_form_binary_image_darkroom_modal');
|
||||
if ($button.length > 0) {
|
||||
$button.click(openModal);
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
<templates id="field_templates" xml:space="preserve">
|
||||
<t t-name="FieldDarkroomImage">
|
||||
<span class="oe_form_field o_form_field_darkroom" t-att-style="widget.node.attrs.style">
|
||||
<span class="o_form_field o_form_field_darkroom" t-att-style="widget.node.attrs.style">
|
||||
<t t-if="!widget.get('effective_readonly')">
|
||||
<div class="darkroom-toolbar"/>
|
||||
</t>
|
||||
@@ -15,16 +15,16 @@
|
||||
</t>
|
||||
|
||||
<t t-extend="FieldBinaryImage">
|
||||
<t t-jquery=".oe_form_binary_file_edit" t-operation="after">
|
||||
<t t-jquery=".o_select_file_button" t-operation="after">
|
||||
<t t-if="widget.darkroom_supported()">
|
||||
<i class="fa fa-picture-o fa-lg oe_form_binary_image_darkroom_modal" title="Darkroom"></i>
|
||||
<i class="fa fa-picture-o fa-lg o_form_binary_image_darkroom_modal" title="Darkroom"></i>
|
||||
</t>
|
||||
</t>
|
||||
<t t-jquery=".oe_form_binary_file_edit" t-operation="replace">
|
||||
<i class="fa fa-pencil fa-lg oe_form_binary_file_edit" title="Edit"></i>
|
||||
<t t-jquery=".o_select_file_button" t-operation="replace">
|
||||
<i class="fa fa-pencil fa-lg o_select_file_button" title="Edit"></i>
|
||||
</t>
|
||||
<t t-jquery=".oe_form_binary_file_clear" t-operation="replace">
|
||||
<i class="fa fa-trash-o fa-lg oe_form_binary_file_clear" title="Clear"></i>
|
||||
<t t-jquery=".o_clear_file_button" t-operation="replace">
|
||||
<i class="fa fa-trash-o fa-lg o_clear_file_button" title="Clear"></i>
|
||||
</t>
|
||||
</t>
|
||||
</templates>
|
||||
|
||||
@@ -9,18 +9,18 @@
|
||||
<template id="assets_darkroom" name="web_widget_darkroom Assets" inherit_id="web.assets_backend">
|
||||
<xpath expr="//script[last()]" position="after">
|
||||
<link href="/web_widget_darkroom/static/src/less/darkroom.less" rel="stylesheet" type="text/less"/>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/fabric.js/1.5.0/fabric.require.min.js"/>
|
||||
|
||||
<script src="/web_widget_darkroom/static/lib/js/fabric.js"/>
|
||||
|
||||
<script src="/web_widget_darkroom/static/lib/darkroomjs/core/darkroom.js"/>
|
||||
<script src="/web_widget_darkroom/static/lib/darkroomjs/core/plugin.js"/>
|
||||
<script src="/web_widget_darkroom/static/lib/darkroomjs/core/transformation.js"/>
|
||||
<script src="/web_widget_darkroom/static/lib/darkroomjs/core/utils.js"/>
|
||||
|
||||
|
||||
<script src="/web_widget_darkroom/static/src/js/plugins/darkroom.crop.js"/>
|
||||
<script src="/web_widget_darkroom/static/src/js/plugins/darkroom.history.js"/>
|
||||
<script src="/web_widget_darkroom/static/src/js/plugins/darkroom.rotate.js"/>
|
||||
<script src="/web_widget_darkroom/static/src/js/plugins/darkroom.zoom.js"/>
|
||||
|
||||
|
||||
<script src="/web_widget_darkroom/static/src/js/widget_darkroom.js"/>
|
||||
<script src="/web_widget_darkroom/static/src/js/widget_darkroom_modal.js"/>
|
||||
</xpath>
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
# Copyright 2017 LasLabs Inc.
|
||||
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html).
|
||||
|
||||
from openerp import api, fields, models
|
||||
from openerp.exceptions import MissingError
|
||||
from odoo import api, fields, models
|
||||
from odoo.exceptions import MissingError
|
||||
|
||||
|
||||
class DarkroomModal(models.TransientModel):
|
||||
|
||||
Reference in New Issue
Block a user