@@ -65,7 +65,7 @@ trait GistControllerBase extends ControllerBase {
6565 if (gitdir.exists){
6666 using(Git .open(gitdir)){ git =>
6767 val files : Seq [(String , JGitUtil .ContentInfo )] = JGitUtil .getFileList(git, " master" , " ." ).map { file =>
68- file.name -> JGitUtil .getContentInfo(git, file.name, file.id)
68+ ( if (isGistFile( file.name)) " " else file.name) -> JGitUtil .getContentInfo(git, file.name, file.id)
6969 }
7070 _root_.gist.html.edit(Nil , getGist(userName, repoName), files)
7171 }
@@ -95,7 +95,7 @@ trait GistControllerBase extends ControllerBase {
9595 loginAccount.userName,
9696 repoName,
9797 isPrivate,
98- files.head._1,
98+ getTitle( files.head._1, repoName) ,
9999 description
100100 )
101101
@@ -115,12 +115,18 @@ trait GistControllerBase extends ControllerBase {
115115
116116 val loginAccount = context.loginAccount.get
117117 val files = getFileParameters(true )
118- // TODO Save isPrivate and description
119- // val isPrivate = params("private")
120118 val description = params(" description" )
121- val gitdir = new File (GistRepoDir , userName + " /" + repoName)
119+
120+ // Update database
121+ updateGist(
122+ userName,
123+ repoName,
124+ getTitle(files.head._1, repoName),
125+ description
126+ )
122127
123128 // Commit files
129+ val gitdir = new File (GistRepoDir , userName + " /" + repoName)
124130 using(Git .open(gitdir)){ git =>
125131 val commitId = commitFiles(git, loginAccount, " Update" , files)
126132
@@ -318,4 +324,8 @@ trait GistControllerBase extends ControllerBase {
318324 commitId
319325 }
320326
327+ private def isGistFile (fileName : String ): Boolean = fileName.matches(" gistfile[0-9]+\\ .txt" )
328+
329+ private def getTitle (fileName : String , repoName : String ): String = if (isGistFile(fileName)) repoName else fileName
330+
321331}
0 commit comments