Skip to content
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

Merged
merged 4 commits into from
Oct 2, 2017

Conversation

kellylougheed
Copy link

@kellylougheed kellylougheed commented Apr 1, 2017

Work in progress

@kellylougheed kellylougheed force-pushed the 10.0-mig-web_widget_darkroom branch from a3a2c36 to f754cdc Compare April 1, 2017 19:29
@lasley lasley added this to the 10.0 milestone Aug 14, 2017
@lasley
Copy link
Contributor

lasley commented Aug 14, 2017

@obulkin please review

'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',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

10.0.0.0

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.
Copy link
Contributor

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

Copy link

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)
**/
Copy link
Contributor

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

Copy link

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.

Copy link
Contributor

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.

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

Copy link

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.

Copy link
Contributor

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!

lasley and others added 3 commits August 14, 2017 14:52
…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
@lasley lasley force-pushed the 10.0-mig-web_widget_darkroom branch from f754cdc to cf8f89d Compare August 14, 2017 21:52
<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"/>
Copy link
Contributor

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.

Copy link

@obulkin obulkin left a 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
Copy link

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('_');
Copy link

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.

@hughesbm
Copy link

hughesbm commented Sep 6, 2017

I have made the requested/suggested changes. I also updated some css classes that apparently changed in v10.

@obulkin
Copy link

obulkin commented Sep 7, 2017

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:

image

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.

@lasley
Copy link
Contributor

lasley commented Sep 7, 2017

It seems that the desync is being caused in the click event. Clicking again synchronizes it (at least in my case)

image

@hughesbm
Copy link

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.

@lasley
Copy link
Contributor

lasley commented Sep 11, 2017

Can you add the MattKetmo/darkroomjs#112 to the ReadMe under known issues please

Copy link
Contributor

@lasley lasley left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link

@obulkin obulkin left a 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.

Copy link

@rami-wafaie rami-wafaie left a 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
👍

@rami-wafaie
Copy link

@pedrobaeza can you please have a look at this??

@lasley
Copy link
Contributor

lasley commented Oct 2, 2017

@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
@lasley lasley force-pushed the 10.0-mig-web_widget_darkroom branch from 607a69e to bb2b144 Compare October 2, 2017 15:44
@lasley
Copy link
Contributor

lasley commented Oct 2, 2017

Oh derp you're one of mine! Squashed myself

@lasley lasley merged commit 36c62c8 into OCA:10.0 Oct 2, 2017
@lasley lasley deleted the 10.0-mig-web_widget_darkroom branch October 2, 2017 15:44
cuongnmtm pushed a commit to komit-consulting/web that referenced this pull request Dec 20, 2024
Signed-off-by pedrobaeza
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants