Procházet zdrojové kódy

tab settings images, tab settings polish, ajax show apply

Cerothen před 9 roky
rodič
revize
ecdf694364
4 změnil soubory, kde provedl 26 přidání a 4 odebrání
  1. 1 1
      ajax.php
  2. 13 0
      css/settings.css
  3. 7 3
      functions.php
  4. 5 0
      js/ajax.js

+ 1 - 1
ajax.php

@@ -114,7 +114,7 @@ switch ($_SERVER['REQUEST_METHOD']) {
 				break;
 			case 'submit-tabs':
 				$response['notify'] = sendNotification(updateTabs($_POST) , false, false);
-				//$response['parent']['reload'] = true;
+				$response['show_apply'] = true;
 				break;
 			default:
 				sendNotification(false, 'Unsupported Action!');

+ 13 - 0
css/settings.css

@@ -35,6 +35,19 @@ tab > div.row > div:first-child {
 	max-width: 42px;
 }
 
+tab > div.row > div:first-child .tabIconView {
+	width: 100% !important;
+	margin: 7px 0px !important;
+}
+
+tab > div.row button {
+	margin: 9px 0px !important;
+}
+
+tab > div.row div.custom-field {
+	margin: 8px 0px !important;
+}
+
 tab p.help-text {
 	margin: 0px !important;
 }

+ 7 - 3
functions.php

@@ -1283,7 +1283,10 @@ function buildField($params, $sizeSm = 12, $sizeMd = 12, $sizeLg = 12) {
 	// Tags
 	$tags = array();
 	foreach(array('placeholder','style','disabled','readonly','pattern','min','max','required','onkeypress','onchange','onfocus','onleave','href','onclick') as $value) {
-		$tags[] = (isset($params[$value])?$value.'="'.$params[$value].'"':'');
+		if (isset($params[$value])) {
+			if (is_string($params[$value])) { $tags[] = $value.'="'.$params[$value].'"';
+			} else if ($params[$value] === true) { $tags[] = $value; }
+		}
 	}
 	
 	$format = (isset($params['format']) && in_array($params['format'],array(false,'colour','color'))?$params['format']:false);
@@ -1417,8 +1420,7 @@ function printTabRow($data) {
 				<div class="row">
 					'.buildField(array(
 						'type' => 'custom',
-						'html' => '<div class="action-btns tabIconView" style="width:100%;"><a style="margin-left: 0px">$val</a></div>',
-						'value' => $image,
+						'html' => '<div class="action-btns tabIconView"><a style="margin-left: 0px">'.($data['iconurl']?'<img src="'.$data['iconurl'].'" height="30" width="30">':'<span style="font: normal normal normal 30px/1 FontAwesome;" class="fa '.($data['icon']?$data['icon']:'hand-paper-o').'"></span>').'</a></div>',
 					),12,1,1).'
 					'.buildField(array(
 						'type' => 'hidden',
@@ -1430,6 +1432,7 @@ function printTabRow($data) {
 						'type' => 'text',
 						'id' => 'tab-'.$data['id'].'-name',
 						'name' => 'name['.$data['id'].']',
+						'required' => true,
 						'placeholder' => 'Organizr Homepage',
 						'labelTranslate' => 'TAB_NAME',
 						'value' => $data['name'],
@@ -1438,6 +1441,7 @@ function printTabRow($data) {
 						'type' => 'text',
 						'id' => 'tab-'.$data['id'].'-url',
 						'name' => 'url['.$data['id'].']',
+						'required' => true,
 						'placeholder' => 'homepage.php',
 						'labelTranslate' => 'TAB_URL',
 						'value' => $data['url'],

+ 5 - 0
js/ajax.js

@@ -24,6 +24,11 @@ function ajax_request(method, action, data, callback, options) {
 					}
 				}
 				
+				// Show Apply
+				if (data.show_apply === true) {
+					$('#apply').show();
+				}
+				
 				// Callback
 				if (typeof data.callback === 'string') {
 					eval(data.callback);