mirror of
https://github.com/gitbucket/gitbucket.git
synced 2025-11-09 15:05:50 +01:00
(refs #13)Implementing file editing on the repository viewer
This commit is contained in:
@@ -163,6 +163,45 @@ object helpers extends AvatarImageProvider with LinkConverter with RequestCache
|
||||
*/
|
||||
def isPast(date: Date): Boolean = System.currentTimeMillis > date.getTime
|
||||
|
||||
/**
|
||||
* Returns file type for AceEditor.
|
||||
*/
|
||||
def editorType(fileName: String): String = {
|
||||
fileName.toLowerCase match {
|
||||
case x if(x.endsWith(".bat")) => "batchfile"
|
||||
case x if(x.endsWith(".java")) => "java"
|
||||
case x if(x.endsWith(".scala")) => "scala"
|
||||
case x if(x.endsWith(".js")) => "javascript"
|
||||
case x if(x.endsWith(".css")) => "css"
|
||||
case x if(x.endsWith(".md")) => "markdown"
|
||||
case x if(x.endsWith(".html")) => "html"
|
||||
case x if(x.endsWith(".xml")) => "xml"
|
||||
case x if(x.endsWith(".c")) => "c_cpp"
|
||||
case x if(x.endsWith(".cpp")) => "c_cpp"
|
||||
case x if(x.endsWith(".coffee")) => "coffee"
|
||||
case x if(x.endsWith(".ejs")) => "ejs"
|
||||
case x if(x.endsWith(".hs")) => "haskell"
|
||||
case x if(x.endsWith(".json")) => "json"
|
||||
case x if(x.endsWith(".jsp")) => "jsp"
|
||||
case x if(x.endsWith(".jsx")) => "jsx"
|
||||
case x if(x.endsWith(".cl")) => "lisp"
|
||||
case x if(x.endsWith(".clojure")) => "lisp"
|
||||
case x if(x.endsWith(".lua")) => "lua"
|
||||
case x if(x.endsWith(".php")) => "php"
|
||||
case x if(x.endsWith(".py")) => "python"
|
||||
case x if(x.endsWith(".rdoc")) => "rdoc"
|
||||
case x if(x.endsWith(".rhtml")) => "rhtml"
|
||||
case x if(x.endsWith(".ruby")) => "ruby"
|
||||
case x if(x.endsWith(".sh")) => "sh"
|
||||
case x if(x.endsWith(".sql")) => "sql"
|
||||
case x if(x.endsWith(".tcl")) => "tcl"
|
||||
case x if(x.endsWith(".vbs")) => "vbscript"
|
||||
case x if(x.endsWith(".tcl")) => "tcl"
|
||||
case x if(x.endsWith(".yml")) => "yaml"
|
||||
case _ => "plain_text"
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Implicit conversion to add mkHtml() to Seq[Html].
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user