Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Merge pull request #121 from 4teamwork/ne/fix-plone5-languageselector
Fix plone 4 / 5 language selector dropdown
- Loading branch information
Showing
16 changed files
with
122 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
*-compiled.css -diff linguist-vendored | ||
*-compiled.js -diff linguist-vendored |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
({ | ||
baseUrl: "./ftw/subsite/browser/resources", | ||
paths: { | ||
jquery: "empty:", | ||
subsite_dropdown: "dropdown", | ||
}, | ||
name: "main", | ||
out: "./ftw/subsite/browser/resources/subsite-compiled.js", | ||
// Uncomment the line below for JS development | ||
// optimize: "none", | ||
}) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
(function (root, factory) { | ||
if (typeof define === 'function' && define.amd) { | ||
// AMD. Register as an anonymous module. (Plone 5 with requirejs) | ||
define(['jquery'], factory); | ||
} else { | ||
// Browser globals (Plone 4 without requirejs) | ||
factory(root.jQuery); | ||
} | ||
}(typeof self !== 'undefined' ? self : this, function ($) { | ||
function hide() { | ||
$('[id="portal-languageselector"]').removeClass('activated').addClass('deactivated'); | ||
} | ||
|
||
function toggle() { | ||
$(this).parents('#portal-languageselector').toggleClass('activated').toggleClass('deactivated'); | ||
return false; | ||
} | ||
|
||
function hideOnOutsideClick(event) { | ||
if ($(event.target).parents('#portal-languageselector').length === 0) { | ||
hide(); | ||
} | ||
} | ||
|
||
function initializeMenu() { | ||
hide(); | ||
|
||
$(document).on('mousedown', hideOnOutsideClick); | ||
|
||
$('#portal-languageselector .actionMenuHeader a').on('click', toggle) | ||
$('#portal-languageselector .actionMenuContent').on('click', hide); | ||
} | ||
|
||
$(initializeMenu); | ||
})); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
require(['subsite_dropdown'], function (dropdown) {}); |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<?xml version="1.0"?> | ||
<object name="portal_javascripts"> | ||
|
||
<javascript | ||
id="++resource++ftw.subsite-resources/dropdown.js" | ||
compression="safe" | ||
authenticated="False" | ||
enabled="True" | ||
/> | ||
|
||
</object> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<?xml version="1.0"?> | ||
<object name="portal_javascripts"> | ||
|
||
<javascript | ||
id="++resource++ftw.subsite-resources/dropdown.js" | ||
remove="True" /> | ||
|
||
</object> | ||
|
Empty file.
12 changes: 12 additions & 0 deletions
12
ftw/subsite/upgrades/20191219135547_fix_languageselector_dropdown/jsregistry.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<?xml version="1.0"?> | ||
<object name="portal_javascripts"> | ||
|
||
<javascript | ||
id="++resource++ftw.subsite-resources/dropdown.js" | ||
compression="safe" | ||
authenticated="False" | ||
enabled="True" | ||
/> | ||
|
||
</object> | ||
|
16 changes: 16 additions & 0 deletions
16
ftw/subsite/upgrades/20191219135547_fix_languageselector_dropdown/registry.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?xml version="1.0"?> | ||
<registry> | ||
|
||
<records prefix="plone.bundles/ftw-subsite-resources" interface='Products.CMFPlone.interfaces.IBundleRegistry'> | ||
<value key="enabled">True</value> | ||
<value key="depends">plone</value> | ||
<value key="stub_js_modules">jquery</value> | ||
<value key="compile">False</value> | ||
<value key="csscompilation">++resource++ftw.subsite-resources/subsite-compiled.css</value> | ||
<value key="jscompilation">++resource++ftw.subsite-resources/subsite-compiled.js</value> | ||
<value key="merge_with">default</value> | ||
<value key="last_compilation">2019-12-07 15:25:00</value> | ||
<value key="merge_with">default</value> | ||
</records> | ||
|
||
</registry> |
13 changes: 13 additions & 0 deletions
13
ftw/subsite/upgrades/20191219135547_fix_languageselector_dropdown/upgrade.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
from ftw.subsite import IS_PLONE_5 | ||
from ftw.upgrade import UpgradeStep | ||
|
||
|
||
class FixLanguageselectorDropdown(UpgradeStep): | ||
"""Fix languageselector dropdown. | ||
""" | ||
|
||
def __call__(self): | ||
if IS_PLONE_5: | ||
self.install_upgrade_profile(['plone.app.registry']) | ||
else: | ||
self.install_upgrade_profile(['jsregistry']) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters