Skip to content

Commit

Permalink
Criado componente para carregar o warning Ref.: #1
Browse files Browse the repository at this point in the history
  • Loading branch information
israelmelo committed Sep 5, 2024
1 parent 6f2138a commit 6d49c02
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 0 deletions.
11 changes: 11 additions & 0 deletions assets/css/admin-spam-warning.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
.spam-warning {
position: relative;
top: 20px;
text-align: center;
z-index: 1000;
padding: 10px;
}

.spam-warning input[type="checkbox"] {
margin-left: 10px;
}
27 changes: 27 additions & 0 deletions components/spam-warning/script.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
app.component('spam-warning', {
template: $TEMPLATES['spam-warning'],

props: {
entity: {
type: Entity,
required: true,
},
},

data() {
return {
spamStatus: this.entity?.spam_status ?? true
}
},

methods: {
setSpamStatus() {
this.entity.spam_status = this.spamStatus;
this.entity.save();
}
},

mounted() {
console.log("ENTITY =>", this.entity);
}
});
20 changes: 20 additions & 0 deletions components/spam-warning/template.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?php
/**
* @var MapasCulturais\App $app
* @var MapasCulturais\Themes\BaseV2\Theme $this
*/
use MapasCulturais\i;

$this->import('
mc-alert
');
?>

<div class="spam-warning">
<mc-alert type="warning" class="spam-warning">
<label>
<?= i::__('Um termo de spam foi detectado.') ?>
<input type="checkbox" v-model="spamStatus" @change="setSpamStatus"/><?= i::__('Classificar como Spam') ?>
</label>
</mc-alert>
</div>

0 comments on commit 6d49c02

Please sign in to comment.