This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 182357 - With Rails projects, the path of image is incorrect in the visual editor
Summary: With Rails projects, the path of image is incorrect in the visual editor
Status: RESOLVED FIXED
Alias: None
Product: web
Classification: Unclassified
Component: CSS Visual Tools (show other bugs)
Version: 6.x
Hardware: PC Linux
: P3 normal (vote)
Assignee: Marek Fukala
URL:
Keywords:
Depends on:
Blocks: 182359
  Show dependency tree
 
Reported: 2010-03-19 10:21 UTC by ehartmann
Modified: 2010-03-27 06:12 UTC (History)
2 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Patch for ProjectWebRootQuery (3.09 KB, patch)
2010-03-24 16:06 UTC, ehartmann
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description ehartmann 2010-03-19 10:21:23 UTC
When editing CSS file, using the background tab, I choose a file in the subdirectory of the css file, select it with the FileChooser window. 

My directory structure is something like :

public/application/stylecheets/project.css
public/application/stylecheets/img/my-image.gif

The result is '../img/my-image.gif' instead of 'img/my-image.gif'.

I don't know if it's related to Rails project.
Comment 1 Marek Fukala 2010-03-23 12:27:45 UTC
The stylebuilder UI likely uses the project's root directory as the base. There's org.netbeans.modules.web.common.spi.ProjectWebRootQuery which could be used exactly for such case (beyond others).

There isn't an instance of ProjectWebRootProvider registered for RHTML so far so it wouldn't work even if I fix the stylebuilder.

Erno, can you please make an implementation of the ProjectWebRootProvider and put it to your (rails) project lookup? I would do that, but I do not understand the rails project structure so I could possibly make it wrong. The whole idea of the API/SPI is that it provides a facility for clients which can get "web root" of a FileObject. The web root should represent a folder underneath the project's root which is "equal to the base URL" when the application is deployed. It's used for example to resolve the links in html/css files.

I'll reassign the issue to you and kindly ask you to make such implementation (should be 10minutes for you and approx. 10lines of code). Then reassign the issue back to me and I'll fix the stylebuilder. 

Thanks!
Comment 2 ehartmann 2010-03-24 16:06:02 UTC
Created attachment 95703 [details]
Patch for ProjectWebRootQuery
Comment 3 ehartmann 2010-03-24 16:10:15 UTC
I've just attached a patch to add the requirement for Marek.

But I'm not aware of all the internals of Netbeans, you may review it as I don't know how to test it. So I may be completely wrong.

Marek, the root for a rails project is quite simple for static content : is the public directory under the root directory. 

I don't think it's relevant to use any other directories (a controller may return a css or an image).
Comment 4 Erno Mononen 2010-03-25 12:51:09 UTC
Thanks for the patch! It looks good, I've applied it in 9df7775b159d. 

Passing the issue back to Marek.
Comment 5 Marek Fukala 2010-03-25 14:07:38 UTC
Thanks to both of you guys!
Comment 6 Marek Fukala 2010-03-25 19:02:11 UTC
fixed in web-main#b242de5bf3ab

the links are now resolved to the obtained web root. If none is returned (in some strange web like projects) , the project's root is used instead.
Comment 7 Quality Engineering 2010-03-26 05:28:45 UTC
Integrated into 'main-golden', will be available in build *201003260201* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/b242de5bf3ab
User: Marek Fukala <mfukala@netbeans.org>
Log: #182357 -  With Rails projects, the path of image is incorrect in the visual editor
Comment 8 Quality Engineering 2010-03-27 06:12:01 UTC
Integrated into 'main-golden', will be available in build *201003270201* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/9df7775b159d
User: Erno Mononen <emononen@netbeans.org>
Log: #182357 - With Rails projects, the path of image is incorrect in the visual editor
- thanks to ehartmann for the patch