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

Pure JS implementation #457

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Entity/TransUnitRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,8 @@ protected function addTranslationFilter(QueryBuilder $builder, array $locales =

if ((is_countable($ids) ? count($ids) : 0) > 0) {
$builder->andWhere($builder->expr()->in('tu.id', $ids));
} else {
$builder->andWhere($builder->expr()->eq(1, 0));
Copy link
Contributor

Choose a reason for hiding this comment

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

Why?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

To avoid to return all results (because there is no where condition added) when there is no ids matching the search. In case there is no matching results I add a condition to the builder that is never true.

With the fix when the search doesn't matches, we have an empty list:
image

We didn't wanted to throw a NoResult exception as we are in addTranslationFilter and didn't wanted to change to much the logics but if you have a better idea, please suggest it.

Copy link
Contributor

Choose a reason for hiding this comment

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

It should be in a separate PR if unrelated to the pure JS implementation

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@Seb33300 Right, I just revert 2 unrelated commit (this fix and the fix of deprecation)

}
}
}
Expand Down
24 changes: 24 additions & 0 deletions Resources/public/css/translation.css
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,18 @@
width: 60px;
}

.col-hide {
display: none;
}

.pagination {
margin: 0;
}

.pagination li > a {
cursor: pointer;
}

.table-overview .progress {
margin: 0;
height: 12px;
Expand All @@ -40,3 +48,19 @@ table .actions {
table button.delete {
padding: 2px 5px;
}

.disabled {
pointer-events: none;
cursor: not-allowed;
text-decoration: none;
color: gray !important;
}

.content div.actions {
display: flex;
gap: 5px;
}

.content div.action.action-button {
margin: 0;
}
Loading