Added SASS CoffeeScript compilation through Grunt.js
This commit is contained in:
		
							
								
								
									
										4
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										4
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							| @@ -1,2 +1,6 @@ | ||||
| # Modules installed via NPM | ||||
| node_modules/ | ||||
|  | ||||
| # Stylesheets and Javascript files generated through Grunt.js | ||||
| public/styles/ | ||||
| public/js/ | ||||
|   | ||||
							
								
								
									
										65
									
								
								Gruntfile.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										65
									
								
								Gruntfile.js
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,65 @@ | ||||
| module.exports = function(grunt) { | ||||
|  | ||||
|   var pkg = grunt.file.readJSON('package.json') | ||||
|  | ||||
|   // Project configuration. | ||||
|   grunt.initConfig({ | ||||
|     'dart-sass': { | ||||
|       dist: { | ||||
|         options: { | ||||
|           style: 'compressed' | ||||
|         }, | ||||
|         files: [{ | ||||
|           expand: true, | ||||
|           cwd: 'assets/sass', | ||||
|           src: ['*.sass'], | ||||
|           dest: 'public/styles', | ||||
|           ext: '.css' | ||||
|         }] | ||||
|       } | ||||
|     }, | ||||
|  | ||||
|     coffee: { | ||||
|       options: { | ||||
|         sourceMap: true, | ||||
|         style: 'compressed' | ||||
|       }, | ||||
|       files: { | ||||
|         expand: true, | ||||
|         flatten: true, | ||||
|         cwd: 'assets/coffee', | ||||
|         src: ['*.coffee'], | ||||
|         dest: 'public/js', | ||||
|         ext: '.js' | ||||
|       } | ||||
|     }, | ||||
|  | ||||
|     watch: { | ||||
|       css: { | ||||
|         files: ['assets/sass/*.sass'], | ||||
|         tasks: ['dart-sass'], | ||||
|         options: { | ||||
|           atBegin: true, | ||||
|           spawn: false | ||||
|         } | ||||
|       }, | ||||
|       js: { | ||||
|         files: ['assets/coffee/*.coffee'], | ||||
|         tasks: ['coffee'], | ||||
|         options: { | ||||
|           atBegin: true, | ||||
|           spawn: false | ||||
|         } | ||||
|       } | ||||
|     } | ||||
|   }); | ||||
|  | ||||
|   // Load task plugins | ||||
|   grunt.loadNpmTasks('grunt-dart-sass'); | ||||
|   grunt.loadNpmTasks('grunt-contrib-coffee'); | ||||
|   grunt.loadNpmTasks('grunt-contrib-watch'); | ||||
|  | ||||
|   // Default task(s). | ||||
|   grunt.registerTask('default', ['dart-sass', 'coffee']); | ||||
|  | ||||
| }; | ||||
							
								
								
									
										2
									
								
								assets/coffee/archon.coffee
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										2
									
								
								assets/coffee/archon.coffee
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,2 @@ | ||||
| @loadPage = (pagePath) -> | ||||
|   window.location.href = pagePath + '.html' | ||||
							
								
								
									
										44
									
								
								assets/coffee/index.coffee
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										44
									
								
								assets/coffee/index.coffee
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,44 @@ | ||||
| ldap = require('ldapjs') | ||||
|  | ||||
| userTable = {} | ||||
|  | ||||
| window.onload = -> | ||||
|   document.getElementById('ldapHost').textContent = localStorage.getItem('ldap_hostname') | ||||
|   userTable = document.getElementById('ldapUserList') | ||||
|   ldapGetUserList() | ||||
|   return | ||||
|  | ||||
| searchOpts = | ||||
|   filter: '(objectClass=posixAccount)' | ||||
|   scope: 'sub' | ||||
|   attributes: ['uid', 'displayName', 'mail'] | ||||
|  | ||||
| ldapGetUserList = () -> | ||||
|   client = ldap.createClient(url: 'ldap://' + localStorage.getItem('ldap_hostname') + '/') | ||||
|   client.bind(localStorage.getItem('ldap_bind_dn'), localStorage.getItem('ldap_bind_pw'), (err) -> | ||||
|     if err | ||||
|       document.querySelector('h1').textContent = 'error' | ||||
|       return | ||||
|     else | ||||
|       client.search('ou=People,' + localStorage.getItem('ldap_base_dn'), searchOpts, (err, res) -> | ||||
|         if err | ||||
|           console.log(err) | ||||
|           return | ||||
|         else | ||||
|           res.on('searchEntry', (entry) -> | ||||
|             userEntry = document.createElement('tr') | ||||
|  | ||||
|             userUid = document.createElement('td') | ||||
|             userUid.innerText = entry.object.uid | ||||
|             userEntry.appendChild(userUid) | ||||
|             userName = document.createElement('td') | ||||
|             userName.innerText = entry.object.displayName | ||||
|             userEntry.appendChild(userName) | ||||
|             userMail = document.createElement('td') | ||||
|             userMail.innerText = entry.object.mail | ||||
|             userEntry.appendChild(userMail) | ||||
|  | ||||
|             userTable.appendChild(userEntry) | ||||
|           ) | ||||
|       ) | ||||
|   ) | ||||
							
								
								
									
										30
									
								
								assets/coffee/login.coffee
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										30
									
								
								assets/coffee/login.coffee
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,30 @@ | ||||
| ldap = require('ldapjs') | ||||
|  | ||||
| loginForm = (event) -> | ||||
|   event.preventDefault() | ||||
|   bindHost = document.forms.loginForm.ldap_host.value | ||||
|   bindDn = document.forms.loginForm.bind_dn.value | ||||
|   bindPw = document.forms.loginForm.bind_pw.value | ||||
|   client = ldap.createClient(url: 'ldap://' + bindHost + '/') | ||||
|   client.bind bindDn, bindPw, (err) -> | ||||
|     if err | ||||
|       document.querySelector('h1').textContent = 'error' | ||||
|     else | ||||
|       document.querySelector('h1').textContent = 'Logged in!' | ||||
|       bindDn = document.forms.loginForm.bind_dn.value | ||||
|       baseDnBits = bindDn.split(',') | ||||
|       baseDnBits.shift() | ||||
|       baseDn = baseDnBits.join(',') | ||||
|  | ||||
|       localStorage.setItem('ldap_hostname', document.forms.loginForm.ldap_host.value) | ||||
|       localStorage.setItem('ldap_bind_dn', bindDn) | ||||
|       localStorage.setItem('ldap_bind_pw', document.forms.loginForm.bind_pw.value) | ||||
|       localStorage.setItem('ldap_base_dn', baseDn) | ||||
|  | ||||
|       loadPage('index') | ||||
|     return | ||||
|   return | ||||
|  | ||||
| window.onload = -> | ||||
|   document.getElementById('loginForm').addEventListener('submit', loginForm) | ||||
|   return | ||||
							
								
								
									
										9
									
								
								assets/coffee/user.coffee
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										9
									
								
								assets/coffee/user.coffee
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,9 @@ | ||||
| userCreateFormSubmit = (e) -> | ||||
|   e.preventDefault() | ||||
|  | ||||
|   user_uid = document.forms.createUserForm.user_username.value | ||||
|   console.log(user_uid) | ||||
|  | ||||
| window.onload = -> | ||||
|   document.getElementById('createUserForm').addEventListener('submit', userCreateFormSubmit) | ||||
|   return | ||||
							
								
								
									
										53
									
								
								assets/sass/archon.sass
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										53
									
								
								assets/sass/archon.sass
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,53 @@ | ||||
| body | ||||
|   padding-bottom: 115px | ||||
|   background: white | ||||
|  | ||||
| a | ||||
|   color: cornflowerblue | ||||
|   transition: all 200ms ease-in-out | ||||
|  | ||||
|   &:hover | ||||
|     color: darken(cornflowerblue, 10%) | ||||
|  | ||||
| input | ||||
|   transition: all 200ms ease-in-out | ||||
|  | ||||
| input[type=submit], | ||||
| button | ||||
|   background-color: cornflowerblue | ||||
|   color: #f0f0f0 | ||||
|   transition: all 200ms ease-in-out | ||||
|  | ||||
|   &:hover | ||||
|     background-color: darken(cornflowerblue, 10%) | ||||
|     color: white | ||||
|  | ||||
| .u-text-center | ||||
|   text-align: center | ||||
|  | ||||
| .container | ||||
|   max-width: 1024px | ||||
|  | ||||
| .container.fluid | ||||
|   max-width: 100% | ||||
|  | ||||
| #header h1 | ||||
|   text-align: center | ||||
|  | ||||
| #footer | ||||
|   position: fixed | ||||
|   left: 0 | ||||
|   right: 0 | ||||
|   bottom: 0 | ||||
|   padding-top: 25px | ||||
|   padding-bottom: 25px | ||||
|   border-top: 1px solid #999 | ||||
|  | ||||
|   .row | ||||
|     position: relative | ||||
|  | ||||
|   p.no-margin | ||||
|     margin-bottom: 0 | ||||
|  | ||||
| #ldapObjectTable table | ||||
|   width: 100% | ||||
							
								
								
									
										2893
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										2893
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										11
									
								
								package.json
									
									
									
									
									
								
							
							
						
						
									
										11
									
								
								package.json
									
									
									
									
									
								
							| @@ -5,7 +5,8 @@ | ||||
|   "main": "index.js", | ||||
|   "scripts": { | ||||
|     "start": "node index.js", | ||||
|     "test": "echo \"Error: no test specified\" && exit 1" | ||||
|     "test": "echo \"Error: no test specified\" && exit 1", | ||||
|     "grunt": "grunt" | ||||
|   }, | ||||
|   "repository": { | ||||
|     "type": "git", | ||||
| @@ -14,6 +15,12 @@ | ||||
|   "author": "Gregory Ballantine <gballantine@metaunix.net>", | ||||
|   "license": "BSD-2-Clause", | ||||
|   "dependencies": { | ||||
|     "express": "^4.18.1" | ||||
|     "express": "^4.18.1", | ||||
|     "grunt-dart-sass": "^2.0.1" | ||||
|   }, | ||||
|   "devDependencies": { | ||||
|     "grunt": "^1.5.3", | ||||
|     "grunt-contrib-coffee": "^2.1.0", | ||||
|     "grunt-contrib-watch": "^1.1.0" | ||||
|   } | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user