-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c3eddeb
commit cc99e0b
Showing
1 changed file
with
0 additions
and
106 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,106 +0,0 @@ | ||
{% set locales = app['translate.config'].getLocales() %} | ||
{% set currentkey = locales|keys|first %} | ||
{% set current = locales|first %} | ||
{% set translatable = [] %} | ||
|
||
{% for name, field in context.contenttype.fields %} | ||
{% if field.is_translateable is defined and field.is_translateable == true %} | ||
{% set translatable = translatable|merge(['#'~name, '[name="'~name~'"]', '[name^="'~name~'[0]"]', '[name="'~name~'[file]"]']) %} | ||
{% endif %} | ||
{% endfor %} | ||
|
||
{% for key, option in locales %} | ||
{% set current = option.get('slug') == app['translate.slug'] ? option : current %} | ||
{% set currentkey = option.get('slug') == app['translate.slug'] ? key : currentkey %} | ||
{% endfor %} | ||
<input name="_locale" type="hidden" value="{{current.get('slug')}}"> | ||
<input name="no_locale_hydrate" type="hidden" value="true"> | ||
|
||
<fieldset class="locale"> | ||
<div class="col-sm-12"> | ||
{% if app.request.get('id') is not empty %} | ||
<div class="dropdown pull-right" id="locale-select"> | ||
<button class="btn btn-default dropdown-toggle" data-toggle="dropdown" type="button"> | ||
<span class="selected">{{ current.get('label') }}</span> | ||
<span class="caret"></span> | ||
</button> | ||
<ul class="dropdown-menu"> | ||
{% for key, option in locales %} | ||
<li> | ||
<a href="{{ url( | ||
app.request.get('_route'), | ||
app.request.get('_route_params')|merge({_locale: option.get('slug') }) | ||
)}}">{{ option.get('label') }}</a> | ||
</li> | ||
{% endfor %} | ||
</ul> | ||
</div> | ||
{% endif %} | ||
</div> | ||
</fieldset> | ||
|
||
<script> | ||
$(function() { | ||
// Prepend translation icons to translatable fields. | ||
$('{{translatable|join(",")|raw}}') | ||
.closest('[data-bolt-fieldset]') | ||
.each(function(i, el){ | ||
$(el).find('label') | ||
.first() | ||
.prepend('<i class="fa fa-language icon"></i> '); | ||
}); | ||
// Move locale switcher to tab navigation | ||
$("#locale-select") | ||
.detach() | ||
.appendTo('#filtertabs'); | ||
// Fix preview link | ||
$('#sidebarpreviewbutton') | ||
.attr( | ||
'data-url', | ||
"{{ path('preview', {'contenttypeslug': context.contenttype.singular_slug, _locale: current.get('slug')}) }}" | ||
); | ||
{% if context.content.slug|default(false) %} | ||
// Fix "view saved" link | ||
$('[href="{{ context.content.link }}"]') | ||
.attr( | ||
'href', | ||
"{{ path('contentlink', {'contenttypeslug': context.contenttype.singular_slug, slug: context.content.slug, _locale: current.get('slug')}) }}" | ||
); | ||
{% endif %} | ||
}); | ||
</script> | ||
|
||
<style> | ||
#locale-select button { | ||
border-radius: 4px 4px 0 0; | ||
padding: 5px 12px; | ||
line-height: 1.42857; | ||
margin-bottom: -1px; | ||
} | ||
#locale-select button a { | ||
border: 0; | ||
background-color: transparent!important; | ||
} | ||
#locale-select .dropdown-menu > li { | ||
margin-left: 0; | ||
} | ||
#locale-select .dropdown-menu > li > a { | ||
padding: 3px 20px; | ||
color: #333; | ||
background-color: transparent; | ||
border: 0; | ||
} | ||
#locale-select .dropdown-menu > li > a:hover { | ||
background-color: #DDD !important; | ||
} | ||
#locale-select .dropdown-menu > .disabled > a { | ||
color: #777; | ||
cursor: default; | ||
} | ||
#locale-select .dropdown-menu > .disabled > a:hover { | ||
background-color: transparent !important; | ||
} | ||
</style> | ||