Changeset 2494716
- Timestamp:
- 03/13/2021 10:04:11 AM (3 years ago)
- Location:
- super-reactions
- Files:
-
- 62 added
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
super-reactions/trunk/admin/assets/dist/css/srea-admin.css
r2461152 r2494716 21 21 flex-basis: 50%; 22 22 background-color: #ffffff; 23 bo x-shadow: 1px 1px 5px 2px#cccccc;23 bo #cccccc; 24 24 padding: 10px; 25 25 align-items: center; … … 36 36 display: grid; 37 37 grid-template-columns: 200px auto; 38 39 38 40 } 39 41 … … 50 52 51 53 .srea-admin-main .srea-tabs .srea-tab.active { 52 background-color: # d5edff;54 background-color: #ff; 53 55 font-weight: bold; 54 56 } … … 62 64 display: flex; 63 65 align-items: center; 64 } 65 66 .srea-admin-main .srea-views .srea-template-selector label { 67 margin-right: 5px; 66 margin: 15px 0; 67 } 68 69 .srea-admin-main .srea-views .srea-template-selector .srea-setting-label { 70 width: 30px; 71 margin-right: 25px; 72 } 73 74 .srea-admin-main .srea-views .srea-template-selector .srea-action-buttons { 75 display: flex; 76 flex-direction: column; 77 justify-content: space-between; 78 align-items: center; 79 height: 60px; 80 width: 100px; 81 } 82 83 .srea-admin-main .srea-views .srea-template-selector .srea-template-selector-btn { 84 display: flex; 85 align-items: center; 86 justify-content: center; 87 width: 60px; 88 height: 25px; 89 border: 1px solid #cccccc; 90 border-radius: 2px; 91 } 92 93 .srea-admin-main .srea-views .srea-template-selector .srea-template-selector-btn:enabled { 94 cursor: pointer; 95 } 96 97 .srea-admin-main .srea-views .srea-template-selector .srea-template-selector-btn.srea-remover:enabled { 98 color: #e24a4a; 99 } 100 101 .srea-admin-main .srea-views .srea-template-selector .preview-wrapper { 102 display: flex; 103 justify-content: center; 104 align-items: center; 105 width: 450px; 106 min-height: 90px; 68 107 } 69 108 … … 76 115 min-height: 130px; 77 116 height: 100%; 117 118 119 120 121 122 123 124 78 125 } 79 126 … … 98 145 color: #ffffff; 99 146 font-weight: 500; 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 100 208 } 101 209 … … 113 221 border-top: 3px solid rgba(66, 66, 66, 0.5); 114 222 border-radius: 50%; 115 width: 1 6px;116 height: 1 6px;117 margin: 3px;223 width: 1px; 224 height: 1px; 225 margin: px; 118 226 animation: spin 1s linear infinite; 119 227 } 120 228 121 .srea-badge-success { 122 background-color: #3c932c; 229 .srea-result-badge { 123 230 color: #ffffff; 124 231 padding: 6px; … … 126 233 line-height: 10px; 127 234 font-size: 13px; 128 margin: 0 5px; 129 } 235 } 236 237 .srea-result-badge.srea-badge-success { 238 background-color: #3c932c; 239 } 240 241 .srea-result-badge.srea-badge-error { 242 background-color: #932c2c; 243 } 244 245 .srea-modal-close-btn { 246 cursor: pointer; 247 position: relative; 248 display: block; 249 width: 30px; 250 height: 30px; 251 border: 2px solid #747474; 252 left: 30px; 253 bottom: 20px; 254 } 255 256 .srea-modal-close-btn::before { 257 content: ''; 258 position: absolute; 259 top: 13px; 260 height: 2px; 261 width: 30px; 262 background-color: #747474; 263 transform: rotate(45deg); 264 } 265 266 .srea-modal-close-btn::after { 267 content: ''; 268 position: absolute; 269 top: 13px; 270 height: 2px; 271 width: 30px; 272 background-color: #747474; 273 transform: rotate(-45deg); 274 } 275 276 .srea-template { 277 display: flex; 278 } 279 280 .srea-template .srea-reaction-item { 281 display: flex; 282 margin-right: 10px; 283 align-items: center; 284 height: 28px; 285 } 286 287 .srea-template .srea-button { 288 cursor: pointer; 289 } 290 291 .srea-template .srea-template-count { 292 width: 23px; 293 text-align: center; 294 font-size: medium; 295 } 296 297 .srea-template .srea-button { 298 outline: none; 299 border: none; 300 background: none; 301 } 302 303 .srea-template .srea-button:focus, .srea-template .srea-button:active, .srea-template .srea-button:hover { 304 outline: none; 305 border: none; 306 background: none; 307 } -
super-reactions/trunk/admin/assets/dist/css/srea-admin.min.css
r2461152 r2494716 1 #wpcontent{padding-left:0;padding-right:0}.srea-admin-wrapper{display:block;margin:0 auto;max-width:900px;height:100%;background-color:#fff}.srea-admin-wrapper input,.srea-admin-wrapper select{border-radius:0}.srea-admin-header{display:flex;flex-basis:50%;background-color:#fff;bo x-shadow:1px 1px 5px 2px #ccc;padding:10px;align-items:center}.srea-admin-header .srea-admin-title{text-align:center;flex:1 0 auto;justify-self:center}.srea-admin-main{padding:20px;display:grid;grid-template-columns:200px auto}.srea-admin-main .srea-tabs{border-top:1px solid #ccc;cursor:pointer}.srea-admin-main .srea-tabs .srea-tab{padding:20px;border-bottom:1px solid #ccc;border-left:1px solid #ccc}.srea-admin-main .srea-tabs .srea-tab.active{background-color:#d5edff;font-weight:700}.srea-admin-main .srea-views{border:1px solid #ccc;padding-left:40px}.srea-admin-main .srea-views .srea-template-selector{display:flex;align-items:center}.srea-admin-main .srea-views .srea-template-selector label{margin-right:5px}.srea-admin-main .srea-view.active{display:flex;flex-direction:column;align-items:flex-start;justify-content:space-evenly;flex-wrap:wrap;min-height:130px;height:100%}.srea-admin-main .srea-view:not(.active){display:none}.srea-admin-footer{display:flex;justify-content:flex-end;padding:20px}.srea-button{display:block;padding:10px;border:none}.srea-button.srea-button-primary{background-color:#4a91e2;color:#fff;font-weight:500}@keyframes spin{0%{transform:rotate(0)}100%{transform:rotate(360deg)}}.srea-loader{border:3px solid rgba(200,200,200,.7);border-top:3px solid rgba(66,66,66,.5);border-radius:50%;width:16px;height:16px;margin:3px;animation:spin 1s linear infinite}.srea-badge-success{background-color:#3c932c;color:#fff;padding:6px;text-align:center;line-height:10px;font-size:13px;margin:0 5px}1 #wpcontent{padding-left:0;padding-right:0}.srea-admin-wrapper{display:block;margin:0 auto;max-width:900px;height:100%;background-color:#fff}.srea-admin-wrapper input,.srea-admin-wrapper select{border-radius:0}.srea-admin-header{display:flex;flex-basis:50%;background-color:#fff;bo} -
super-reactions/trunk/admin/assets/dist/js/srea-admin.js
r2461152 r2494716 1 1 "use strict"; 2 2 3 document.addEventListener("DOMContentLoaded", function (event) { 3 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 4 5 function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } 6 7 function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } 8 9 document.addEventListener('DOMContentLoaded', function (event) { 4 10 var nonce = document.getElementById('_wpnonce'); 5 var $selects = document.querySelectorAll('select');6 11 var $tabs = document.querySelectorAll('.srea-tab'); 7 12 $tabs.forEach(function (element) { … … 20 25 } 21 26 22 $selects.forEach(function (element) {23 element.addEventListener('change', sreaSaveSettings);24 });25 26 function sreaSaveSettings(e) {27 var spinner = showLoader();28 e.target.insertAdjacentElement('afterend', spinner);29 var formData = new FormData();30 formData.append('action', 'srea_save_settings');31 formData.append('nonce', nonce.value);32 formData.append('option', e.target.name);33 formData.append('value', e.target.value);34 fetch(ajaxurl, {35 method: 'POST',36 body: formData37 }).then(function (response) {38 return response.json();39 }).then(function (res) {40 e.target.parentNode.removeChild(spinner);41 var badge = showResults(res.success, res.data.results);42 e.target.insertAdjacentElement('afterend', badge);43 setTimeout(function () {44 e.target.parentNode.removeChild(badge);45 }, 500);46 });47 }48 49 27 function showLoader() { 50 28 var loader = document.createElement('div'); … … 55 33 function showResults(status, text) { 56 34 var badge = document.createElement('div'); 57 badge.className = status ? 'srea- badge-success' : 'srea-badge-error';35 badge.className = status ? 'srea-srea-badge-error'; 58 36 badge.textContent = text; 59 37 return badge; 60 38 } 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 61 191 }); -
super-reactions/trunk/admin/assets/dist/js/srea-admin.min.js
r2461152 r2494716 1 "use strict"; document.addEventListener("DOMContentLoaded",function(e){var a=document.getElementById("_wpnonce"),t=document.querySelectorAll("select");function n(e){var t;document.querySelector(".srea-tab.active").classList.remove("active"),e.currentTarget.classList.add("active"),t=e.currentTarget.dataset.view,document.querySelector(".srea-view.active").classList.remove("active"),document.querySelector("#".concat(t)).classList.add("active")}function r(c){var e,o=((e=document.createElement("div")).className="srea-loader",e);c.target.insertAdjacentElement("afterend",o);var t=new FormData;t.append("action","srea_save_settings"),t.append("nonce",a.value),t.append("option",c.target.name),t.append("value",c.target.value),fetch(ajaxurl,{method:"POST",body:t}).then(function(e){return e.json()}).then(function(e){c.target.parentNode.removeChild(o);var t,a,n,r=(t=e.success,a=e.data.results,(n=document.createElement("div")).className=t?"srea-badge-success":"srea-badge-error",n.textContent=a,n);c.target.insertAdjacentElement("afterend",r),setTimeout(function(){c.target.parentNode.removeChild(r)},500)})}document.querySelectorAll(".srea-tab").forEach(function(e){e.addEventListener("click",n)}),t.forEach(function(e){e.addEventListener("change",r)})});1 "use strict";)}); -
super-reactions/trunk/admin/class-settings-view.php
r2461152 r2494716 2 2 3 3 namespace SREA\Admin; 4 5 4 6 5 7 class Settings_View { … … 42 44 </div> 43 45 <?php 46 44 47 } 45 48 … … 103 106 private function custom_post_types() { 104 107 $args = array( 105 'public' => true, 106 '_builtin' => false, 108 'public' => true, 109 'publicly_queryable' => true, 110 'exclude_from_search' => true, 111 'show_ui' => true, 112 'show_in_nav_menus' => true, 113 '_builtin' => false, 107 114 ); 108 115 109 $this->cpts = array_diff( get_post_types( $args ), array( 'product' ) ); 116 $cpts = array_diff( get_post_types( $args ), array( 'product' ) ); 117 $this->cpts = apply_filters( 'srea_custom_post_types', $cpts ); 110 118 } 111 119 112 120 private function render_setting_row( $post_type ) { 113 $ reactions = srea_reactions();121 $); 114 122 ?> 115 123 <div class="srea-template-selector"> 116 <label for="srea-template-selector-<?php echo esc_attr( $post_type ); ?>"><?php echo ucfirst( $post_type ) . ':'; ?></label> 117 <select name="<?php echo esc_attr( $post_type ); ?>" id="srea-template-selector-<?php echo esc_attr( $post_type ); ?>"> 118 <option value="0"><?php esc_html_e( 'Disable', 'super-reactions' ); ?></option> 119 <?php foreach ( $reactions as $slug => $reaction ) : ?> 120 <?php $selected = srea_get_active_template_slug( $post_type ) === $slug ? 'selected' : ''; ?> 121 <option value="<?php echo esc_attr( $slug ); ?>" <?php echo esc_attr( $selected ); ?> ><?php echo esc_html( $reaction['name'] ); ?></option> 122 <?php endforeach; ?> 123 </select> 124 <span class="srea-setting-label"> 125 <?php echo ucfirst( $post_type ) . ':'; ?> 126 </span> 127 <div class="srea-action-buttons"> 128 <button class="srea-template-selector-btn" data-srea-option="<?php echo esc_attr( $post_type ); ?>"> 129 <?php $selected ? esc_html_e( 'Change', 'super-reactions' ) : esc_html_e( 'Select', 'super-reactions' ); ?> 130 </button> 131 <button 132 class="srea-template-selector-btn srea-remover" 133 data-srea-option="<?php echo esc_attr( $post_type ); ?>" 134 <?php echo ! $selected ? esc_attr( 'disabled', 'super-reactions' ) : ''; ?>> 135 <?php esc_html_e( 'Remove', 'super-reactions' ); ?> 136 </button> 137 </div> 138 <div class="preview-wrapper"> 139 <div class="srea-selected-template-preview"> 140 <?php 141 if ( $selected ) { 142 $this->generate_single_preview( $selected ); 143 } else { 144 esc_html_e( 'Disabled', 'growmatik' ); 145 } 146 ?> 147 </div> 148 </div> 124 149 </div> 125 150 <?php … … 148 173 } 149 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 150 208 } -
super-reactions/trunk/constants.php
r2461152 r2494716 6 6 define( 'SREA_URL', plugin_dir_url( __FILE__ ) ); 7 7 8 define( 'SREA_VERSION', '1. 2.0' );8 define( 'SREA_VERSION', '1..0' ); 9 9 define( 'SREA_SLUG', 'super_reactions' ); 10 10 -
super-reactions/trunk/front/assets/dist/css/srea-front.css
r2452813 r2494716 7 7 margin: 5px; 8 8 animation: spin 1s linear infinite; 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 9 56 } 10 57 -
super-reactions/trunk/front/assets/dist/css/srea-front.min.css
r2452813 r2494716 1 .srea-loader{border:3px solid rgba(200,200,200,.7);border-top:3px solid rgba(66,66,66,.5);border-radius:50%;width:18px;height:18px;margin:5px;animation:spin 1s linear infinite}.srea- template{display:flex}.srea-template .srea-reaction-item{display:flex;margin-right:10px;align-items:center;height:28px}.srea-template .srea-button{cursor:pointer}.srea-template .srea-template-count{width:23px;text-align:center;font-size:medium}.srea-template .srea-button{outline:0;border:none;background:0 0}.srea-template .srea-button:active,.srea-template .srea-button:focus,.srea-template .srea-button:hover{outline:0;border:none;background:0 0}@keyframes spin{0%{transform:rotate(0)}100%{transform:rotate(360deg)}}1 .srea-loader{border:3px solid rgba(200,200,200,.7);border-top:3px solid rgba(66,66,66,.5);border-radius:50%;width:18px;height:18px;margin:5px;animation:spin 1s linear infinite}.srea-template{display:flex}.srea-template .srea-reaction-item{display:flex;margin-right:10px;align-items:center;height:28px}.srea-template .srea-button{cursor:pointer}.srea-template .srea-template-count{width:23px;text-align:center;font-size:medium}.srea-template .srea-button{outline:0;border:none;background:0 0}.srea-template .srea-button:active,.srea-template .srea-button:focus,.srea-template .srea-button:hover{outline:0;border:none;background:0 0}@keyframes spin{0%{transform:rotate(0)}100%{transform:rotate(360deg)}} -
super-reactions/trunk/includes/templates.php
r2461152 r2494716 2 2 3 3 function srea_get_template( string $reaction_slug ) { 4 if ( ! $reaction_slug ) {4 if ( ! $reaction_slug ) { 5 5 return false; 6 6 } -
super-reactions/trunk/languages/super-reactions.pot
r2461152 r2494716 24 24 msgstr "" 25 25 26 #: admin/class-init.php:35, admin/class-settings-view.php:2 626 #: admin/class-init.php:35, admin/class-settings-view.php:2 27 27 msgid "Super Reactions" 28 28 msgstr "" … … 32 32 msgstr "" 33 33 34 #: admin/class-settings-view.php:118 35 msgid "Disable" 34 #: admin/class-settings-view.php:129 35 msgid "Change" 36 msgstr "" 37 38 #: admin/class-settings-view.php:129 39 msgid "Select" 40 msgstr "" 41 42 #: admin/class-settings-view.php:135 43 msgid "Remove" 44 msgstr "" 45 46 #: admin/class-settings-view.php:180 47 msgid "Select reaction template for" 36 48 msgstr "" 37 49 -
super-reactions/trunk/readme.txt
r2461152 r2494716 6 6 Tested up to: 5.6 7 7 Requires PHP: 7.0 8 Stable tag: 1. 2.08 Stable tag: 1..0 9 9 License: GPLv3 10 10 License URI: http://www.gnu.org/licenses/gpl-3.0.html … … 23 23 == Changelog == 24 24 25 26 27 28 25 29 = 1.2.0 = 26 30 * New admin panel -
super-reactions/trunk/super-reactions.php
r2461152 r2494716 4 4 * Plugin Name: Super Reactions 5 5 * Description: Get meaningful reactions from users. 6 * Version: 1. 2.06 * Version: 1..0 7 7 * Author: Super Reactions Team 8 8 * Text Domain: super-reactions
Note: See TracChangeset
for help on using the changeset viewer.