mirror of https://github.com/OCA/web.git
[FIX + ADD] fix markdown update condition on form view, add markdown support on list view
parent
43a9c38ba3
commit
0a07b2e825
|
@ -0,0 +1,26 @@
|
|||
# Translation of Odoo Server.
|
||||
# This file contains the translation of the following modules:
|
||||
# * web_widget_text_markdown
|
||||
#
|
||||
# Translators:
|
||||
# SaFi J. <safi2266@gmail.com>, 2015
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: web (8.0)\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2015-12-16 07:41+0000\n"
|
||||
"PO-Revision-Date: 2015-12-16 17:24+0000\n"
|
||||
"Last-Translator: SaFi J. <safi2266@gmail.com>\n"
|
||||
"Language-Team: Arabic (http://www.transifex.com/oca/OCA-web-8-0/language/ar/)\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: \n"
|
||||
"Language: ar\n"
|
||||
"Plural-Forms: nplurals=6; plural=n==0 ? 0 : n==1 ? 1 : n==2 ? 2 : n%100>=3 && n%100<=10 ? 3 : n%100>=11 && n%100<=99 ? 4 : 5;\n"
|
||||
|
||||
#. module: web_widget_text_markdown
|
||||
#. openerp-web
|
||||
#: code:addons/web_widget_text_markdown/static/src/js/web_widget_text_markdown.js:12
|
||||
#, python-format
|
||||
msgid "MarkDown"
|
||||
msgstr "مارك داون"
|
|
@ -0,0 +1,26 @@
|
|||
# Translation of Odoo Server.
|
||||
# This file contains the translation of the following modules:
|
||||
# * web_widget_text_markdown
|
||||
#
|
||||
# Translators:
|
||||
# Rudolf Schnapka <rs@techno-flex.de>, 2016
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: web (8.0)\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2016-01-10 07:31+0000\n"
|
||||
"PO-Revision-Date: 2016-01-18 20:15+0000\n"
|
||||
"Last-Translator: Rudolf Schnapka <rs@techno-flex.de>\n"
|
||||
"Language-Team: German (http://www.transifex.com/oca/OCA-web-8-0/language/de/)\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: \n"
|
||||
"Language: de\n"
|
||||
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
||||
|
||||
#. module: web_widget_text_markdown
|
||||
#. openerp-web
|
||||
#: code:addons/web_widget_text_markdown/static/src/js/web_widget_text_markdown.js:12
|
||||
#, python-format
|
||||
msgid "MarkDown"
|
||||
msgstr "Abschlag"
|
|
@ -0,0 +1,26 @@
|
|||
# Translation of Odoo Server.
|
||||
# This file contains the translation of the following modules:
|
||||
# * web_widget_text_markdown
|
||||
#
|
||||
# Translators:
|
||||
# Pedro M. Baeza <pedro.baeza@gmail.com>, 2015
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: web (8.0)\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2015-11-23 13:46+0000\n"
|
||||
"PO-Revision-Date: 2015-11-07 11:29+0000\n"
|
||||
"Last-Translator: Pedro M. Baeza <pedro.baeza@gmail.com>\n"
|
||||
"Language-Team: Spanish (http://www.transifex.com/oca/OCA-web-8-0/language/es/)\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: \n"
|
||||
"Language: es\n"
|
||||
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
||||
|
||||
#. module: web_widget_text_markdown
|
||||
#. openerp-web
|
||||
#: code:addons/web_widget_text_markdown/static/src/js/web_widget_text_markdown.js:12
|
||||
#, python-format
|
||||
msgid "MarkDown"
|
||||
msgstr "MarkDown"
|
|
@ -0,0 +1,26 @@
|
|||
# Translation of Odoo Server.
|
||||
# This file contains the translation of the following modules:
|
||||
# * web_widget_text_markdown
|
||||
#
|
||||
# Translators:
|
||||
# Jarmo Kortetjärvi <jarmo.kortetjarvi@gmail.com>, 2016
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: web (8.0)\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2016-01-10 07:31+0000\n"
|
||||
"PO-Revision-Date: 2016-02-01 09:42+0000\n"
|
||||
"Last-Translator: Jarmo Kortetjärvi <jarmo.kortetjarvi@gmail.com>\n"
|
||||
"Language-Team: Finnish (http://www.transifex.com/oca/OCA-web-8-0/language/fi/)\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: \n"
|
||||
"Language: fi\n"
|
||||
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
||||
|
||||
#. module: web_widget_text_markdown
|
||||
#. openerp-web
|
||||
#: code:addons/web_widget_text_markdown/static/src/js/web_widget_text_markdown.js:12
|
||||
#, python-format
|
||||
msgid "MarkDown"
|
||||
msgstr "Markdown"
|
|
@ -0,0 +1,26 @@
|
|||
# Translation of Odoo Server.
|
||||
# This file contains the translation of the following modules:
|
||||
# * web_widget_text_markdown
|
||||
#
|
||||
# Translators:
|
||||
# Christophe CHAUVET <christophe.chauvet@gmail.com>, 2016
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: web (8.0)\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2016-05-06 15:50+0000\n"
|
||||
"PO-Revision-Date: 2016-05-06 08:22+0000\n"
|
||||
"Last-Translator: Christophe CHAUVET <christophe.chauvet@gmail.com>\n"
|
||||
"Language-Team: French (http://www.transifex.com/oca/OCA-web-8-0/language/fr/)\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: \n"
|
||||
"Language: fr\n"
|
||||
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
|
||||
|
||||
#. module: web_widget_text_markdown
|
||||
#. openerp-web
|
||||
#: code:addons/web_widget_text_markdown/static/src/js/web_widget_text_markdown.js:12
|
||||
#, python-format
|
||||
msgid "MarkDown"
|
||||
msgstr "MarkDown"
|
|
@ -0,0 +1,26 @@
|
|||
# Translation of Odoo Server.
|
||||
# This file contains the translation of the following modules:
|
||||
# * web_widget_text_markdown
|
||||
#
|
||||
# Translators:
|
||||
# danimaribeiro <danimaribeiro@gmail.com>, 2016
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: web (8.0)\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2016-03-11 02:18+0000\n"
|
||||
"PO-Revision-Date: 2016-03-05 16:20+0000\n"
|
||||
"Last-Translator: danimaribeiro <danimaribeiro@gmail.com>\n"
|
||||
"Language-Team: Portuguese (Brazil) (http://www.transifex.com/oca/OCA-web-8-0/language/pt_BR/)\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: \n"
|
||||
"Language: pt_BR\n"
|
||||
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
|
||||
|
||||
#. module: web_widget_text_markdown
|
||||
#. openerp-web
|
||||
#: code:addons/web_widget_text_markdown/static/src/js/web_widget_text_markdown.js:12
|
||||
#, python-format
|
||||
msgid "MarkDown"
|
||||
msgstr "MarkDown"
|
|
@ -0,0 +1,26 @@
|
|||
# Translation of Odoo Server.
|
||||
# This file contains the translation of the following modules:
|
||||
# * web_widget_text_markdown
|
||||
#
|
||||
# Translators:
|
||||
# Matjaž Mozetič <m.mozetic@matmoz.si>, 2015
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: web (8.0)\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2015-11-23 13:46+0000\n"
|
||||
"PO-Revision-Date: 2015-11-08 05:48+0000\n"
|
||||
"Last-Translator: Matjaž Mozetič <m.mozetic@matmoz.si>\n"
|
||||
"Language-Team: Slovenian (http://www.transifex.com/oca/OCA-web-8-0/language/sl/)\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: \n"
|
||||
"Language: sl\n"
|
||||
"Plural-Forms: nplurals=4; plural=(n%100==1 ? 0 : n%100==2 ? 1 : n%100==3 || n%100==4 ? 2 : 3);\n"
|
||||
|
||||
#. module: web_widget_text_markdown
|
||||
#. openerp-web
|
||||
#: code:addons/web_widget_text_markdown/static/src/js/web_widget_text_markdown.js:12
|
||||
#, python-format
|
||||
msgid "MarkDown"
|
||||
msgstr "MarkDown"
|
|
@ -0,0 +1,26 @@
|
|||
# Translation of Odoo Server.
|
||||
# This file contains the translation of the following modules:
|
||||
# * web_widget_text_markdown
|
||||
#
|
||||
# Translators:
|
||||
# Ahmet Altınışık <aaltinisik@altinkaya.com.tr>, 2016
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: web (8.0)\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2016-01-10 07:31+0000\n"
|
||||
"PO-Revision-Date: 2016-01-31 11:44+0000\n"
|
||||
"Last-Translator: Ahmet Altınışık <aaltinisik@altinkaya.com.tr>\n"
|
||||
"Language-Team: Turkish (http://www.transifex.com/oca/OCA-web-8-0/language/tr/)\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: \n"
|
||||
"Language: tr\n"
|
||||
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
|
||||
|
||||
#. module: web_widget_text_markdown
|
||||
#. openerp-web
|
||||
#: code:addons/web_widget_text_markdown/static/src/js/web_widget_text_markdown.js:12
|
||||
#, python-format
|
||||
msgid "MarkDown"
|
||||
msgstr "MarkDown"
|
|
@ -39,16 +39,17 @@ openerp.web_widget_text_markdown = function (oe) {
|
|||
|
||||
store_dom_value: function () {
|
||||
if (!this.get('effective_readonly') &&
|
||||
this._get_raw_value() !== '' &&
|
||||
this.is_syntax_valid()) {
|
||||
// We use internal_set_value because we were called by
|
||||
// ``.commit_value()`` which is called by a ``.set_value()``
|
||||
// itself called because of a ``onchange`` event
|
||||
this.internal_set_value(
|
||||
this.parse_value(
|
||||
this._get_raw_value()));
|
||||
}
|
||||
},
|
||||
// We use internal_set_value because we were called by
|
||||
// ``.commit_value()`` which is called by a ``.set_value()``
|
||||
// itself called because of a ``onchange`` event
|
||||
this.internal_set_value(
|
||||
this.parse_value(
|
||||
this._get_raw_value()
|
||||
)
|
||||
);
|
||||
}
|
||||
},
|
||||
|
||||
commit_value: function () {
|
||||
this.store_dom_value();
|
||||
|
@ -58,7 +59,7 @@ openerp.web_widget_text_markdown = function (oe) {
|
|||
_get_raw_value: function() {
|
||||
if (this.$txt === false)
|
||||
return '';
|
||||
return this.$txt.val();
|
||||
return this.$txt.val();
|
||||
},
|
||||
|
||||
render_value: function () {
|
||||
|
@ -86,4 +87,35 @@ openerp.web_widget_text_markdown = function (oe) {
|
|||
}
|
||||
}
|
||||
);
|
||||
|
||||
/**
|
||||
* bootstrap_markdown support on list view
|
||||
**/
|
||||
oe.web_widget_text_markdown.FieldTextMarkDownList = oe.web.list.Char.extend({
|
||||
|
||||
init: function(){
|
||||
this._super.apply(this, arguments);
|
||||
hljs.initHighlightingOnLoad();
|
||||
marked.setOptions({
|
||||
sanitize: true,
|
||||
highlight: function (code) {
|
||||
return hljs.highlightAuto(code).value;
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
_format: function(row_data, options){
|
||||
options = options || {};
|
||||
var markdown_text = marked(
|
||||
oe.web.format_value(
|
||||
row_data[this.id].value, this, options.value_if_empty
|
||||
)
|
||||
);
|
||||
return markdown_text;
|
||||
}
|
||||
});
|
||||
|
||||
oe.web.list.columns.add(
|
||||
"field.bootstrap_markdown", "oe.web_widget_text_markdown.FieldTextMarkDownList"
|
||||
);
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue