-
Notifications
You must be signed in to change notification settings - Fork 24
gist website embed link #42
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
You can paste GitBucket Gist Code in your website.
| private def _gist(userName: String, repoName: Option[String] = None, revision: String = "master", isEmbed: Boolean = false): Any = { | ||
|
|
||
| if( repoName.isDefined && repoName.get.endsWith(".js")) { | ||
| return _gist(userName, Some(repoName.get.substring(0,repoName.get.length()-3)), revision, true) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't use return statement in Scala as much as possible because it's translated to throwing and catching an exception by the compiler.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I found better solution.
I changed function structure. Please review new one
| files: Seq[(String, String)] | ||
| )(implicit context: gitbucket.core.controller.Context) | ||
| @import gitbucket.core.view.helpers | ||
| @import play.twirl.api.Html |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems that play.twirl.api.Html isn't used in this template. So maybe this import statement is unnecessary.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I removed unnecessary import statement.
| @prettifyCSS={<link href="@helpers.assets("/vendors/google-code-prettify/prettify.css")" rel="stylesheet">} | ||
| @gistCSS={<link href="@context.path/plugin-assets/gist/style.css" rel="stylesheet">} | ||
| @gitbucketCSS={<link href="@helpers.assets("/common/css/gitbucket.css")" rel="stylesheet">} | ||
| @adminLTECSS={<link href="@helpers.assets("/vendors/AdminLTE-2.3.8/css/AdminLTE.min.css")" rel="stylesheet">} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do you define these variables even through you are using them only once?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I modified that code to use strings directly in "document.write()".
|
|
||
|
|
||
| private def _gist(userName: String, repoName: Option[String] = None, revision: String = "master"): Any = { | ||
| private def _gist(userName: String, repoName: Option[String] = None, revision: String = "master", isEmbed: Boolean = false): Any = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Who pass true to isEmbed parameter?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I found better solution.
I changed function structure. Please review new one
|
I modified codes in response to the review. |
|
@tkgdsg Looks good. Great thanks for this pull request! |
You can paste GitBucket Gist Code in your website.
please review this patch.