mirror of
https://github.com/BoostIo/Boostnote
synced 2025-12-13 01:36:22 +00:00
add snippet list
This commit is contained in:
@@ -32,7 +32,7 @@ gulp.task('js', function(){
|
||||
gulp.task('sass', function () {
|
||||
return gulp.src('src/**/*.scss')
|
||||
.pipe(cached('styles'))
|
||||
.pipe(sass().on('error', sass.logError))
|
||||
.pipe(sass())
|
||||
.pipe(autoprefixer())
|
||||
.pipe(remember('styles'))
|
||||
.pipe(concat('all.css'))
|
||||
|
||||
@@ -111,6 +111,7 @@ body > .select2-container.open {
|
||||
.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 {
|
||||
|
||||
@@ -7,3 +7,5 @@ $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;
|
||||
|
||||
@@ -10,10 +10,12 @@ angular.module('codexen', [
|
||||
'templates',
|
||||
'codexen.config',
|
||||
'codexen.directives',
|
||||
'codexen.modals',
|
||||
'codexen.services',
|
||||
'codexen.states'])
|
||||
angular.module('templates', [])
|
||||
angular.module('codexen.config', [])
|
||||
angular.module('codexen.directives', [])
|
||||
angular.module('codexen.modals', [])
|
||||
angular.module('codexen.services', [])
|
||||
angular.module('codexen.states', [])
|
||||
|
||||
740
src/config/ace.js
Normal file
740
src/config/ace.js
Normal file
@@ -0,0 +1,740 @@
|
||||
angular.module('codexen.config')
|
||||
.constant('aceModes', [{
|
||||
"name": "ABAP",
|
||||
"mode": [
|
||||
"abap"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "ABC",
|
||||
"mode": [
|
||||
"abc"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "ActionScript",
|
||||
"mode": [
|
||||
"as"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "ADA",
|
||||
"mode": [
|
||||
"ada|adb"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "Apache_Conf",
|
||||
"mode": [
|
||||
"^htaccess|^htgroups|^htpasswd|^conf|htaccess|htgroups|htpasswd"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "AsciiDoc",
|
||||
"mode": [
|
||||
"asciidoc|adoc"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "Assembly_x86",
|
||||
"mode": [
|
||||
"asm"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "AutoHotKey",
|
||||
"mode": [
|
||||
"ahk"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "BatchFile",
|
||||
"mode": [
|
||||
"bat|cmd"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "C9Search",
|
||||
"mode": [
|
||||
"c9search_results"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "C_Cpp",
|
||||
"mode": [
|
||||
"cpp|c|cc|cxx|h|hh|hpp"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "Cirru",
|
||||
"mode": [
|
||||
"cirru|cr"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "Clojure",
|
||||
"mode": [
|
||||
"clj|cljs"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "Cobol",
|
||||
"mode": [
|
||||
"CBL|COB"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "coffee",
|
||||
"mode": [
|
||||
"coffee|cf|cson|^Cakefile"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "ColdFusion",
|
||||
"mode": [
|
||||
"cfm"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "CSharp",
|
||||
"mode": [
|
||||
"cs"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "CSS",
|
||||
"mode": [
|
||||
"css"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "Curly",
|
||||
"mode": [
|
||||
"curly"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "D",
|
||||
"mode": [
|
||||
"d|di"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "Dart",
|
||||
"mode": [
|
||||
"dart"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "Diff",
|
||||
"mode": [
|
||||
"diff|patch"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "Dockerfile",
|
||||
"mode": [
|
||||
"^Dockerfile"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "Dot",
|
||||
"mode": [
|
||||
"dot"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "Dummy",
|
||||
"mode": [
|
||||
"dummy"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "DummySyntax",
|
||||
"mode": [
|
||||
"dummy"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "Eiffel",
|
||||
"mode": [
|
||||
"e"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "EJS",
|
||||
"mode": [
|
||||
"ejs"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "Elixir",
|
||||
"mode": [
|
||||
"ex|exs"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "Elm",
|
||||
"mode": [
|
||||
"elm"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "Erlang",
|
||||
"mode": [
|
||||
"erl|hrl"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "Forth",
|
||||
"mode": [
|
||||
"frt|fs|ldr"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "FTL",
|
||||
"mode": [
|
||||
"ftl"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "Gcode",
|
||||
"mode": [
|
||||
"gcode"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "Gherkin",
|
||||
"mode": [
|
||||
"feature"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "Gitignore",
|
||||
"mode": [
|
||||
"^.gitignore"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "Glsl",
|
||||
"mode": [
|
||||
"glsl|frag|vert"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "golang",
|
||||
"mode": [
|
||||
"go"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "Groovy",
|
||||
"mode": [
|
||||
"groovy"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "HAML",
|
||||
"mode": [
|
||||
"haml"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "Handlebars",
|
||||
"mode": [
|
||||
"hbs|handlebars|tpl|mustache"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "Haskell",
|
||||
"mode": [
|
||||
"hs"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "haXe",
|
||||
"mode": [
|
||||
"hx"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "HTML",
|
||||
"mode": [
|
||||
"html|htm|xhtml"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "HTML_Ruby",
|
||||
"mode": [
|
||||
"erb|rhtml|html.erb"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "INI",
|
||||
"mode": [
|
||||
"ini|conf|cfg|prefs"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "Io",
|
||||
"mode": [
|
||||
"io"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "Jack",
|
||||
"mode": [
|
||||
"jack"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "Jade",
|
||||
"mode": [
|
||||
"jade"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "Java",
|
||||
"mode": [
|
||||
"java"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "JavaScript",
|
||||
"mode": [
|
||||
"js|jsm"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "JSON",
|
||||
"mode": [
|
||||
"json"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "JSONiq",
|
||||
"mode": [
|
||||
"jq"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "JSP",
|
||||
"mode": [
|
||||
"jsp"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "JSX",
|
||||
"mode": [
|
||||
"jsx"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "Julia",
|
||||
"mode": [
|
||||
"jl"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "LaTeX",
|
||||
"mode": [
|
||||
"tex|latex|ltx|bib"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "Lean",
|
||||
"mode": [
|
||||
"lean|hlean"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "LESS",
|
||||
"mode": [
|
||||
"less"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "Liquid",
|
||||
"mode": [
|
||||
"liquid"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "Lisp",
|
||||
"mode": [
|
||||
"lisp"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "LiveScript",
|
||||
"mode": [
|
||||
"ls"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "LogiQL",
|
||||
"mode": [
|
||||
"logic|lql"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "LSL",
|
||||
"mode": [
|
||||
"lsl"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "Lua",
|
||||
"mode": [
|
||||
"lua"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "LuaPage",
|
||||
"mode": [
|
||||
"lp"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "Lucene",
|
||||
"mode": [
|
||||
"lucene"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "Makefile",
|
||||
"mode": [
|
||||
"^Makefile|^GNUmakefile|^makefile|^OCamlMakefile|make"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "Markdown",
|
||||
"mode": [
|
||||
"md|markdown"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "Mask",
|
||||
"mode": [
|
||||
"mask"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "MATLAB",
|
||||
"mode": [
|
||||
"matlab"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "MEL",
|
||||
"mode": [
|
||||
"mel"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "MUSHCode",
|
||||
"mode": [
|
||||
"mc|mush"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "MySQL",
|
||||
"mode": [
|
||||
"mysql"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "Nix",
|
||||
"mode": [
|
||||
"nix"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "ObjectiveC",
|
||||
"mode": [
|
||||
"m|mm"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "OCaml",
|
||||
"mode": [
|
||||
"ml|mli"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "Pascal",
|
||||
"mode": [
|
||||
"pas|p"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "Perl",
|
||||
"mode": [
|
||||
"pl|pm"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "pgSQL",
|
||||
"mode": [
|
||||
"pgsql"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "PHP",
|
||||
"mode": [
|
||||
"php|phtml"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "Powershell",
|
||||
"mode": [
|
||||
"ps1"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "Praat",
|
||||
"mode": [
|
||||
"praat|praatscript|psc|proc"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "Prolog",
|
||||
"mode": [
|
||||
"plg|prolog"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "Properties",
|
||||
"mode": [
|
||||
"properties"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "Protobuf",
|
||||
"mode": [
|
||||
"proto"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "Python",
|
||||
"mode": [
|
||||
"py"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "R",
|
||||
"mode": [
|
||||
"r"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "RDoc",
|
||||
"mode": [
|
||||
"Rd"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "RHTML",
|
||||
"mode": [
|
||||
"Rhtml"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "Ruby",
|
||||
"mode": [
|
||||
"rb|ru|gemspec|rake|^Guardfile|^Rakefile|^Gemfile"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "Rust",
|
||||
"mode": [
|
||||
"rs"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "SASS",
|
||||
"mode": [
|
||||
"sass"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "SCAD",
|
||||
"mode": [
|
||||
"scad"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "Scala",
|
||||
"mode": [
|
||||
"scala"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "Scheme",
|
||||
"mode": [
|
||||
"scm|rkt"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "SCSS",
|
||||
"mode": [
|
||||
"scss"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "SH",
|
||||
"mode": [
|
||||
"sh|bash|^.bashrc"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "SJS",
|
||||
"mode": [
|
||||
"sjs"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "Smarty",
|
||||
"mode": [
|
||||
"smarty|tpl"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "snippets",
|
||||
"mode": [
|
||||
"snippets"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "Soy_Template",
|
||||
"mode": [
|
||||
"soy"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "Space",
|
||||
"mode": [
|
||||
"space"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "SQL",
|
||||
"mode": [
|
||||
"sql"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "SQLServer",
|
||||
"mode": [
|
||||
"sqlserver"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "Stylus",
|
||||
"mode": [
|
||||
"styl|stylus"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "SVG",
|
||||
"mode": [
|
||||
"svg"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "Tcl",
|
||||
"mode": [
|
||||
"tcl"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "Tex",
|
||||
"mode": [
|
||||
"tex"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "Text",
|
||||
"mode": [
|
||||
"txt"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "Textile",
|
||||
"mode": [
|
||||
"textile"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "Toml",
|
||||
"mode": [
|
||||
"toml"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "Twig",
|
||||
"mode": [
|
||||
"twig"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "Typescript",
|
||||
"mode": [
|
||||
"ts|typescript|str"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "Vala",
|
||||
"mode": [
|
||||
"vala"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "VBScript",
|
||||
"mode": [
|
||||
"vbs|vb"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "Velocity",
|
||||
"mode": [
|
||||
"vm"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "Verilog",
|
||||
"mode": [
|
||||
"v|vh|sv|svh"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "VHDL",
|
||||
"mode": [
|
||||
"vhd|vhdl"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "XML",
|
||||
"mode": [
|
||||
"xml|rdf|rss|wsdl|xslt|atom|mathml|mml|xul|xbl|xaml"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "XQuery",
|
||||
"mode": [
|
||||
"xq"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "YAML",
|
||||
"mode": [
|
||||
"yaml|yml"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "Django",
|
||||
"mode": [
|
||||
"html"
|
||||
]
|
||||
}
|
||||
])
|
||||
@@ -1,3 +1,4 @@
|
||||
/* global angular */
|
||||
angular.module('codexen.config')
|
||||
.constant('apiUrl', 'http://localhost:8000/')
|
||||
.config(function ($authProvider, $httpProvider) {
|
||||
|
||||
15
src/directives/btn-new-snippet.js
Normal file
15
src/directives/btn-new-snippet.js
Normal file
@@ -0,0 +1,15 @@
|
||||
angular.module('codexen.directives')
|
||||
.directive('btnNewSnippet', function (newSnippetModal, $rootScope) {
|
||||
return {
|
||||
link: function (scope, el) {
|
||||
el.on('click', function () {
|
||||
newSnippetModal.open()
|
||||
.result.then(function (snippet) {
|
||||
$rootScope.$broadcast('snippetUpdated', snippet)
|
||||
}, function () {
|
||||
console.log('new snippet modal dismissed')
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
@@ -1,10 +1,16 @@
|
||||
@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{
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<img width="30" ng-src="http://www.gravatar.com/avatar/{{ vm.currentUser.email | gravatar }}">
|
||||
<span ng-bind="vm.currentUser.name"></span>
|
||||
<span class="dropdown" dropdown is-open>
|
||||
<button type="button" name="button" dropdown-toggle class="btn btn-default dropdown-toggle"><i class="fa fa-caret-down"></i></button>
|
||||
<a type="button" name="button" dropdown-toggle class="btn btn-sm btn-default dropdown-toggle"><i class="fa fa-caret-down"></i></a>
|
||||
<ul class="dropdown-menu">
|
||||
<li>
|
||||
<a ng-click="vm.signOut()"><i class="fa fa-signout"></i> Sign Out</a>
|
||||
@@ -19,10 +19,23 @@
|
||||
|
||||
<p>Side Nav</p>
|
||||
<ul class="nav nav-pills nav-stacked">
|
||||
<li>
|
||||
<a btn-new-snippet href="#"><i class="fa fa-plus-square-o"></i> New Snippet</a>
|
||||
</li>
|
||||
<li class="divider"><hr></li>
|
||||
<li>
|
||||
</li>
|
||||
<li ui-sref-active="active">
|
||||
<a ui-sref="home"><i class="fa fa-home"></i> Home</a>
|
||||
</li>
|
||||
<li ui-sref-active="active">
|
||||
<a ui-sref="snippets"><i class="fa fa-code"></i> Snippets</a>
|
||||
</li>
|
||||
<li ui-sref-active="active">
|
||||
<a ui-sref="clips"><i class="fa fa-paperclip"></i> Clips</a>
|
||||
</li>
|
||||
<li class="divider"><hr></li>
|
||||
<li>
|
||||
<a href="">My Page</a>
|
||||
<a href=""><i class="fa fa-gears"></i> Configuration</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
@@ -46,3 +46,9 @@ label{
|
||||
overflow-x: hidden;
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
||||
.inline-form-control{
|
||||
@extend .form-control;
|
||||
width: auto;
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
12
src/modals/new-snippet-editor.scss
Normal file
12
src/modals/new-snippet-editor.scss
Normal file
@@ -0,0 +1,12 @@
|
||||
@import "../variables";
|
||||
|
||||
$editor-border-color: $border-color;
|
||||
|
||||
.new-snippet-modal{
|
||||
|
||||
.ace_editor {
|
||||
height: 200px;
|
||||
border: solid 1px $editor-border-color;
|
||||
border-radius: 5px;
|
||||
}
|
||||
}
|
||||
38
src/modals/new-snippet-modal.js
Normal file
38
src/modals/new-snippet-modal.js
Normal file
@@ -0,0 +1,38 @@
|
||||
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
|
||||
}
|
||||
})
|
||||
.controller('NewSnippetModalController', function ($modalInstance, aceModes, $log, Snippet, $rootScope){
|
||||
var vm = this
|
||||
|
||||
vm.aceModes = aceModes
|
||||
|
||||
vm.submit = function () {
|
||||
var params = {
|
||||
title: vm.title,
|
||||
description: vm.description,
|
||||
prefix: vm.prefix,
|
||||
mode: vm.mode==null?null:vm.mode.name.toLowerCase(),
|
||||
content: vm.content
|
||||
}
|
||||
|
||||
Snippet.create(params)
|
||||
.success(function(data){
|
||||
$modalInstance.close(data.snippet)
|
||||
console.log('snippet created!', data)
|
||||
})
|
||||
}
|
||||
|
||||
vm.cancel = function () {
|
||||
$modalInstance.dismiss()
|
||||
}
|
||||
})
|
||||
34
src/modals/new-snippet-modal.tpl.html
Normal file
34
src/modals/new-snippet-modal.tpl.html
Normal file
@@ -0,0 +1,34 @@
|
||||
<div class="new-snippet-modal">
|
||||
<div class="modal-header">
|
||||
<input ng-model="vm.title" type="title" class="form-control input-lg" placeholder="Title">
|
||||
</div>
|
||||
|
||||
<div class="modal-body">
|
||||
<div class="form-group">
|
||||
<textarea ng-model="vm.description" name="description" class="form-control" placeholder="Description..."></textarea>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<input ng-model="vm.prefix" type="text" name="prefix" class="inline-form-control" placeholder="Prefix">
|
||||
|
||||
<ui-select ng-model="vm.mode" style="display: inline-block;" on-select="vm.log(vm.mode.name.toLowerCase())" theme="bootstrap" ng-disabled="disabled">
|
||||
<ui-select-match placeholder="Select Type">{{$select.selected.name}}</ui-select-match>
|
||||
<ui-select-choices repeat="mode in vm.aceModes | filter: {name: $select.search}">
|
||||
<div ng-bind-html="mode.name | highlight: $select.search"></div>
|
||||
</ui-select-choices>
|
||||
</ui-select>
|
||||
</div>
|
||||
|
||||
<div
|
||||
ui-ace="{
|
||||
mode: vm.mode.name.toLowerCase()
|
||||
|
||||
}"
|
||||
ng-model="vm.content"
|
||||
></div>
|
||||
</div>
|
||||
|
||||
<div class="modal-footer">
|
||||
<button ng-click="vm.submit()" type="button" name="button" class="btn btn-primary">Submit</button>
|
||||
<button ng-click="vm.cancel()" type="button" name="button" class="btn btn-default">Cancel</button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -1,16 +1,23 @@
|
||||
angular.module('codexen.services')
|
||||
.factory('Snippet', function ($http, $auth, apiUrl) {
|
||||
var findByUserId = function (userId) {
|
||||
var findByUser = function (user) {
|
||||
var url = apiUrl + 'snippets'
|
||||
|
||||
return $http.get(url, {
|
||||
params: {
|
||||
userId: userId
|
||||
user: user
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
var create = function (params) {
|
||||
var url = apiUrl + 'snippets'
|
||||
|
||||
return $http.post(url, params)
|
||||
}
|
||||
|
||||
return {
|
||||
findByUserId: findByUserId
|
||||
findByUser: findByUser,
|
||||
create: create
|
||||
}
|
||||
})
|
||||
|
||||
@@ -1,36 +1,6 @@
|
||||
/* global angular */
|
||||
angular.module('codexen.states')
|
||||
.controller('HomeController', function ($auth, Snippet, $scope) {
|
||||
var vm = this
|
||||
|
||||
vm.isLoaded = false
|
||||
|
||||
var laodSnippets = function () {
|
||||
if ($auth.isAuthenticated) {
|
||||
console.log($auth.getPayload())
|
||||
var userId = $auth.getPayload().sub
|
||||
Snippet.findByUserId(userId)
|
||||
.success(function (data) {
|
||||
console.log('snippets fetched', data.snippets)
|
||||
vm.isLoaded = true
|
||||
vm.snippets = data.snippets
|
||||
vm.isGuest = false
|
||||
})
|
||||
}else {
|
||||
vm.isLoaded = true
|
||||
vm.isGuest = true
|
||||
vm.snippets = void 0
|
||||
}
|
||||
}
|
||||
|
||||
laodSnippets()
|
||||
|
||||
$scope.$on('userSignIn', function () {
|
||||
laodSnippets()
|
||||
})
|
||||
|
||||
$scope.$on('userSignOut', function () {
|
||||
laodSnippets()
|
||||
})
|
||||
|
||||
|
||||
})
|
||||
|
||||
@@ -1,51 +1,6 @@
|
||||
@import "../../variables";
|
||||
@import "../../mixins";
|
||||
|
||||
$left-pane-width: 275px;
|
||||
|
||||
|
||||
$pane-border-color: #ddd;
|
||||
$snippet-list-border-color: #ddd;
|
||||
$snippet-list-item-hover-bg: #EEE;
|
||||
|
||||
.home-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-x: hidden;
|
||||
overflow-y: auto;
|
||||
border-right: solid 1px $pane-border-color;
|
||||
.snippet-list{
|
||||
list-style: none;
|
||||
padding: 0;
|
||||
li{
|
||||
padding: 5px;
|
||||
border-bottom: solid 1px $snippet-list-border-color;
|
||||
h4{
|
||||
margin: 0;
|
||||
}
|
||||
&:hover{
|
||||
background-color: $snippet-list-item-hover-bg;
|
||||
}
|
||||
p{
|
||||
margin:0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.right-pane{
|
||||
position: absolute;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
left: $left-pane-width;
|
||||
right: 0;
|
||||
}
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
@@ -1,51 +1,10 @@
|
||||
<div class="home-state">
|
||||
<h1 class="jumbotron">Codexen App, v0.1 (breakthru)</h1>
|
||||
<p>
|
||||
App for Code snippets<br>
|
||||
|
||||
<div class="left-pane">
|
||||
<ul class="snippet-list">
|
||||
|
||||
<li ng-if="!vm.isLoaded" class="message-item">
|
||||
<h4>
|
||||
Loading
|
||||
</h4>
|
||||
</li>
|
||||
|
||||
<li ng-if="vm.isLoaded && vm.snippets==0 && !vm.isGuest" class="message-item">
|
||||
<h4>
|
||||
Empty List
|
||||
</h4>
|
||||
<button class="btn btn-xs btn-default"><i class="fa fa-plus-square-o"></i> New Snippet</button>
|
||||
</li>
|
||||
|
||||
<li ng-if="vm.isLoaded && vm.isGuest" class="message-item">
|
||||
<h4>
|
||||
Sign In to access
|
||||
</h4>
|
||||
<a ui-sref="auth.signin" class="btn btn-xs btn-default"><i class="fa fa-signin"></i> Sign In</a>
|
||||
</li>
|
||||
|
||||
<li ng-repeat="snippet in vm.snippets">
|
||||
<div class="media">
|
||||
<div class="media-left">
|
||||
<img width="25" height="25" src="http://www.gravatar.com/avatar/ea0b6ad1c11700120d1af08810caa19d" alt="" />
|
||||
</div>
|
||||
<div class="media-body">
|
||||
<h4 ng-bind="snippet.title"></h4>
|
||||
<p class="created-at">created at <span ng-bind="snippet.createdAt"></span></p>
|
||||
</div>
|
||||
</div>
|
||||
<p ng-bind="snippet.description"></p>
|
||||
<p>
|
||||
<a ng-repeat="tag in snippet.tags" ng-bind="tag.name" href="#" class="label label-default"></a>
|
||||
</p>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="right-pane">
|
||||
<div class="">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
App: <a href="https://github.com/Rokt33r/codexen-app">Rokt33r/codexen-app</a><br>
|
||||
Server: <a href="https://github.com/Rokt33r/codexen-server">Rokt33r/codexen-server</a>
|
||||
|
||||
</p>
|
||||
</div>
|
||||
|
||||
40
src/states/snippets/list.js
Normal file
40
src/states/snippets/list.js
Normal file
@@ -0,0 +1,40 @@
|
||||
/* global angular */
|
||||
angular.module('codexen.states')
|
||||
.controller('SnippetsListController', function ($auth, Snippet, $scope) {
|
||||
var vm = this
|
||||
|
||||
vm.isLoaded = false
|
||||
|
||||
var laodSnippets = function () {
|
||||
if ($auth.isAuthenticated) {
|
||||
console.log($auth.getPayload())
|
||||
var userId = $auth.getPayload().sub
|
||||
Snippet.findByUser(userId)
|
||||
.success(function (data) {
|
||||
console.log('snippets fetched', data.snippets)
|
||||
vm.isLoaded = true
|
||||
vm.snippets = data.snippets
|
||||
vm.isGuest = false
|
||||
})
|
||||
}else {
|
||||
vm.isLoaded = true
|
||||
vm.isGuest = true
|
||||
vm.snippets = void 0
|
||||
}
|
||||
}
|
||||
|
||||
laodSnippets()
|
||||
|
||||
$scope.$on('userSignIn', function () {
|
||||
laodSnippets()
|
||||
})
|
||||
|
||||
$scope.$on('userSignOut', function () {
|
||||
laodSnippets()
|
||||
})
|
||||
|
||||
$scope.$on('snippetUpdated', function () {
|
||||
laodSnippets()
|
||||
})
|
||||
|
||||
})
|
||||
51
src/states/snippets/list.tpl.html
Normal file
51
src/states/snippets/list.tpl.html
Normal file
@@ -0,0 +1,51 @@
|
||||
<div class="snippets-list-state">
|
||||
|
||||
<div class="left-pane">
|
||||
<ul class="snippet-list">
|
||||
|
||||
<li ng-if="!vm.isLoaded" class="message-item">
|
||||
<h4>
|
||||
Loading
|
||||
</h4>
|
||||
</li>
|
||||
|
||||
<li ng-if="vm.isLoaded && vm.snippets==0 && !vm.isGuest" class="message-item">
|
||||
<h4>
|
||||
Empty List
|
||||
</h4>
|
||||
<button btn-new-snippet class="btn btn-default"><i class="fa fa-plus-square-o"></i> New Snippet</button>
|
||||
</li>
|
||||
|
||||
<li ng-if="vm.isLoaded && vm.isGuest" class="message-item">
|
||||
<h4>
|
||||
Sign In to access
|
||||
</h4>
|
||||
<a ui-sref="auth.signin" class="btn btn-default"><i class="fa fa-signin"></i> Sign In</a>
|
||||
</li>
|
||||
|
||||
<li ng-repeat="snippet in vm.snippets">
|
||||
<div class="media">
|
||||
<div class="media-left">
|
||||
<img width="25" height="25" src="http://www.gravatar.com/avatar/ea0b6ad1c11700120d1af08810caa19d" alt="" />
|
||||
</div>
|
||||
<div class="media-body">
|
||||
<h4 ng-bind="snippet.title"></h4>
|
||||
<p class="created-at">created at <span ng-bind="snippet.createdAt"></span></p>
|
||||
</div>
|
||||
</div>
|
||||
<p ng-bind="snippet.description"></p>
|
||||
<p>
|
||||
<a ng-repeat="tag in snippet.tags" ng-bind="tag.name" href="#" class="label label-default"></a>
|
||||
</p>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="right-pane">
|
||||
<div class="">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
51
src/states/snippets/snippets.scss
Normal file
51
src/states/snippets/snippets.scss
Normal file
@@ -0,0 +1,51 @@
|
||||
@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;
|
||||
|
||||
.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-x: hidden;
|
||||
overflow-y: auto;
|
||||
border-right: solid 1px $pane-border-color;
|
||||
.snippet-list{
|
||||
list-style: none;
|
||||
padding: 0;
|
||||
li{
|
||||
padding: 5px;
|
||||
border-bottom: solid 1px $snippet-list-border-color;
|
||||
h4{
|
||||
margin: 0;
|
||||
}
|
||||
&:hover{
|
||||
background-color: $snippet-list-item-hover-bg;
|
||||
}
|
||||
p{
|
||||
margin:0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.right-pane{
|
||||
position: absolute;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
left: $left-pane-width;
|
||||
right: 0;
|
||||
}
|
||||
}
|
||||
@@ -4,6 +4,7 @@ angular.module('codexen.states')
|
||||
$urlRouterProvider
|
||||
.when('/auth', '/auth/register')
|
||||
.when('/auth/', '/auth/register')
|
||||
.otherwise('/')
|
||||
|
||||
$stateProvider
|
||||
/* Auth */
|
||||
@@ -26,10 +27,26 @@ angular.module('codexen.states')
|
||||
controller: 'AuthSignInController as vm'
|
||||
})
|
||||
|
||||
/* Snippets */
|
||||
.state('snippets', {
|
||||
url: '/snippets',
|
||||
views:{
|
||||
'main-view': {
|
||||
templateUrl: 'states/snippets/list.tpl.html',
|
||||
controller: 'SnippetsListController as vm'
|
||||
}
|
||||
}
|
||||
})
|
||||
.state('snippets.detail', {
|
||||
url: '/:id',
|
||||
templateUrl: 'states/snippets/detail.tpl.html',
|
||||
controller: 'SnippetsDetailController as vm'
|
||||
})
|
||||
|
||||
/* Home */
|
||||
.state('home', {
|
||||
url: '/',
|
||||
views:{
|
||||
views: {
|
||||
'main-view': {
|
||||
templateUrl: 'states/home/home.tpl.html',
|
||||
controller: 'HomeController as vm'
|
||||
|
||||
132
test.js
Normal file
132
test.js
Normal file
@@ -0,0 +1,132 @@
|
||||
var data = {
|
||||
ABAP: ["abap"],
|
||||
ABC: ["abc"],
|
||||
ActionScript:["as"],
|
||||
ADA: ["ada|adb"],
|
||||
Apache_Conf: ["^htaccess|^htgroups|^htpasswd|^conf|htaccess|htgroups|htpasswd"],
|
||||
AsciiDoc: ["asciidoc|adoc"],
|
||||
Assembly_x86:["asm"],
|
||||
AutoHotKey: ["ahk"],
|
||||
BatchFile: ["bat|cmd"],
|
||||
C9Search: ["c9search_results"],
|
||||
C_Cpp: ["cpp|c|cc|cxx|h|hh|hpp"],
|
||||
Cirru: ["cirru|cr"],
|
||||
Clojure: ["clj|cljs"],
|
||||
Cobol: ["CBL|COB"],
|
||||
coffee: ["coffee|cf|cson|^Cakefile"],
|
||||
ColdFusion: ["cfm"],
|
||||
CSharp: ["cs"],
|
||||
CSS: ["css"],
|
||||
Curly: ["curly"],
|
||||
D: ["d|di"],
|
||||
Dart: ["dart"],
|
||||
Diff: ["diff|patch"],
|
||||
Dockerfile: ["^Dockerfile"],
|
||||
Dot: ["dot"],
|
||||
Dummy: ["dummy"],
|
||||
DummySyntax: ["dummy"],
|
||||
Eiffel: ["e"],
|
||||
EJS: ["ejs"],
|
||||
Elixir: ["ex|exs"],
|
||||
Elm: ["elm"],
|
||||
Erlang: ["erl|hrl"],
|
||||
Forth: ["frt|fs|ldr"],
|
||||
FTL: ["ftl"],
|
||||
Gcode: ["gcode"],
|
||||
Gherkin: ["feature"],
|
||||
Gitignore: ["^.gitignore"],
|
||||
Glsl: ["glsl|frag|vert"],
|
||||
golang: ["go"],
|
||||
Groovy: ["groovy"],
|
||||
HAML: ["haml"],
|
||||
Handlebars: ["hbs|handlebars|tpl|mustache"],
|
||||
Haskell: ["hs"],
|
||||
haXe: ["hx"],
|
||||
HTML: ["html|htm|xhtml"],
|
||||
HTML_Ruby: ["erb|rhtml|html.erb"],
|
||||
INI: ["ini|conf|cfg|prefs"],
|
||||
Io: ["io"],
|
||||
Jack: ["jack"],
|
||||
Jade: ["jade"],
|
||||
Java: ["java"],
|
||||
JavaScript: ["js|jsm"],
|
||||
JSON: ["json"],
|
||||
JSONiq: ["jq"],
|
||||
JSP: ["jsp"],
|
||||
JSX: ["jsx"],
|
||||
Julia: ["jl"],
|
||||
LaTeX: ["tex|latex|ltx|bib"],
|
||||
Lean: ["lean|hlean"],
|
||||
LESS: ["less"],
|
||||
Liquid: ["liquid"],
|
||||
Lisp: ["lisp"],
|
||||
LiveScript: ["ls"],
|
||||
LogiQL: ["logic|lql"],
|
||||
LSL: ["lsl"],
|
||||
Lua: ["lua"],
|
||||
LuaPage: ["lp"],
|
||||
Lucene: ["lucene"],
|
||||
Makefile: ["^Makefile|^GNUmakefile|^makefile|^OCamlMakefile|make"],
|
||||
Markdown: ["md|markdown"],
|
||||
Mask: ["mask"],
|
||||
MATLAB: ["matlab"],
|
||||
MEL: ["mel"],
|
||||
MUSHCode: ["mc|mush"],
|
||||
MySQL: ["mysql"],
|
||||
Nix: ["nix"],
|
||||
ObjectiveC: ["m|mm"],
|
||||
OCaml: ["ml|mli"],
|
||||
Pascal: ["pas|p"],
|
||||
Perl: ["pl|pm"],
|
||||
pgSQL: ["pgsql"],
|
||||
PHP: ["php|phtml"],
|
||||
Powershell: ["ps1"],
|
||||
Praat: ["praat|praatscript|psc|proc"],
|
||||
Prolog: ["plg|prolog"],
|
||||
Properties: ["properties"],
|
||||
Protobuf: ["proto"],
|
||||
Python: ["py"],
|
||||
R: ["r"],
|
||||
RDoc: ["Rd"],
|
||||
RHTML: ["Rhtml"],
|
||||
Ruby: ["rb|ru|gemspec|rake|^Guardfile|^Rakefile|^Gemfile"],
|
||||
Rust: ["rs"],
|
||||
SASS: ["sass"],
|
||||
SCAD: ["scad"],
|
||||
Scala: ["scala"],
|
||||
Scheme: ["scm|rkt"],
|
||||
SCSS: ["scss"],
|
||||
SH: ["sh|bash|^.bashrc"],
|
||||
SJS: ["sjs"],
|
||||
Smarty: ["smarty|tpl"],
|
||||
snippets: ["snippets"],
|
||||
Soy_Template:["soy"],
|
||||
Space: ["space"],
|
||||
SQL: ["sql"],
|
||||
SQLServer: ["sqlserver"],
|
||||
Stylus: ["styl|stylus"],
|
||||
SVG: ["svg"],
|
||||
Tcl: ["tcl"],
|
||||
Tex: ["tex"],
|
||||
Text: ["txt"],
|
||||
Textile: ["textile"],
|
||||
Toml: ["toml"],
|
||||
Twig: ["twig"],
|
||||
Typescript: ["ts|typescript|str"],
|
||||
Vala: ["vala"],
|
||||
VBScript: ["vbs|vb"],
|
||||
Velocity: ["vm"],
|
||||
Verilog: ["v|vh|sv|svh"],
|
||||
VHDL: ["vhd|vhdl"],
|
||||
XML: ["xml|rdf|rss|wsdl|xslt|atom|mathml|mml|xul|xbl|xaml"],
|
||||
XQuery: ["xq"],
|
||||
YAML: ["yaml|yml"],
|
||||
Django: ["html"]
|
||||
}
|
||||
var arr = []
|
||||
|
||||
for(var key in data){
|
||||
arr.push({name:key, mode:data[key]})
|
||||
}
|
||||
|
||||
console.log(JSON.stringify(arr, null, ' '))
|
||||
Reference in New Issue
Block a user