Skip to content

Commit

Permalink
Hsd8 251 custom login block (#106)
Browse files Browse the repository at this point in the history
* HSD8-251 Custom login block

* added context

* use text_format for the preface and remove postface

* added unit test

* cc fix

* cc fix
  • Loading branch information
pookmish authored and boznik committed Sep 26, 2018
1 parent 192799b commit d5f244e
Show file tree
Hide file tree
Showing 12 changed files with 7,867 additions and 0 deletions.
1 change: 1 addition & 0 deletions config/default/core.extension.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ module:
honeypot: 0
hs_basic_page: 0
hs_basic_page_display: 0
hs_blocks: 0
hs_bugherd: 0
hs_courses: 0
hs_courses_importer: 0
Expand Down
174 changes: 174 additions & 0 deletions docroot/modules/humsci/hs_blocks/Gruntfile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,174 @@
/**
* @file
*/
module.exports = function(grunt) {

// This is where we configure each task that we'd like to run.
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
watch: {
// This is where we set up all the tasks we'd like grunt to watch for changes.
scripts: {
files: ['js/source/**/*.js'],
tasks: ['uglify', 'drush:ccall'],
options: {
spawn: false,
},
},
images: {
files: ['images/source/*.{png,jpg,gif}'],
tasks: ['imagemin'],
options: {
spawn: false,
}
},
vector: {
files: ['images/source/**/*.svg'],
tasks: ['svgmin'],
options: {
spawn: false,
}
},
css: {
files: ['scss/**/*.scss', 'scss/**/**/*.scss', 'patterns/**/**/scss/*.scss'],
tasks: ['sass'],
options: {
interrupt: true
}
},
twig: {
files: ['templates/**/*.html.twig'],
tasks: ['uglify', 'svgmin', 'imagemin', 'sass', 'drush:ccall']
}
},
uglify: {
// This is for minifying all of our scripts.
options: {
sourceMap: true,
mangle: false
},
my_target: {
files: [{
expand: true,
cwd: 'js/source',
src: '{,*/}*.js',
dest: 'js/build'
}]
}
},
imagemin: {
// This will optimize all of our images for the web.
dynamic: {
files: [{
expand: true,
cwd: 'img/source/',
src: ['{,*/}*.{png,jpg,gif}'],
dest: 'img/optimized/'
}]
}
},
svgmin: {
options: {
plugins: [{
removeViewBox: false
}, {
removeUselessStrokeAndFill: false
}]
},
dist: {
files: [{
expand: true,
cwd: 'images/source/',
src: ['{,*/}*.svg'],
dest: 'images/optimized/'
}]
}
},
sass: {
// This will compile all of our sass files
// Additional configuration options can be found at https://github.com/sindresorhus/grunt-sass
options: {
includePaths: [
"scss",
"node_modules/bourbon/core",
"node_modules/bourbon-neat/app/assets/stylesheets",
"node_modules/neat-omega/core",
"node_modules/decanter/scss",
"node_modules",
],
sourceMap: false,
// This controls the compiled css and can be changed to nested, compact or compressed.
outputStyle: 'compressed',
precision: 10
},
dist: {
files: [{
expand: true,
cwd: 'scss',
src: ['**/[a-z]*.scss'],
dest: 'css',
ext: '.css',
extDot: 'last',
rename: function(dest, src) {
return dest + '/' + src.replace('scss', 'css');
}
}
]
}
},
drush: {
ccall: {
args: ['cache-rebuild', 'all']
}
},
browserSync: {
dev: {
bsFiles: {
src: [
'css/**/*.css',
'templates/**/*.twig',
'images/optimized/**/*.{png,jpg,gif,svg}',
'js/build/**/*.js',
'*.theme'
]
},
options: {
watchTask: true,
// reloadDelay: 1000,
// reloadDebounce: 500,
reloadOnRestart: true,
logConnections: true,
injectChanges: false // Depends on enabling the link_css module
}
}
},
availabletasks: {
tasks: {
options: {
filter: "include",
tasks: [
'browserSync', 'imagemin', 'sass', 'svgmin', 'uglify', 'watch', 'devmode'
]
}
}
}
});

// This is where we tell Grunt we plan to use this plug-in.
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-imagemin');
grunt.loadNpmTasks('grunt-svgmin');
grunt.loadNpmTasks('grunt-sass');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-browser-sync');
grunt.loadNpmTasks('grunt-available-tasks');
grunt.loadNpmTasks('grunt-drush');

// My tasks.
grunt.registerTask('devmode', "Watch and BrowserSync all in one.", ['browserSync', 'watch']);

// This is where we tell Grunt what to do when we type "grunt" into the terminal.
// Note: if you'd like to run and of the tasks individually you can do so by typing 'grunt mytaskname' alternatively
// you can type 'grunt watch' to automatically track your files for changes.
grunt.registerTask('default', ['availabletasks']);
};
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#drupal-off-canvas .cke_top{border-bottom:1px solid #d1d1d1}#drupal-off-canvas .cke_top,#drupal-off-canvas .cke_top *{background-color:#f8f8f8;color:#484848}#drupal-off-canvas .cke_button_icon{margin-right:5px}
8 changes: 8 additions & 0 deletions docroot/modules/humsci/hs_blocks/hs_blocks.info.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
name: 'H&S Blocks'
type: module
description: 'Custom blocks for Humsci'
core: 8.x
version: 8.x
package: 'Humanities & Sciences'
dependencies:
- block
5 changes: 5 additions & 0 deletions docroot/modules/humsci/hs_blocks/hs_blocks.libraries.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
login.admin:
version: VERSION
css:
base:
css/hs_blocks.login.admin.css: {}
36 changes: 36 additions & 0 deletions docroot/modules/humsci/hs_blocks/hs_blocks.module
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?php

/**
* @file
* Contains hs_blocks.module.
*/

use Drupal\Core\Routing\RouteMatchInterface;

/**
* Implements hook_help().
*/
function hs_blocks_help($route_name, RouteMatchInterface $route_match) {
switch ($route_name) {
// Main module help for the hs_blocks module.
case 'help.page.hs_blocks':
$output = '';
$output .= '<h3>' . t('About') . '</h3>';
$output .= '<p>' . t('Humsci Blocks') . '</p>';
return $output;

default:
}
}

/**
* Implements hook_theme().
*/
function hs_blocks_theme($existing, $type, $theme, $path) {
return [
'hs_blocks_login' => [
'template' => 'block--hs-login',
'variables' => ['preface' => NULL, 'link' => NULL, 'postface' => NULL],
],
];
}
Loading

0 comments on commit d5f244e

Please sign in to comment.