Skip to content

Commit

Permalink
Changes to themes - theme list will now be ordered alphabetically in …
Browse files Browse the repository at this point in the history
…editor & themes can now include a js file (e.g. so you can add/rearrange tags in interface)
  • Loading branch information
FayCross committed Oct 2, 2015
1 parent cb37cd6 commit e8d363d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
10 changes: 8 additions & 2 deletions modules/xerte/edithtml.php
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,6 @@ function output_editor_code($row_edit, $xerte_toolkits_site, $read_status, $vers
*/
$theme_folder = $xerte_toolkits_site->root_file_path . "themes/" . $row_edit['template_name'] . "/";
$ThemeList = array();
// Add default theme
$ThemeList[] = array('name' => "default", 'display_name' => "Xerte Online Toolkits", 'description' => "Xerte Online Toolkits", 'preview' => "");
if (file_exists($theme_folder))
{
$d = opendir($theme_folder);
Expand Down Expand Up @@ -145,6 +143,14 @@ function output_editor_code($row_edit, $xerte_toolkits_site, $read_status, $vers
}
}
}
// sort into alphabetical order
$display_name = array();
foreach ($ThemeList as $key => $row) {
$display_name[$key] = $row['display_name'];
}
array_multisort($display_name, SORT_ASC, $ThemeList);
// Add default theme to beginning
array_unshift($ThemeList, array('name' => "default", 'display_name' => "Xerte Online Toolkits", 'description' => "Xerte Online Toolkits", 'preview' => ""));
}
/**
* sort of the screen sies required for the preview window
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -436,6 +436,7 @@ function x_setUp() {
x_insertCSS(x_evalURL(x_params.stylesheet));
}
if (x_params.theme != undefined && x_params.theme != "default") {
$.getScript(x_themePath + x_params.theme + '/' + x_params.theme + '.js'); // most themes won't have this js file
x_insertCSS(x_themePath + x_params.theme + '/' + x_params.theme + '.css');
}

Expand Down

2 comments on commit e8d363d

@ronm123
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@FayCross whilst investigating the gapfill issue I just reported I also noticed errors in console if a themename.js file isn't found. Does each theme need this even if empty or does a success check need to be added to avoid the error?

@FayCross
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added this as I had a theme that needed a couple of new tags to be added for the css to work correctly. Not all themes need to have a js file though - they should all still work without one.

Please sign in to comment.