Commit 0a4f3405 authored by Raph El's avatar Raph El

Modif ajout d'un btn pour desactivité tout les mails de la communauté

parent cb67b637
......@@ -75,6 +75,26 @@ var settings = {
$("#mails-settings .changeValueDrop").text(tradLabel[preferences.mails]);
}
},
initNotificationsCommunity: function(preferences){
if(typeof preferences.mailsCommunity != "undefined"){
// $("#mailsCommunity-settings .changeValueDrop").text(tradLabel[preferences.mailsCommunity]);
settings.showNotifCommunity(preferences.mailsCommunity);
}
},
showNotifCommunity : function (value){
console.log("showNotifCommunity", value);
if(value == "desactivated"){
$("#community-settings-list").hide();
$("#settingsScrollByType").hide();
$("#search-in-settings").hide();
} else {
$("#community-settings-list").show();
$("#settingsScrollByType").show();
$("#search-in-settings").show();
}
$("#mailsCommunity-settings").html(tradSettings[value]);
},
settingsCommunityEvents : function(){
$(".settingsCommunity").off().on("click", function() {
settings.savePreferencesNotification($(this).data("settings"),$(this).data("value"), $(this).data("type"), $(this).data("id"));
......@@ -95,6 +115,14 @@ var settings = {
$("#btnSettingsInfos").off().on("click",function(){
$("#modalExplainSettings").modal("show");
});
$(".settingsEmailCommunity").off().on("click", function() {
console.log("settingsEmailCommunity", $(this).data("settings"), $(this).data("value"), $(this).data("type"), $(this).data("id") ) ;
settings.showNotifCommunity($(this).data("value"));
settings.savePreferencesNotification("mailsCommunity", $(this).data("value"), $(this).data("type"), $(this).data("id"));
//$(this).parents().eq(2).find(".dropdown-settings .changeValueDrop").html(tradSettings[$(this).data("value")]);
});
},
//recherche text par nom, cp, city, slug
filterSettingsCommunity: function(searchVal){
......
......@@ -40,7 +40,8 @@ class SettingsController extends CommunecterController {
echo $this->renderPartial("confidentialityCommunity", array(), true);
}
public function actionNotificationsCommunity(){
echo $this->renderPartial("notificationsCommunity", array(), true);
$element=Element::getElementSimpleById(Yii::app()->session["userId"], Person::COLLECTION, null, array("preferences"));
echo $this->renderPartial("notificationsCommunity", array("preferences"=>$element["preferences"]), true);
}
public function actionMyAccount($type=null,$id=null){
......
......@@ -18,20 +18,19 @@ HtmlHelper::registerCssAndScriptsFiles($cssAnsScriptFilesTheme, Yii::app()->requ
<div class="settings-header">
<h4 class="title"><i class="fa fa-bell"></i> <?php echo Yii::t("settings", "Settings on your community's notifications") ?></h4>
</div>
Désactivivé les mails :
<div class="dropdown no-padding col-xs-6 margin-bottom-20 margin-top-20">
<a data-toggle="dropdown" class="btn btn-default col-md-12 col-sm-12 col-xs-12 dropdown-settings" href="javascript:;">
<span class="changeValueDrop"><?php echo Yii::t("settings", "By default") ?></span> <i class="fa fa-caret-down" style="font-size:inherit;"></i>
<div class="dropdown padding-10 col-xs-12 margin-bottom-20 ">
<h5>Recevoir des mails en rapport à votre communautés </h5>
<a data-toggle="dropdown" class="btn btn-default col-sm-6 col-xs-12 dropdown-settings" href="javascript:;">
<span id="mailsCommunity-settings" class="changeValueDrop"><?php echo Yii::t("settings", "Activated") ?></span> <i class="fa fa-caret-down" style="font-size:inherit;"></i>
</a>
<ul class="dropdown-menu" role="menu" aria-labelledby="dLabel">
<li>
<a href="javascript:;" class="settingsCommunity" data-settings="mails" data-value="desactivated"s data-id="<?php echo Yii::app()->session["userId"] ?>">
<a href="javascript:;" class="settingsEmailCommunity" data-settings="mailsCommunity" data-value="desactivated" data-id="<?php echo Yii::app()->session["userId"] ?>" data-type="<?php echo Person::COLLECTION ?>">
<h4 class="list-group-item-heading"><i class="fa fa-ban"></i> <?php echo Yii::t("settings", "Desactivated") ?></h4>
<p class="list-group-item-text small"><?php echo Yii::t("settings", "Desactivate all email notifications about your account activity") ?></p>
</a>
<a href="javascript:;" class="settingsCommunity" data-settings="mails" data-value="activated" data-id="<?php echo Yii::app()->session["userId"] ?>">
<a href="javascript:;" class="settingsEmailCommunity" data-settings="mailsCommunity" data-value="activated" data-id="<?php echo Yii::app()->session["userId"] ?>" data-type="<?php echo Person::COLLECTION ?>">
<h4 class="list-group-item-heading"><i class="fa fa-ban"></i> <?php echo Yii::t("settings", "Activated") ?></h4>
<p class="list-group-item-text small"><?php echo Yii::t("settings", "Activer email notifications about your account activity") ?></p>
......@@ -98,7 +97,9 @@ HtmlHelper::registerCssAndScriptsFiles($cssAnsScriptFilesTheme, Yii::app()->requ
</div>
<script type="text/javascript">
var preferences=<?php echo json_encode(@$preferences) ?>;
jQuery(document).ready(function() {
settings.initNotificationsCommunity(preferences);
settings.getCommunitySettings("notifications");
if(searchInCommunity!=""){
$("#search-in-settings").val(searchInCommunity);
......
......@@ -1249,6 +1249,7 @@ var tradTags = {
var tradSettings = {
"notificationsSettingsSuccess" : "<?php echo Yii::t("settings","Notifications settings well updated") ?>",
"desactivated" : "<?php echo Yii::t("settings","Desactivated") ?>",
"activated" : "<?php echo Yii::t("settings","Activated") ?>",
"low" : "<?php echo Yii::t("settings","Low") ?>",
"bydefault" : "<?php echo Yii::t("settings","By default") ?>",
"default" : "<?php echo Yii::t("settings","By default") ?>",
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment