From 84eee721c7d91b2416afb359709f21ee1e73858b Mon Sep 17 00:00:00 2001 From: Andrew White Date: Thu, 21 Nov 2024 18:03:37 +0000 Subject: [PATCH 01/14] Combine web, worker and counter into a single container This is the recommended default Rails docker setup and it allows us to add processes for CSS/JS bundling when we switch away from sprockets. --- Gemfile | 4 ++++ Gemfile.lock | 2 ++ Procfile.dev | 3 +++ docker-compose.yml | 20 +++----------------- 4 files changed, 12 insertions(+), 17 deletions(-) create mode 100644 Procfile.dev diff --git a/Gemfile b/Gemfile index e1881b81b..d48045973 100644 --- a/Gemfile +++ b/Gemfile @@ -43,6 +43,10 @@ gem 'aws-sdk-codedeploy' gem 'aws-sdk-cloudwatchlogs' gem 'aws-sdk-s3' +group :development do + gem 'foreman' +end + group :development, :test do gem 'simplecov' gem 'brakeman', require: false diff --git a/Gemfile.lock b/Gemfile.lock index 7ade79e4f..9b0a9f03d 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -224,6 +224,7 @@ GEM ffi-compiler (1.3.2) ffi (>= 1.15.5) rake + foreman (0.88.1) globalid (1.2.1) activesupport (>= 6.1) hashdiff (1.1.1) @@ -498,6 +499,7 @@ DEPENDENCIES faker faraday faraday_middleware + foreman image_processing jbuilder jquery-rails diff --git a/Procfile.dev b/Procfile.dev new file mode 100644 index 000000000..258d162b0 --- /dev/null +++ b/Procfile.dev @@ -0,0 +1,3 @@ +web: bin/rails server -b 0.0.0.0 -p 3000 +worker: MIN_PRIORITY=10 bin/rake jobs:work +counter: MAX_PRIORITY=5 bin/rake jobs:work diff --git a/docker-compose.yml b/docker-compose.yml index 2caa5b7c3..842957235 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -46,28 +46,14 @@ services: environment: <<: *environment command: [ - "rails", "server", - "-b", "0.0.0.0", - "-p", "3000" + "foreman", "start", + "-f", "Procfile.dev" ] ports: - "127.0.0.1:3000:3000" stdin_open: true tty: true - - worker: - <<: *application - environment: - <<: *environment - MIN_PRIORITY: "10" - command: [ "rake", "jobs:work" ] - - counter: - <<: *application - environment: - <<: *environment - MAX_PRIORITY: "5" - command: [ "rake", "jobs:work" ] + init: true volumes: bundle: From 6b7dfd5cd7a9565b2ff3888d16f7870edb68dc97 Mon Sep 17 00:00:00 2001 From: Andrew White Date: Thu, 21 Nov 2024 18:44:59 +0000 Subject: [PATCH 02/14] Remove legacy IE code and behaviour --- app/assets/javascripts/details.js | 1 - app/assets/javascripts/ie.js | 2 - app/assets/stylesheets/application-ie7.css | 1 - app/assets/stylesheets/application-ie8.css | 1 - app/assets/stylesheets/site-ie7.scss | 5 - app/assets/stylesheets/site-ie8.scss | 5 - app/views/layouts/application.html.erb | 7 +- config/initializers/assets.rb | 2 - spec/requests/link_header_spec.rb | 30 --- vendor/assets/javascripts/details.polyfill.js | 217 ------------------ .../assets/javascripts/html5shiv-printshiv.js | 11 - vendor/assets/javascripts/html5shiv.js | 9 - 12 files changed, 1 insertion(+), 290 deletions(-) delete mode 100644 app/assets/javascripts/details.js delete mode 100644 app/assets/javascripts/ie.js delete mode 100644 app/assets/stylesheets/application-ie7.css delete mode 100644 app/assets/stylesheets/application-ie8.css delete mode 100644 app/assets/stylesheets/site-ie7.scss delete mode 100644 app/assets/stylesheets/site-ie8.scss delete mode 100644 vendor/assets/javascripts/details.polyfill.js delete mode 100644 vendor/assets/javascripts/html5shiv-printshiv.js delete mode 100644 vendor/assets/javascripts/html5shiv.js diff --git a/app/assets/javascripts/details.js b/app/assets/javascripts/details.js deleted file mode 100644 index 4e2d8eda0..000000000 --- a/app/assets/javascripts/details.js +++ /dev/null @@ -1 +0,0 @@ -//= require details.polyfill diff --git a/app/assets/javascripts/ie.js b/app/assets/javascripts/ie.js deleted file mode 100644 index c99e5aaea..000000000 --- a/app/assets/javascripts/ie.js +++ /dev/null @@ -1,2 +0,0 @@ -//= require html5shiv -//= require html5shiv-printshiv diff --git a/app/assets/stylesheets/application-ie7.css b/app/assets/stylesheets/application-ie7.css deleted file mode 100644 index d4e274154..000000000 --- a/app/assets/stylesheets/application-ie7.css +++ /dev/null @@ -1 +0,0 @@ -// = require 'site-ie7' \ No newline at end of file diff --git a/app/assets/stylesheets/application-ie8.css b/app/assets/stylesheets/application-ie8.css deleted file mode 100644 index f5cb63c08..000000000 --- a/app/assets/stylesheets/application-ie8.css +++ /dev/null @@ -1 +0,0 @@ -// = require 'site-ie8' \ No newline at end of file diff --git a/app/assets/stylesheets/site-ie7.scss b/app/assets/stylesheets/site-ie7.scss deleted file mode 100644 index f60fb209c..000000000 --- a/app/assets/stylesheets/site-ie7.scss +++ /dev/null @@ -1,5 +0,0 @@ -$is-ie: true; -$ie-version: 7; -$mobile-ie6: false; - -@import "site"; \ No newline at end of file diff --git a/app/assets/stylesheets/site-ie8.scss b/app/assets/stylesheets/site-ie8.scss deleted file mode 100644 index 088297b73..000000000 --- a/app/assets/stylesheets/site-ie8.scss +++ /dev/null @@ -1,5 +0,0 @@ -$is-ie: true; -$ie-version: 8; -$mobile-ie6: false; - -@import "site"; \ No newline at end of file diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 842a81afd..7c1155960 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -14,12 +14,7 @@ <%= preload_link_tag 'character-counter.js', nopush: true %> <% end %> - <%= stylesheet_link_tag 'application' %> - - - - - + <%= stylesheet_link_tag 'application' %> <%= render 'application/os' %> diff --git a/config/initializers/assets.rb b/config/initializers/assets.rb index 0689db54e..445eb2634 100644 --- a/config/initializers/assets.rb +++ b/config/initializers/assets.rb @@ -12,8 +12,6 @@ # Rails.application.config.assets.precompile += %w[ admin.js admin.css ] Rails.application.config.assets.precompile += %w[ - application-ie7.css - application-ie8.css admin.css delayed/web/application.css ie.js diff --git a/spec/requests/link_header_spec.rb b/spec/requests/link_header_spec.rb index 83a091dcf..150862faa 100644 --- a/spec/requests/link_header_spec.rb +++ b/spec/requests/link_header_spec.rb @@ -15,11 +15,6 @@ expect(link_header).to include("; rel=preload; as=style; type=text/css; nopush") expect(link_header).to include("; rel=preload; as=script; type=text/javascript; nopush") - expect(link_header).not_to include("; rel=preload; as=style; type=text/css; nopush") - expect(link_header).not_to include("; rel=preload; as=style; type=text/css; nopush") - expect(link_header).not_to include("; rel=preload; as=script; type=text/javascript; nopush") - expect(link_header).not_to include("; rel=preload; as=script; type=text/javascript; nopush") - expect(link_header).not_to include("; rel=preload; as=script; type=text/javascript; nopush") expect(link_header).not_to include("; rel=preload; as=script; type=text/javascript; nopush") end @@ -36,11 +31,6 @@ expect(link_header).to include("; rel=preload; as=style; type=text/css; nopush") expect(link_header).to include("; rel=preload; as=script; type=text/javascript; nopush") - expect(link_header).not_to include("; rel=preload; as=style; type=text/css; nopush") - expect(link_header).not_to include("; rel=preload; as=style; type=text/css; nopush") - expect(link_header).not_to include("; rel=preload; as=script; type=text/javascript; nopush") - expect(link_header).not_to include("; rel=preload; as=script; type=text/javascript; nopush") - expect(link_header).not_to include("; rel=preload; as=script; type=text/javascript; nopush") expect(link_header).not_to include("; rel=preload; as=script; type=text/javascript; nopush") end @@ -57,11 +47,6 @@ expect(link_header).to include("; rel=preload; as=style; type=text/css; nopush") expect(link_header).to include("; rel=preload; as=script; type=text/javascript; nopush") - expect(link_header).not_to include("; rel=preload; as=style; type=text/css; nopush") - expect(link_header).not_to include("; rel=preload; as=style; type=text/css; nopush") - expect(link_header).not_to include("; rel=preload; as=script; type=text/javascript; nopush") - expect(link_header).not_to include("; rel=preload; as=script; type=text/javascript; nopush") - expect(link_header).not_to include("; rel=preload; as=script; type=text/javascript; nopush") expect(link_header).to include("; rel=preload; as=script; type=text/javascript; nopush") end @@ -80,11 +65,6 @@ expect(link_header).to include("; rel=preload; as=style; type=text/css; nopush") expect(link_header).to include("; rel=preload; as=script; type=text/javascript; nopush") - expect(link_header).not_to include("; rel=preload; as=style; type=text/css; nopush") - expect(link_header).not_to include("; rel=preload; as=style; type=text/css; nopush") - expect(link_header).not_to include("; rel=preload; as=script; type=text/javascript; nopush") - expect(link_header).not_to include("; rel=preload; as=script; type=text/javascript; nopush") - expect(link_header).to include("; rel=preload; as=script; type=text/javascript; nopush") expect(link_header).not_to include("; rel=preload; as=script; type=text/javascript; nopush") end @@ -103,11 +83,6 @@ expect(link_header).to include("; rel=preload; as=style; type=text/css; nopush") expect(link_header).to include("; rel=preload; as=script; type=text/javascript; nopush") - expect(link_header).not_to include("; rel=preload; as=style; type=text/css; nopush") - expect(link_header).not_to include("; rel=preload; as=style; type=text/css; nopush") - expect(link_header).not_to include("; rel=preload; as=script; type=text/javascript; nopush") - expect(link_header).not_to include("; rel=preload; as=script; type=text/javascript; nopush") - expect(link_header).not_to include("; rel=preload; as=script; type=text/javascript; nopush") expect(link_header).not_to include("; rel=preload; as=script; type=text/javascript; nopush") end @@ -126,11 +101,6 @@ expect(link_header).to include("; rel=preload; as=style; type=text/css; nopush") expect(link_header).to include("; rel=preload; as=script; type=text/javascript; nopush") - expect(link_header).not_to include("; rel=preload; as=style; type=text/css; nopush") - expect(link_header).not_to include("; rel=preload; as=style; type=text/css; nopush") - expect(link_header).not_to include("; rel=preload; as=script; type=text/javascript; nopush") - expect(link_header).not_to include("; rel=preload; as=script; type=text/javascript; nopush") - expect(link_header).not_to include("; rel=preload; as=script; type=text/javascript; nopush") expect(link_header).not_to include("; rel=preload; as=script; type=text/javascript; nopush") end diff --git a/vendor/assets/javascripts/details.polyfill.js b/vendor/assets/javascripts/details.polyfill.js deleted file mode 100644 index 8b0d20658..000000000 --- a/vendor/assets/javascripts/details.polyfill.js +++ /dev/null @@ -1,217 +0,0 @@ -//
polyfill -// http://caniuse.com/#feat=details - -// FF Support for HTML5's
and -// https://bugzilla.mozilla.org/show_bug.cgi?id=591737 - -// http://www.sitepoint.com/fixing-the-details-element/ - -;(function () { - 'use strict' - - var NATIVE_DETAILS = typeof document.createElement('details').open === 'boolean' - var KEY_ENTER = 13 - var KEY_SPACE = 32 - - // Add event construct for modern browsers or IE - // which fires the callback with a pre-converted target reference - function addEvent (node, type, callback) { - if (node.addEventListener) { - node.addEventListener(type, function (e) { - callback(e, e.target) - }, false) - } else if (node.attachEvent) { - node.attachEvent('on' + type, function (e) { - callback(e, e.srcElement) - }) - } - } - - // Cross-browser character code / key pressed - function charCode (e) { - return (typeof e.which === 'number') ? e.which : e.keyCode - } - - // Cross-browser preventing default action - function preventDefault (e) { - if (e.preventDefault) { - e.preventDefault() - } else { - e.returnValue = false - } - } - - // Handle cross-modal click events - function addClickEvent (node, callback) { - addEvent(node, 'keypress', function (e, target) { - // When the key gets pressed - check if it is enter or space - if (charCode(e) === KEY_ENTER || charCode(e) === KEY_SPACE) { - if (target.nodeName.toLowerCase() === 'summary') { - // Prevent space from scrolling the page - // and enter from submitting a form - preventDefault(e) - // Click to let the click event do all the necessary action - if (target.click) { - target.click() - } else { - // except Safari 5.1 and under don't support .click() here - callback(e, target) - } - } - } - }) - - // Prevent keyup to prevent clicking twice in Firefox when using space key - addEvent(node, 'keyup', function (e, target) { - if (charCode(e) === KEY_SPACE) { - if (target.nodeName === 'SUMMARY') { - preventDefault(e) - } - } - }) - - addEvent(node, 'click', function (e, target) { - callback(e, target) - }) - } - - // Get the nearest ancestor element of a node that matches a given tag name - function getAncestor (node, match) { - do { - if (!node || node.nodeName.toLowerCase() === match) { - break - } - node = node.parentNode - } while (node) - - return node - } - - // Create a started flag so we can prevent the initialisation - // function firing from both DOMContentLoaded and window.onload - var started = false - - // Initialisation function - function addDetailsPolyfill (list) { - // If this has already happened, just return - // else set the flag so it doesn't happen again - if (started) { - return - } - started = true - - // Get the collection of details elements, but if that's empty - // then we don't need to bother with the rest of the scripting - if ((list = document.getElementsByTagName('details')).length === 0) { - return - } - - // else iterate through them to apply their initial state - var n = list.length - var i = 0 - for (i; i < n; i++) { - var details = list[i] - - // Save shortcuts to the inner summary and content elements - details.__summary = details.getElementsByTagName('summary').item(0) - details.__content = details.getElementsByTagName('div').item(0) - - // If the content doesn't have an ID, assign it one now - // which we'll need for the summary's aria-controls assignment - if (!details.__content.id) { - details.__content.id = 'details-content-' + i - } - - // Add ARIA role="group" to details - details.setAttribute('role', 'group') - - // Add role=button to summary - details.__summary.setAttribute('role', 'button') - - // Add aria-controls - details.__summary.setAttribute('aria-controls', details.__content.id) - - // Set tabIndex so the summary is keyboard accessible for non-native elements - // http://www.saliences.com/browserBugs/tabIndex.html - if (!NATIVE_DETAILS) { - details.__summary.tabIndex = 0 - } - - // Detect initial open state - var openAttr = details.getAttribute('open') !== null - if (openAttr === true) { - details.__summary.setAttribute('aria-expanded', 'true') - details.__content.setAttribute('aria-hidden', 'false') - } else { - details.__summary.setAttribute('aria-expanded', 'false') - details.__content.setAttribute('aria-hidden', 'true') - if (!NATIVE_DETAILS) { - details.__content.style.display = 'none' - } - } - - // Create a circular reference from the summary back to its - // parent details element, for convenience in the click handler - details.__summary.__details = details - - // If this is not a native implementation, create an arrow - // inside the summary - if (!NATIVE_DETAILS) { - var twisty = document.createElement('i') - - if (openAttr === true) { - twisty.className = 'arrow arrow-open' - twisty.appendChild(document.createTextNode('\u25bc')) - } else { - twisty.className = 'arrow arrow-closed' - twisty.appendChild(document.createTextNode('\u25ba')) - } - - details.__summary.__twisty = details.__summary.insertBefore(twisty, details.__summary.firstChild) - details.__summary.__twisty.setAttribute('aria-hidden', 'true') - } - } - - // Define a statechange function that updates aria-expanded and style.display - // Also update the arrow position - function statechange (summary) { - var expanded = summary.__details.__summary.getAttribute('aria-expanded') === 'true' - var hidden = summary.__details.__content.getAttribute('aria-hidden') === 'true' - - summary.__details.__summary.setAttribute('aria-expanded', (expanded ? 'false' : 'true')) - summary.__details.__content.setAttribute('aria-hidden', (hidden ? 'false' : 'true')) - - if (!NATIVE_DETAILS) { - summary.__details.__content.style.display = (expanded ? 'none' : '') - - var hasOpenAttr = summary.__details.getAttribute('open') !== null - if (!hasOpenAttr) { - summary.__details.setAttribute('open', 'open') - } else { - summary.__details.removeAttribute('open') - } - } - - if (summary.__twisty) { - summary.__twisty.firstChild.nodeValue = (expanded ? '\u25ba' : '\u25bc') - summary.__twisty.setAttribute('class', (expanded ? 'arrow arrow-closed' : 'arrow arrow-open')) - } - - return true - } - - // Bind a click event to handle summary elements - addClickEvent(document, function (e, summary) { - if (!(summary = getAncestor(summary, 'summary'))) { - return true - } - return statechange(summary) - }) - } - - // Bind two load events for modern and older browsers - // If the first one fires it will set a flag to block the second one - // but if it's not supported then the second one will fire - addEvent(document, 'DOMContentLoaded', addDetailsPolyfill) - addEvent(window, 'load', addDetailsPolyfill) -})() diff --git a/vendor/assets/javascripts/html5shiv-printshiv.js b/vendor/assets/javascripts/html5shiv-printshiv.js deleted file mode 100644 index 944bc8dfb..000000000 --- a/vendor/assets/javascripts/html5shiv-printshiv.js +++ /dev/null @@ -1,11 +0,0 @@ -/* - HTML5 Shiv v3.6.2 | @afarkas @jdalton @jon_neal @rem | MIT/GPL2 Licensed -*/ -(function(j,f){function s(a,b){var c=a.createElement("p"),m=a.getElementsByTagName("head")[0]||a.documentElement;c.innerHTML="x";return m.insertBefore(c.lastChild,m.firstChild)}function o(){var a=d.elements;return"string"==typeof a?a.split(" "):a}function n(a){var b=t[a[u]];b||(b={},p++,a[u]=p,t[p]=b);return b}function v(a,b,c){b||(b=f);if(e)return b.createElement(a);c||(c=n(b));b=c.cache[a]?c.cache[a].cloneNode():y.test(a)?(c.cache[a]=c.createElem(a)).cloneNode():c.createElem(a); -return b.canHaveChildren&&!z.test(a)?c.frag.appendChild(b):b}function A(a,b){if(!b.cache)b.cache={},b.createElem=a.createElement,b.createFrag=a.createDocumentFragment,b.frag=b.createFrag();a.createElement=function(c){return!d.shivMethods?b.createElem(c):v(c,a,b)};a.createDocumentFragment=Function("h,f","return function(){var n=f.cloneNode(),c=n.createElement;h.shivMethods&&("+o().join().replace(/\w+/g,function(a){b.createElem(a);b.frag.createElement(a);return'c("'+a+'")'})+");return n}")(d,b.frag)} -function w(a){a||(a=f);var b=n(a);if(d.shivCSS&&!q&&!b.hasCSS)b.hasCSS=!!s(a,"article,aside,figcaption,figure,footer,header,hgroup,main,nav,section{display:block}mark{background:#FF0;color:#000}");e||A(a,b);return a}function B(a){for(var b,c=a.attributes,m=c.length,f=a.ownerDocument.createElement(l+":"+a.nodeName);m--;)b=c[m],b.specified&&f.setAttribute(b.nodeName,b.nodeValue);f.style.cssText=a.style.cssText;return f}function x(a){function b(){clearTimeout(d._removeSheetTimer);c&&c.removeNode(!0); -c=null}var c,f,d=n(a),e=a.namespaces,j=a.parentWindow;if(!C||a.printShived)return a;"undefined"==typeof e[l]&&e.add(l);j.attachEvent("onbeforeprint",function(){b();var g,i,d;d=a.styleSheets;for(var e=[],h=d.length,k=Array(h);h--;)k[h]=d[h];for(;d=k.pop();)if(!d.disabled&&D.test(d.media)){try{g=d.imports,i=g.length}catch(j){i=0}for(h=0;h+~])("+o().join("|")+")(?=[[\\s,>+~#.:]|$)","gi"); -for(k="$1"+l+"\\:$2";i--;)e=g[i]=g[i].split("}"),e[e.length-1]=e[e.length-1].replace(h,k),g[i]=e.join("}");e=g.join("{");i=a.getElementsByTagName("*");h=i.length;k=RegExp("^(?:"+o().join("|")+")$","i");for(d=[];h--;)g=i[h],k.test(g.nodeName)&&d.push(g.applyElement(B(g)));f=d;c=s(a,e)});j.attachEvent("onafterprint",function(){for(var a=f,c=a.length;c--;)a[c].removeNode();clearTimeout(d._removeSheetTimer);d._removeSheetTimer=setTimeout(b,500)});a.printShived=!0;return a}var r=j.html5||{},z=/^<|^(?:button|map|select|textarea|object|iframe|option|optgroup)$/i, -y=/^(?:a|b|code|div|fieldset|h1|h2|h3|h4|h5|h6|i|label|li|ol|p|q|span|strong|style|table|tbody|td|th|tr|ul)$/i,q,u="_html5shiv",p=0,t={},e;(function(){try{var a=f.createElement("a");a.innerHTML="";q="hidden"in a;var b;if(!(b=1==a.childNodes.length)){f.createElement("a");var c=f.createDocumentFragment();b="undefined"==typeof c.cloneNode||"undefined"==typeof c.createDocumentFragment||"undefined"==typeof c.createElement}e=b}catch(d){e=q=!0}})();var d={elements:r.elements||"abbr article aside audio bdi canvas data datalist details figcaption figure footer header hgroup main mark meter nav output progress section summary time video", -version:"3.6.2",shivCSS:!1!==r.shivCSS,supportsUnknownElements:e,shivMethods:!1!==r.shivMethods,type:"default",shivDocument:w,createElement:v,createDocumentFragment:function(a,b){a||(a=f);if(e)return a.createDocumentFragment();for(var b=b||n(a),c=b.frag.cloneNode(),d=0,j=o(),l=j.length;darticle,aside,figcaption,figure,footer,header,hgroup,main,nav,section{display:block}mark{background:#FF0;color:#000}"; -c=d.insertBefore(c.lastChild,d.firstChild);b.hasCSS=!!c}g||t(a,b);return a}var k=l.html5||{},s=/^<|^(?:button|map|select|textarea|object|iframe|option|optgroup)$/i,r=/^(?:a|b|code|div|fieldset|h1|h2|h3|h4|h5|h6|i|label|li|ol|p|q|span|strong|style|table|tbody|td|th|tr|ul)$/i,j,o="_html5shiv",h=0,n={},g;(function(){try{var a=f.createElement("a");a.innerHTML="";j="hidden"in a;var b;if(!(b=1==a.childNodes.length)){f.createElement("a");var c=f.createDocumentFragment();b="undefined"==typeof c.cloneNode|| -"undefined"==typeof c.createDocumentFragment||"undefined"==typeof c.createElement}g=b}catch(d){g=j=!0}})();var e={elements:k.elements||"abbr article aside audio bdi canvas data datalist details figcaption figure footer header hgroup main mark meter nav output progress section summary time video",version:"3.6.2",shivCSS:!1!==k.shivCSS,supportsUnknownElements:g,shivMethods:!1!==k.shivMethods,type:"default",shivDocument:q,createElement:p,createDocumentFragment:function(a,b){a||(a=f);if(g)return a.createDocumentFragment(); -for(var b=b||i(a),c=b.frag.cloneNode(),d=0,e=m(),h=e.length;d Date: Fri, 22 Nov 2024 12:26:52 +0000 Subject: [PATCH 03/14] Wrap label in a h2 tag for accessibility --- app/assets/stylesheets/petitions/views/_home.scss | 8 ++++++-- app/views/pages/home/_search_petitions.html.erb | 6 +++++- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/app/assets/stylesheets/petitions/views/_home.scss b/app/assets/stylesheets/petitions/views/_home.scss index 2ac0d3bb2..77d35c448 100644 --- a/app/assets/stylesheets/petitions/views/_home.scss +++ b/app/assets/stylesheets/petitions/views/_home.scss @@ -166,10 +166,9 @@ a.threshold-panel:hover, a.threshold-panel:focus { padding-bottom: 0; } -.search-petitions label { +.search-petitions h2 { @include bold-36(); - display: block; margin-top: em(30, 20); margin-bottom: em(10, 20); @@ -177,4 +176,9 @@ a.threshold-panel:hover, a.threshold-panel:focus { margin-top: em(30, 24); margin-bottom: em(10, 24); } + + label { + display: block; + margin: 0; + } } diff --git a/app/views/pages/home/_search_petitions.html.erb b/app/views/pages/home/_search_petitions.html.erb index 256daf74f..d81a5a027 100644 --- a/app/views/pages/home/_search_petitions.html.erb +++ b/app/views/pages/home/_search_petitions.html.erb @@ -10,7 +10,11 @@ <% end %> - <%= label_tag 'search', 'Search petitions', id: 'search-petitions-heading' %> +

+ <%= label_tag 'search' do %> + Search petitions + <% end %> +

<%= search_field_tag 'q', nil, class: 'form-control', id: 'search' %> From 41d6146d43d01b8f7860207176ed2daa6d8e1fdb Mon Sep 17 00:00:00 2001 From: Andrew White Date: Fri, 22 Nov 2024 12:38:04 +0000 Subject: [PATCH 04/14] Use void tags instead of self-closing tags --- app/views/admin/admin/index.html.erb | 16 ++--- .../petitions/_petition_details.html.erb | 4 +- .../admin/archived/petitions/index.html.erb | 8 +-- app/views/admin/logs/show.html.erb | 2 +- .../petitions/_petition_details.html.erb | 4 +- app/views/admin/petitions/index.html.erb | 8 +-- app/views/application/_os.html.erb | 34 ++++----- app/views/application/_social_meta.html.erb | 2 +- .../petition_mailer/email_creator.html.erb | 6 +- .../petition_mailer/email_signer.html.erb | 6 +- .../mailshot_for_creator.html.erb | 6 +- .../mailshot_for_signer.html.erb | 6 +- .../notify_creator_of_debate_outcome.html.erb | 4 +- ...otify_creator_of_debate_scheduled.html.erb | 4 +- ...ify_creator_of_threshold_response.html.erb | 4 +- .../notify_signer_of_debate_outcome.html.erb | 4 +- ...notify_signer_of_debate_scheduled.html.erb | 4 +- ...tify_signer_of_threshold_response.html.erb | 4 +- app/views/errors/layout.html.erb | 6 +- app/views/layouts/admin.html.erb | 6 +- app/views/layouts/application.html.erb | 6 +- app/views/pages/privacy.html.erb | 2 +- .../email_confirmation_for_signer.html.erb | 4 +- .../petition_mailer/email_creator.html.erb | 6 +- .../email_duplicate_signatures.html.erb | 6 +- .../petition_mailer/email_signer.html.erb | 6 +- .../gather_sponsors_for_petition.html.erb | 12 ++-- .../mailshot_for_creator.html.erb | 6 +- .../mailshot_for_signer.html.erb | 6 +- ...fy_creator_of_closing_date_change.html.erb | 6 +- .../notify_creator_of_debate_outcome.html.erb | 4 +- ...otify_creator_of_debate_scheduled.html.erb | 4 +- ..._sponsored_petition_being_stopped.html.erb | 4 +- ...ify_creator_of_threshold_response.html.erb | 4 +- ..._validated_petition_being_stopped.html.erb | 4 +- ...reator_that_moderation_is_delayed.html.erb | 6 +- ...reator_that_petition_is_published.html.erb | 6 +- ...reator_that_petition_was_rejected.html.erb | 10 +-- ...ify_signer_of_closing_date_change.html.erb | 6 +- .../notify_signer_of_debate_outcome.html.erb | 4 +- ...notify_signer_of_debate_scheduled.html.erb | 4 +- ...tify_signer_of_threshold_response.html.erb | 4 +- ...ponsor_that_petition_is_published.html.erb | 6 +- ...ponsor_that_petition_was_rejected.html.erb | 8 +-- ..._of_email_confirmation_for_signer.html.erb | 4 +- app/views/petitions/check.html.erb | 2 +- ...nd_email_confirmation_for_sponsor.html.erb | 6 +- ...nsor_signed_email_below_threshold.html.erb | 6 +- ...sponsor_signed_email_on_threshold.html.erb | 6 +- config/initializers/action_view.rb | 69 +++++++++++++++++++ spec/helpers/social_meta_helper_spec.rb | 16 ++--- 51 files changed, 225 insertions(+), 156 deletions(-) create mode 100644 config/initializers/action_view.rb diff --git a/app/views/admin/admin/index.html.erb b/app/views/admin/admin/index.html.erb index 9ff0b0809..f63c94796 100644 --- a/app/views/admin/admin/index.html.erb +++ b/app/views/admin/admin/index.html.erb @@ -31,14 +31,14 @@

- Match - - + Match + +

<% Department.by_name.each do |dept| %>
- +
<% end %> @@ -52,14 +52,14 @@

- Match - - + Match + +

<% Tag.by_name.each do |tag| %>
- +
<% end %> diff --git a/app/views/admin/archived/petitions/_petition_details.html.erb b/app/views/admin/archived/petitions/_petition_details.html.erb index 464fbb411..32a77774e 100644 --- a/app/views/admin/archived/petitions/_petition_details.html.erb +++ b/app/views/admin/archived/petitions/_petition_details.html.erb @@ -11,14 +11,14 @@ <% elsif creator = @petition.creator %>
Creator
- <%= creator.name %>
+ <%= creator.name %>
<%= auto_link(creator.email) %>
<% if constituency = creator.constituency %>
Constituency
- <%= constituency.name %>
+ <%= constituency.name %>
<%= constituency.region.name %>
<% end %> diff --git a/app/views/admin/archived/petitions/index.html.erb b/app/views/admin/archived/petitions/index.html.erb index dcb94a2cb..03b25fcc5 100644 --- a/app/views/admin/archived/petitions/index.html.erb +++ b/app/views/admin/archived/petitions/index.html.erb @@ -38,9 +38,9 @@ <% Department.by_name.each do |dept| %>
<% if selected_depts.include?(dept.id) %> - + <% else %> - + <% end %>
@@ -63,9 +63,9 @@ <% Tag.by_name.each do |tag| %>
<% if selected_tags.include?(tag.id) %> - + <% else %> - + <% end %>
diff --git a/app/views/admin/logs/show.html.erb b/app/views/admin/logs/show.html.erb index 5dce742f1..8c36b0dfa 100644 --- a/app/views/admin/logs/show.html.erb +++ b/app/views/admin/logs/show.html.erb @@ -3,7 +3,7 @@ <%= link_to admin_petition_signatures_path(@petition, q: @signature.email) do %> <%= @signature.name %> <<%= @signature.email %>> - <% end %>
+ <% end %>
on <%= link_to admin_petition_path(@petition) do %> <%= @petition.action %> <% end %> diff --git a/app/views/admin/petitions/_petition_details.html.erb b/app/views/admin/petitions/_petition_details.html.erb index 17e1b28e9..b6b5c4adb 100644 --- a/app/views/admin/petitions/_petition_details.html.erb +++ b/app/views/admin/petitions/_petition_details.html.erb @@ -15,7 +15,7 @@ <% elsif creator = @petition.creator %>
Creator
- <%= creator.name %>
+ <%= creator.name %>
<%= link_to(creator.email, admin_signatures_path(q: creator.email), class: "creator-email") %>
<% if creator.united_kingdom? %> @@ -32,7 +32,7 @@ <% if constituency = creator.constituency %>
Constituency
- <%= constituency.name %>
+ <%= constituency.name %>
<%= constituency.region.name %>
<% end %> diff --git a/app/views/admin/petitions/index.html.erb b/app/views/admin/petitions/index.html.erb index 28a6eabc4..e12f96987 100644 --- a/app/views/admin/petitions/index.html.erb +++ b/app/views/admin/petitions/index.html.erb @@ -34,9 +34,9 @@ <% Department.by_name.each do |dept| %>
<% if selected_depts.include?(dept.id) %> - + <% else %> - + <% end %>
@@ -59,9 +59,9 @@ <% Tag.by_name.each do |tag| %>
<% if selected_tags.include?(tag.id) %> - + <% else %> - + <% end %>
diff --git a/app/views/application/_os.html.erb b/app/views/application/_os.html.erb index 716aec89a..169b04858 100644 --- a/app/views/application/_os.html.erb +++ b/app/views/application/_os.html.erb @@ -1,29 +1,29 @@ - + - + - - + + - - + + - - - - - + + + + + - + - - - - - + + + + + diff --git a/app/views/application/_social_meta.html.erb b/app/views/application/_social_meta.html.erb index f2be93062..706ba76de 100644 --- a/app/views/application/_social_meta.html.erb +++ b/app/views/application/_social_meta.html.erb @@ -1,5 +1,5 @@ - + <%= open_graph_tag 'site_name', :site_name %> <%= open_graph_tag 'locale', 'en_GB' %> diff --git a/app/views/archived/petition_mailer/email_creator.html.erb b/app/views/archived/petition_mailer/email_creator.html.erb index 45305269f..8296293e5 100644 --- a/app/views/archived/petition_mailer/email_creator.html.erb +++ b/app/views/archived/petition_mailer/email_creator.html.erb @@ -4,13 +4,13 @@

Dear <%= @signature.name %>,

-

You recently created the petition “<%= @petition.action %>”:
+

You recently created the petition “<%= @petition.action %>”:
<%= link_to nil, archived_petition_url(@petition) %>

<%= markdown_to_html(@email.body) %> -

Thanks,
-<%= t("petitions.emails.signoff_prefix") %>
+

Thanks,
+<%= t("petitions.emails.signoff_prefix") %>
<%= t("petitions.emails.signoff_suffix") %>


diff --git a/app/views/archived/petition_mailer/email_signer.html.erb b/app/views/archived/petition_mailer/email_signer.html.erb index cad76c179..28f681af2 100644 --- a/app/views/archived/petition_mailer/email_signer.html.erb +++ b/app/views/archived/petition_mailer/email_signer.html.erb @@ -4,13 +4,13 @@

Dear <%= @signature.name %>,

-

You recently signed the petition “<%= @petition.action %>”:
+

You recently signed the petition “<%= @petition.action %>”:
<%= link_to nil, archived_petition_url(@petition) %>

<%= markdown_to_html(@email.body) %> -

Thanks,
-<%= t("petitions.emails.signoff_prefix") %>
+

Thanks,
+<%= t("petitions.emails.signoff_prefix") %>
<%= t("petitions.emails.signoff_suffix") %>


diff --git a/app/views/archived/petition_mailer/mailshot_for_creator.html.erb b/app/views/archived/petition_mailer/mailshot_for_creator.html.erb index 17f4e3b97..448dee612 100644 --- a/app/views/archived/petition_mailer/mailshot_for_creator.html.erb +++ b/app/views/archived/petition_mailer/mailshot_for_creator.html.erb @@ -4,13 +4,13 @@

Dear <%= @signature.name %>,

-

You recently created the petition “<%= @petition.action %>”:
+

You recently created the petition “<%= @petition.action %>”:
<%= link_to nil, archived_petition_url(@petition) %>

<%= markdown_to_html(@mailshot.body) %> -

Thanks,
-<%= t("petitions.emails.signoff_prefix") %>
+

Thanks,
+<%= t("petitions.emails.signoff_prefix") %>
<%= t("petitions.emails.signoff_suffix") %>


diff --git a/app/views/archived/petition_mailer/mailshot_for_signer.html.erb b/app/views/archived/petition_mailer/mailshot_for_signer.html.erb index 17849b2f6..9d590b30d 100644 --- a/app/views/archived/petition_mailer/mailshot_for_signer.html.erb +++ b/app/views/archived/petition_mailer/mailshot_for_signer.html.erb @@ -4,13 +4,13 @@

Dear <%= @signature.name %>,

-

You recently signed the petition “<%= @petition.action %>”:
+

You recently signed the petition “<%= @petition.action %>”:
<%= link_to nil, archived_petition_url(@petition) %>

<%= markdown_to_html(@mailshot.body) %> -

Thanks,
-<%= t("petitions.emails.signoff_prefix") %>
+

Thanks,
+<%= t("petitions.emails.signoff_prefix") %>
<%= t("petitions.emails.signoff_suffix") %>


diff --git a/app/views/archived/petition_mailer/notify_creator_of_debate_outcome.html.erb b/app/views/archived/petition_mailer/notify_creator_of_debate_outcome.html.erb index 233e33819..819c27f8b 100644 --- a/app/views/archived/petition_mailer/notify_creator_of_debate_outcome.html.erb +++ b/app/views/archived/petition_mailer/notify_creator_of_debate_outcome.html.erb @@ -44,8 +44,8 @@

Find out more about the Petitions Committee: <%= link_to nil, help_url(anchor: "petitions-committee") %>

<% end %> -

Thanks,
-<%= t("petitions.emails.signoff_prefix") %>
+

Thanks,
+<%= t("petitions.emails.signoff_prefix") %>
<%= t("petitions.emails.signoff_suffix") %>


diff --git a/app/views/archived/petition_mailer/notify_creator_of_debate_scheduled.html.erb b/app/views/archived/petition_mailer/notify_creator_of_debate_scheduled.html.erb index 9b916cd8a..7c3873467 100644 --- a/app/views/archived/petition_mailer/notify_creator_of_debate_scheduled.html.erb +++ b/app/views/archived/petition_mailer/notify_creator_of_debate_scheduled.html.erb @@ -12,8 +12,8 @@

Once the debate has happened, we’ll email you a video and transcript.

-

Thanks,
-<%= t("petitions.emails.signoff_prefix") %>
+

Thanks,
+<%= t("petitions.emails.signoff_prefix") %>
<%= t("petitions.emails.signoff_suffix") %>


diff --git a/app/views/archived/petition_mailer/notify_creator_of_threshold_response.html.erb b/app/views/archived/petition_mailer/notify_creator_of_threshold_response.html.erb index 1a4073605..a42c85901 100644 --- a/app/views/archived/petition_mailer/notify_creator_of_threshold_response.html.erb +++ b/app/views/archived/petition_mailer/notify_creator_of_threshold_response.html.erb @@ -24,8 +24,8 @@

The Committee is made up of 11 MPs, from political parties in government and in opposition. It is entirely independent of the Government. Find out more about the Committee: <%= link_to nil, help_url(anchor: 'petitions-committee') %>

-

Thanks,
-<%= t("petitions.emails.signoff_prefix") %>
+

Thanks,
+<%= t("petitions.emails.signoff_prefix") %>
<%= t("petitions.emails.signoff_suffix") %>


diff --git a/app/views/archived/petition_mailer/notify_signer_of_debate_outcome.html.erb b/app/views/archived/petition_mailer/notify_signer_of_debate_outcome.html.erb index 6b4359ef2..566f97264 100644 --- a/app/views/archived/petition_mailer/notify_signer_of_debate_outcome.html.erb +++ b/app/views/archived/petition_mailer/notify_signer_of_debate_outcome.html.erb @@ -43,8 +43,8 @@

Find out more about the Petitions Committee: <%= link_to nil, help_url(anchor: "petitions-committee") %>

<% end %> -

Thanks,
-<%= t("petitions.emails.signoff_prefix") %>
+

Thanks,
+<%= t("petitions.emails.signoff_prefix") %>
<%= t("petitions.emails.signoff_suffix") %>


diff --git a/app/views/archived/petition_mailer/notify_signer_of_debate_scheduled.html.erb b/app/views/archived/petition_mailer/notify_signer_of_debate_scheduled.html.erb index 03105bafe..7933c38ed 100644 --- a/app/views/archived/petition_mailer/notify_signer_of_debate_scheduled.html.erb +++ b/app/views/archived/petition_mailer/notify_signer_of_debate_scheduled.html.erb @@ -12,8 +12,8 @@

Once the debate has happened, we’ll email you a video and transcript.

-

Thanks,
-<%= t("petitions.emails.signoff_prefix") %>
+

Thanks,
+<%= t("petitions.emails.signoff_prefix") %>
<%= t("petitions.emails.signoff_suffix") %>


diff --git a/app/views/archived/petition_mailer/notify_signer_of_threshold_response.html.erb b/app/views/archived/petition_mailer/notify_signer_of_threshold_response.html.erb index a0547fc48..731613df3 100644 --- a/app/views/archived/petition_mailer/notify_signer_of_threshold_response.html.erb +++ b/app/views/archived/petition_mailer/notify_signer_of_threshold_response.html.erb @@ -24,8 +24,8 @@

The Committee is made up of 11 MPs, from political parties in government and in opposition. It is entirely independent of the Government. Find out more about the Committee: <%= link_to nil, help_url(anchor: 'petitions-committee') %>

-

Thanks,
-<%= t("petitions.emails.signoff_prefix") %>
+

Thanks,
+<%= t("petitions.emails.signoff_prefix") %>
<%= t("petitions.emails.signoff_suffix") %>


diff --git a/app/views/errors/layout.html.erb b/app/views/errors/layout.html.erb index 368702c66..d74bcaa08 100644 --- a/app/views/errors/layout.html.erb +++ b/app/views/errors/layout.html.erb @@ -5,10 +5,10 @@ <%= yield :title -%> - + - - + + diff --git a/app/views/layouts/admin.html.erb b/app/views/layouts/admin.html.erb index 879587028..831562e6f 100644 --- a/app/views/layouts/admin.html.erb +++ b/app/views/layouts/admin.html.erb @@ -6,10 +6,10 @@ <%= javascript_include_tag "admin" %> <%= yield :admin_scripts %> <%= csrf_meta_tag %> - + <%= yield :js %> - - + + diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 7c1155960..f004b64c2 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -2,7 +2,7 @@ <%= page_title %> - + <%= preload_link_tag 'application.css', nopush: true %> <%= preload_link_tag 'application.js', nopush: true %> @@ -16,11 +16,11 @@ <%= stylesheet_link_tag 'application' %> - + <%= render 'application/os' %> <%= render 'application/social_meta' %> <% if noindex_page? %> - + <% end %> diff --git a/app/views/pages/privacy.html.erb b/app/views/pages/privacy.html.erb index 2668d3649..07192af81 100644 --- a/app/views/pages/privacy.html.erb +++ b/app/views/pages/privacy.html.erb @@ -122,7 +122,7 @@

- Our policy for processing special category data can be found here:
+ Our policy for processing special category data can be found here:
House of Commons Data Protection information - UK Parliament diff --git a/app/views/petition_mailer/email_confirmation_for_signer.html.erb b/app/views/petition_mailer/email_confirmation_for_signer.html.erb index 5d89b989f..1fb074cd5 100644 --- a/app/views/petition_mailer/email_confirmation_for_signer.html.erb +++ b/app/views/petition_mailer/email_confirmation_for_signer.html.erb @@ -2,6 +2,6 @@

<%= link_to nil, verify_signature_url(@signature, token: @signature.perishable_token) %>

-

Thanks,
-<%= t("petitions.emails.signoff_prefix") %>
+

Thanks,
+<%= t("petitions.emails.signoff_prefix") %>
<%= t("petitions.emails.signoff_suffix") %>

diff --git a/app/views/petition_mailer/email_creator.html.erb b/app/views/petition_mailer/email_creator.html.erb index 7cdef4e03..d2171ff33 100644 --- a/app/views/petition_mailer/email_creator.html.erb +++ b/app/views/petition_mailer/email_creator.html.erb @@ -4,13 +4,13 @@

Dear <%= @signature.name %>,

-

You recently created the petition “<%= @petition.action %>”:
+

You recently created the petition “<%= @petition.action %>”:
<%= link_to nil, petition_url(@petition) %>

<%= markdown_to_html(@email.body) %> -

Thanks,
-<%= t("petitions.emails.signoff_prefix") %>
+

Thanks,
+<%= t("petitions.emails.signoff_prefix") %>
<%= t("petitions.emails.signoff_suffix") %>


diff --git a/app/views/petition_mailer/email_duplicate_signatures.html.erb b/app/views/petition_mailer/email_duplicate_signatures.html.erb index f1d087b34..0720fb945 100644 --- a/app/views/petition_mailer/email_duplicate_signatures.html.erb +++ b/app/views/petition_mailer/email_duplicate_signatures.html.erb @@ -1,8 +1,8 @@

You're receiving this email because your email has been used to sign the petition “<%= @petition.action %>”, but you have already signed this petition.

-

View the petition “<%= @petition.action %>” at:
+

View the petition “<%= @petition.action %>” at:
<%= link_to nil, petition_url(@petition) %>

-

Thanks,
-<%= t("petitions.emails.signoff_prefix") %>
+

Thanks,
+<%= t("petitions.emails.signoff_prefix") %>
<%= t("petitions.emails.signoff_suffix") %>

diff --git a/app/views/petition_mailer/email_signer.html.erb b/app/views/petition_mailer/email_signer.html.erb index 8cd968bbd..1921d20b6 100644 --- a/app/views/petition_mailer/email_signer.html.erb +++ b/app/views/petition_mailer/email_signer.html.erb @@ -4,13 +4,13 @@

Dear <%= @signature.name %>,

-

You recently signed the petition “<%= @petition.action %>”:
+

You recently signed the petition “<%= @petition.action %>”:
<%= link_to nil, petition_url(@petition) %>

<%= markdown_to_html(@email.body) %> -

Thanks,
-<%= t("petitions.emails.signoff_prefix") %>
+

Thanks,
+<%= t("petitions.emails.signoff_prefix") %>
<%= t("petitions.emails.signoff_suffix") %>


diff --git a/app/views/petition_mailer/gather_sponsors_for_petition.html.erb b/app/views/petition_mailer/gather_sponsors_for_petition.html.erb index f9b1d5a4a..f5e59ddc4 100644 --- a/app/views/petition_mailer/gather_sponsors_for_petition.html.erb +++ b/app/views/petition_mailer/gather_sponsors_for_petition.html.erb @@ -18,15 +18,15 @@

Once your petition has <%= Site.maximum_number_of_signatures %> signatures it won’t be able to add more until it’s been checked by the petitions team. So, please wait until it’s been checked and published before sharing it more widely.

-

Thanks,
-<%= t("petitions.emails.signoff_prefix") %>
+

Thanks,
+<%= t("petitions.emails.signoff_prefix") %>
<%= t("petitions.emails.signoff_suffix") %>

-
+

I’ve made a petition – will you sign it?

-

Click this link to sign the petition:
+

Click this link to sign the petition:
<%= link_to nil, new_petition_sponsor_url(@petition, token: @petition.sponsor_token) %>

My petition:

@@ -39,7 +39,7 @@

<%= @petition.additional_details %>

<% end %> -
+
-

Click this link to sign the petition:
+

Click this link to sign the petition:
<%= link_to nil, new_petition_sponsor_url(@petition, token: @petition.sponsor_token) %>

diff --git a/app/views/petition_mailer/mailshot_for_creator.html.erb b/app/views/petition_mailer/mailshot_for_creator.html.erb index 817a6ad9b..6858fb5ea 100644 --- a/app/views/petition_mailer/mailshot_for_creator.html.erb +++ b/app/views/petition_mailer/mailshot_for_creator.html.erb @@ -4,13 +4,13 @@

Dear <%= @signature.name %>,

-

You recently created the petition “<%= @petition.action %>”:
+

You recently created the petition “<%= @petition.action %>”:
<%= link_to nil, petition_url(@petition) %>

<%= markdown_to_html(@mailshot.body) %> -

Thanks,
-<%= t("petitions.emails.signoff_prefix") %>
+

Thanks,
+<%= t("petitions.emails.signoff_prefix") %>
<%= t("petitions.emails.signoff_suffix") %>


diff --git a/app/views/petition_mailer/mailshot_for_signer.html.erb b/app/views/petition_mailer/mailshot_for_signer.html.erb index 5bbbb25b2..21da43d83 100644 --- a/app/views/petition_mailer/mailshot_for_signer.html.erb +++ b/app/views/petition_mailer/mailshot_for_signer.html.erb @@ -4,13 +4,13 @@

Dear <%= @signature.name %>,

-

You recently signed the petition “<%= @petition.action %>”:
+

You recently signed the petition “<%= @petition.action %>”:
<%= link_to nil, petition_url(@petition) %>

<%= markdown_to_html(@mailshot.body) %> -

Thanks,
-<%= t("petitions.emails.signoff_prefix") %>
+

Thanks,
+<%= t("petitions.emails.signoff_prefix") %>
<%= t("petitions.emails.signoff_suffix") %>


diff --git a/app/views/petition_mailer/notify_creator_of_closing_date_change.html.erb b/app/views/petition_mailer/notify_creator_of_closing_date_change.html.erb index b718c7319..d117c4e06 100644 --- a/app/views/petition_mailer/notify_creator_of_closing_date_change.html.erb +++ b/app/views/petition_mailer/notify_creator_of_closing_date_change.html.erb @@ -3,7 +3,7 @@

You recently started the <%= "petition".pluralize(@count) %>:

<% @petitions.each do |petition| %> -

<%= petition.action %>
+

<%= petition.action %>
<%= link_to(nil, petition_url(petition)) %>

<% end %> @@ -29,6 +29,6 @@ <% end %>

Ahead of the General Election on <%= @election_date %>, make sure you’re registered to vote. You can check whether you’re eligible to vote and find out how to register at: https://www.gov.uk/register-to-vote. The deadline to register to vote is <%= @registration_deadline %>.

-

Many thanks,
-<%= t("petitions.emails.signoff_prefix") %>
+

Many thanks,
+<%= t("petitions.emails.signoff_prefix") %>
<%= t("petitions.emails.signoff_suffix") %>

diff --git a/app/views/petition_mailer/notify_creator_of_debate_outcome.html.erb b/app/views/petition_mailer/notify_creator_of_debate_outcome.html.erb index b3199df42..81d16afe8 100644 --- a/app/views/petition_mailer/notify_creator_of_debate_outcome.html.erb +++ b/app/views/petition_mailer/notify_creator_of_debate_outcome.html.erb @@ -51,8 +51,8 @@

Find out more about the Petitions Committee: <%= link_to nil, help_url(anchor: "petitions-committee") %>

<% end %> -

Thanks,
-<%= t("petitions.emails.signoff_prefix") %>
+

Thanks,
+<%= t("petitions.emails.signoff_prefix") %>
<%= t("petitions.emails.signoff_suffix") %>


diff --git a/app/views/petition_mailer/notify_creator_of_debate_scheduled.html.erb b/app/views/petition_mailer/notify_creator_of_debate_scheduled.html.erb index f6da9f942..9961d3096 100644 --- a/app/views/petition_mailer/notify_creator_of_debate_scheduled.html.erb +++ b/app/views/petition_mailer/notify_creator_of_debate_scheduled.html.erb @@ -12,8 +12,8 @@

Once the debate has happened, we’ll email you a video and transcript.

-

Thanks,
-<%= t("petitions.emails.signoff_prefix") %>
+

Thanks,
+<%= t("petitions.emails.signoff_prefix") %>
<%= t("petitions.emails.signoff_suffix") %>


diff --git a/app/views/petition_mailer/notify_creator_of_sponsored_petition_being_stopped.html.erb b/app/views/petition_mailer/notify_creator_of_sponsored_petition_being_stopped.html.erb index e7ac8f451..ccf41f592 100644 --- a/app/views/petition_mailer/notify_creator_of_sponsored_petition_being_stopped.html.erb +++ b/app/views/petition_mailer/notify_creator_of_sponsored_petition_being_stopped.html.erb @@ -12,6 +12,6 @@

You can find out more about what the General Election means for your petitions on our website: <%= link_to(nil, Parliament.dissolution_faq_url) %>

<% end %> -

Many thanks,
-<%= t("petitions.emails.signoff_prefix") %>
+

Many thanks,
+<%= t("petitions.emails.signoff_prefix") %>
<%= t("petitions.emails.signoff_suffix") %>

diff --git a/app/views/petition_mailer/notify_creator_of_threshold_response.html.erb b/app/views/petition_mailer/notify_creator_of_threshold_response.html.erb index 339ac4ad7..3c478bc90 100644 --- a/app/views/petition_mailer/notify_creator_of_threshold_response.html.erb +++ b/app/views/petition_mailer/notify_creator_of_threshold_response.html.erb @@ -24,8 +24,8 @@

The Committee is made up of 11 MPs, from political parties in government and in opposition. It is entirely independent of the Government. Find out more about the Committee: <%= link_to nil, help_url(anchor: 'petitions-committee') %>

-

Thanks,
-<%= t("petitions.emails.signoff_prefix") %>
+

Thanks,
+<%= t("petitions.emails.signoff_prefix") %>
<%= t("petitions.emails.signoff_suffix") %>


diff --git a/app/views/petition_mailer/notify_creator_of_validated_petition_being_stopped.html.erb b/app/views/petition_mailer/notify_creator_of_validated_petition_being_stopped.html.erb index 0346b360b..270551d16 100644 --- a/app/views/petition_mailer/notify_creator_of_validated_petition_being_stopped.html.erb +++ b/app/views/petition_mailer/notify_creator_of_validated_petition_being_stopped.html.erb @@ -12,6 +12,6 @@

You can find out more about what the General Election means for your petitions on our website: <%= link_to(nil, Parliament.dissolution_faq_url) %>

<% end %> -

Many thanks,
-<%= t("petitions.emails.signoff_prefix") %>
+

Many thanks,
+<%= t("petitions.emails.signoff_prefix") %>
<%= t("petitions.emails.signoff_suffix") %>

diff --git a/app/views/petition_mailer/notify_creator_that_moderation_is_delayed.html.erb b/app/views/petition_mailer/notify_creator_that_moderation_is_delayed.html.erb index 29f8c1e67..df385ebf2 100644 --- a/app/views/petition_mailer/notify_creator_that_moderation_is_delayed.html.erb +++ b/app/views/petition_mailer/notify_creator_that_moderation_is_delayed.html.erb @@ -4,13 +4,13 @@

Dear <%= @signature.name %>,

-

You recently created the petition “<%= @petition.action %>”:
+

You recently created the petition “<%= @petition.action %>”:
<%= link_to nil, petition_url(@petition) %>

<%= auto_link(simple_format(h(@body))) %> -

Thanks,
-<%= t("petitions.emails.signoff_prefix") %>
+

Thanks,
+<%= t("petitions.emails.signoff_prefix") %>
<%= t("petitions.emails.signoff_suffix") %>


diff --git a/app/views/petition_mailer/notify_creator_that_petition_is_published.html.erb b/app/views/petition_mailer/notify_creator_that_petition_is_published.html.erb index 5c60b4ca0..4d09868a8 100644 --- a/app/views/petition_mailer/notify_creator_that_petition_is_published.html.erb +++ b/app/views/petition_mailer/notify_creator_that_petition_is_published.html.erb @@ -2,9 +2,9 @@

We published the petition you created – “<%= @petition.action %>”

-

Click this link to see your petition and start sharing it:
+

Click this link to see your petition and start sharing it:
<%= link_to nil, petition_url(@petition) %>

-

Thanks,
-<%= t("petitions.emails.signoff_prefix") %>
+

Thanks,
+<%= t("petitions.emails.signoff_prefix") %>
<%= t("petitions.emails.signoff_suffix") %>

diff --git a/app/views/petition_mailer/notify_creator_that_petition_was_rejected.html.erb b/app/views/petition_mailer/notify_creator_that_petition_was_rejected.html.erb index 84635f489..e4d637c36 100644 --- a/app/views/petition_mailer/notify_creator_that_petition_was_rejected.html.erb +++ b/app/views/petition_mailer/notify_creator_that_petition_was_rejected.html.erb @@ -9,16 +9,16 @@ <% end -%> <% unless @petition.hidden? -%> -

Click this link to see your rejected petition:
+

Click this link to see your rejected petition:
<%= link_to 'View your rejected petition', petition_url(@petition) %>

<% end -%> -

We only reject petitions that don’t meet the petition standards:
+

We only reject petitions that don’t meet the petition standards:
<%= link_to nil, help_url(anchor: 'standards') %>

-

If you want to try again, click here to start a petition:
+

If you want to try again, click here to start a petition:
<%= link_to nil, check_petitions_url %>

-

Thanks,
-<%= t("petitions.emails.signoff_prefix") %>
+

Thanks,
+<%= t("petitions.emails.signoff_prefix") %>
<%= t("petitions.emails.signoff_suffix") %>

diff --git a/app/views/petition_mailer/notify_signer_of_closing_date_change.html.erb b/app/views/petition_mailer/notify_signer_of_closing_date_change.html.erb index 73be63225..f3b661c05 100644 --- a/app/views/petition_mailer/notify_signer_of_closing_date_change.html.erb +++ b/app/views/petition_mailer/notify_signer_of_closing_date_change.html.erb @@ -3,7 +3,7 @@

You recently signed the <%= "petition".pluralize(@count) %>:

<% @petitions.each do |petition| %> -

<%= petition.action %>
+

<%= petition.action %>
<%= link_to(nil, petition_url(petition)) %>

<% end %> @@ -29,6 +29,6 @@ <% end %>

Ahead of the General Election on <%= @election_date %>, make sure you’re registered to vote. You can check whether you’re eligible to vote and find out how to register at: https://www.gov.uk/register-to-vote. The deadline to register to vote is <%= @registration_deadline %>.

-

Many thanks,
-<%= t("petitions.emails.signoff_prefix") %>
+

Many thanks,
+<%= t("petitions.emails.signoff_prefix") %>
<%= t("petitions.emails.signoff_suffix") %>

diff --git a/app/views/petition_mailer/notify_signer_of_debate_outcome.html.erb b/app/views/petition_mailer/notify_signer_of_debate_outcome.html.erb index c66ebc5ed..ecc57b520 100644 --- a/app/views/petition_mailer/notify_signer_of_debate_outcome.html.erb +++ b/app/views/petition_mailer/notify_signer_of_debate_outcome.html.erb @@ -43,8 +43,8 @@

Find out more about the Petitions Committee: <%= link_to nil, help_url(anchor: "petitions-committee") %>

<% end %> -

Thanks,
-<%= t("petitions.emails.signoff_prefix") %>
+

Thanks,
+<%= t("petitions.emails.signoff_prefix") %>
<%= t("petitions.emails.signoff_suffix") %>


diff --git a/app/views/petition_mailer/notify_signer_of_debate_scheduled.html.erb b/app/views/petition_mailer/notify_signer_of_debate_scheduled.html.erb index 7cbcc3e02..65514e054 100644 --- a/app/views/petition_mailer/notify_signer_of_debate_scheduled.html.erb +++ b/app/views/petition_mailer/notify_signer_of_debate_scheduled.html.erb @@ -12,8 +12,8 @@

Once the debate has happened, we’ll email you a video and transcript.

-

Thanks,
-<%= t("petitions.emails.signoff_prefix") %>
+

Thanks,
+<%= t("petitions.emails.signoff_prefix") %>
<%= t("petitions.emails.signoff_suffix") %>


diff --git a/app/views/petition_mailer/notify_signer_of_threshold_response.html.erb b/app/views/petition_mailer/notify_signer_of_threshold_response.html.erb index 0402231fa..46fa3d794 100644 --- a/app/views/petition_mailer/notify_signer_of_threshold_response.html.erb +++ b/app/views/petition_mailer/notify_signer_of_threshold_response.html.erb @@ -24,8 +24,8 @@

The Committee is made up of 11 MPs, from political parties in government and in opposition. It is entirely independent of the Government. Find out more about the Committee: <%= link_to nil, help_url(anchor: 'petitions-committee') %>

-

Thanks,
-<%= t("petitions.emails.signoff_prefix") %>
+

Thanks,
+<%= t("petitions.emails.signoff_prefix") %>
<%= t("petitions.emails.signoff_suffix") %>


diff --git a/app/views/petition_mailer/notify_sponsor_that_petition_is_published.html.erb b/app/views/petition_mailer/notify_sponsor_that_petition_is_published.html.erb index b1131ab7a..98f845341 100644 --- a/app/views/petition_mailer/notify_sponsor_that_petition_is_published.html.erb +++ b/app/views/petition_mailer/notify_sponsor_that_petition_is_published.html.erb @@ -2,9 +2,9 @@

We published the petition you supported – “<%= @petition.action %>”

-

Click this link to see the petition and start sharing it:
+

Click this link to see the petition and start sharing it:
<%= link_to nil, petition_url(@petition) %>

-

Thanks,
-<%= t("petitions.emails.signoff_prefix") %>
+

Thanks,
+<%= t("petitions.emails.signoff_prefix") %>
<%= t("petitions.emails.signoff_suffix") %>

diff --git a/app/views/petition_mailer/notify_sponsor_that_petition_was_rejected.html.erb b/app/views/petition_mailer/notify_sponsor_that_petition_was_rejected.html.erb index 00fc879e4..d723e067b 100644 --- a/app/views/petition_mailer/notify_sponsor_that_petition_was_rejected.html.erb +++ b/app/views/petition_mailer/notify_sponsor_that_petition_was_rejected.html.erb @@ -9,13 +9,13 @@ <% end -%> <% unless @petition.hidden? -%> -

Click this link to see the rejected petition:
+

Click this link to see the rejected petition:
<%= link_to 'View the rejected petition', petition_url(@petition) %>

<% end -%> -

We only reject petitions that don’t meet the petition standards:
+

We only reject petitions that don’t meet the petition standards:
<%= link_to nil, help_url(anchor: 'standards') %>

-

Thanks,
-<%= t("petitions.emails.signoff_prefix") %>
+

Thanks,
+<%= t("petitions.emails.signoff_prefix") %>
<%= t("petitions.emails.signoff_suffix") %>

diff --git a/app/views/petition_mailer/special_resend_of_email_confirmation_for_signer.html.erb b/app/views/petition_mailer/special_resend_of_email_confirmation_for_signer.html.erb index ae2de7872..cc7d14042 100644 --- a/app/views/petition_mailer/special_resend_of_email_confirmation_for_signer.html.erb +++ b/app/views/petition_mailer/special_resend_of_email_confirmation_for_signer.html.erb @@ -6,6 +6,6 @@

<%= link_to nil, verify_signature_url(@signature, token: @signature.perishable_token) %>

-

Thanks,
-<%= t("petitions.emails.signoff_prefix") %>
+

Thanks,
+<%= t("petitions.emails.signoff_prefix") %>
<%= t("petitions.emails.signoff_suffix") %>

diff --git a/app/views/petitions/check.html.erb b/app/views/petitions/check.html.erb index 0d4d9be49..79c8bed0b 100644 --- a/app/views/petitions/check.html.erb +++ b/app/views/petitions/check.html.erb @@ -16,5 +16,5 @@

Later on, you'll need email addresses for <%= Site.minimum_number_of_sponsors %> supporters to get your petition started

- + diff --git a/app/views/sponsor_mailer/petition_and_email_confirmation_for_sponsor.html.erb b/app/views/sponsor_mailer/petition_and_email_confirmation_for_sponsor.html.erb index 72b488a99..ee9201462 100644 --- a/app/views/sponsor_mailer/petition_and_email_confirmation_for_sponsor.html.erb +++ b/app/views/sponsor_mailer/petition_and_email_confirmation_for_sponsor.html.erb @@ -2,7 +2,7 @@

<%= link_to nil, verify_sponsor_url(@sponsor, token: @sponsor.perishable_token) %>

-
+

<%= @petition.creator.name %>’s petition:

@@ -14,7 +14,7 @@

<%= @petition.additional_details %>

<% end %> -
+
-

Click this link to sign the petition:
+

Click this link to sign the petition:
<%= link_to nil, verify_sponsor_url(@sponsor, token: @sponsor.perishable_token) %>

diff --git a/app/views/sponsor_mailer/sponsor_signed_email_below_threshold.html.erb b/app/views/sponsor_mailer/sponsor_signed_email_below_threshold.html.erb index db8a0a4e6..f0b06db72 100644 --- a/app/views/sponsor_mailer/sponsor_signed_email_below_threshold.html.erb +++ b/app/views/sponsor_mailer/sponsor_signed_email_below_threshold.html.erb @@ -4,9 +4,9 @@

You have <%= pluralize(@sponsor_count, 'supporter', locale: :en) %> so far. If <%= Site.threshold_for_moderation %> people support your petition we’ll check it to make sure it meets the petition standards. If it does, we’ll publish it.

-

Find out how we check petitions before we publish them:
+

Find out how we check petitions before we publish them:
<%= link_to nil, help_url(anchor: 'standards') %>

-

Thanks,
-<%= t("petitions.emails.signoff_prefix") %>
+

Thanks,
+<%= t("petitions.emails.signoff_prefix") %>
<%= t("petitions.emails.signoff_suffix") %>

diff --git a/app/views/sponsor_mailer/sponsor_signed_email_on_threshold.html.erb b/app/views/sponsor_mailer/sponsor_signed_email_on_threshold.html.erb index b2f744930..acc320fa0 100644 --- a/app/views/sponsor_mailer/sponsor_signed_email_on_threshold.html.erb +++ b/app/views/sponsor_mailer/sponsor_signed_email_on_threshold.html.erb @@ -16,9 +16,9 @@

Once your petition has <%= Site.maximum_number_of_signatures %> signatures it won’t be able to add more until it’s been checked. So, please wait until it’s been checked and published before sharing it with lots more people.

-

Find out how we check petitions before we publish them:
+

Find out how we check petitions before we publish them:
<%= link_to nil, help_url(anchor: 'standards') %>

-

Thanks,
-<%= t("petitions.emails.signoff_prefix") %>
+

Thanks,
+<%= t("petitions.emails.signoff_prefix") %>
<%= t("petitions.emails.signoff_suffix") %>

diff --git a/config/initializers/action_view.rb b/config/initializers/action_view.rb new file mode 100644 index 000000000..500df89d1 --- /dev/null +++ b/config/initializers/action_view.rb @@ -0,0 +1,69 @@ +ActiveSupport.on_load(:action_view) do + # Monkey patch tag method to generate void tags instead of self-closing tags + ActionView::Helpers::TagHelper.module_eval do + remove_possible_method :tag + + def tag(name = nil, options = nil, open = false, escape = true) + if name.nil? + tag_builder + else + ensure_valid_html5_tag_name(name) + "<#{name}#{tag_builder.tag_options(options, escape) if options}>".html_safe + end + end + end + + # Monkey patch CheckBox to remove autocomplete="off" + ActionView::Helpers::Tags::CheckBox.class_eval do + private + + remove_possible_method :hidden_field_for_checkbox + + def hidden_field_for_checkbox(options) + @unchecked_value ? tag("input", options.slice("name", "disabled", "form").merge!("type" => "hidden", "value" => @unchecked_value)) : "".html_safe + end + end + + # Monkey patch HiddenField to remove autocomplete="off" + ActionView::Helpers::Tags::HiddenField.class_eval do + remove_possible_method :render + + def render + super + end + end + + # Monkey patch hidden_field_tag to remove autocomplete="off" + ActionView::Helpers::FormTagHelper.class_eval do + remove_possible_method :hidden_field_tag + + def hidden_field_tag(name, value = nil, options = {}) + text_field_tag(name, value, options.merge(type: :hidden)) + end + end + + # Monkey patch token_tag and method_tag to remove autocomplete="off" + ActionView::Helpers::UrlHelper.class_eval do + remove_possible_method :token_tag + + def token_tag(token = nil, form_options: {}) + if token != false && defined?(protect_against_forgery?) && protect_against_forgery? + token = + if token == true || token.nil? + form_authenticity_token(form_options: form_options.merge(authenticity_token: token)) + else + token + end + tag(:input, type: "hidden", name: request_forgery_protection_token.to_s, value: token) + else + "" + end + end + + remove_possible_method :method_tag + + def method_tag(method) + tag("input", type: "hidden", name: "_method", value: method.to_s) + end + end +end diff --git a/spec/helpers/social_meta_helper_spec.rb b/spec/helpers/social_meta_helper_spec.rb index ef36ba903..41857f858 100644 --- a/spec/helpers/social_meta_helper_spec.rb +++ b/spec/helpers/social_meta_helper_spec.rb @@ -10,7 +10,7 @@ end it "generates a meta tag with the content" do - expect(subject).to match(%r{}) + expect(subject).to match(%r{}) end end @@ -20,7 +20,7 @@ end it "generates a meta tag with the i18n content" do - expect(subject).to match(%r{}) + expect(subject).to match(%r{}) end end @@ -30,7 +30,7 @@ end it "generates a meta tag with the i18n content" do - expect(subject).to match(%r{}) + expect(subject).to match(%r{}) end end @@ -46,7 +46,7 @@ end it "generates a meta tag with the correct asset image url" do - expect(subject).to match(%r{}) + expect(subject).to match(%r{}) end end end @@ -58,7 +58,7 @@ end it "generates a meta tag with the content" do - expect(subject).to match(%r{}) + expect(subject).to match(%r{}) end end @@ -68,7 +68,7 @@ end it "generates a meta tag with the i18n content" do - expect(subject).to match(%r{}) + expect(subject).to match(%r{}) end end @@ -78,7 +78,7 @@ end it "generates a meta tag with the i18n content" do - expect(subject).to match(%r{}) + expect(subject).to match(%r{}) end end @@ -94,7 +94,7 @@ end it "generates a meta tag with the correct asset image url" do - expect(subject).to match(%r{}) + expect(subject).to match(%r{}) end end end From 83b63b9eb800be27936859341dee6595ad50bc88 Mon Sep 17 00:00:00 2001 From: Andrew White Date: Fri, 22 Nov 2024 12:50:29 +0000 Subject: [PATCH 05/14] Remove unnecessary role attributes --- .../admin/archived/petitions/_petition_actions.html.erb | 2 +- app/views/admin/petitions/_petition_actions.html.erb | 2 +- app/views/admin/shared/_header.html.erb | 2 +- app/views/application/_about_petition_data.html.erb | 6 +++--- app/views/application/_footer.html.erb | 2 +- app/views/application/_header.html.erb | 2 +- app/views/archived/petitions/index.html.erb | 2 +- app/views/errors/layout.html.erb | 2 +- app/views/layouts/admin.html.erb | 2 +- app/views/layouts/application.html.erb | 2 +- app/views/petitions/index.html.erb | 2 +- 11 files changed, 13 insertions(+), 13 deletions(-) diff --git a/app/views/admin/archived/petitions/_petition_actions.html.erb b/app/views/admin/archived/petitions/_petition_actions.html.erb index eeb90e4a7..be3c8918b 100644 --- a/app/views/admin/archived/petitions/_petition_actions.html.erb +++ b/app/views/admin/archived/petitions/_petition_actions.html.erb @@ -1,4 +1,4 @@ -