diff --git a/.gitignore b/.gitignore index 16d12354..92646c57 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ /build /node_modules /electron_build +.env diff --git a/Gulpfile.js b/Gulpfile.js index 64bf6bf2..61705a7b 100644 --- a/Gulpfile.js +++ b/Gulpfile.js @@ -1,53 +1,61 @@ +require('dotenv').load() +var env = process.env + var gulp = require('gulp') -var sass = require('gulp-sass') +var styl = require('gulp-stylus') var autoprefixer = require('gulp-autoprefixer') var templateCache = require('gulp-angular-templatecache') var globby = require('globby') var template = require('gulp-template') -var concat = require('gulp-concat') var del = require('del') var runSequence = require('run-sequence') -var merge = require('merge-stream') - +var plumber = require('gulp-plumber') +var notify = require('gulp-notify') var changed = require('gulp-changed') -var cached = require('gulp-cached') -var remember = require('gulp-remember') var livereload = require('gulp-livereload') -var childProcess = require('child_process') // for Dist var rev = require('gulp-rev') var ngAnnotate = require('gulp-ng-annotate') var uglify = require('gulp-uglify') var minifyCss = require('gulp-minify-css') +var merge = require('merge-stream') var config = require('./build.config.js') -gulp.task('js', function(){ +gulp.task('env', function () { + return gulp.src('tpls/env.js') + .pipe(template({ + apiUrl: env.BUILD_API_URL + })) + .pipe(gulp.dest('build/config')) +}) + +gulp.task('js', function (){ return gulp.src(['src/**/*.js']) .pipe(changed('build')) .pipe(gulp.dest('build')) }) -gulp.task('sass', function () { - return gulp.src('src/**/*.scss') - .pipe(cached('styles')) - .pipe(sass().on('error', sass.logError)) +gulp.task('styl', function () { + return gulp.src('src/styles/main.styl') + .pipe(plumber({errorHandler: notify.onError('Error: <%= error.message %>')})) + .pipe(styl()) .pipe(autoprefixer()) - .pipe(remember('styles')) - .pipe(concat('all.css')) .pipe(gulp.dest('build')) + .pipe(notify("Stylus!!")) .pipe(livereload()) }) gulp.task('tpls', function(){ return gulp.src('src/**/*.tpl.html') .pipe(templateCache()) + .pipe(notify("Tpls Done!! :)")) .pipe(gulp.dest('build')) }) gulp.task('index', function () { - var files = globby.sync(['build/**/*', '!build/vendor/**/*', '!build/electron/**/*']) + var files = globby.sync(['build/**/*', '!build/vendor/**/*']) var filter = function (files, ext) { return files.filter(function (file) { @@ -64,7 +72,7 @@ gulp.task('index', function () { .pipe(template({ scripts: scripts, styles: styles, - env: 'build' + env: env })) .pipe(gulp.dest('build')) .pipe(livereload()) @@ -77,6 +85,10 @@ gulp.task('vendor', function () { return vendor.src }) + vendorFiles.push('node_modules/font-awesome/**/font-awesome.css') + vendorFiles.push('node_modules/font-awesome/**/fontawesome-webfont.*') + vendorFiles.push('node_modules/font-awesome/**/FontAwesome.*') + return gulp.src(vendorFiles) .pipe(gulp.dest('build/vendor')) }) @@ -88,13 +100,15 @@ gulp.task('resources', function () { }) gulp.task('build', function (cb) { - runSequence(['js', 'sass', 'tpls', 'vendor', 'resources'], 'index', cb) + runSequence(['env', 'js', 'styl', 'tpls', 'vendor', 'resources'], 'index', cb) }) gulp.task('watch', function (cb) { - gulp.watch(['src/**/*.js'], ['js']) + gulp.watch(['.env', 'tpls/env.js'], ['env']) - gulp.watch('src/**/*.scss', ['sass']) + gulp.watch('src/**/*.js', ['js']) + + gulp.watch('src/styles/**/*.styl', ['styl']) gulp.watch('src/**/*.tpl.html', ['tpls']) @@ -108,15 +122,7 @@ gulp.task('del', function (cb) { }) gulp.task('default', function (cb) { - var spawn = childProcess.spawn('http-server', ['build']) - spawn.stdout.on('data', function (data) { - console.log('OUT: ' + data) - }) - spawn.stderr.on('data', function (data) { - console.log('ERR: ' + data) - }) - runSequence('del', 'build', 'watch', cb) }) -require('./gulp-electron')(gulp) +// require('./gulp-electron')(gulp) diff --git a/build.config.js b/build.config.js index bdc3fda9..2007842b 100644 --- a/build.config.js +++ b/build.config.js @@ -1,53 +1,44 @@ module.exports = { vendors: [ { - name:'ace', - src:'node_modules/@rokt33r/ace-builds/src/**/*', - cdn:'https://cdnjs.cloudflare.com/ajax/libs/ace/1.1.9/ace.js' + name: 'ace', + src: 'node_modules/@rokt33r/ace-builds/src/**/*' }, { - name:'angular', - src:'node_modules/angular/angular.js', - cdn:'https://ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular.min.js' + name: 'angular', + src: 'node_modules/angular/angular.js' }, { - name:'angular-bootstrap', - src:'node_modules/angular-bootstrap/dist/ui-bootstrap-tpls.js', - cdn:'https://cdnjs.cloudflare.com/ajax/libs/angular-ui-bootstrap/0.12.1/ui-bootstrap-tpls.min.js' + name: 'angular-bootstrap', + src: 'node_modules/angular-bootstrap/dist/ui-bootstrap-tpls.js' }, { - name:'angular-sanitize', - src:'node_modules/angular-sanitize/angular-sanitize.js', - cdn:'https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.3.15/angular-animate.min.js' + name: 'angular-sanitize', + src: 'node_modules/angular-sanitize/angular-sanitize.js' }, { - name:'angular-ui-router', - src:'node_modules/angular-ui-router/build/angular-ui-router.js', - cdn:'https://cdnjs.cloudflare.com/ajax/libs/angular-ui-router/0.2.14/angular-ui-router.min.js' + name: 'angular-ui-router', + src: 'node_modules/angular-ui-router/build/angular-ui-router.js' }, { - name:'ui-select', - src:'node_modules/ui-select/dist/select.js', - cdn:'https://cdnjs.cloudflare.com/ajax/libs/angular-ui-select/0.11.2/select.js' + name: 'ui-select', + src: 'node_modules/ui-select/dist/select.js' }, { - name:'satellizer', - src:'node_modules/satellizer/satellizer.js', - cdn:'https://cdn.jsdelivr.net/satellizer/0.10.1/satellizer.min.js' + name: 'satellizer', + src: 'node_modules/satellizer/satellizer.js' }, { - name:'angular-md5', - src:'node_modules/angular-md5/angular-md5.js', - cdn:'https://raw.githubusercontent.com/gdi2290/angular-md5/v0.1.7/angular-md5.min.js' + name: 'angular-md5', + src: 'node_modules/angular-md5/angular-md5.js' }, { - name:'moment', - src:'node_modules/moment/moment.js', - cdn:'https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.10.3/moment.min.js' + name: 'moment', + src: 'node_modules/moment/moment.js' }, { - name:'angular-hotkeys', - src:'node_modules/angular-hotkeys/build/hotkeys.js' + name: 'angular-hotkeys', + src: 'node_modules/angular-hotkeys/build/hotkeys.js' } ] } diff --git a/package.json b/package.json index d012e3a9..66a8b315 100644 --- a/package.json +++ b/package.json @@ -4,6 +4,8 @@ "description": "CodeXen App", "main": "index.js", "scripts": { + "install": "gulp build", + "start": "http-server build", "test": "echo \"Error: no test specified\" && exit 1" }, "repository": { @@ -16,7 +18,11 @@ "template", "task", "runner", - "remote" + "remote", + "automator", + "code", + "storage", + "short code" ], "author": "Dick Choi (http://kazup.co)", "license": "ISC", @@ -33,33 +39,34 @@ "angular-md5": "^0.1.7", "angular-sanitize": "^1.3.15", "angular-ui-router": "^0.2.15", + "bootstrap-styl": "^4.0.4", "font-awesome": "^4.3.0", "moment": "^2.10.3", "robotjs": "^0.1.2", "satellizer": "^0.10.1", - "ui-select": "^0.11.2" - }, - "devDependencies": { + "ui-select": "^0.11.2", "bootstrap-sass": "^3.3.4", "del": "^1.2.0", + "dotenv": "^1.1.0", "electron-prebuilt": "^0.27.2", "electron-rebuild": "^0.2.1", "globby": "^2.0.0", "gulp": "^3.8.11", "gulp-angular-templatecache": "^1.6.0", "gulp-autoprefixer": "^2.3.0", - "gulp-cached": "^1.1.0", "gulp-changed": "^1.2.1", - "gulp-concat": "^2.5.2", "gulp-livereload": "^3.8.0", "gulp-minify-css": "^1.1.1", "gulp-ng-annotate": "^0.5.3", - "gulp-remember": "^0.3.0", + "gulp-notify": "^2.2.0", + "gulp-plumber": "^1.0.1", "gulp-rev": "^4.0.0", - "gulp-sass": "^2.0.1", + "gulp-stylus": "^2.0.3", "gulp-template": "^3.0.0", "gulp-uglify": "^1.2.0", "merge-stream": "^0.1.7", "run-sequence": "^1.1.0" + }, + "devDependencies": { } } diff --git a/resources/fonts/FontAwesome.otf b/resources/fonts/FontAwesome.otf deleted file mode 100644 index f7936cc1..00000000 Binary files a/resources/fonts/FontAwesome.otf and /dev/null differ diff --git a/resources/fonts/fontawesome-webfont.eot b/resources/fonts/fontawesome-webfont.eot deleted file mode 100644 index 33b2bb80..00000000 Binary files a/resources/fonts/fontawesome-webfont.eot and /dev/null differ diff --git a/resources/fonts/fontawesome-webfont.svg b/resources/fonts/fontawesome-webfont.svg deleted file mode 100644 index 1ee89d43..00000000 --- a/resources/fonts/fontawesome-webfont.svg +++ /dev/null @@ -1,565 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/resources/fonts/fontawesome-webfont.ttf b/resources/fonts/fontawesome-webfont.ttf deleted file mode 100644 index ed9372f8..00000000 Binary files a/resources/fonts/fontawesome-webfont.ttf and /dev/null differ diff --git a/resources/fonts/fontawesome-webfont.woff b/resources/fonts/fontawesome-webfont.woff deleted file mode 100644 index 8b280b98..00000000 Binary files a/resources/fonts/fontawesome-webfont.woff and /dev/null differ diff --git a/resources/fonts/fontawesome-webfont.woff2 b/resources/fonts/fontawesome-webfont.woff2 deleted file mode 100644 index 3311d585..00000000 Binary files a/resources/fonts/fontawesome-webfont.woff2 and /dev/null differ diff --git a/src/_bootstrap.scss b/src/_bootstrap.scss deleted file mode 100644 index fce410e8..00000000 --- a/src/_bootstrap.scss +++ /dev/null @@ -1,49 +0,0 @@ -// Core variables and mixins -@import "variables"; -@import "mixins"; - -// Reset and dependencies -@import "../node_modules/bootstrap-sass/assets/stylesheets/bootstrap/normalize"; -@import "../node_modules/bootstrap-sass/assets/stylesheets/bootstrap/print"; - -// Core CSS -@import "../node_modules/bootstrap-sass/assets/stylesheets/bootstrap/scaffolding"; -@import "../node_modules/bootstrap-sass/assets/stylesheets/bootstrap/type"; -@import "../node_modules/bootstrap-sass/assets/stylesheets/bootstrap/code"; -@import "../node_modules/bootstrap-sass/assets/stylesheets/bootstrap/grid"; -@import "../node_modules/bootstrap-sass/assets/stylesheets/bootstrap/tables"; -@import "../node_modules/bootstrap-sass/assets/stylesheets/bootstrap/forms"; -@import "../node_modules/bootstrap-sass/assets/stylesheets/bootstrap/buttons"; - -// Components -@import "../node_modules/bootstrap-sass/assets/stylesheets/bootstrap/component-animations"; -@import "../node_modules/bootstrap-sass/assets/stylesheets/bootstrap/dropdowns"; -@import "../node_modules/bootstrap-sass/assets/stylesheets/bootstrap/button-groups"; -@import "../node_modules/bootstrap-sass/assets/stylesheets/bootstrap/input-groups"; -@import "../node_modules/bootstrap-sass/assets/stylesheets/bootstrap/navs"; -@import "../node_modules/bootstrap-sass/assets/stylesheets/bootstrap/navbar"; -@import "../node_modules/bootstrap-sass/assets/stylesheets/bootstrap/breadcrumbs"; -@import "../node_modules/bootstrap-sass/assets/stylesheets/bootstrap/pagination"; -@import "../node_modules/bootstrap-sass/assets/stylesheets/bootstrap/pager"; -@import "../node_modules/bootstrap-sass/assets/stylesheets/bootstrap/labels"; -@import "../node_modules/bootstrap-sass/assets/stylesheets/bootstrap/badges"; -@import "../node_modules/bootstrap-sass/assets/stylesheets/bootstrap/jumbotron"; -@import "../node_modules/bootstrap-sass/assets/stylesheets/bootstrap/thumbnails"; -@import "../node_modules/bootstrap-sass/assets/stylesheets/bootstrap/alerts"; -@import "../node_modules/bootstrap-sass/assets/stylesheets/bootstrap/progress-bars"; -@import "../node_modules/bootstrap-sass/assets/stylesheets/bootstrap/media"; -@import "../node_modules/bootstrap-sass/assets/stylesheets/bootstrap/list-group"; -@import "../node_modules/bootstrap-sass/assets/stylesheets/bootstrap/panels"; -@import "../node_modules/bootstrap-sass/assets/stylesheets/bootstrap/responsive-embed"; -@import "../node_modules/bootstrap-sass/assets/stylesheets/bootstrap/wells"; -@import "../node_modules/bootstrap-sass/assets/stylesheets/bootstrap/close"; - -// Components w/ JavaScript -@import "../node_modules/bootstrap-sass/assets/stylesheets/bootstrap/modals"; -@import "../node_modules/bootstrap-sass/assets/stylesheets/bootstrap/tooltip"; -@import "../node_modules/bootstrap-sass/assets/stylesheets/bootstrap/popovers"; -@import "../node_modules/bootstrap-sass/assets/stylesheets/bootstrap/carousel"; - -// Utility classes -@import "../node_modules/bootstrap-sass/assets/stylesheets/bootstrap/utilities"; -@import "../node_modules/bootstrap-sass/assets/stylesheets/bootstrap/responsive-utilities"; diff --git a/src/_mixins.scss b/src/_mixins.scss deleted file mode 100644 index ee9abccf..00000000 --- a/src/_mixins.scss +++ /dev/null @@ -1 +0,0 @@ -@import "../node_modules/bootstrap-sass/assets/stylesheets/bootstrap/mixins"; diff --git a/src/_ui-select.scss b/src/_ui-select.scss deleted file mode 100644 index 974632e0..00000000 --- a/src/_ui-select.scss +++ /dev/null @@ -1,222 +0,0 @@ -/*! - * ui-select - * http://github.com/angular-ui/ui-select - * Version: 0.11.2 - 2015-03-17T04:08:46.478Z - * License: MIT - */ - - -/* Style when highlighting a search. */ -.ui-select-highlight { - font-weight: bold; -} - -.ui-select-offscreen { - clip: rect(0 0 0 0) !important; - width: 1px !important; - height: 1px !important; - border: 0 !important; - margin: 0 !important; - padding: 0 !important; - overflow: hidden !important; - position: absolute !important; - outline: 0 !important; - left: 0px !important; - top: 0px !important; -} - -/* Select2 theme */ - -/* Mark invalid Select2 */ -.ng-dirty.ng-invalid > a.select2-choice { - border-color: #D44950; -} - -.select2-result-single { - padding-left: 0; -} - -.select2-locked > .select2-search-choice-close{ - display:none; -} - -.select-locked > .ui-select-match-close{ - display:none; -} - -body > .select2-container.open { - z-index: 9999; /* The z-index Select2 applies to the select2-drop */ -} - -/* Selectize theme */ - -/* Helper class to show styles when focus */ -.selectize-input.selectize-focus{ - border-color: #007FBB !important; -} - -/* Fix input width for Selectize theme */ -.selectize-control > .selectize-input > input { - width: 100%; -} - -/* Fix dropdown width for Selectize theme */ -.selectize-control > .selectize-dropdown { - width: 100%; -} - -/* Mark invalid Selectize */ -.ng-dirty.ng-invalid > div.selectize-input { - border-color: #D44950; -} - - -/* Bootstrap theme */ - -/* Helper class to show styles when focus */ -.btn-default-focus { - color: #333; - background-color: #EBEBEB; - border-color: #ADADAD; - text-decoration: none; - outline: 5px auto -webkit-focus-ring-color; - outline-offset: -2px; - box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(102, 175, 233, 0.6); -} - -.ui-select-bootstrap .ui-select-toggle { - position: relative; -} - -.ui-select-bootstrap .ui-select-toggle > .caret { - position: absolute; - height: 10px; - top: 50%; - right: 10px; - margin-top: -2px; -} - -/* Fix Bootstrap dropdown position when inside a input-group */ -.input-group > .ui-select-bootstrap.dropdown { - /* Instead of relative */ - position: static; -} - -.input-group > .ui-select-bootstrap > input.ui-select-search.form-control { - border-radius: 4px; /* FIXME hardcoded value :-/ */ - border-top-right-radius: 0; - border-bottom-right-radius: 0; -} - -.ui-select-bootstrap > .ui-select-match > .btn{ - /* Instead of center because of .btn */ - text-align: left !important; - padding-right: 25px; -} - -.ui-select-bootstrap > .ui-select-match > .caret { - position: absolute; - top: 45%; - right: 15px; -} - -/* See Scrollable Menu with Bootstrap 3 http://stackoverflow.com/questions/19227496 */ -.ui-select-bootstrap > .ui-select-choices { - width: 100%; - height: auto; - max-height: 200px; - overflow-x: hidden; - margin-top: -1px; -} - -body > .ui-select-bootstrap.open { - z-index: 1000; /* Standard Bootstrap dropdown z-index */ -} - -.ui-select-multiple.ui-select-bootstrap { - height: auto; - padding: 3px 3px 0 3px; -} - -.ui-select-multiple.ui-select-bootstrap input.ui-select-search { - background-color: transparent !important; /* To prevent double background when disabled */ - border: none; - outline: none; - height: 1.666666em; - margin-bottom: 3px; -} - -.ui-select-multiple.ui-select-bootstrap .ui-select-match .close { - font-size: 1.6em; - line-height: 0.75; -} - -.ui-select-multiple.ui-select-bootstrap .ui-select-match-item { - outline: 0; - margin: 0 3px 3px 0; -} - -.ui-select-multiple .ui-select-match-item { - position: relative; -} - -.ui-select-multiple .ui-select-match-item.dropping-before:before { - content: ""; - position: absolute; - top: 0; - right: 100%; - height: 100%; - margin-right: 2px; - border-left: 1px solid #428bca; -} - -.ui-select-multiple .ui-select-match-item.dropping-after:after { - content: ""; - position: absolute; - top: 0; - left: 100%; - height: 100%; - margin-left: 2px; - border-right: 1px solid #428bca; -} - -.ui-select-bootstrap .ui-select-choices-row>a { - display: block; - padding: 3px 20px; - clear: both; - font-weight: 400; - line-height: 1.42857143; - color: #333; - white-space: nowrap; -} - -.ui-select-bootstrap .ui-select-choices-row>a:hover, .ui-select-bootstrap .ui-select-choices-row>a:focus { - text-decoration: none; - color: #262626; - background-color: #f5f5f5; -} - -.ui-select-bootstrap .ui-select-choices-row.active>a { - color: #fff; - text-decoration: none; - outline: 0; - background-color: #428bca; -} - -.ui-select-bootstrap .ui-select-choices-row.disabled>a, -.ui-select-bootstrap .ui-select-choices-row.active.disabled>a { - color: #777; - cursor: not-allowed; - background-color: #fff; -} - -/* fix hide/show angular animation */ -.ui-select-match.ng-hide-add, -.ui-select-search.ng-hide-add { - display: none !important; -} - -/* Mark invalid Bootstrap */ -.ui-select-bootstrap.ng-dirty.ng-invalid > button.btn.ui-select-match { - border-color: #D44950; -} diff --git a/src/_variables.scss b/src/_variables.scss deleted file mode 100644 index 304f8101..00000000 --- a/src/_variables.scss +++ /dev/null @@ -1,11 +0,0 @@ -@import "../node_modules/bootstrap-sass/assets/stylesheets/bootstrap/variables"; - -$side-view-bg: $navbar-inverse-bg; -$side-view-color: $navbar-inverse-color; -$side-view-link-color: $navbar-inverse-link-color; -$side-view-link-active-color: $navbar-inverse-link-active-color; -$side-view-link-hover-color: $navbar-inverse-link-hover-color; -$side-view-link-active-bg: $navbar-inverse-link-active-bg; -$side-view-link-hover-bg: $navbar-inverse-link-hover-bg; - -$border-color: #ddd; diff --git a/src/app.js b/src/app.js index 41a5cdb8..9c139070 100644 --- a/src/app.js +++ b/src/app.js @@ -7,17 +7,5 @@ angular.module('codexen', [ 'ui.bootstrap', 'satellizer', 'angular-md5', - 'templates', - 'codexen.config', - 'codexen.directives', - 'codexen.filters', - 'codexen.modals', - 'codexen.services', - 'codexen.states']) + 'templates']) angular.module('templates', []) -angular.module('codexen.config', []) -angular.module('codexen.directives', []) -angular.module('codexen.filters', []) -angular.module('codexen.modals', []) -angular.module('codexen.services', []) -angular.module('codexen.states', []) diff --git a/src/config/ace.js b/src/config/ace.js index 49cab275..5d684947 100644 --- a/src/config/ace.js +++ b/src/config/ace.js @@ -1,2 +1,2 @@ -angular.module('codexen.config') -.constant('aceModes', ["ABAP","ABC","ActionScript","ADA","Apache_Conf","AsciiDoc","Assembly_x86","AutoHotKey","BatchFile","C9Search","C_Cpp","Cirru","Clojure","Cobol","coffee","ColdFusion","CSharp","CSS","Curly","D","Dart","Diff","Dockerfile","Dot","Dummy","DummySyntax","Eiffel","EJS","Elixir","Elm","Erlang","Forth","FTL","Gcode","Gherkin","Gitignore","Glsl","golang","Groovy","HAML","Handlebars","Haskell","haXe","HTML","HTML_Ruby","INI","Io","Jack","Jade","Java","JavaScript","JSON","JSONiq","JSP","JSX","Julia","LaTeX","Lean","LESS","Liquid","Lisp","LiveScript","LogiQL","LSL","Lua","LuaPage","Lucene","Makefile","Markdown","Mask","MATLAB","MEL","MUSHCode","MySQL","Nix","ObjectiveC","OCaml","Pascal","Perl","pgSQL","PHP","Powershell","Praat","Prolog","Properties","Protobuf","Python","R","RDoc","RHTML","Ruby","Rust","SASS","SCAD","Scala","Scheme","SCSS","SH","SJS","Smarty","snippets","Soy_Template","Space","SQL","SQLServer","Stylus","SVG","Tcl","Tex","Text","Textile","Toml","Twig","Typescript","Vala","VBScript","Velocity","Verilog","VHDL","XML","XQuery","YAML","Django"]) +angular.module('codexen') + .constant('aceModes', ['ABAP','ABC','ActionScript','ADA','Apache_Conf','AsciiDoc','Assembly_x86','AutoHotKey','BatchFile','C9Search','C_Cpp','Cirru','Clojure','Cobol','coffee','ColdFusion','CSharp','CSS','Curly','D','Dart','Diff','Dockerfile','Dot','Dummy','DummySyntax','Eiffel','EJS','Elixir','Elm','Erlang','Forth','FTL','Gcode','Gherkin','Gitignore','Glsl','golang','Groovy','HAML','Handlebars','Haskell','haXe','HTML','HTML_Ruby','INI','Io','Jack','Jade','Java','JavaScript','JSON','JSONiq','JSP','JSX','Julia','LaTeX','Lean','LESS','Liquid','Lisp','LiveScript','LogiQL','LSL','Lua','LuaPage','Lucene','Makefile','Markdown','Mask','MATLAB','MEL','MUSHCode','MySQL','Nix','ObjectiveC','OCaml','Pascal','Perl','pgSQL','PHP','Powershell','Praat','Prolog','Properties','Protobuf','Python','R','RDoc','RHTML','Ruby','Rust','SASS','SCAD','Scala','Scheme','SCSS','SH','SJS','Smarty','snippets','Soy_Template','Space','SQL','SQLServer','Stylus','SVG','Tcl','Tex','Text','Textile','Toml','Twig','Typescript','Vala','VBScript','Velocity','Verilog','VHDL','XML','XQuery','YAML','Django']) diff --git a/src/config/satellizer.js b/src/config/satellizer.js index 328ceca7..affaf000 100644 --- a/src/config/satellizer.js +++ b/src/config/satellizer.js @@ -1,8 +1,7 @@ /* global angular */ -angular.module('codexen.config') - .constant('apiUrl', 'http://localhost:8000/') - .config(function ($authProvider, $httpProvider) { - $authProvider.baseUrl = 'http://localhost:8000/' +angular.module('codexen') + .config(function ($authProvider, $httpProvider, apiUrl) { + $authProvider.baseUrl = apiUrl $httpProvider.defaults.useXDomain = true delete $httpProvider.defaults.headers.common['X-Requested-With'] diff --git a/src/states/states.js b/src/config/states.js similarity index 74% rename from src/states/states.js rename to src/config/states.js index c10db336..8f0f5b88 100644 --- a/src/states/states.js +++ b/src/config/states.js @@ -1,5 +1,5 @@ /* global angular */ -angular.module('codexen.states') +angular.module('codexen') .config(function ($stateProvider, $urlRouterProvider) { $urlRouterProvider .when('/auth', '/auth/register') @@ -12,18 +12,18 @@ angular.module('codexen.states') url: '/auth', views: { 'main-view': { - templateUrl: 'states/auth/auth.tpl.html' + templateUrl: 'tpls/states/auth.tpl.html' } } }) .state('auth.register', { url: '/register', - templateUrl: 'states/auth/register.tpl.html', + templateUrl: 'tpls/states/auth.register.tpl.html', controller: 'AuthRegisterController as vm' }) .state('auth.signin', { url: '/signin', - templateUrl: 'states/auth/signin.tpl.html', + templateUrl: 'tpls/states/auth.signin.tpl.html', controller: 'AuthSignInController as vm' }) @@ -32,14 +32,14 @@ angular.module('codexen.states') url: '/snippets', views: { 'main-view': { - templateUrl: 'states/snippets/list.tpl.html', + templateUrl: 'tpls/states/snippets.list.tpl.html', controller: 'SnippetsListController as vm' } } }) .state('snippets.detail', { url: '/:id', - templateUrl: 'states/snippets/detail.tpl.html', + templateUrl: 'tpls/states/snippets.detail.tpl.html', controller: 'SnippetsDetailController as vm' }) @@ -48,7 +48,7 @@ angular.module('codexen.states') url: '/', views: { 'main-view': { - templateUrl: 'states/home/home.tpl.html', + templateUrl: 'tpls/states/home.tpl.html', controller: 'HomeController as vm' } } diff --git a/src/controllers/directives/SideNavController.js b/src/controllers/directives/SideNavController.js new file mode 100644 index 00000000..60cb36a0 --- /dev/null +++ b/src/controllers/directives/SideNavController.js @@ -0,0 +1,36 @@ +/* global angular */ +angular.module('codexen') + .controller('SideNavController', function ($auth, User, $rootScope, $scope) { + var vm = this + + vm.isAuthenticated = $auth.isAuthenticated() + + var reloadUser = function () { + if (vm.isAuthenticated) { + User.me().success(function (data) { + console.log('currentUser', data) + vm.currentUser = data.user + }) + } + } + reloadUser() + + vm.signOut = function () { + $auth.logout() + .then(function () { + console.log('Sign Out') + $rootScope.$broadcast('userSignOut') + }) + } + + $scope.$on('userSignIn', function () { + vm.isAuthenticated = true + reloadUser() + }) + + $scope.$on('userSignOut', function () { + vm.isAuthenticated = false + vm.currentUser = null + + }) + }) diff --git a/src/modals/edit-snippet-modal.js b/src/controllers/modals/EditSnippetModalController.js similarity index 53% rename from src/modals/edit-snippet-modal.js rename to src/controllers/modals/EditSnippetModalController.js index 54665290..67f0d48e 100644 --- a/src/modals/edit-snippet-modal.js +++ b/src/controllers/modals/EditSnippetModalController.js @@ -1,22 +1,6 @@ -angular.module('codexen.modals') - .factory('editSnippetModal', function ($modal) { - var open = function (snippet) { - return $modal.open({ - resolve:{ - snippet: function () { - return snippet - } - }, - templateUrl:'modals/edit-snippet-modal.tpl.html', - controller:'EditSnippetModalController as vm' - }) - } - - return { - open: open - } - }) - .controller('EditSnippetModalController', function ($modalInstance, aceModes, $log, Snippet, $rootScope, Tag, snippet){ +/* global angular */ +angular.module('codexen') + .controller('EditSnippetModalController', function ($modalInstance, aceModes, $log, Snippet, $rootScope, Tag, snippet) { var vm = this vm.aceModes = aceModes @@ -24,13 +8,13 @@ angular.module('codexen.modals') console.log(snippet) vm.submit = function () { - console.log('mode: ',vm.snippet.mode) + console.log('mode: ', vm.snippet.mode) var params = { description: vm.snippet.description, callSign: vm.snippet.callSign, - mode: vm.snippet.mode==null?null:vm.snippet.mode.toLowerCase(), + mode: vm.snippet.mode == null ? null : vm.snippet.mode.toLowerCase(), content: vm.snippet.content, - tags: angular.isArray(vm.snippet.tags)?vm.snippet.tags.map(function (tag) { return {_id: tag._id, name: tag.name} }):[] + tags: angular.isArray(vm.snippet.tags) ? vm.snippet.tags.map(function (tag) { return {_id: tag._id, name: tag.name} }) : [] } Snippet.update(vm.snippet._id, params) @@ -43,7 +27,7 @@ angular.module('codexen.modals') // vm.tags = [] vm.tagCandidates = [] vm.refreshTagCandidates = function (tagName) { - if (tagName == null || tagName == '') return null + if (tagName == null || tagName === '') return null return Tag.findByName(tagName) .success(function (data) { console.log('tags fetched!!', data) @@ -52,8 +36,8 @@ angular.module('codexen.modals') } vm.transform = function (tagName) { return { - _id:0, - name:tagName + _id: 0, + name: tagName } } diff --git a/src/modals/new-snippet-modal.js b/src/controllers/modals/NewSnippetModalController.js similarity index 54% rename from src/modals/new-snippet-modal.js rename to src/controllers/modals/NewSnippetModalController.js index 8387e1cf..39d22e4c 100644 --- a/src/modals/new-snippet-modal.js +++ b/src/controllers/modals/NewSnippetModalController.js @@ -1,16 +1,5 @@ -angular.module('codexen.modals') - .factory('newSnippetModal', function ($modal) { - var open = function () { - return $modal.open({ - templateUrl:'modals/new-snippet-modal.tpl.html', - controller:'NewSnippetModalController as vm' - }) - } - - return { - open: open - } - }) +/* global angular */ +angular.module('codexen') .controller('NewSnippetModalController', function ($modalInstance, aceModes, $log, Snippet, $rootScope, Tag){ var vm = this @@ -20,21 +9,21 @@ angular.module('codexen.modals') var params = { description: vm.description, callSign: vm.callSign, - mode: vm.mode==null?null:vm.mode.toLowerCase(), + mode: vm.mode == null ? null : vm.mode.toLowerCase(), content: vm.content, - tags: angular.isArray(vm.tags)?vm.tags.map(function (tag) { return {_id: tag._id, name: tag.name} }):[] + tags: angular.isArray(vm.tags) ? vm.tags.map(function (tag) { return {_id: tag._id, name: tag.name} }) : [] } Snippet.create(params) - .success(function(data){ + .success(function (data) { $modalInstance.close(data.snippet) }) } // vm.tags = [] vm.tagCandidates = [] - vm.refreshTagCandidates = function(tagName) { - if (tagName == null || tagName == '') return null + vm.refreshTagCandidates = function (tagName) { + if (tagName == null || tagName === '') return null return Tag.findByName(tagName) .success(function (data) { console.log('tags fetched!!', data) @@ -43,8 +32,8 @@ angular.module('codexen.modals') } vm.transform = function (tagName) { return { - _id:0, - name:tagName + _id: 0, + name: tagName } } diff --git a/src/states/auth/register.js b/src/controllers/states/AuthRegisterController.js similarity index 93% rename from src/states/auth/register.js rename to src/controllers/states/AuthRegisterController.js index b1d69300..336c1d48 100644 --- a/src/states/auth/register.js +++ b/src/controllers/states/AuthRegisterController.js @@ -1,5 +1,5 @@ /* global angular */ -angular.module('codexen.states') +angular.module('codexen') .controller('AuthRegisterController', function ($auth, $log) { var vm = this vm.isEmpty = function (obj) { diff --git a/src/states/auth/signin.js b/src/controllers/states/AuthSignInController.js similarity index 100% rename from src/states/auth/signin.js rename to src/controllers/states/AuthSignInController.js diff --git a/src/states/home/home.js b/src/controllers/states/HomeController.js similarity index 73% rename from src/states/home/home.js rename to src/controllers/states/HomeController.js index 2ec9efd3..0b5e946f 100644 --- a/src/states/home/home.js +++ b/src/controllers/states/HomeController.js @@ -1,6 +1,5 @@ /* global angular */ -angular.module('codexen.states') +angular.module('codexen') .controller('HomeController', function ($auth, Snippet, $scope) { - }) diff --git a/src/states/snippets/detail.js b/src/controllers/states/SnippetsDetailController.js similarity index 93% rename from src/states/snippets/detail.js rename to src/controllers/states/SnippetsDetailController.js index bfbb20e7..ca0b9965 100644 --- a/src/states/snippets/detail.js +++ b/src/controllers/states/SnippetsDetailController.js @@ -1,5 +1,5 @@ /* global angular */ -angular.module('codexen.states') +angular.module('codexen') .controller('SnippetsDetailController', function (Snippet, $state, $rootScope) { var vm = this diff --git a/src/states/snippets/list.js b/src/controllers/states/SnippetsListController.js similarity index 97% rename from src/states/snippets/list.js rename to src/controllers/states/SnippetsListController.js index c184d033..95754a5d 100644 --- a/src/states/snippets/list.js +++ b/src/controllers/states/SnippetsListController.js @@ -1,5 +1,5 @@ /* global angular */ -angular.module('codexen.states') +angular.module('codexen') .controller('SnippetsListController', function ($auth, Snippet, $scope, $state) { var vm = this diff --git a/src/directives/btn-edit-snippet.js b/src/directives/btn-edit-snippet.js index 597bc13e..d951a5a6 100644 --- a/src/directives/btn-edit-snippet.js +++ b/src/directives/btn-edit-snippet.js @@ -1,12 +1,13 @@ -angular.module('codexen.directives') - .directive('btnEditSnippet', function (editSnippetModal, $rootScope) { +/* global angular */ +angular.module('codexen') + .directive('btnEditSnippet', function (Modal, $rootScope) { return { - scope:{ + scope: { snippet: '=btnEditSnippet' }, link: function (scope, el) { el.on('click', function () { - editSnippetModal.open(scope.snippet) + Modal.editSnippet(scope.snippet) .result.then(function (snippet) { $rootScope.$broadcast('snippetUpdated', snippet) }, function () { diff --git a/src/directives/btn-new-snippet.js b/src/directives/btn-new-snippet.js index 347d5482..292fed87 100644 --- a/src/directives/btn-new-snippet.js +++ b/src/directives/btn-new-snippet.js @@ -1,9 +1,10 @@ -angular.module('codexen.directives') - .directive('btnNewSnippet', function (newSnippetModal, $rootScope) { +/* global angular */ +angular.module('codexen') + .directive('btnNewSnippet', function (Modal, $rootScope) { return { link: function (scope, el) { el.on('click', function () { - newSnippetModal.open() + Modal.newSnippet() .result.then(function (snippet) { console.log('event fire', snippet) $rootScope.$broadcast('snippetUpdated', snippet) diff --git a/src/directives/side-nav.js b/src/directives/side-nav.js index 827c3671..4f84a045 100644 --- a/src/directives/side-nav.js +++ b/src/directives/side-nav.js @@ -1,42 +1,8 @@ - -angular.module('codexen.directives') - .directive('sideNav', function(){ +/* global angular */ +angular.module('codexen') + .directive('sideNav', function () { return { - templateUrl: 'directives/side-nav.tpl.html', + templateUrl: 'tpls/directives/side-nav.tpl.html', controller: 'SideNavController as vm' } }) - .controller('SideNavController', function($auth, User, $rootScope, $scope){ - var vm = this - - vm.isAuthenticated = $auth.isAuthenticated() - - var reloadUser = function(){ - if(vm.isAuthenticated){ - User.me().success(function (data){ - console.log('currentUser', data) - vm.currentUser = data.user - }) - } - } - reloadUser() - - vm.signOut = function () { - $auth.logout() - .then(function () { - console.log('Sign Out') - $rootScope.$broadcast('userSignOut') - }) - } - - $scope.$on('userSignIn', function () { - vm.isAuthenticated = true - reloadUser() - }) - - $scope.$on('userSignOut', function () { - vm.isAuthenticated = false - vm.currentUser = null - - }) - }) diff --git a/src/directives/side-nav.scss b/src/directives/side-nav.scss deleted file mode 100644 index 2e3eb901..00000000 --- a/src/directives/side-nav.scss +++ /dev/null @@ -1,25 +0,0 @@ -@import "../variables"; -@import "../mixins"; - -$side-view-link-hover-color: $gray-dark; -$side-view-link-active-color: $link-color; -$side-view-link-active-bg: $body-bg; - -#side-view ul.nav.nav-pills{ - li hr{ - margin: 5px 0; - border-color: lighten($gray-dark, 20%); - - } - li a{ - color: white; - &:hover{ - color: $side-view-link-hover-color; - } - } - - li.active a{ - color:$side-view-link-active-color; - background-color: $side-view-link-active-bg; - } -} diff --git a/src/directives/tags.js b/src/directives/tags.js index ce2411e5..ea7b06bb 100644 --- a/src/directives/tags.js +++ b/src/directives/tags.js @@ -1,12 +1,13 @@ -angular.module('codexen.directives') +/* global angular */ +angular.module('codexen') .directive('tags', function () { return { - restrict:'A', - template: '

'+ - ' '+ - '#'+ + restrict: 'A', + template: '

' + + ' ' + + '#' + '

', - scope:{ + scope: { tags: '=' } } diff --git a/src/filters/from-now.js b/src/filters/from-now.js index a0d9b890..ccc85a83 100644 --- a/src/filters/from-now.js +++ b/src/filters/from-now.js @@ -1,7 +1,7 @@ -/* global angular */ -angular.module('codexen.filters') -.filter('fromNow', function() { - return function(input) { +/* global angular moment */ +angular.module('codexen') +.filter('fromNow', function () { + return function (input) { return moment(input).fromNow() } }) diff --git a/src/index.html b/src/index.html index 33c9d9c0..b4108d5e 100644 --- a/src/index.html +++ b/src/index.html @@ -11,7 +11,7 @@ Codexen! - + <% styles.forEach(function(style){ %> <% }) %> diff --git a/src/main.scss b/src/main.scss deleted file mode 100644 index cc687151..00000000 --- a/src/main.scss +++ /dev/null @@ -1,57 +0,0 @@ -$fa-font-path: "./resources/fonts"; -@import "../node_modules/font-awesome/scss/font-awesome"; - -@import "bootstrap"; -@import "ui-select"; - -html { - overflow: hidden; - height: 100%; -} - -body { - height: 100%; - overflow: auto; - font-family: "Lato", sans-serif; -} -label{ - font-family: "Lato", sans-serif; -} -textarea{ - resize: vertical; -} - -#side-view{ - position:absolute; - top: 0; - bottom: 0; - left: 0; - width: 200px; - color: $navbar-inverse-color; - background-color: $side-view-bg; - box-sizing: border-box; - padding: 10px 0 10px 10px; - .nav.nav-pills>li>a{ - border-top-right-radius: 0; - border-bottom-right-radius: 0; - } -} -.alert{ - margin: 5px 0; -} - -#main-view{ - position:absolute; - top: 0; - bottom: 0; - left: 200px; - right: 0; - overflow-x: hidden; - overflow-y: auto; -} - -.inline-form-control{ - @extend .form-control; - width: auto; - display: inline-block; -} diff --git a/src/modals/new-snippet-editor.scss b/src/modals/new-snippet-editor.scss deleted file mode 100644 index cc833a6e..00000000 --- a/src/modals/new-snippet-editor.scss +++ /dev/null @@ -1,12 +0,0 @@ -@import "../variables"; - -$editor-border-color: $border-color; - -.new-snippet-modal{ - - .ace_editor { - height: 200px; - border: solid 1px $editor-border-color; - border-radius: 5px; - } -} diff --git a/src/services/Modal.js b/src/services/Modal.js new file mode 100644 index 00000000..5552e1fe --- /dev/null +++ b/src/services/Modal.js @@ -0,0 +1,27 @@ +/* global angular */ +angular.module('codexen') + .factory('Modal', function ($modal) { + var newSnippet = function () { + return $modal.open({ + templateUrl: 'tpls/modals/new-snippet-modal.tpl.html', + controller: 'NewSnippetModalController as vm' + }) + } + + var editSnippet = function (snippet) { + return $modal.open({ + resolve: { + snippet: function () { + return snippet + } + }, + templateUrl: 'tpls/modals/edit-snippet-modal.tpl.html', + controller: 'EditSnippetModalController as vm' + }) + } + + return { + newSnippet: newSnippet, + editSnippet: editSnippet + } + }) diff --git a/src/services/snippet.js b/src/services/snippet.js index 95aad88a..08094dfb 100644 --- a/src/services/snippet.js +++ b/src/services/snippet.js @@ -1,4 +1,5 @@ -angular.module('codexen.services') +/* global angular */ +angular.module('codexen') .factory('Snippet', function ($http, $auth, apiUrl) { var findByUser = function (user) { var url = apiUrl + 'snippets/search' diff --git a/src/services/tag.js b/src/services/tag.js index 7cd68d4f..5b25fa93 100644 --- a/src/services/tag.js +++ b/src/services/tag.js @@ -1,4 +1,5 @@ -angular.module('codexen.services') +/* global angular */ +angular.module('codexen') .factory('Tag', function ($http, apiUrl) { var findByName = function (tagName) { var url = apiUrl + 'tags/search' diff --git a/src/services/user.js b/src/services/user.js index b7412cd2..52e1c816 100644 --- a/src/services/user.js +++ b/src/services/user.js @@ -1,6 +1,7 @@ -angular.module('codexen.services') +/* global angular */ +angular.module('codexen') .factory('User', function ($http, apiUrl, $rootScope, $state) { - $rootScope.$on('userSignOut', function(){ + $rootScope.$on('userSignOut', function () { $state.go('auth.signin') }) diff --git a/src/states/clips/list.js b/src/states/clips/list.js deleted file mode 100644 index e69de29b..00000000 diff --git a/src/states/home/home.scss b/src/states/home/home.scss deleted file mode 100644 index 17a788d0..00000000 --- a/src/states/home/home.scss +++ /dev/null @@ -1,6 +0,0 @@ -@import "../../variables"; -@import "../../mixins"; - -.home-state{ - padding: 10px; -} diff --git a/src/states/snippets/snippets.scss b/src/states/snippets/snippets.scss deleted file mode 100644 index 6a640539..00000000 --- a/src/states/snippets/snippets.scss +++ /dev/null @@ -1,117 +0,0 @@ -@import "../../variables"; -@import "../../mixins"; - -$left-pane-width: 275px; - - -$pane-border-color: $border-color; -$snippet-list-border-color: $border-color; -$snippet-list-item-hover-bg: #EEE; -$snippet-list-active-color: white; -$snippet-list-active-bg: $brand-primary; - -.snippets-list-state{ - position: absolute; - top:0; - left:0; - right:0; - bottom:0; - .left-pane{ - position: absolute; - top: 0; - bottom: 0; - left: 0; - width: $left-pane-width; - overflow:hidden; - border-right: solid 1px $pane-border-color; - .snippet-search{ - position: absolute; - top: 0; - height: 50px; - left: 0; - right: 0; - border-bottom: solid 1px $snippet-list-border-color; - padding: 7px 5px; - } - .snippet-list{ - position: absolute; - top: 50px; - bottom: 0; - left: 0; - right: 0; - overflow-x: hidden; - overflow-y: auto; - list-style: none; - padding: 0; - li{ - cursor: pointer; - padding: 5px; - border-bottom: solid 1px $snippet-list-border-color; - h4{ - margin: 0; - } - &:hover{ - background-color: $snippet-list-item-hover-bg; - } - p{ - margin:0; - } - p.call-sign{ - font-size:0.8em; - } - p.created-at{ - font-size:0.8em; - opacity: 0.8; - } - &.active{ - color: $snippet-list-active-color; - background-color: $snippet-list-active-bg; - a{ - color: white; - } - } - } - } - } - .right-pane{ - position: absolute; - top: 0; - bottom: 0; - left: $left-pane-width; - right: 0; - overflow-x: hidden; - overflow-y: auto; - } -} - -.snippets-detail-state{ - .detail-header{ - padding: 5px 10px; - height: 50px; - border-bottom: solid 1px $border-color; - .detail-header-title{ - small{ - font-size: 0.6em; - } - line-height: 40px; - font-size: 1.2em; - } - .detail-header-control{ - padding:3px; - } - } - .detail-body{ - padding: 5px 10px; - .ace_editor { - min-height: 300px; - border: solid 1px $border-color; - border-radius: 5px; - } - } -} -.tags{ - word-break: break-all; - a{ - margin: 0 2px; - } -} diff --git a/src/styles/bootstrap.styl b/src/styles/bootstrap.styl new file mode 100644 index 00000000..8d623c39 --- /dev/null +++ b/src/styles/bootstrap.styl @@ -0,0 +1,49 @@ +// Core variables and mixins +@import 'vars' +@import 'mixins' + +// Utilities +@import '../../node_modules/bootstrap-styl/bootstrap/utilities' +@import '../../node_modules/bootstrap-styl/bootstrap/responsive-utilities' + +// Reset and dependencies +@import '../../node_modules/bootstrap-styl/bootstrap/normalize' +@import '../../node_modules/bootstrap-styl/bootstrap/print' + +// Core CSS +@import '../../node_modules/bootstrap-styl/bootstrap/scaffolding' +@import '../../node_modules/bootstrap-styl/bootstrap/type' +// @import '../../node_modules/bootstrap-styl/bootstrap/code' +@import '../../node_modules/bootstrap-styl/bootstrap/grid' +@import '../../node_modules/bootstrap-styl/bootstrap/tables' +@import '../../node_modules/bootstrap-styl/bootstrap/forms' +@import '../../node_modules/bootstrap-styl/bootstrap/buttons' + +// Components +@import '../../node_modules/bootstrap-styl/bootstrap/component-animations' +@import '../../node_modules/bootstrap-styl/bootstrap/dropdowns' +@import '../../node_modules/bootstrap-styl/bootstrap/button-groups' +@import '../../node_modules/bootstrap-styl/bootstrap/input-groups' +@import '../../node_modules/bootstrap-styl/bootstrap/navs' +@import '../../node_modules/bootstrap-styl/bootstrap/navbar' +// @import '../../node_modules/bootstrap-styl/bootstrap/breadcrumbs' +@import '../../node_modules/bootstrap-styl/bootstrap/pagination' +@import '../../node_modules/bootstrap-styl/bootstrap/pager' +@import '../../node_modules/bootstrap-styl/bootstrap/labels' +@import '../../node_modules/bootstrap-styl/bootstrap/badges' +@import '../../node_modules/bootstrap-styl/bootstrap/jumbotron' +@import '../../node_modules/bootstrap-styl/bootstrap/thumbnails' +@import '../../node_modules/bootstrap-styl/bootstrap/alerts' +@import '../../node_modules/bootstrap-styl/bootstrap/progress-bars' +@import '../../node_modules/bootstrap-styl/bootstrap/media' +@import '../../node_modules/bootstrap-styl/bootstrap/list-group' +@import '../../node_modules/bootstrap-styl/bootstrap/panels' +@import '../../node_modules/bootstrap-styl/bootstrap/responsive-embed' +@import '../../node_modules/bootstrap-styl/bootstrap/wells' +@import '../../node_modules/bootstrap-styl/bootstrap/close' + +// Components w/ JavaScript +@import '../../node_modules/bootstrap-styl/bootstrap/modals' +@import '../../node_modules/bootstrap-styl/bootstrap/tooltip' +@import '../../node_modules/bootstrap-styl/bootstrap/popovers' +// @import '../../node_modules/bootstrap-styl/bootstrap/carousel' diff --git a/src/styles/directives/side-nav.styl b/src/styles/directives/side-nav.styl new file mode 100644 index 00000000..e5d4458c --- /dev/null +++ b/src/styles/directives/side-nav.styl @@ -0,0 +1,20 @@ +$side-view-link-hover-color= $gray-dark +$side-view-link-active-color= $link-color +$side-view-link-active-bg= $body-bg + +#side-view ul.nav.nav-pills + li hr + margin: 5px 0 + border-color: lighten($gray-dark, 20%) + + + li a + color: white + &:hover + color: $side-view-link-hover-color + + + + li.active a + color:$side-view-link-active-color + background-color: $side-view-link-active-bg diff --git a/src/styles/directives/ui-select.styl b/src/styles/directives/ui-select.styl new file mode 100644 index 00000000..998de31e --- /dev/null +++ b/src/styles/directives/ui-select.styl @@ -0,0 +1,221 @@ +/*! + * ui-select + * http://github.com/angular-ui/ui-select + * Version: 0.11.2 - 2015-03-17T04:08:46.478Z + * License: MIT + */ + + +/* Style when highlighting a search. */ +.ui-select-highlight + font-weight: bold + + +.ui-select-offscreen + clip: rect(0 0 0 0) !important + width: 1px !important + height: 1px !important + border: 0 !important + margin: 0 !important + padding: 0 !important + overflow: hidden !important + position: absolute !important + outline: 0 !important + left: 0px !important + top: 0px !important + + +/* Select2 theme */ + +/* Mark invalid Select2 */ +.ng-dirty.ng-invalid > a.select2-choice + border-color: #D44950 + + +.select2-result-single + padding-left: 0 + + +.select2-locked > .select2-search-choice-close + display:none + + +.select-locked > .ui-select-match-close + display:none + + +body > .select2-container.open + z-index: 9999 /* The z-index Select2 applies to the select2-drop */ + + +/* Selectize theme */ + +/* Helper class to show styles when focus */ +.selectize-input.selectize-focus + border-color: #007FBB !important + + +/* Fix input width for Selectize theme */ +.selectize-control > .selectize-input > input + width: 100% + + +/* Fix dropdown width for Selectize theme */ +.selectize-control > .selectize-dropdown + width: 100% + + +/* Mark invalid Selectize */ +.ng-dirty.ng-invalid > div.selectize-input + border-color: #D44950 + + + +/* Bootstrap theme */ + +/* Helper class to show styles when focus */ +.btn-default-focus + color: #333 + background-color: #EBEBEB + border-color: #ADADAD + text-decoration: none + outline: 5px auto -webkit-focus-ring-color + outline-offset: -2px + box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(102, 175, 233, 0.6) + + +.ui-select-bootstrap .ui-select-toggle + position: relative + + +.ui-select-bootstrap .ui-select-toggle > .caret + position: absolute + height: 10px + top: 50% + right: 10px + margin-top: -2px + + +/* Fix Bootstrap dropdown position when inside a input-group */ +.input-group > .ui-select-bootstrap.dropdown + /* Instead of relative */ + position: static + + +.input-group > .ui-select-bootstrap > input.ui-select-search.form-control + border-radius: 4px /* FIXME hardcoded value :-/ */ + border-top-right-radius: 0 + border-bottom-right-radius: 0 + + +.ui-select-bootstrap > .ui-select-match > .btn + /* Instead of center because of .btn */ + text-align: left !important + padding-right: 25px + + +.ui-select-bootstrap > .ui-select-match > .caret + position: absolute + top: 45% + right: 15px + + +/* See Scrollable Menu with Bootstrap 3 http://stackoverflow.com/questions/19227496 */ +.ui-select-bootstrap > .ui-select-choices + width: 100% + height: auto + max-height: 200px + overflow-x: hidden + margin-top: -1px + + +body > .ui-select-bootstrap.open + z-index: 1000 /* Standard Bootstrap dropdown z-index */ + + +.ui-select-multiple.ui-select-bootstrap + height: auto + padding: 3px 3px 0 3px + + +.ui-select-multiple.ui-select-bootstrap input.ui-select-search + background-color: transparent !important /* To prevent double background when disabled */ + border: none + outline: none + height: 1.666666em + margin-bottom: 3px + + +.ui-select-multiple.ui-select-bootstrap .ui-select-match .close + font-size: 1.6em + line-height: 0.75 + + +.ui-select-multiple.ui-select-bootstrap .ui-select-match-item + outline: 0 + margin: 0 3px 3px 0 + + +.ui-select-multiple .ui-select-match-item + position: relative + + +.ui-select-multiple .ui-select-match-item.dropping-before:before + content: "" + position: absolute + top: 0 + right: 100% + height: 100% + margin-right: 2px + border-left: 1px solid #428bca + + +.ui-select-multiple .ui-select-match-item.dropping-after:after + content: "" + position: absolute + top: 0 + left: 100% + height: 100% + margin-left: 2px + border-right: 1px solid #428bca + + +.ui-select-bootstrap .ui-select-choices-row>a + display: block + padding: 3px 20px + clear: both + font-weight: 400 + line-height: 1.42857143 + color: #333 + white-space: nowrap + + +.ui-select-bootstrap .ui-select-choices-row>a:hover, .ui-select-bootstrap .ui-select-choices-row>a:focus + text-decoration: none + color: #262626 + background-color: #f5f5f5 + + +.ui-select-bootstrap .ui-select-choices-row.active>a + color: #fff + text-decoration: none + outline: 0 + background-color: #428bca + + +.ui-select-bootstrap .ui-select-choices-row.disabled>a, +.ui-select-bootstrap .ui-select-choices-row.active.disabled>a + color: #777 + cursor: not-allowed + background-color: #fff + + +/* fix hide/show angular animation */ +.ui-select-match.ng-hide-add, +.ui-select-search.ng-hide-add + display: none !important + + +/* Mark invalid Bootstrap */ +.ui-select-bootstrap.ng-dirty.ng-invalid > button.btn.ui-select-match + border-color: #D44950 diff --git a/src/styles/main.styl b/src/styles/main.styl new file mode 100644 index 00000000..ea84e306 --- /dev/null +++ b/src/styles/main.styl @@ -0,0 +1,77 @@ +@import 'bootstrap' + +@import 'modals/*' +@import 'directives/*' +@import 'states/*' +// @import 'mixins/*' + +html + overflow: hidden + height: 100% + +body + height: 100% + overflow: auto + font-family: "Lato", sans-serif + color $color + background-color: $bg + +// body:before +// content '' +// background-image url('http://img10.deviantart.net/f372/i/2014/283/8/3/blue_pattern_design_free_vector_by_vecree-d829oba.jpg') +// filter blur(5px) +// opacity 1 +// position absolute +// left 0 +// top 0 +// bottom 0 +// right 0 + +label + font-family: "Lato", sans-serif + color $color + +textarea + resize: vertical + + +#side-view + position:absolute + top: 0 + bottom: 0 + left: 0 + width: 200px + background-color: $bgDarker + border-right solid 2px $borderEdge + box-sizing: border-box + padding: 10px 0 10px 10px + .nav.nav-pills>li + &.active>a{ + background-color $bg + } + + .nav.nav-pills>li>a + color white + border-top-right-radius: 0 + border-bottom-right-radius: 0 + + +.alert + margin: 5px 0 + + +#main-view + position:absolute + top: 0 + bottom: 0 + left: 200px + right: 0 + overflow-x: hidden + overflow-y: auto + background-color $bg + + +.inline-form-control + @extend .form-control + width: auto + display: inline-block diff --git a/src/styles/mixins.styl b/src/styles/mixins.styl new file mode 100644 index 00000000..e0504de7 --- /dev/null +++ b/src/styles/mixins.styl @@ -0,0 +1 @@ +@import '../../node_modules/bootstrap-styl/bootstrap/mixins' diff --git a/src/styles/modals/new-snippet-editor.styl b/src/styles/modals/new-snippet-editor.styl new file mode 100644 index 00000000..4bcc3ce7 --- /dev/null +++ b/src/styles/modals/new-snippet-editor.styl @@ -0,0 +1,8 @@ +$editor-border-color= $border-color + +.new-snippet-modal + + .ace_editor + height: 200px + border: solid 1px $editor-border-color + border-radius: 5px diff --git a/src/styles/states/home.styl b/src/styles/states/home.styl new file mode 100644 index 00000000..290ad895 --- /dev/null +++ b/src/styles/states/home.styl @@ -0,0 +1,2 @@ +.home-state + padding 10px diff --git a/src/styles/states/snippets.styl b/src/styles/states/snippets.styl new file mode 100644 index 00000000..d1770e57 --- /dev/null +++ b/src/styles/states/snippets.styl @@ -0,0 +1,112 @@ +$left-pane-width= 275px + + +$pane-border-color= $border-color +$snippet-list-border-color= $border-color +$snippet-list-item-hover-bg= #EEE +$snippet-list-active-color= white +$snippet-list-active-bg= $brand-primary + +.snippets-list-state + position: absolute + top:0 + left:0 + right:0 + bottom:0 + .left-pane + position: absolute + top: 0 + bottom: 0 + left: 0 + width: $left-pane-width + overflow:hidden + border-right: solid 1px $pane-border-color + .snippet-search + position: absolute + top: 0 + height: 50px + left: 0 + right: 0 + border-bottom: solid 1px $snippet-list-border-color + padding: 7px 5px + + .snippet-list + position: absolute + top: 50px + bottom: 0 + left: 0 + right: 0 + overflow-x: hidden + overflow-y: auto + list-style: none + padding: 0 + li + cursor: pointer + padding: 5px + border-bottom: solid 1px $snippet-list-border-color + h4 + margin: 0 + + &:hover + background-color: $snippet-list-item-hover-bg + + p + margin:0 + + p.call-sign + font-size:0.8em + + p.created-at + font-size:0.8em + opacity: 0.8 + + &.active + color: $snippet-list-active-color + background-color: $snippet-list-active-bg + a + color: white + + + + + + .right-pane + position: absolute + top: 0 + bottom: 0 + left: $left-pane-width + right: 0 + overflow-x: hidden + overflow-y: auto + + + +.snippets-detail-state + .detail-header + padding: 5px 10px + height: 50px + border-bottom: solid 1px $border-color + .detail-header-title + small + font-size: 0.6em + + line-height: 40px + font-size: 1.2em + + .detail-header-control + padding:3px + + + .detail-body + padding: 5px 10px + .ace_editor + min-height: 300px + border: solid 1px $border-color + border-radius: 5px + + + +.tags + word-break: break-all + a + margin: 0 2px diff --git a/src/styles/vars.styl b/src/styles/vars.styl new file mode 100644 index 00000000..f247a6b7 --- /dev/null +++ b/src/styles/vars.styl @@ -0,0 +1,12 @@ +@import '../../node_modules/bootstrap-styl/bootstrap/variables' + +$brandColor= #26A7D5 + +$colorEdge= white +$color= #777 + +$border= #444 +$borderEdge= #26A7D5 + +$bg= RGBA(38, 58, 71, 1) +$bgDarker= RGBA(25, 41, 52, 1) diff --git a/src/directives/side-nav.tpl.html b/src/tpls/directives/side-nav.tpl.html similarity index 100% rename from src/directives/side-nav.tpl.html rename to src/tpls/directives/side-nav.tpl.html diff --git a/src/modals/edit-snippet-modal.tpl.html b/src/tpls/modals/edit-snippet-modal.tpl.html similarity index 100% rename from src/modals/edit-snippet-modal.tpl.html rename to src/tpls/modals/edit-snippet-modal.tpl.html diff --git a/src/modals/new-snippet-modal.tpl.html b/src/tpls/modals/new-snippet-modal.tpl.html similarity index 100% rename from src/modals/new-snippet-modal.tpl.html rename to src/tpls/modals/new-snippet-modal.tpl.html diff --git a/src/states/auth/register.tpl.html b/src/tpls/states/auth.register.tpl.html similarity index 100% rename from src/states/auth/register.tpl.html rename to src/tpls/states/auth.register.tpl.html diff --git a/src/states/auth/signin.tpl.html b/src/tpls/states/auth.signin.tpl.html similarity index 100% rename from src/states/auth/signin.tpl.html rename to src/tpls/states/auth.signin.tpl.html diff --git a/src/states/auth/auth.tpl.html b/src/tpls/states/auth.tpl.html similarity index 100% rename from src/states/auth/auth.tpl.html rename to src/tpls/states/auth.tpl.html diff --git a/src/states/home/home.tpl.html b/src/tpls/states/home.tpl.html similarity index 100% rename from src/states/home/home.tpl.html rename to src/tpls/states/home.tpl.html diff --git a/src/states/snippets/detail.tpl.html b/src/tpls/states/snippets.detail.tpl.html similarity index 100% rename from src/states/snippets/detail.tpl.html rename to src/tpls/states/snippets.detail.tpl.html diff --git a/src/states/snippets/list.tpl.html b/src/tpls/states/snippets.list.tpl.html similarity index 100% rename from src/states/snippets/list.tpl.html rename to src/tpls/states/snippets.list.tpl.html diff --git a/tpls/env.js b/tpls/env.js new file mode 100644 index 00000000..d9a7a894 --- /dev/null +++ b/tpls/env.js @@ -0,0 +1,3 @@ +/* global angular */ +angular.module('codexen') + .constant('apiUrl', '<%= apiUrl %>')