Skip to content
Snippets Groups Projects
Commit 26da40b7 authored by Liam Morland's avatar Liam Morland
Browse files

Coding standards

parent 560ba639
No related branches found
No related tags found
1 merge request!10Coding standards
Showing
with 5246 additions and 3813 deletions
# Using Gesso # Using Gesso
## Requirements ## Requirements
## How to install ## How to install
\ No newline at end of file
...@@ -27,4 +27,4 @@ document.documentElement.className += ' js'; ...@@ -27,4 +27,4 @@ document.documentElement.className += ' js';
domReady(function () { domReady(function () {
Drupal.attachBehaviors(document, drupalSettings); Drupal.attachBehaviors(document, drupalSettings);
}); });
})(Drupal, window.drupalSettings); })(Drupal, window.drupalSettings);
\ No newline at end of file
...@@ -219,4 +219,4 @@ window.Drupal = { behaviors: {}, locale: {} }; ...@@ -219,4 +219,4 @@ window.Drupal = { behaviors: {}, locale: {} };
Drupal.theme.placeholder = function (str) { Drupal.theme.placeholder = function (str) {
return '<em class="placeholder">' + Drupal.checkPlain(str) + '</em>'; return '<em class="placeholder">' + Drupal.checkPlain(str) + '</em>';
}; };
})(Drupal, window.drupalSettings, window.drupalTranslations, window.console, window.Proxy, window.Reflect); })(Drupal, window.drupalSettings, window.drupalTranslations, window.console, window.Proxy, window.Reflect);
\ No newline at end of file
...@@ -13,4 +13,4 @@ ...@@ -13,4 +13,4 @@
if (settingsElement !== null) { if (settingsElement !== null) {
window.drupalSettings = JSON.parse(settingsElement.textContent); window.drupalSettings = JSON.parse(settingsElement.textContent);
} }
})(); })();
\ No newline at end of file
This diff is collapsed.
...@@ -40,9 +40,9 @@ const compileComponentScripts = () => { ...@@ -40,9 +40,9 @@ const compileComponentScripts = () => {
.pipe(dest(jsDest)); .pipe(dest(jsDest));
} }
const cssSrc = path.join(__dirname, '..', 'css'); const cssSrc = path.join(__dirname, '..', 'css');
const buildConfig = async () => { const buildConfig = async() => {
const scssDir = path.join(__dirname, '/source/_patterns/00-config'); const scssDir = path.join(__dirname, '/source/_patterns/00-config');
const ymlDir = path.join(__dirname, './source/_data'); const ymlDir = path.join(__dirname, './source/_data');
...@@ -170,7 +170,7 @@ const buildComponentScripts = (exports.buildScripts = series(compileComponentScr ...@@ -170,7 +170,7 @@ const buildComponentScripts = (exports.buildScripts = series(compileComponentScr
const buildStyles = (exports.buildStyles = series(lintStyles, compileStyles)); const buildStyles = (exports.buildStyles = series(lintStyles, compileStyles));
const build = (isProduction = true ) => { const build = (isProduction = true ) => {
const scriptTask = isProduction ? bundleScripts : bundleScriptsDev; const scriptTask = isProduction ? bundleScripts : bundleScriptsDev;
task('bundleScripts', scriptTask) task('bundleScripts', scriptTask)
return series( return series(
......
(function ($, Drupal) { (function ($, Drupal) {
Drupal.behaviors.expandcollapse = { Drupal.behaviors.expandcollapse = {
attach: function (context, settings) { attach: function (context, settings) {
$(document).ready(function(){ $(document).ready(function () {
$('.uw-expand-collapse').each(function() { $('.uw-expand-collapse').each(function () {
// Get the id of the expand collapse. // Get the id of the expand collapse.
var id = '#uw-expand-collapse-' + $(this).data('id'); var id = '#uw-expand-collapse-' + $(this).data('id');
// When the expand all button is clicked, expand all the items. // When the expand all button is clicked, expand all the items.
$(id + ' [data-type="expand-all"]').click(function() { $(id + ' [data-type="expand-all"]').click(function () {
// Find each of the buttons, which are the titles and change // Find each of the buttons, which are the titles and change
// aria-expanded and add class to show expanded. // aria-expanded and add class to show expanded.
$(id + ' .uw-expand-collapse__items button').each(function() { $(id + ' .uw-expand-collapse__items button').each(function () {
$(this).attr('aria-expanded', true); $(this).attr('aria-expanded', true);
$(this).addClass('uw-expanded'); $(this).addClass('uw-expanded');
}); });
// Find each of the text and add css to display them. // Find each of the text and add css to display them.
$(id + ' .uw-expand-collapse__items .uw-expand-collapse__text').each(function() { $(id + ' .uw-expand-collapse__items .uw-expand-collapse__text').each(function () {
$(this).css('display', 'block'); $(this).css('display', 'block');
}); });
}); });
// When the collapse all button is clicked, collapse all the items. // When the collapse all button is clicked, collapse all the items.
$(id + ' [data-type="collapse-all"]').click(function() { $(id + ' [data-type="collapse-all"]').click(function () {
// Find each of the buttons, which are the titles and change // Find each of the buttons, which are the titles and change
// aria-expanded and remove class to show collapsed. // aria-expanded and remove class to show collapsed.
$(id + ' .uw-expand-collapse__items button').each(function() { $(id + ' .uw-expand-collapse__items button').each(function () {
$(this).attr('aria-expanded', true); $(this).attr('aria-expanded', true);
$(this).removeClass('uw-expanded'); $(this).removeClass('uw-expanded');
}); });
// Find each of the text and add css to display them. // Find each of the text and add css to display them.
$(id + ' .uw-expand-collapse__items .uw-expand-collapse__text').each(function() { $(id + ' .uw-expand-collapse__items .uw-expand-collapse__text').each(function () {
$(this).css('display', 'none'); $(this).css('display', 'none');
}); });
}); });
// Step through each of the titles and add a click function. // Step through each of the titles and add a click function.
$(id + ' .uw-expand-collapse__items button').click(function() { $(id + ' .uw-expand-collapse__items button').click(function () {
// If this has an expanded class, remove it and change aria expanded to false. // If this has an expanded class, remove it and change aria expanded to false.
// Otherwise add the expanded class and set aria-expanded to true. // Otherwise add the expanded class and set aria-expanded to true.
...@@ -67,10 +67,10 @@ ...@@ -67,10 +67,10 @@
(function ($, Drupal) { (function ($, Drupal) {
Drupal.behaviors.factfigure = { Drupal.behaviors.factfigure = {
attach: function (context, settings) { attach: function (context, settings) {
$(document).ready(function(){ $(document).ready(function () {
// Step through each FF on the page. // Step through each FF on the page.
$('.uw-ff').each(function() { $('.uw-ff').each(function () {
var result = $(this).find('.uw-ff__has-carousel-settings').length; var result = $(this).find('.uw-ff__has-carousel-settings').length;
...@@ -115,10 +115,10 @@ ...@@ -115,10 +115,10 @@
(function ($, Drupal) { (function ($, Drupal) {
Drupal.behaviors.imagegallery = { Drupal.behaviors.imagegallery = {
attach: function (context, settings) { attach: function (context, settings) {
$(document).ready(function(){ $(document).ready(function () {
// Step through each FF on the page. // Step through each FF on the page.
$('.uw-ig').each(function() { $('.uw-ig').each(function () {
// Get the id to reference the individual FF. // Get the id to reference the individual FF.
// Need this to ensure that if more than one FF on the page, // Need this to ensure that if more than one FF on the page,
...@@ -205,7 +205,6 @@ ...@@ -205,7 +205,6 @@
const parent = target.parentNode; const parent = target.parentNode;
const grandparent = parent.parentNode; const grandparent = parent.parentNode;
// Remove all current selected tabs // Remove all current selected tabs
parent parent
.querySelectorAll('[aria-selected="true"]') .querySelectorAll('[aria-selected="true"]')
...@@ -229,20 +228,15 @@ ...@@ -229,20 +228,15 @@
}; };
})(jQuery, Drupal); })(jQuery, Drupal);
(function ($, Drupal) { (function ($, Drupal) {
Drupal.behaviors.menuhorizontal = { Drupal.behaviors.menuhorizontal = {
attach: function (context, settings) { attach: function (context, settings) {
// uw-horizontal-nav // uw-horizontal-nav
$(document).ready(function(){ $(document).ready(function () {
// Have to add the run this code only once, so that multiple // Have to add the run this code only once, so that multiple
// loads of the menu are not shown when logged in. // loads of the menu are not shown when logged in.
$(document, context).once('menuhorizontal').each( function() { $(document, context).once('menuhorizontal').each( function () {
const toggle = document.querySelector(".uw-navigation-button"); const toggle = document.querySelector(".uw-navigation-button");
const navHeader = document.querySelector(".uw-header__navigation"); const navHeader = document.querySelector(".uw-header__navigation");
...@@ -277,7 +271,6 @@ ...@@ -277,7 +271,6 @@
var parent = this.parentNode.parentNode.parentNode.parentNode; var parent = this.parentNode.parentNode.parentNode.parentNode;
var screenWidth = $(window).width(); var screenWidth = $(window).width();
if (this.classList.contains('submenu-active')) { if (this.classList.contains('submenu-active')) {
this.classList.remove('submenu-active'); this.classList.remove('submenu-active');
...@@ -316,7 +309,6 @@ ...@@ -316,7 +309,6 @@
} }
} }
/* Close Submenu From Anywhere */ /* Close Submenu From Anywhere */
function closeSubmenu(e) { function closeSubmenu(e) {
...@@ -359,7 +351,6 @@ ...@@ -359,7 +351,6 @@
// Add event listeners on the menu toggle button. // Add event listeners on the menu toggle button.
toggle.addEventListener("click", toggleMenu, false); toggle.addEventListener("click", toggleMenu, false);
// apply timeout to the to event firing // apply timeout to the to event firing
// so it fires at end of event. // so it fires at end of event.
function debouncer(func) { function debouncer(func) {
...@@ -404,7 +395,6 @@ ...@@ -404,7 +395,6 @@
) )
); );
menuCheckWidth(); menuCheckWidth();
}); });
}); });
......
var comments = { var comments = {
"comments" : [ "comments" : [
{ {
"el": "#annotation-css-selector", "el": "#annotation-css-selector",
"title" : "Annotation title", "title" : "Annotation title",
"comment": "Annotation description" "comment": "Annotation description"
} }
] ]
}; };
\ No newline at end of file
...@@ -159,4 +159,4 @@ $button-font-size: gesso-font-size(1) !default; ...@@ -159,4 +159,4 @@ $button-font-size: gesso-font-size(1) !default;
cursor: default; cursor: default;
pointer-events: none; pointer-events: none;
} }
} }
\ No newline at end of file
...@@ -44,4 +44,4 @@ ...@@ -44,4 +44,4 @@
&:active { &:active {
color: $active; color: $active;
} }
} }
\ No newline at end of file
...@@ -90,4 +90,4 @@ $max-width: $xl; ...@@ -90,4 +90,4 @@ $max-width: $xl;
@include breakpoint($max-width) { @include breakpoint($max-width) {
@content; @content;
} }
} }
\ No newline at end of file
...@@ -511,4 +511,4 @@ $gesso: ( ...@@ -511,4 +511,4 @@ $gesso: (
xxl: 96px, xxl: 96px,
), ),
gutter-width: 40px, gutter-width: 40px,
); );
\ No newline at end of file
...@@ -78,4 +78,4 @@ ...@@ -78,4 +78,4 @@
} }
} }
\ No newline at end of file
...@@ -2,4 +2,4 @@ ...@@ -2,4 +2,4 @@
title: Break Hints title: Break Hints
--- ---
## Quick use ## Quick use
{% include '@global/06-break-hints/break-hints.twig' %} in your template to use the break hints while you do development {% include '@global/06-break-hints/break-hints.twig' %} in your template to use the break hints while you do development
\ No newline at end of file
...@@ -467,4 +467,4 @@ $fdsu-location: "\e930"; ...@@ -467,4 +467,4 @@ $fdsu-location: "\e930";
&::before{ &::before{
content: $fdsu-location; content: $fdsu-location;
} }
} }
\ No newline at end of file
...@@ -218,4 +218,4 @@ textarea { ...@@ -218,4 +218,4 @@ textarea {
row-gap: 1rem; row-gap: 1rem;
} }
} }
} }
\ No newline at end of file
--- ---
title: UW Input title: UW Input
--- ---
\ No newline at end of file
...@@ -40,4 +40,4 @@ $faculties: 'org-default', 'org-ahs', 'org-art', 'org-eng', 'org-env', 'org-mat' ...@@ -40,4 +40,4 @@ $faculties: 'org-default', 'org-ahs', 'org-art', 'org-eng', 'org-env', 'org-mat'
} }
} }
} }
} }
\ No newline at end of file
...@@ -158,4 +158,4 @@ ...@@ -158,4 +158,4 @@
font-size: 3rem; font-size: 3rem;
} }
} }
} }
\ No newline at end of file
...@@ -40,4 +40,4 @@ $sidebar-width: 300px; ...@@ -40,4 +40,4 @@ $sidebar-width: 300px;
grid-row: 1 / 2; grid-row: 1 / 2;
} }
} }
} }
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment