actively set all the theme options on the display settings page based on the current theme selection
This commit is contained in:
parent
678148b9aa
commit
720f1d7123
@ -9,6 +9,8 @@ class Theme_info extends \Zotlabs\Web\Controller {
|
|||||||
$theme = argv(1);
|
$theme = argv(1);
|
||||||
if(! $theme)
|
if(! $theme)
|
||||||
killme();
|
killme();
|
||||||
|
|
||||||
|
$schemalist = array();
|
||||||
|
|
||||||
$theme_config = "";
|
$theme_config = "";
|
||||||
if(($themeconfigfile = $this->get_theme_config_file($theme)) != null){
|
if(($themeconfigfile = $this->get_theme_config_file($theme)) != null){
|
||||||
@ -17,6 +19,12 @@ class Theme_info extends \Zotlabs\Web\Controller {
|
|||||||
$clsname = ucfirst($theme) . 'Config';
|
$clsname = ucfirst($theme) . 'Config';
|
||||||
$th_config = new $clsname();
|
$th_config = new $clsname();
|
||||||
$schemas = $th_config->get_schemas();
|
$schemas = $th_config->get_schemas();
|
||||||
|
if($schemas) {
|
||||||
|
foreach($schemas as $k => $v) {
|
||||||
|
$schemalist[] = [ 'key' => $k, 'val' => $v ];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
$theme_config = theme_content($a);
|
$theme_config = theme_content($a);
|
||||||
}
|
}
|
||||||
@ -39,7 +47,7 @@ class Theme_info extends \Zotlabs\Web\Controller {
|
|||||||
'desc' => $desc,
|
'desc' => $desc,
|
||||||
'version' => $version,
|
'version' => $version,
|
||||||
'credits' => $credits,
|
'credits' => $credits,
|
||||||
'schemas' => $schemas,
|
'schemas' => $schemalist,
|
||||||
'config' => $theme_config
|
'config' => $theme_config
|
||||||
];
|
];
|
||||||
json_return_and_die($ret);
|
json_return_and_die($ret);
|
||||||
|
@ -1247,12 +1247,6 @@ Array.prototype.remove = function(item) {
|
|||||||
return this.push.apply(this, rest);
|
return this.push.apply(this, rest);
|
||||||
};
|
};
|
||||||
|
|
||||||
function previewTheme(elm) {
|
|
||||||
theme = $(elm).val();
|
|
||||||
$.getJSON('pretheme?f=&theme=' + theme,function(data) {
|
|
||||||
$('#theme-preview').html('<div id="theme-desc">' + data.desc + '</div><div id="theme-version">' + data.version + '</div><div id="theme-credits">' + data.credits + '</div><a href="' + data.img + '"><img src="' + data.img + '" style="max-width:100%; max-height:300px" alt="' + theme + '"></a>');
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
|
|
||||||
|
@ -8,6 +8,8 @@ $(document).ready(function() {
|
|||||||
$('.token-mirror').html($('#id_token').val());
|
$('.token-mirror').html($('#id_token').val());
|
||||||
$('#id_token').keyup( function() { $('.token-mirror').html($('#id_token').val()); });
|
$('#id_token').keyup( function() { $('.token-mirror').html($('#id_token').val()); });
|
||||||
|
|
||||||
|
previewTheme($('#id_theme')[0]);
|
||||||
|
|
||||||
$("#id_permissions_role").change(function() {
|
$("#id_permissions_role").change(function() {
|
||||||
var role = $("#id_permissions_role").val();
|
var role = $("#id_permissions_role").val();
|
||||||
if(role == 'custom')
|
if(role == 'custom')
|
||||||
@ -17,6 +19,26 @@ $(document).ready(function() {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
function setTheme(elm) {
|
||||||
|
$('#settings-form').submit();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function previewTheme(elm) {
|
||||||
|
theme = $(elm).val();
|
||||||
|
$.getJSON('theme_info/' + theme,function(data) {
|
||||||
|
$('#theme-preview').html('<div id="theme-desc">' + data.desc + '</div><div id="theme-version">' + data.version + '</div><div id="theme-credits">' + data.credits + '</div><a href="' + data.img + '"><img src="' + data.img + '" style="max-width:100%; max-height:300px" alt="' + theme + '"></a>');
|
||||||
|
$('#id_schema').empty();
|
||||||
|
$(data.schemas).each(function(index,item) {
|
||||||
|
$('<option/>',{value:item['key'],text:item['val']}).appendTo('#id_schema');
|
||||||
|
});
|
||||||
|
$('#custom-settings-content .section-content-tools-wrapper').html(data.config);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 0 nobody
|
* 0 nobody
|
||||||
* 1 perms_specific
|
* 1 perms_specific
|
||||||
|
@ -6,8 +6,7 @@
|
|||||||
* * Version: 1.0
|
* * Version: 1.0
|
||||||
* * Author: Fabrixxm
|
* * Author: Fabrixxm
|
||||||
* * Maintainer: Mike Macgirvin
|
* * Maintainer: Mike Macgirvin
|
||||||
* * Compat: Red [*]
|
* * Maintainer: Mario Vavti
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function redbasic_init(&$a) {
|
function redbasic_init(&$a) {
|
||||||
|
Reference in New Issue
Block a user