data-reset-data-dialog.php
6 years ago
palettes-edit-palette.php
5 years ago
privacy-ip-delete.php
6 years ago
palettes-edit-palette.php
277 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Modal for editing or creating custom palettes. |
| 4 | * |
| 5 | * @package Hustle |
| 6 | * @since 4.0.4 |
| 7 | */ |
| 8 | |
| 9 | $palette_args = array( |
| 10 | 'is_settings_page' => true, |
| 11 | 'capitalize_singular' => __( 'Module', 'hustle' ), |
| 12 | ); |
| 13 | |
| 14 | ob_start(); |
| 15 | ?> |
| 16 | |
| 17 | <?php // STEP 1: Create Palette. ?> |
| 18 | <div id="hustle-edit-palette-first-step" style="margin-bottom: 0;"> |
| 19 | |
| 20 | <p id="customPaletteDesc" class="sui-description"><?php esc_html_e( "Let's start by giving your color palette a name and choosing a base palette. You can either begin with one of our default color palettes or import colors from one of your existing modules.", 'hustle' ); ?></p> |
| 21 | |
| 22 | <div class="sui-form-field"> |
| 23 | |
| 24 | <label for="hustle-palette-name" id="hustle-palette-name-label" class="sui-label"><?php esc_html_e( 'Name', 'hustle' ); ?></label> |
| 25 | |
| 26 | <input |
| 27 | type="text" |
| 28 | autocomplete="off" |
| 29 | name="palette_name" |
| 30 | value="" |
| 31 | placeholder="<?php esc_html_e( 'Custom Palette Name', 'hustle' ); ?>" |
| 32 | id="hustle-palette-name" |
| 33 | class="hustle-required-field sui-form-control" |
| 34 | aria-labelledby="hustle-palette-name-label" |
| 35 | aria-describedby="hustle-palette-name-error" |
| 36 | data-error-message="<?php esc_attr_e( 'The palette name is required.', 'hustle' ); ?>" |
| 37 | /> |
| 38 | |
| 39 | <span id="hustle-palette-name-error" class="sui-error-message" style="display: none;" aria-hidden="true" hidden></span> |
| 40 | |
| 41 | </div> |
| 42 | |
| 43 | <div class="sui-form-field"> |
| 44 | |
| 45 | <label id="hustle-base-palette-label" class="sui-label"><?php esc_html_e( 'Base Palette', 'hustle' ); ?></label> |
| 46 | |
| 47 | <div id="hustle-base-palette" class="sui-tabs sui-side-tabs" style="margin-top: 5px;"> |
| 48 | |
| 49 | <div role="tablist" class="sui-tabs-menu"> |
| 50 | |
| 51 | <label |
| 52 | id="hustle-palette-default-label" |
| 53 | for="hustle-palette-base-source-palette" |
| 54 | class="sui-tab-item active" |
| 55 | > |
| 56 | <input |
| 57 | tabindex="-1" |
| 58 | type="radio" |
| 59 | name="base_source" |
| 60 | value="palette" |
| 61 | id="hustle-palette-base-source-palette" |
| 62 | style="display: none;" |
| 63 | aria-hidden="true" |
| 64 | hidden |
| 65 | checked="checked" |
| 66 | data-tab-menu="default" |
| 67 | /> |
| 68 | <?php esc_html_e( 'Default Palettes', 'hustle' ); ?> |
| 69 | </label> |
| 70 | |
| 71 | <label |
| 72 | id="hustle-palette-import-label" |
| 73 | for="hustle-palette-base-source-module" |
| 74 | class="sui-tab-item" |
| 75 | > |
| 76 | <input |
| 77 | tabindex="-1" |
| 78 | type="radio" |
| 79 | name="base_source" |
| 80 | value="module" |
| 81 | id="hustle-palette-base-source-module" |
| 82 | style="display: none;" |
| 83 | aria-hidden="true" |
| 84 | hidden |
| 85 | data-tab-menu="module" |
| 86 | /> |
| 87 | <?php esc_html_e( 'Import From A Module', 'hustle' ); ?> |
| 88 | </label> |
| 89 | |
| 90 | </div> |
| 91 | |
| 92 | <div class="sui-tabs-content"> |
| 93 | |
| 94 | <?php // TAB: Default Palettes. ?> |
| 95 | <div |
| 96 | role="tabpanel" |
| 97 | tabindex="0" |
| 98 | id="hustle-palette-default" |
| 99 | class="sui-tab-content sui-border-frame active" |
| 100 | aria-labelledby="hustle-palette-default-label" |
| 101 | data-tab-content="default" |
| 102 | > |
| 103 | |
| 104 | <p class="sui-description" style="margin-bottom: 20px;"><?php esc_html_e( 'Choose one of the default color palettes and click on the next button to start customizing it.', 'hustle' ); ?></p> |
| 105 | |
| 106 | <div class="sui-form-field"> |
| 107 | |
| 108 | <label for="hustle-pick-palette" id="hustle-pick-palette-label" class="sui-label"><?php esc_html_e( 'Color Palette', 'hustle' ); ?></label> |
| 109 | |
| 110 | <select id="hustle-pick-palette" name="base_palette" aria-labelledby="hustle-pick-palette-label"> |
| 111 | <?php foreach ( $palettes as $slug => $display_name ) : ?> |
| 112 | <option value="<?php echo esc_attr( $slug ); ?>"><?php echo esc_attr( $display_name ); ?></option> |
| 113 | <?php endforeach; ?> |
| 114 | </select> |
| 115 | |
| 116 | </div> |
| 117 | |
| 118 | </div> |
| 119 | |
| 120 | <?php // TAB: Import Palette. ?> |
| 121 | <div |
| 122 | role="tabpanel" |
| 123 | tabindex="0" |
| 124 | id="hustle-palette-import" |
| 125 | class="sui-tab-content sui-border-frame" |
| 126 | aria-labelledby="hustle-palette-import-label" |
| 127 | data-tab-content="module" |
| 128 | hidden |
| 129 | > |
| 130 | |
| 131 | <p class="sui-description" style="margin-bottom: 20px;"><?php esc_html_e( 'Import colors from one of your existing modules and click on the next button to start customizing the base palette.', 'hustle' ); ?></p> |
| 132 | |
| 133 | <div class="sui-form-field" style="margin-bottom: 20px;"> |
| 134 | |
| 135 | <label for="hustle-palette-module-type" id="hustle-palette-module-type-label" class="sui-label"><?php esc_html_e( 'Module Type', 'hustle' ); ?></label> |
| 136 | |
| 137 | <select id="hustle-palette-module-type" name="module_type" aria-labelledby="hustle-palette-module-type-label"> |
| 138 | |
| 139 | <?php |
| 140 | foreach ( Hustle_Data::get_module_types() as $module_type ) : |
| 141 | if ( Hustle_Module_Model::SOCIAL_SHARING_MODULE === $module_type ) { |
| 142 | continue; |
| 143 | } |
| 144 | ?> |
| 145 | |
| 146 | <option value="<?php echo esc_attr( $module_type ); ?>"><?php echo esc_html( Opt_In_Utils::get_module_type_display_name( $module_type, false, true ) ); ?></option> |
| 147 | |
| 148 | <?php endforeach; ?> |
| 149 | |
| 150 | </select> |
| 151 | |
| 152 | </div> |
| 153 | |
| 154 | <div class="sui-form-field" style="margin-bottom: 20px;"> |
| 155 | |
| 156 | <label for="hustle-palette-module-name" id="hustle-palette-module-name-label" class="sui-label"><?php esc_html_e( 'Module Name', 'hustle' ); ?></label> |
| 157 | |
| 158 | <select id="hustle-palette-module-name" name="module_id" class="sui-select" aria-labelledby="hustle-palette-module-name-label"></select> |
| 159 | |
| 160 | </div> |
| 161 | |
| 162 | <div class="sui-form-field"> |
| 163 | |
| 164 | <label for="hustle-palette-module-fallback" id="hustle-palette-module-fallback-label" class="sui-label"><?php esc_html_e( 'Fallback Color Palette', 'hustle' ); ?></label> |
| 165 | |
| 166 | <select id="hustle-palette-module-fallback" name="fallback_palette" aria-labelledby="hustle-palette-module-fallback-label" aria-describedby="hustle-palette-module-fallback-message"> |
| 167 | <?php foreach ( $palettes as $slug => $display_name ) : ?> |
| 168 | <option value="<?php echo esc_attr( $slug ); ?>" ><?php echo esc_html( $display_name ); ?></option> |
| 169 | <?php endforeach; ?> |
| 170 | </select> |
| 171 | |
| 172 | <span id="hustle-palette-module-fallback-message" class="sui-description"><?php esc_html_e( 'We will use this palette to import colors which are not available in your chosen module.', 'hustle' ); ?></span> |
| 173 | |
| 174 | </div> |
| 175 | |
| 176 | </div> |
| 177 | |
| 178 | </div> |
| 179 | |
| 180 | </div> |
| 181 | |
| 182 | </div> |
| 183 | |
| 184 | </div> |
| 185 | |
| 186 | <?php // STEP 2: Edit Palette. ?> |
| 187 | <div id="hustle-edit-palette-second-step" style="display: none;" tabindex="-1" aria-hidden="true" hidden></div> |
| 188 | |
| 189 | <?php |
| 190 | $body_content = ob_get_clean(); |
| 191 | ob_start(); |
| 192 | ?> |
| 193 | |
| 194 | <button class="sui-button sui-button-ghost hustle-modal-close" data-modal-close> |
| 195 | <?php esc_attr_e( 'Cancel', 'hustle' ); ?> |
| 196 | </button> |
| 197 | |
| 198 | <button |
| 199 | class="hustle-button-action sui-button" |
| 200 | data-hustle-action="go-to-step" |
| 201 | data-form-id="hustle-edit-palette-form" |
| 202 | data-step="2" |
| 203 | > |
| 204 | <span id="hustle-step-button-text" class="sui-loading-text"> |
| 205 | <?php esc_attr_e( 'Next', 'hustle' ); ?> |
| 206 | </span> |
| 207 | <span id="hustle-finish-button-text" class="sui-loading-text" style="display:none;"> |
| 208 | <?php esc_attr_e( 'Save Palette', 'hustle' ); ?> |
| 209 | </span> |
| 210 | <span class="sui-icon-loader sui-loading" aria-hidden="true"></span> |
| 211 | </button> |
| 212 | |
| 213 | <?php |
| 214 | $footer_content = ob_get_clean(); |
| 215 | |
| 216 | $attributes = array( |
| 217 | 'modal_id' => 'edit-palette', |
| 218 | 'has_description' => false, |
| 219 | 'modal_size' => 'lg', |
| 220 | 'sui_box_tag' => 'form', |
| 221 | 'sui_box_id' => 'hustle-edit-palette-form', |
| 222 | |
| 223 | 'header' => array( |
| 224 | 'title' => __( 'Create Custom Palette', 'hustle' ), |
| 225 | ), |
| 226 | 'body' => array( |
| 227 | 'content' => $body_content, |
| 228 | ), |
| 229 | 'footer' => array( |
| 230 | 'classes' => 'sui-content-separated', |
| 231 | 'content' => $footer_content, |
| 232 | ), |
| 233 | ); |
| 234 | |
| 235 | $this->render_modal( $attributes ); |
| 236 | ?> |
| 237 | |
| 238 | <script type="text/template" id="hustle-dialog--edit-palette-tpl"> |
| 239 | |
| 240 | <p class="sui-description"><?php esc_html_e( 'Customize your base palette as per your liking and click on the “Create Palette“ button to add this to your palettes list.', 'hustle' ); ?></p> |
| 241 | |
| 242 | <div class="sui-form-field"> |
| 243 | <?php |
| 244 | $this->render( |
| 245 | 'admin/global/sui-components/sui-tabs', |
| 246 | array( |
| 247 | 'name' => 'module_type', |
| 248 | 'content' => true, |
| 249 | 'options' => array( |
| 250 | 'general' => array( |
| 251 | 'label' => esc_html__( 'General', 'hustle' ), |
| 252 | 'content' => $this->render( |
| 253 | 'admin/commons/sui-wizard/elements/palette-general', |
| 254 | $palette_args, |
| 255 | true |
| 256 | ), |
| 257 | ), |
| 258 | 'optin' => array( |
| 259 | 'label' => esc_html__( 'Opt-in', 'hustle' ), |
| 260 | 'content' => $this->render( |
| 261 | 'admin/commons/sui-wizard/elements/palette-optin', |
| 262 | $palette_args, |
| 263 | true |
| 264 | ), |
| 265 | ), |
| 266 | ), |
| 267 | ) |
| 268 | ); |
| 269 | ?> |
| 270 | </div> |
| 271 | |
| 272 | <# if ( 'undefined' !== typeof slug ) { #> |
| 273 | <input type="hidden" name="slug" value="{{ slug }}"> |
| 274 | <# } #> |
| 275 | |
| 276 | </script> |
| 277 |