Release v0.2.2: Added duplicate content buttons to translated StreamFieldPanels;

This commit is contained in:
Rui Manuel da Silva Martins 2015-08-12 15:20:54 +01:00
parent 82a76f423e
commit 8f604e87ab
8 changed files with 31 additions and 7 deletions

View file

@ -8,6 +8,7 @@ Core Committers
* Diogo Marques
* Rui Martins
* Eduardo Nogueira
Contributors
------------

View file

@ -1,3 +1,6 @@
v0.2.2:
- Added duplicate content buttons to translated StreamFieldPanels;
v0.2.1:
- Fixed missing templatetags folder on pypi package;

View file

@ -1,10 +1,9 @@
Metadata-Version: 1.0
Name: wagtail-modeltranslation
Version: 0.2.1
Version: 0.2.2
Summary: Translates Wagtail CMS models using a registration approach.
Home-page: https://github.com/infoportugal/wagtail-modeltranslation
Author: Diogo Marques,
Rui Martins,
Author: Diogo Marques, Eduardo Nogueira, Rui Martins
Author-email: ...
License: New BSD
Description: The modeltranslation application can be used to translate dynamic

View file

@ -4,7 +4,7 @@ from distutils.core import setup
setup(
name='wagtail-modeltranslation',
version='0.2.1',
version='0.2.2',
description='Translates Wagtail CMS models using a registration approach.',
long_description=(
'The modeltranslation application can be used to translate dynamic '
@ -23,7 +23,7 @@ setup(
package_data={'wagtail_modeltranslation': ['static/modeltranslation/css/*.css',
'static/modeltranslation/js/*.js']},
requires=['django(>=1.7)', 'wagtail(>=1.0)'],
download_url='https://github.com/infoportugal/wagtail-modeltranslation/archive/v0.2.1.tar.gz',
download_url='https://github.com/infoportugal/wagtail-modeltranslation/archive/v0.2.2.tar.gz',
classifiers=[
'Programming Language :: Python',
'Programming Language :: Python :: 2.6',

Binary file not shown.

View file

@ -0,0 +1,12 @@
.translation-field-copy-wrapper{
float: right;
margin-right: 20px;
}
.translation-field-copy-wrapper > button{
width: 30px;
height: 30px;
line-height: 30px;
text-align: center;
padding: 0;
margin-left: 10px;
}

View file

@ -15,11 +15,13 @@ $(document).ready(function(){
var fieldName = fieldInfos.split('_')[0];
var fieldLang = fieldInfos.split('_')[1];
//The cycle to create the buttons for copy each language field
var copyContentString = 'Copy content from';
header.innerHTML += '<div class="translation-field-copy-wrapper">'+copyContentString+': </div>';
for (var j = 0; j < langs.length; j++) {
if (fieldLang != langs[j]) {
var currentFieldID = fieldName + '_' + fieldLang;
var targetFieldID = fieldName + '_' + langs [j];
header.innerHTML += '<button class="translation-field-copy" current-lang-code="'+ currentFieldID +'" data-lang-code="'+ targetFieldID +'">'+langs[j]+'</button>';
$(header).children('.translation-field-copy-wrapper')[0].innerHTML += '<button class="translation-field-copy" current-lang-code="'+ currentFieldID +'" data-lang-code="'+ targetFieldID +'">'+langs[j]+'</button>';
};
};
};

View file

@ -98,7 +98,7 @@ def streamfields_translation_copy():
and send a ajax request to copy the content.
"""
# includes the java script file in the html file
# includes the javascript file in the html file
js_files = [
'modeltranslation/js/copy_stream_fields.js',
]
@ -108,3 +108,10 @@ def streamfields_translation_copy():
)
return js_includes
@hooks.register('insert_editor_css')
def modeltranslation_page_editor_css():
return format_html('<link rel="stylesheet" href="' \
+ settings.STATIC_URL \
+ 'modeltranslation/css/page_editor_modeltranslation.css" >')