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

Do not truncate source file path #331

Merged
merged 3 commits into from
Apr 29, 2016
Merged

Conversation

sustmi
Copy link
Contributor

@sustmi sustmi commented Mar 28, 2016

Q A
Bug fix? no
New feature? no
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets
License MIT

Description

Remove truncating of source file path to only two levels. I think the only added value of truncation is that filepaths in UI are shorter. Anyway, if this is really a problem, it should be done in the UI/presentation part, not FileSource class.

@sustmi
Copy link
Contributor Author

sustmi commented Mar 28, 2016

The problem with truncating the path is that sometimes you end-up with ambiguous truncated path.
For example both Administration/User/Xml/base.html.twig and Api/User/Xml/base.html.twig will be truncated to User/Xml/base.html.twig.

@Nyholm
Copy link
Collaborator

Nyholm commented Mar 29, 2016

I like this, we should not truncate the sources. However, how will this look in the WebUI? I think we have to truncate the string there and make sure the full path is shown on hover. (Use HTML's title attribute)

@sustmi sustmi force-pushed the extract-full-path branch from 5feee53 to 06813cc Compare April 3, 2016 15:26
@sustmi
Copy link
Contributor Author

sustmi commented Apr 3, 2016

I updated the PR to truncate the path from left in UI. It uses JavaScript as it cannot be done right in CSS.

@Nyholm
Copy link
Collaborator

Nyholm commented Apr 3, 2016

I like this change. I've sent you a PR with suggestions. At the moment the source line will render on two rows. Let me know what you think. sustmi#1

@Nyholm
Copy link
Collaborator

Nyholm commented Apr 3, 2016

This will fix #87

@Nyholm
Copy link
Collaborator

Nyholm commented Apr 7, 2016

Do you have any updates on this PR?

@sustmi
Copy link
Contributor Author

sustmi commented Apr 10, 2016

Hi @Nyholm . You want the file path to be always only one line. The best solution for good UX I can think of is the left-side ellipsis (because the left side of the path is usually the same).
But left-side ellipsis cannot be done in CSS (without ugly hacks) and the JS plugin I used does not play well with Chrome.
I would rather let the file path to be over more lines than use classic ellipsis (on the right side) that is useless in my opinion (you would always see only the common part of the file path).
What do you suggest?

@sustmi sustmi force-pushed the extract-full-path branch from 06813cc to 1add7f0 Compare April 10, 2016 19:18
@sustmi
Copy link
Contributor Author

sustmi commented Apr 10, 2016

I found a different truncating JS plugin - trunk8.js . It looks like it works in Chrome too.
Is it all-right now, @Nyholm ?

@Nyholm
Copy link
Collaborator

Nyholm commented Apr 11, 2016

You want the file path to be always only one line.

I thought that was your idea when you truncated it.

I found a different truncating JS plugin - trunk8.js . It looks like it works in Chrome too.

Okey, cool. I'll make sure to have a look later today.

@sustmi
Copy link
Contributor Author

sustmi commented Apr 11, 2016

I thought that was your idea when you truncated it.

No, I reacted to your comment:

However, how will this look in the WebUI? I think we have to truncate the string there and make sure the full path is shown on hover

Actually, I do not use the UI at all. I use only the parser and export parts of bundle. :)

@Nyholm
Copy link
Collaborator

Nyholm commented Apr 11, 2016

Sorry for being back and forth with this. Im not sure what the best solution might be...

What I think is great:

  • We have an absolute reference to the source file.

What we must fix:

  • Make sure the WebUI not look horrible because of long source paths.

Possible solutions:

  • Truncate the path in the UI
  • Create a "$absolutePath" in the FileSource class and deprecate the current $path.
  • Introduce/Use a twig filter that shortens the path to x chars
  • Something else?

What do you think is the best and most simple solution?


I tested the current PR with the new truncate library in Chrome (OSX). It does not work as expected.
screen shot 2016-04-11 at 17 20 10

@sustmi
Copy link
Contributor Author

sustmi commented Apr 12, 2016

What version of Chrome do you use and what is the resolution?

@Nyholm
Copy link
Collaborator

Nyholm commented Apr 12, 2016

I use:

  • Chrome 49.0.2623.110
  • OS X 10.11.0
  • 19200x1200

screen shot 2016-04-12 at 10 12 43

@sustmi
Copy link
Contributor Author

sustmi commented Apr 12, 2016

How it comes that your table columns widths are not 20:40:40?
Here is how it looks in Chrome 48 on Mac OSX 10.8:
28194821
Do you use the branch without any changes?

@Nyholm
Copy link
Collaborator

Nyholm commented Apr 12, 2016

I do not know. I get the same result in Safari but not Firefox. Firefox is behaving as expected...
Yes, Im using your branch with no additional changes. I do not have the same issue with master. It has noting to do with the javascript..

Im going to try to revert your changes one by one...

@Nyholm
Copy link
Collaborator

Nyholm commented Apr 12, 2016

I do not have the same issue with master

No, sorry. That is not correct. I have the same issue with master when the content of the third column is too big.

This issue is resolved by adding some CSS. Example:

li {
    word-break: break-all;
}

After that it all looks good. Thank you!

@sustmi
Copy link
Contributor Author

sustmi commented Apr 12, 2016

Thank you. I added the word-break CSS attribute. Is it all right now?

@Nyholm
Copy link
Collaborator

Nyholm commented Apr 12, 2016

I think so. I've flagged this PR for a 2nd review. I like it and if any of my collaborators agrees with me they will merge it.

@gnat42
Copy link
Collaborator

gnat42 commented Apr 29, 2016

So I'm quite confused by this PR actually. I understood what it was meant to do. But when I apply it to my project using this bundle I'm wondering why it is even needed. My translation files don't have a full path? The HTML for example looks like this for me:

screen shot 2016-04-28 at 11 41 27 pm

The message translations are already truncated there with or without the trunk8.js.

Which leaves me to wonder why are yours not?

@Nyholm
Copy link
Collaborator

Nyholm commented Apr 29, 2016

See the changes in FileSource.php

The purpose of this PR is to make sure that the FileSource has the full path. In master we only got the 2 directories. That is great because we should have as much info about the source as possible.

But when we have the complete path in the WebUI it looks weird. That is why @sustmi made all this extra changes in the WebUI.

After merge of this PR:

  • WebUI will look the same
  • FileSource will have the full path.

@gnat42
Copy link
Collaborator

gnat42 commented Apr 29, 2016

This looks good. Thanks

@gnat42 gnat42 merged commit efca383 into schmittjoh:master Apr 29, 2016
@gnat42 gnat42 mentioned this pull request Apr 29, 2016
3 tasks
@sustmi
Copy link
Contributor Author

sustmi commented Apr 30, 2016

Thank you.

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.

3 participants