Add empty css file for each panel

This commit is contained in:
Brian Read 2024-09-18 15:54:05 +01:00
parent c7f22b54f8
commit a551ee928c
5 changed files with 54 additions and 4 deletions

View File

@ -1,5 +1,5 @@
#
# Generated by SM2Gen version:0.8 Chameleon version:4.5.4 On Python:3.12.3 at 2024-09-18 11:44:06
# Generated by SM2Gen version:0.8 Chameleon version:4.5.4 On Python:3.12.3 at 2024-09-18 15:44:18
#
#
# Routines to be edited by the developer to provide validation for parameters

View File

@ -0,0 +1,3 @@
/*
Generated by SM2Gen version: SM2Gen version:0.8 Chameleon version:4.5.4 On Python:3.12.3 at 2024-09-18 15:44:18
*/

View File

@ -2,6 +2,8 @@
%# Generated by ${version}
%#
% layout 'default', title => "Sme server 2 - ${MenuDescription}", share_dir => './';
% css specific to this panel:
%= stylesheet '/css/{lcPackageName}.css'
% content_for 'module' => begin
<div id="module" class="module ${PackageName}-panel">

36
copySM2.sh Executable file
View File

@ -0,0 +1,36 @@
#!/bin/bash
if [ $# -ne 3 ]; then
echo "Error: copySM2.sh requires two parameters."
echo "copySM2.sh <systemname> <prefix> <packagename>"
exit 1
fi
export REMOTE=/home/brianr/$1/usr/share/smanager
cd ~/clients/SM2/SM2Gen/venv/Targets/$3
echo `pwd`
# controller file name is just capitalised
cont_file=$(echo "$3" | awk '{
for(i=1; i<=NF; i++) {
$i = toupper(substr($i, 1, 1)) tolower(substr($i, 2))
}
print
}' | tr ' ' '_')
echo $cont_file
#if [ ! -f "$cont_file.pm" ]; then
# echo "no controller file $cont_file found in `pwd`"
# exit 1
#fi
mkdir -p $REMOTE/lib/SrvMngr/Controller
mkdir -p $REMOTE/themes/default/templates/partials/
mkdir -p $REMOTE/lib/SrvMngr/I18N/Modules/Nfsshare
mkdir -p $REMOTE/themes/default/templates/
cp -fv *.pm $REMOTE/lib/SrvMngr/Controller
cp -fv *.css $REMOTE/themes/default/public/css
cp -fv _$2*.html.ep $REMOTE/themes/default/templates/partials/
find . -maxdepth 1 -type f -name "[!_]*\.ep" | xargs -I% bash -c 'cp -fv % $REMOTE/themes/default/templates/'
mkdir -p $REMOTE/lib/SrvMngr/I18N/Modules/$3
cp -fv *.lex $REMOTE/lib/SrvMngr/I18N/Modules/$3
rm -f $REMOTE/lib/SrvMngr/I18N/Modules/$3/*.pm
ssh -p 1234 root@$1.thereadclan.me.uk 'signal-event smanager-refresh'
exit 0

View File

@ -469,7 +469,9 @@ if __name__ == "__main__":
routes = get_all_routes()
lc_routes = lc_get_all_routes()
#
# File names
#
# Define the path for the generated files
directory_path = Path("Targets/" + hl("PackageName"))
# Create the directory if it doesn't exist
@ -478,8 +480,9 @@ if __name__ == "__main__":
controller_file = check_file_version(target_directory_path + hl("PackageName") + ".pm")
custom_controller_file = check_file_version(target_directory_path + hl("PackageName") + "-Custom.pm",3)
print(custom_controller_file)
#print(custom_controller_file)
layout_file = check_file_version(target_directory_path + hl("PackageName").lower() + ".html.ep")
css_file = check_file_version(target_directory_path + hl("PackageName").lower() + ".css")
partial_files = list()
for panel in routes:
partial_files.append(check_file_version(
@ -538,7 +541,8 @@ if __name__ == "__main__":
try:
try:
layout_mojo = layout_template.render(
version=strVersion, **json5_dict, conditions=routes
version=strVersion, **json5_dict, conditions=routes,
lcPackageName=json5_dict["PackageName"].lower()
)
with open(layout_file, "w") as file:
file.write(layout_mojo)
@ -548,6 +552,11 @@ if __name__ == "__main__":
except Exception as e:
print(f"A Chameleon template layout file error occurred: {e}")
# Create the css file (empty for now, except the header)
# maybe it should have empty expamples of all the relevant classes?
with open(css_file, "w") as file:
file.write(f"/*\n Generated by SM2Gen version: {strVersion}\n*/\n")
# Generate a partial file for each of the entries in the html list
# Pull in the template code for each of the input types
# html_controls = json5_to_dict('Templates/html_controls.html.ep.tem')