forked from projects/fipamo
asset moving for themes fixed, settings save patch
When testing themes, the script wasn't moving all assets that were in subdirectories of the theme css folder, so that's been fixed so it moves everything when testing a theme and rendering the site there was also an issue with saving settings options because the script was referencing email data that was no longer being provided from the front end, so it was erroring out trying to save it. those references have been removed so it's smooth sailing
This commit is contained in:
parent
7d78476870
commit
37120efe18
6 changed files with 45 additions and 33 deletions
|
@ -55,3 +55,22 @@ function randomString(int $length)
|
|||
|
||||
return $string;
|
||||
}
|
||||
|
||||
function delete_directory($dirPath)
|
||||
{
|
||||
if (is_dir($dirPath)) {
|
||||
$objects = new DirectoryIterator($dirPath);
|
||||
foreach ($objects as $object) {
|
||||
if (!$object->isDot()) {
|
||||
if ($object->isDir()) {
|
||||
delete_directory($object->getPathname());
|
||||
} else {
|
||||
unlink($object->getPathname());
|
||||
}
|
||||
}
|
||||
}
|
||||
rmdir($dirPath);
|
||||
} else {
|
||||
throw new Exception(__FUNCTION__ . '(dirPath): dirPath is not a directory!');
|
||||
}
|
||||
}
|
||||
|
|
|
@ -56,8 +56,9 @@ class ThemeController extends Controller
|
|||
$view == 'index' ?
|
||||
$template = $currentTheme . '.index' :
|
||||
$template = $currentTheme . '.page';
|
||||
$page = $this->pages->getById('F4429D34-25E7-4CA9-9B0A-742810277505');
|
||||
$pageData = $this->sort->page($page);
|
||||
//TODO: Get rid of hard link page IDS
|
||||
$page = $this->pages->getById('F791DED9-0359-4662-8976-4C474803D2C6');
|
||||
$pageData = $this->sort->page($page);
|
||||
break;
|
||||
case "tags":
|
||||
$template = $currentTheme . '.tags';
|
||||
|
@ -69,8 +70,8 @@ class ThemeController extends Controller
|
|||
$pageData = $this->sort->archive();
|
||||
break;
|
||||
default:
|
||||
$template = $currentTheme . '.' . $view;
|
||||
$page = $this->pages->getById('F4429D34-25E7-4CA9-9B0A-742810277505');
|
||||
$template = $currentTheme . '.index';
|
||||
$page = $this->pages->getById('F791DED9-0359-4662-8976-4C474803D2C6');
|
||||
$pageData = $this->sort->page($page);
|
||||
}
|
||||
if ($this->member::status()) {
|
||||
|
|
|
@ -54,10 +54,12 @@ class MemberRepository implements MemberRepositoryInterface
|
|||
|
||||
public function update($member)
|
||||
{
|
||||
$index = findIndex($this->folks, ['id' => $member->id]);
|
||||
$this->folks[$index]['handle'] = $member->handle;
|
||||
$this->folks[$index]['email'] = $member->email;
|
||||
$this->folks[$index]['avatar'] = $member->avatar;
|
||||
$index = findIndex($this->folks, ['id' => $member->id]);
|
||||
$this->folks[$index]['handle'] = $member->handle;
|
||||
$this->folks[$index]['email'] = $member->email;
|
||||
if (isset($member->avatar)) {
|
||||
$this->folks[$index]['avatar'] = $member->avatar;
|
||||
}
|
||||
$this->folks[$index]['updated'] = Carbon::now();
|
||||
//save new folks file
|
||||
$this->docs::writeSettings($this->folks, env('FOLKS_PATH'));
|
||||
|
|
|
@ -60,7 +60,6 @@ class AssetService
|
|||
} else {
|
||||
//image is already there, so chill
|
||||
}
|
||||
//print $file->getFilename() . "\n";
|
||||
}
|
||||
//clear test theme css and script directories
|
||||
$styles = glob($cssPath . '*'); // get all file names
|
||||
|
@ -85,6 +84,13 @@ class AssetService
|
|||
if (is_file($file)) {
|
||||
$path = explode('/', $file);
|
||||
copy($file, $cssPath . $path[6]);
|
||||
} else {
|
||||
// if there is a type/font folder, move it
|
||||
$typePath = explode('/', $file);
|
||||
if (is_dir($cssPath . $typePath[6])) {
|
||||
delete_directory($cssPath . $typePath[6]);
|
||||
}
|
||||
rename($file, $cssPath . $typePath[6]);
|
||||
}
|
||||
}
|
||||
$newjs = glob('../content/themes/' . $this->currentTheme . '/assets/scripts/*');
|
||||
|
|
|
@ -122,13 +122,9 @@ class SettingsService
|
|||
$settings['global']['externalAPI'] = $data->global->externalAPI;
|
||||
$settings['global']['dynamicRender'] = $data->global->dynamicRender;
|
||||
|
||||
//TODO: This is for to be created MemberServices
|
||||
//Member::updateData('handle', $data['member']['handle']);
|
||||
//Member::updateData('email', $data['member']['email']);
|
||||
|
||||
$settings['email']['active'] = $data->email->active;
|
||||
$settings['email']['smtp'] = $data->email->smtp;
|
||||
$settings['email']['mailgun'] = $data->email->mailgun;
|
||||
//$settings['email']['active'] = $data->email->active;
|
||||
//$settings['email']['smtp'] = $data->email->smtp;
|
||||
//$settings['email']['mailgun'] = $data->email->mailgun;
|
||||
|
||||
return $this->docs::writeSettings($settings);
|
||||
}
|
||||
|
|
|
@ -21,11 +21,11 @@ export default class SettingsActions {
|
|||
.replace(/"/g, '');
|
||||
let selected = '';
|
||||
let selects = document.querySelectorAll('.theme-select');
|
||||
let smtpDomain = document.getElementById('smtp-domain').value;
|
||||
let smtpEmail = document.getElementById('smtp-email').value;
|
||||
let smtpPass = document.getElementById('smtp-pass').value;
|
||||
let mgDomain = document.getElementById('mg-domain').value;
|
||||
let mgKey = document.getElementById('mg-key').value;
|
||||
//let smtpDomain = document.getElementById('smtp-domain').value;
|
||||
//let smtpEmail = document.getElementById('smtp-email').value;
|
||||
//let smtpPass = document.getElementById('smtp-pass').value;
|
||||
//let mgDomain = document.getElementById('mg-domain').value;
|
||||
//let mgKey = document.getElementById('mg-key').value;
|
||||
let mailActive = '';
|
||||
let mailOptions = document.querySelectorAll('.mail-option');
|
||||
let apiStatus = document
|
||||
|
@ -60,18 +60,6 @@ export default class SettingsActions {
|
|||
handle: handle,
|
||||
email: email,
|
||||
id: memberID
|
||||
},
|
||||
email: {
|
||||
active: mailActive,
|
||||
smtp: {
|
||||
domain: smtpDomain,
|
||||
email: smtpEmail,
|
||||
password: smtpPass
|
||||
},
|
||||
mailgun: {
|
||||
domain: mgDomain,
|
||||
key: mgKey
|
||||
}
|
||||
}
|
||||
};
|
||||
return new Promise(function (resolve) {
|
||||
|
|
Loading…
Reference in a new issue