Skip to content

Commit

Permalink
First Alpha release for Moodle 3.6 Stable
Browse files Browse the repository at this point in the history
  • Loading branch information
Bas Brands committed Mar 5, 2019
1 parent 7cf430e commit 0b7ea57
Show file tree
Hide file tree
Showing 161 changed files with 33,212 additions and 8,023 deletions.
111 changes: 88 additions & 23 deletions Gruntfile.js
Original file line number Diff line number Diff line change
@@ -1,60 +1,125 @@
'use strict';

module.exports = function(grunt) {

// Import modules.
var path = require('path');

// Theme Bootstrap constants.
var LESSDIR = 'less',
THEMEDIR = path.basename(path.resolve('.'));
var path = require("path");

// PHP strings for exec task.
var moodleroot = path.dirname(path.dirname(__dirname)),
configfile = '',
decachephp = '',
dirrootopt = grunt.option('dirroot') || process.env.MOODLE_DIR || '';
var moodleroot = path.dirname(path.dirname(__dirname));
var dirrootopt = grunt.option("dirroot") || process.env.MOODLE_DIR || "";

// Allow user to explicitly define Moodle root dir.
if ('' !== dirrootopt) {
if ("" !== dirrootopt) {
moodleroot = path.resolve(dirrootopt);
}

configfile = path.join(moodleroot, 'config.php');
var PWD = process.cwd();

decachephp += 'define(\'CLI_SCRIPT\', true);';
decachephp += 'require(\'' + configfile + '\');';
decachephp += 'theme_reset_all_caches();';
var decachephp = "../../admin/cli/purge_caches.php";

grunt.initConfig({

exec: {
decache: {
cmd: 'php -r "' + decachephp + '"',
callback: function(error, stdout, stderror) {
// exec will output error messages
// just add one to confirm success.
cmd: 'php "' + decachephp + '"',
callback: function(error) {
// The exec process will output error messages.
// Just add one to confirm success.
if (!error) {
grunt.log.writeln("Moodle theme cache reset.");
}
}
},
postcss: {
command: 'npm run postcss'
}
},
watch: {
// Watch for any changes to less files and compile.
files: ["less/**/*.less"],
tasks: ["decache"],
files: ["scss/**/*.scss"],
tasks: ["compile"],
options: {
spawn: false,
livereload: true
}
}
},
stylelint: {
scss: {
options: {
syntax: "scss"
},
src: ["scss/**/*.scss"]
},
css: {
src: ["*/**/*.css"],
options: {
configOverrides: {
rules: {
// These rules have to be disabled in .stylelintrc for scss compat.
"at-rule-no-unknown": true,
"no-browser-hacks": [true, {"severity": "warning"}]
}
}
}
}
},
jshint: {
options: {
jshintrc: true
},
files: ["**/amd/src/*.js"]
},
uglify: {
dynamic_mappings: {
files: grunt.file.expandMapping(
["**/src/*.js", "!**/node_modules/**"],
"",
{
cwd: PWD,
rename: function(destBase, destPath) {
destPath = destPath.replace("src", "build");
destPath = destPath.replace(".js", ".min.js");
destPath = path.resolve(PWD, destPath);
return destPath;
}
}
)
}
},
sass: {
options: {
style: 'expanded'
},
dist: {
files: {
'style/elegance.css': 'scss/gruntcompile.scss'
}
}
},
});

// Load contrib tasks.
grunt.loadNpmTasks("grunt-contrib-watch");
grunt.loadNpmTasks("grunt-exec");

// Load core tasks.
grunt.loadNpmTasks("grunt-contrib-uglify");
grunt.loadNpmTasks("grunt-contrib-jshint");
grunt.loadNpmTasks("grunt-sass");
grunt.loadNpmTasks("grunt-stylelint");

// Register CSS taks.
grunt.registerTask("css", ["stylelint:scss", "stylelint:css"]);

// Register tasks.
grunt.registerTask("default", ["watch"]);
grunt.registerTask("decache", ["exec:decache"]);
};

grunt.registerTask("compile", [
"sass",
"exec:postcss",
"decache"
]);

grunt.registerTask("amd", ["jshint", "uglify"]);
};
29 changes: 21 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,18 @@
# Elegance

## A Bootstrap 3 Moodle Theme
## A Boost child theme

### Features

[Elegance](https://moodle.org/plugins/view.php?plugin=theme_elegance) is a beautiful Free Moodle theme with robust functionality and lots of custom settings. This theme is a full rewrite of the Moodle 2.8 theme elegance version. This theme requires the theme "[Bootstrap](https://moodle.org/plugins/view.php?plugin=theme_bootstrap)". If you're using Moodle auto-updater it will automatically install it too.

If you have tried this theme and would like to have it customized and styled for your organisation in any way feel free to [contact me](http://theming.sonsbeekmedia.nl/blocks/dashboard/contact.php?dashboard=contact) to request a quotation.
[Elegance](https://moodle.org/plugins/view.php?plugin=theme_elegance) is a beautiful Free Moodle theme with robust functionality and lots of custom settings. This theme is a full rewrite of the Moodle 2.8 theme elegance version.

Custom Settings
* Custom "Quick Links".
* "Marketing" spots.
* Custom Footer.
* A frontpage Slide Show.
* Customizable colours.
* Message notifications.
* Login Page backgroud images.
* Page loading indicator.

### Contributors version 2.9

Expand All @@ -34,11 +30,28 @@ Custom Settings
* [David Bezemer](http://www.davidbezemer.nl)

### Notes
*
*
* Please do not use the github version of this theme in a production environment. The current plugin repository version will always be the most stable.

### Changelog

### Version 3.0 Beta

Moved to theme Boost as a parent theme_elegance.
Removed options:

* blocks configuration, the theme only has the right blocks column
* videowidth
* mobilecss
* transparency

Added features.

* Show available courses on front page in a card layout
* Use the Boost navdrawer
* New Caroussel
* New style marketing spot

[v2.9](https://github.com/bmbrands/moodle-theme_elegance)

### New Features:
Expand Down Expand Up @@ -80,4 +93,4 @@ fixed: H1-H6 sizes not sequential
fixed: default category icons don’t show up
enhanced: all default images are public domain from [unsplash](http://unsplash.com)
enhanced: fontawesome updated to latest version
added: new custom css field for Moodle Mobile app
added: new custom css field for Moodle Mobile app
141 changes: 141 additions & 0 deletions classes/output/carousel.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.

/**
* Class theme_elegance
*
* @package theme_elgance
* @copyright 2019 Bas Brands
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

namespace theme_elegance\output;

use stdClass;
use theme_config;

/**
* Class renderer
*
* @package theme_elgance
* @copyright 2019 Bas Brands
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class carousel implements \templatable, \renderable {

/**
* Function to export the renderer data in a format that is suitable for a
* mustache template. This means:
* 1. No complex types - only stdClass, array, int, string, float, bool
* 2. Any additional info that is required for the template is pre-calculated (e.g. capability checks).
*
* @param renderer_base $output Used to do a final render of any components that need to be rendered for export.
* @return array
*/
public function export_for_template($output) {
$theme = theme_config::load('elegance');
$settings = $theme->settings;
$slidenum = $settings->slidenumber;
$template = new stdClass();

if ($slidenum == 0) {
return '';
}

switch ($settings->togglebanner) {
case 1:
break;
case 2:
if (isloggedin()) {
return '';
}
break;
case 3:
if (!isloggedin()) {
return '';
}
break;
case 4:
return '';
break;
}

$template->slidespeed = $settings->slidespeed;
$banners = [];
$count = 0;
foreach (range(1, $slidenum) as $bannernumber) {
$template->hascontent = true;
$banner = new stdClass();
$banner->active = '';
$banner->count = $count++;
$enablebanner = 'enablebanner' . $bannernumber;
$banner->enablebanner = (!empty($settings->$enablebanner));

$bannerimage = 'bannerimage' . $bannernumber;
$bannerimageset = (!empty($settings->$bannerimage));
if ($bannerimageset) {
$banner->bannerimage = $theme->setting_file_url($bannerimage, $bannerimage);
}

$bannertitle = 'bannertitle' . $bannernumber;
if (!empty($settings->$bannertitle)) {
$banner->bannertitle = $settings->$bannertitle;
} else {
$banner->bannertitle = false;
}

$bannertext = 'bannertext' . $bannernumber;
if (!empty($settings->$bannertext)) {
$banner->bannertext = $settings->$bannertext;
} else {
$banner->bannertext = false;
}

$bannerurl = 'bannerurl' . $bannernumber;
if (!empty($settings->$bannerurl)) {
$banner->bannerurl = $settings->$bannerurl;
} else {
$banner->bannerurl = false;
}

$bannercolor = 'bannercolor' . $bannernumber;
if (!empty($settings->$bannercolor)) {
$banner->bannercolor = $settings->$bannercolor;
} else {
$banner->bannercolor = "transparent";
}

$bannerlinktext = 'bannerlinktext' . $bannernumber;
if (!empty($settings->$bannerlinktext)) {
$banner->bannerlinktext = $settings->$bannerlinktext;
} else {
$banner->bannerlinktext = false;
}

$bannerlinkurl = 'bannerlinkurl' . $bannernumber;
if (!empty($settings->$bannerlinkurl)) {
$banner->bannerlinkurl = $settings->$bannerlinkurl;
} else {
$banner->bannerlinkurl = false;
}
$banners[] = $banner;
}
$banners[0]->active = 'active';
$template->banners = $banners;

return $template;
}
}
Loading

0 comments on commit 0b7ea57

Please sign in to comment.