mirror of
https://git.teknik.io/Teknikode/Teknik.git
synced 2023-08-02 14:16:22 +02:00
Added basic paste interface
This commit is contained in:
parent
5fb06265b3
commit
da64b0c7a2
@ -3,14 +3,38 @@ using System.Collections.Generic;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Web;
|
using System.Web;
|
||||||
using System.Web.Mvc;
|
using System.Web.Mvc;
|
||||||
|
using Teknik.Areas.Paste.ViewModels;
|
||||||
using Teknik.Controllers;
|
using Teknik.Controllers;
|
||||||
|
|
||||||
namespace Teknik.Areas.Paste.Controllers
|
namespace Teknik.Areas.Paste.Controllers
|
||||||
{
|
{
|
||||||
public class PasteController : DefaultController
|
public class PasteController : DefaultController
|
||||||
{
|
{
|
||||||
// GET: Paste/Paste
|
[AllowAnonymous]
|
||||||
public ActionResult Index()
|
public ActionResult Index()
|
||||||
|
{
|
||||||
|
PasteViewModel model = new PasteViewModel();
|
||||||
|
return View(model);
|
||||||
|
}
|
||||||
|
|
||||||
|
[AllowAnonymous]
|
||||||
|
public ActionResult Simple()
|
||||||
|
{
|
||||||
|
PasteViewModel model = new PasteViewModel();
|
||||||
|
return View(model);
|
||||||
|
}
|
||||||
|
|
||||||
|
[AllowAnonymous]
|
||||||
|
public ActionResult Raw()
|
||||||
|
{
|
||||||
|
PasteViewModel model = new PasteViewModel();
|
||||||
|
return View(model);
|
||||||
|
}
|
||||||
|
|
||||||
|
[AllowAnonymous]
|
||||||
|
[HttpPost]
|
||||||
|
[ValidateAntiForgeryToken]
|
||||||
|
public ActionResult Paste()
|
||||||
{
|
{
|
||||||
return View();
|
return View();
|
||||||
}
|
}
|
||||||
|
@ -44,10 +44,18 @@ namespace Teknik.Areas.Paste
|
|||||||
new { controller = "Paste", action = "Raw" }, // Parameter defaults
|
new { controller = "Paste", action = "Raw" }, // Parameter defaults
|
||||||
new[] { typeof(Controllers.PasteController).Namespace }
|
new[] { typeof(Controllers.PasteController).Namespace }
|
||||||
);
|
);
|
||||||
|
context.MapSubdomainRoute(
|
||||||
|
"Paste.Action", // Route name
|
||||||
|
new List<string>() { "dev", "paste", "p" },
|
||||||
|
"Action/{action}", // URL with parameters
|
||||||
|
new { controller = "Paste", action = "Paste" }, // Parameter defaults
|
||||||
|
new[] { typeof(Controllers.PasteController).Namespace }
|
||||||
|
);
|
||||||
|
|
||||||
// Register Script Bundles
|
// Register Script Bundles
|
||||||
BundleTable.Bundles.Add(new ScriptBundle("~/bundles/paste").Include(
|
BundleTable.Bundles.Add(new ScriptBundle("~/bundles/paste").Include(
|
||||||
"~/Scripts/Highlight/highlight.pack.js"));
|
"~/Scripts/Highlight/highlight.pack.js",
|
||||||
|
"~/Areas/Paste/Scripts/Paste.js"));
|
||||||
// Register Style Bundles
|
// Register Style Bundles
|
||||||
BundleTable.Bundles.Add(new StyleBundle("~/Content/paste").Include(
|
BundleTable.Bundles.Add(new StyleBundle("~/Content/paste").Include(
|
||||||
"~/Content/Highlight/default.css"));
|
"~/Content/Highlight/default.css"));
|
||||||
|
3
Teknik/Areas/Paste/Scripts/Paste.js
Normal file
3
Teknik/Areas/Paste/Scripts/Paste.js
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
$(document).ready(function () {
|
||||||
|
$('#content').focus();
|
||||||
|
});
|
@ -1,4 +1,58 @@
|
|||||||
@model Teknik.Areas.Paste.ViewModels.PasteViewModel
|
@model Teknik.Areas.Paste.ViewModels.PasteViewModel
|
||||||
|
|
||||||
@Styles.Render("~/Content/paste");
|
@using Teknik.Helpers
|
||||||
@Scripts.Render("~/bundles/paste");
|
|
||||||
|
@Styles.Render("~/Content/paste")
|
||||||
|
@Scripts.Render("~/bundles/paste")
|
||||||
|
|
||||||
|
<div class="container">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-sm-12">
|
||||||
|
<form class="form-horizontal" name="editor" method="post" action="@Url.SubRouteUrl("paste", "Paste.Paste")">
|
||||||
|
<div class="form-group">
|
||||||
|
<div class="col-sm-10 col-sm-offset-1">
|
||||||
|
<textarea class="form-control" id="content" rows="20"></textarea>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="title" class="col-sm-2 col-sm-offset-2 control-label">Title</label>
|
||||||
|
<div class="col-sm-6">
|
||||||
|
<input type="text" class="form-control" id="title" placeholder="My Awesome Paste">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="format" class="col-sm-2 col-sm-offset-2 control-label">Format</label>
|
||||||
|
<div class="col-sm-6">
|
||||||
|
<select class="form-control">
|
||||||
|
<option value="<auto>">Auto Select</option>
|
||||||
|
@foreach (KeyValuePair<string, string> format in Constants.HIGHLIGHTFORMATS)
|
||||||
|
{
|
||||||
|
<option value="@format.Value">@format.Key</option>
|
||||||
|
}
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="password" class="col-sm-2 col-sm-offset-2 control-label">Password</label>
|
||||||
|
<div class="col-sm-6">
|
||||||
|
<input type="password" class="form-control" id="title" placeholder="Secret">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<div class="col-sm-offset-4 col-sm-6">
|
||||||
|
<div class="checkbox">
|
||||||
|
<label>
|
||||||
|
<input type="checkbox"> Hide from Public List
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<div class="col-sm-offset-2 col-sm-10">
|
||||||
|
<button type="submit" class="btn btn-default">Submit Paste</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
@ -10,5 +10,144 @@ namespace Teknik.Helpers
|
|||||||
{
|
{
|
||||||
// Blog Constants
|
// Blog Constants
|
||||||
public static int SERVERBLOGID = 1;
|
public static int SERVERBLOGID = 1;
|
||||||
|
|
||||||
|
// Paste Constants
|
||||||
|
public static Dictionary<string, string> HIGHLIGHTFORMATS = new Dictionary<string, string>()
|
||||||
|
{
|
||||||
|
{ "1C", "1c" },
|
||||||
|
{ "Access logs", "accesslog" },
|
||||||
|
{ "ARM assembler", "armasm" },
|
||||||
|
{ "AVR assembler", "avrasm" },
|
||||||
|
{ "ActionScript", "actionscript" },
|
||||||
|
{ "Apache", "apache" },
|
||||||
|
{ "AppleScript", "applescript" },
|
||||||
|
{ "AsciiDoc", "asciidoc" },
|
||||||
|
{ "AspectJ", "aspectj" },
|
||||||
|
{ "AutoHotkey", "autohotkey" },
|
||||||
|
{ "AutoIt", "autoit" },
|
||||||
|
{ "Axapta", "axapta" },
|
||||||
|
{ "Bash", "bash" },
|
||||||
|
{ "Basic", "basic" },
|
||||||
|
{ "Brainfuck", "brainfuck" },
|
||||||
|
{ "C#", "cs" },
|
||||||
|
{ "C++", "cpp" },
|
||||||
|
{ "C/AL", "cal" },
|
||||||
|
{ "Cache Object Script", "cos" },
|
||||||
|
{ "CMake", "cmake" },
|
||||||
|
{ "CSS", "css" },
|
||||||
|
{ "Cap’n Proto", "capnproto" },
|
||||||
|
{ "Clojure", "clojure" },
|
||||||
|
{ "CoffeeScript", "coffeescript" },
|
||||||
|
{ "Crmsh", "crmsh" },
|
||||||
|
{ "Crystal", "crystal" },
|
||||||
|
{ "D", "d" },
|
||||||
|
{ "DNS Zone file", "dns" },
|
||||||
|
{ "DOS", "dos" },
|
||||||
|
{ "Dart", "dart" },
|
||||||
|
{ "Delphi", "delphi" },
|
||||||
|
{ "Diff", "diff" },
|
||||||
|
{ "Django", "django" },
|
||||||
|
{ "Dockerfile", "dockerfile" },
|
||||||
|
{ "DTS (Device Tree)", "dts" },
|
||||||
|
{ "Dust", "dust" },
|
||||||
|
{ "Elixir", "elixir" },
|
||||||
|
{ "Elm", "elm" },
|
||||||
|
{ "Erlang", "erlang" },
|
||||||
|
{ "F#", "fsharp" },
|
||||||
|
{ "FIX", "fix" },
|
||||||
|
{ "Fortran", "fortran" },
|
||||||
|
{ "G-Code", "gcode" },
|
||||||
|
{ "Gams", "gams" },
|
||||||
|
{ "GAUSS", "gauss" },
|
||||||
|
{ "Gherkin", "gherkin" },
|
||||||
|
{ "Go", "go" },
|
||||||
|
{ "Golo", "golo" },
|
||||||
|
{ "Gradle", "gradle" },
|
||||||
|
{ "Groovy", "groovy" },
|
||||||
|
{ "HTML, XML", "xml" },
|
||||||
|
{ "HTTP", "http" },
|
||||||
|
{ "Haml", "haml" },
|
||||||
|
{ "Handlebars", "handlebars" },
|
||||||
|
{ "Haskell", "haskell" },
|
||||||
|
{ "Haxe", "haxe" },
|
||||||
|
{ "Ini", "ini" },
|
||||||
|
{ "Inform7", "inform7" },
|
||||||
|
{ "IRPF90", "irpf90" },
|
||||||
|
{ "JSON", "json" },
|
||||||
|
{ "Java", "java" },
|
||||||
|
{ "JavaScript", "javascript" },
|
||||||
|
{ "Lasso", "lasso" },
|
||||||
|
{ "Less", "less" },
|
||||||
|
{ "Lisp", "lisp" },
|
||||||
|
{ "LiveCode Server", "livecodeserver" },
|
||||||
|
{ "LiveScript", "livescript" },
|
||||||
|
{ "Lua", "lua" },
|
||||||
|
{ "Makefile", "makefile" },
|
||||||
|
{ "Markdown", "markdown" },
|
||||||
|
{ "Mathematica", "mathematica" },
|
||||||
|
{ "Matlab", "matlab" },
|
||||||
|
{ "Maya Embedded Language", "mel" },
|
||||||
|
{ "Mercury", "mercury" },
|
||||||
|
{ "Mizar", "mizar" },
|
||||||
|
{ "Mojolicious", "mojolicious" },
|
||||||
|
{ "Monkey", "monkey" },
|
||||||
|
{ "NSIS", "nsis" },
|
||||||
|
{ "Nginx", "nginx" },
|
||||||
|
{ "Nimrod", "nimrod" },
|
||||||
|
{ "Nix", "nix" },
|
||||||
|
{ "OCaml", "ocaml" },
|
||||||
|
{ "Objective C", "objectivec" },
|
||||||
|
{ "OpenGL Shading Language", "glsl" },
|
||||||
|
{ "OpenSCAD", "openscad" },
|
||||||
|
{ "Oracle Rules Language", "ruleslanguage" },
|
||||||
|
{ "Oxygene", "oxygene" },
|
||||||
|
{ "PF", "pf" },
|
||||||
|
{ "PHP", "php" },
|
||||||
|
{ "Parser3", "parser3" },
|
||||||
|
{ "Perl", "perl" },
|
||||||
|
{ "PowerShell", "powershell" },
|
||||||
|
{ "Processing", "processing" },
|
||||||
|
{ "Prolog", "prolog" },
|
||||||
|
{ "Protocol Buffers", "protobuf" },
|
||||||
|
{ "Puppet", "puppet" },
|
||||||
|
{ "Python", "python" },
|
||||||
|
{ "Python profiler results", "profile" },
|
||||||
|
{ "Q", "k" },
|
||||||
|
{ "QML", "qml" },
|
||||||
|
{ "R", "r" },
|
||||||
|
{ "RenderMan RIB", "rib" },
|
||||||
|
{ "RenderMan RSL", "rsl" },
|
||||||
|
{ "Roboconf", "graph" },
|
||||||
|
{ "Ruby", "ruby" },
|
||||||
|
{ "Rust", "rust" },
|
||||||
|
{ "SCSS", "scss" },
|
||||||
|
{ "SQL", "sql" },
|
||||||
|
{ "STEP Part 21", "p21" },
|
||||||
|
{ "Scala", "scala" },
|
||||||
|
{ "Scheme", "scheme" },
|
||||||
|
{ "Scilab", "scilab" },
|
||||||
|
{ "Smali", "smali" },
|
||||||
|
{ "Smalltalk", "smalltalk" },
|
||||||
|
{ "Stan", "stan" },
|
||||||
|
{ "Stata", "stata" },
|
||||||
|
{ "Stylus", "stylus" },
|
||||||
|
{ "Swift", "swift" },
|
||||||
|
{ "Tcl", "tcl" },
|
||||||
|
{ "TeX", "tex" },
|
||||||
|
{ "Thrift", "thrift" },
|
||||||
|
{ "TP", "tp" },
|
||||||
|
{ "Twig", "twig" },
|
||||||
|
{ "TypeScript", "typescript" },
|
||||||
|
{ "VB.Net", "vbnet" },
|
||||||
|
{ "VBScript", "vbscript" },
|
||||||
|
{ "VHDL", "vhdl" },
|
||||||
|
{ "Vala", "vala" },
|
||||||
|
{ "Verilog", "verilog" },
|
||||||
|
{ "Vim Script", "vim" },
|
||||||
|
{ "x86 Assembly", "x86asm" },
|
||||||
|
{ "XL", "xl" },
|
||||||
|
{ "XQuery", "xpath" },
|
||||||
|
{ "Zephir", "zephir" }
|
||||||
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Binary file not shown.
@ -226,6 +226,7 @@
|
|||||||
<Content Include="Areas\Help\Content\Help.css" />
|
<Content Include="Areas\Help\Content\Help.css" />
|
||||||
<Content Include="Areas\Home\Content\Home.css" />
|
<Content Include="Areas\Home\Content\Home.css" />
|
||||||
<Content Include="Areas\Home\Scripts\Home.js" />
|
<Content Include="Areas\Home\Scripts\Home.js" />
|
||||||
|
<Content Include="Areas\Paste\Scripts\Paste.js" />
|
||||||
<Content Include="Areas\Profile\Scripts\Profile.js" />
|
<Content Include="Areas\Profile\Scripts\Profile.js" />
|
||||||
<Content Include="Areas\Upload\Scripts\Download.js" />
|
<Content Include="Areas\Upload\Scripts\Download.js" />
|
||||||
<Content Include="Content\Highlight\agate.css" />
|
<Content Include="Content\Highlight\agate.css" />
|
||||||
@ -460,7 +461,6 @@
|
|||||||
<Folder Include="Areas\Help\Views\Shared\" />
|
<Folder Include="Areas\Help\Views\Shared\" />
|
||||||
<Folder Include="Areas\Home\Models\" />
|
<Folder Include="Areas\Home\Models\" />
|
||||||
<Folder Include="Areas\Home\Views\Shared\" />
|
<Folder Include="Areas\Home\Views\Shared\" />
|
||||||
<Folder Include="Areas\Paste\Scripts\" />
|
|
||||||
<Folder Include="Areas\Paste\Views\Shared\" />
|
<Folder Include="Areas\Paste\Views\Shared\" />
|
||||||
<Folder Include="Areas\Privacy\Models\" />
|
<Folder Include="Areas\Privacy\Models\" />
|
||||||
<Folder Include="Areas\Privacy\Views\Shared\" />
|
<Folder Include="Areas\Privacy\Views\Shared\" />
|
||||||
|
Loading…
Reference in New Issue
Block a user