Skip to content

Commit

Permalink
Merge pull request #211 from plone/master-fix-issue-184
Browse files Browse the repository at this point in the history
Really don't show the Google Translate button when no API key set
  • Loading branch information
jensens committed Mar 7, 2016
2 parents 2bac9b4 + ea4821c commit 059ebac
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 15 deletions.
5 changes: 3 additions & 2 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ New:

Fixes:

- *add item here*

- Really don't show the Google Translate button when no API key set
[djowett]

3.0.15 (2016-03-01)
-------------------
Expand All @@ -26,6 +26,7 @@ Fixes:
[djowett]



3.0.14 (2016-02-25)
-------------------

Expand Down
5 changes: 0 additions & 5 deletions src/plone/app/multilingual/browser/add.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,11 +120,6 @@ class MultilingualAddForm(DefaultAddForm):

group_class = MultilingualAddFormGroup

def gtenabled(self):
registry = getUtility(IRegistry)
settings = registry.forInterface(IMultiLanguageExtraOptionsSchema, prefix="plone")
return settings.google_translation_key != ''

def portal_url(self):
portal_tool = getToolByName(self.context, 'portal_url', None)
if portal_tool is not None:
Expand Down
5 changes: 0 additions & 5 deletions src/plone/app/multilingual/browser/edit.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,6 @@ class MultilingualEditForm(DefaultEditForm):

babel = ViewPageTemplateFile("templates/dexterity_edit.pt")

def gtenabled(self):
registry = getUtility(IRegistry)
settings = registry.forInterface(IMultiLanguageExtraOptionsSchema, prefix="plone")
return settings.google_translation_key != ''

def languages(self):
""" Deprecated """
context = aq_inner(self.context)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@
sync_element_vertically(original_field, destination_field, padding, index === 0);

// Add the google translation field
if ($('#gtanslate_service').attr('value') === "True" && ((original_field.find('.richtext-field, .textline-field, .text-field, .localstatic-field, .ArchetypesField-TextField').length > 0) || ($('#at-babel-edit').length > 0))) {
if ($('#gtranslate_service_available').attr('value') === "True" && ((original_field.find('.richtext-field, .textline-field, .text-field, .localstatic-field, .ArchetypesField-TextField').length > 0) || ($('#at-babel-edit').length > 0))) {
original_field.prepend("<div class='translator-widget' id='item_translation_" + order + "'></div>");
original_field.children('.translator-widget').click(function () {
var field = $(value).attr("rel");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

<script src="++resource++plone.app.multilingual.javascript/babel_helper.js"></script>
<input type="hidden" id="url_translate" value="" tal:attributes="value context/absolute_url"/>
<input type="hidden" id="gtanslate_service" value="" tal:attributes="value view/gtenabled"/>
<input type="hidden" id="gtranslate_service_available" value="" tal:attributes="value pamutils/gtenabled"/>
<div class='col-md-6'>
<h1 i18n:translate="heading_available_translations">Available translations for this content</h1>
<div id="trans-selector"
Expand Down Expand Up @@ -47,4 +47,3 @@
</div>
</div>
</div>

0 comments on commit 059ebac

Please sign in to comment.