Browse Source

publish muk_web_utils - 12.0

pull/35/head
MuK IT GmbH 6 years ago
parent
commit
39bfb1bc10
  1. 1
      muk_web_utils/static/src/js/core/files.js
  2. 35
      muk_web_utils/static/src/js/services/notification_service.js
  3. 46
      muk_web_utils/static/src/js/widgets/notification.js
  4. 27
      muk_web_utils/static/src/scss/notification.scss
  5. 34
      muk_web_utils/static/src/xml/notification.xml
  6. 19
      muk_web_utils/template/assets.xml

1
muk_web_utils/static/src/js/core/files.js

@ -21,7 +21,6 @@ odoo.define('muk_web_utils.files', function (require) {
"use strict"; "use strict";
var core = require('web.core'); var core = require('web.core');
var utils = require('web.utils');
var QWeb = core.qweb; var QWeb = core.qweb;
var _t = core._t; var _t = core._t;

35
muk_web_utils/static/src/js/services/notification_service.js

@ -0,0 +1,35 @@
/**********************************************************************************
*
* Copyright (C) 2017 MuK IT GmbH
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
**********************************************************************************/
odoo.define('muk_web_utils.NotificationService', function (require) {
"use strict";
var NotificationService = require('web.NotificationService');
NotificationService.include({
progress: function (notificationId, progress) {
console.log(this)
if(notificationId in this.notifications) {
var notification = this.notifications[notificationId];
notification.updateProgress(progress.state, progress.text);
}
},
});
});

46
muk_web_utils/static/src/js/widgets/notification.js

@ -0,0 +1,46 @@
/**********************************************************************************
*
* Copyright (C) 2017 MuK IT GmbH
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
**********************************************************************************/
odoo.define('muk_web_utils.Notification', function (require) {
"use strict";
var core = require('web.core');
var Notification = require('web.Notification');
var _t = core._t;
var QWeb = core.qweb;
Notification.include({
init: function (parent, params) {
this._super.apply(this, arguments);
this.icon = params.icon || this.icon;
this.progress = params.progress;
},
updateProgress: function(state, text) {
console.log(state, text)
this.progress = {state: state, text: text};
this.$(".progress-bar").animate({
width: state + "%",
}, 250);
this.$(".progress-bar").text(text);
},
});
});

27
muk_web_utils/static/src/scss/notification.scss

@ -0,0 +1,27 @@
/**********************************************************************************
*
* Copyright (C) 2017 MuK IT GmbH
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
**********************************************************************************/
.o_notification {
.mk_notification_progress {
padding: 2px 10px 10px 10px;
.progress {
background-color: rgba(0, 0, 0, 0.3);
}
}
}

34
muk_web_utils/static/src/xml/notification.xml

@ -0,0 +1,34 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (C) 2018 MuK IT GmbH
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
-->
<templates id="template" xml:space="preserve">
<t t-extend="Notification">
<t t-jquery=".o_notification_content" t-operation="after">
<div t-if="widget.progress" class="mk_notification_progress">
<div class="progress">
<div class="progress-bar" t-attf-style="width: #{widget.progress.state}%;">
<t t-esc="widget.progress.text"/>
</div>
</div>
</div>
</t>
</t>
</templates>

19
muk_web_utils/template/assets.xml

@ -37,16 +37,19 @@
<link rel="stylesheet" type="text/scss" href="/muk_web_utils/static/src/scss/module.scss" /> <link rel="stylesheet" type="text/scss" href="/muk_web_utils/static/src/scss/module.scss" />
<link rel="stylesheet" type="text/scss" href="/muk_web_utils/static/src/scss/copy.scss" /> <link rel="stylesheet" type="text/scss" href="/muk_web_utils/static/src/scss/copy.scss" />
<link rel="stylesheet" type="text/scss" href="/muk_web_utils/static/src/scss/share.scss" /> <link rel="stylesheet" type="text/scss" href="/muk_web_utils/static/src/scss/share.scss" />
<link rel="stylesheet" type="text/scss" href="/muk_web_utils/static/src/scss/notification.scss" />
</xpath> </xpath>
<xpath expr="//script[last()]" position="after"> <xpath expr="//script[last()]" position="after">
<script type="text/javascript" src="/muk_web_utils/static/src/js/libs/jquery.js"></script>
<script type="text/javascript" src="/muk_web_utils/static/src/js/core/utils.js"></script>
<script type="text/javascript" src="/muk_web_utils/static/src/js/core/files.js"></script>
<script type="text/javascript" src="/muk_web_utils/static/src/js/core/dropzone.js"></script>
<script type="text/javascript" src="/muk_web_utils/static/src/js/fields/module.js"></script>
<script type="text/javascript" src="/muk_web_utils/static/src/js/fields/copy.js"></script>
<script type="text/javascript" src="/muk_web_utils/static/src/js/fields/share.js"></script>
<script type="text/javascript" src="/muk_web_utils/static/src/js/views/form/renderer.js"></script>
<script type="text/javascript" src="/muk_web_utils/static/src/js/libs/jquery.js" />
<script type="text/javascript" src="/muk_web_utils/static/src/js/core/utils.js" />
<script type="text/javascript" src="/muk_web_utils/static/src/js/core/files.js" />
<script type="text/javascript" src="/muk_web_utils/static/src/js/core/dropzone.js" />
<script type="text/javascript" src="/muk_web_utils/static/src/js/fields/module.js" />
<script type="text/javascript" src="/muk_web_utils/static/src/js/fields/copy.js" />
<script type="text/javascript" src="/muk_web_utils/static/src/js/fields/share.js" />
<script type="text/javascript" src="/muk_web_utils/static/src/js/widgets/notification.js" />
<script type="text/javascript" src="/muk_web_utils/static/src/js/views/form/renderer.js" />
<script type="text/javascript" src="/muk_web_utils/static/src/js/services/notification_service.js" />
</xpath> </xpath>
</template> </template>
Loading…
Cancel
Save