Skip to content

MarkUnknown checkbox visible with TranslateDoc - Fix #146 #160

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

Conversation

share-with-me
Copy link
Contributor

@share-with-me share-with-me commented Jul 1, 2017

markUnknown checkbox is visible to the user wherein the user can tick/untick the checkbox to achieve document translation. A different ID is used for checkbox in translateDoc div so that it can be independently mapped to the XHR data.

fixes #146

@sushain97
Copy link
Member

Corresponding changes would have to be made to persistence.js. Honestly, I think it would be fine for the option to be shared between the text and document translation mode. The only change necessary in that case would be making it visible in document translation. What do you think?

@share-with-me
Copy link
Contributor Author

The only change necessary in that case would be making it visible in document translation. What do you think?

Yes! This was my initial approach. However, it was getting a bit difficult to hide translateText div and then display a child of it along with docTranslation - the markunknown checkbox. This stackoverflow link discusses that it is possible to display a child modifying parent 's visibility but not with display: none.

One solution I thought of is: Instead of

$('div#translateText').fadeOut('fast', function () {, I would use

$('#originalText, #translatedText, #translateDoc').fadeOut('fast', function () { ... thus not altering the display CSS of the checkbox. Seems like a good approach?

@sushain97
Copy link
Member

$('#originalText, #translatedText, #translateDoc').fadeOut('fast', function () { ... thus not altering the display CSS of the checkbox. Seems like a good approach?

I would add a class to those elements instead and trigger that.

@share-with-me
Copy link
Contributor Author

I would add a class to those elements instead and trigger that.

I did the same :D . Thanks!

@share-with-me
Copy link
Contributor Author

I make use of siblings method. This did help reduce a lot of code. Does this approach make sense?

@@ -191,9 +191,9 @@
<i class="fa fa-file-text"></i> <span data-text="Translate_Document">Translate a document</span>
</button>
</div>
<div class="col-lg-3 col-md-6 pull-right">
<div class="col-lg-3 col-md-6 pull-right" id="translateOptionsContainer">
Copy link
Member

Choose a reason for hiding this comment

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

So, I thought about this a bit and I'm not actually a huge fan of the siblings solution. It's clever and is probably the minimal diff or something but it requires carefully inspecting the HTML to figure out what things are siblings, etc. I would prefer a more explicit approach, e.g.

hiding/showing #translateText *:not(#translateOptionsContainer), #translateOptions *:not(#markUnknownContainer)?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure. I would get on with this approach.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

@@ -147,6 +147,9 @@ if(modeEnabled('translation')) {
if($('div#translateText').is(':visible')) {
translateText();
}
else if($('div#docTranslation').is(':visible')) {
translateDoc();
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Um, I am not sure why this is appearing in the diff here :/ . I simply did a git rebase with master. Do you suggest making a separate PR? (The below snippet has the changes that you asked to do @sushain97 )!

Copy link
Member

Choose a reason for hiding this comment

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

Hm, maybe you're rebasing with your master instead of origin/master? I think these changes are separate so we don't want to merge them.

Copy link
Contributor Author

@share-with-me share-with-me Aug 2, 2017

Choose a reason for hiding this comment

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

Um, I did a git fetch origin, git rebase origin/master. I am not sure why it still exists. Is it okay if I create a new PR?

@@ -147,6 +147,9 @@ if(modeEnabled('translation')) {
if($('div#translateText').is(':visible')) {
translateText();
}
else if($('div#docTranslation').is(':visible')) {
translateDoc();
}
Copy link
Member

Choose a reason for hiding this comment

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

Hm, maybe you're rebasing with your master instead of origin/master? I think these changes are separate so we don't want to merge them.

@share-with-me
Copy link
Contributor Author

Closing here and continuing on #180

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Mark unknown is sent with document translation
2 participants