-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[10.0][MIG] web_widget_darkroom: Migrated to 10.0 #595
Conversation
a3a2c36
to
f754cdc
Compare
@obulkin please review |
web_widget_darkroom/__manifest__.py
Outdated
'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', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
10.0.0.0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think usually it is 10.0.1.0.0
@@ -0,0 +1,356 @@ | |||
/** | |||
* Copyright 2013 Matthieu Moquet | |||
* Copyright 2016-2017 LasLabs Inc. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't hold a copyright to this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added the LasLabs copyrights as I wound up having to make a lot of minor changes in all the DarkroomJS files to satisfy our linter.
* Copyright 2013 Matthieu Moquet | ||
* Copyright 2016-2017 LasLabs Inc. | ||
* License MIT (https://opensource.org/licenses/MIT) | ||
**/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmmm I wonder what version darkroom this is? We should update then add the version number into the header
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The version is listed in the README, but I don't know if it makes sense to include the version number here as the code has been modified to satisfy our linter and wouldn't exactly match the original source for this version number.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah it's still best to have it here - it's relevant in the context of the code to know what version you're dealing with.
Also hmmm I wonder if we should ignore static/lib
from our linter. We don't really want to have to modify libraries like this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@lasley FYI our linter is ignoring static/lib
folder, you can see that we are not emitting message from this folder:
https://travis-ci.org/OCA/web/jobs/264532412#L638
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice. I could swear this wasn't the case when I worked on this module in v9, but I was linting everything locally, so maybe I just missed this exception.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the confirmation @moylop260!
…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
f754cdc
to
cf8f89d
Compare
web_widget_darkroom/views/assets.xml
Outdated
<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"/> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bring this into static/lib/js/fabric.js
and source from there instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are a couple missing migration changes. I did not review the v9 code as I was the last person to work on it. I also could not perform a functional review since the widget won't load in v10 without the Fabric.js change requested here.
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html). | ||
|
||
from openerp import api, fields, models | ||
from openerp.exceptions import MissingError |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These imports need to use odoo
.
var common = require('web.form_common'); | ||
var session = require('web.session'); | ||
var utils = require('web.utils'); | ||
var _ = require('_'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line can be dropped. It doesn't work in v10, and _
should just be available as a global.
I have made the requested/suggested changes. I also updated some css classes that apparently changed in v10. |
My previous comments have been addressed, but when I test the widget on Runbot, I'm running into a weird cropping bug. The grey background layer created during cropping is moving together with the cropping reticle rather than staying put: I can't seem to recreate this in v9 or in the sample on the DarkroomJs page, so I think it's an issue specific to this branch. |
The cropping bug was caused by a change to Fabric.js in version 1.7.0 that is not compatible with DarkroomJS. Downgrading to 1.6.7 appears to have restored normal functionality. |
Can you add the MattKetmo/darkroomjs#112 to the ReadMe under known issues please |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The version change does address the cropping bug in my last comment, so this should be good to go now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review + Functional testing: Looks fine to me
👍
@pedrobaeza can you please have a look at this?? |
@hughesbm - please squash for merge |
* 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
607a69e
to
bb2b144
Compare
Oh derp you're one of mine! Squashed myself |
Work in progress