(refs #1491)Note helper.assets as deprecated.

Use assets(path: String)(implicit context: Context) instead. It adds the hash value which is generated from bootstrap timestamp to the resource url automatically.
This commit is contained in:
Naoki Takezoe
2017-03-14 10:07:16 +09:00
parent 43aff74ad2
commit 2cb29654e9
2 changed files with 8 additions and 7 deletions

View File

@@ -75,18 +75,18 @@ object helpers extends AvatarImageProvider with LinkConverter with RequestCache
def date(date: Date): String = new SimpleDateFormat("yyyy-MM-dd").format(date) def date(date: Date): String = new SimpleDateFormat("yyyy-MM-dd").format(date)
/** /**
* Format java.util.Date to "yyyyMMDDHHmmss" (for url hash ex. /some/path.css?19800101010203 * Format java.util.Date to "yyyyMMDDHHmmss" (for url hash ex. /some/path.css?19800101010203
*/ */
def hashDate(date: Date): String = new SimpleDateFormat("yyyyMMddHHmmss").format(date) def hashDate(date: Date): String = new SimpleDateFormat("yyyyMMddHHmmss").format(date)
/** /**
* java.util.Date of boot timestamp. * java.util.Date of boot timestamp.
*/ */
val bootDate: Date = new Date() val bootDate: Date = new Date()
/** /**
* hashDate of bootDate for /assets, /plugin-assets * hashDate of bootDate for /assets, /plugin-assets
*/ */
def hashQuery: String = hashDate(bootDate) def hashQuery: String = hashDate(bootDate)
/** /**
@@ -224,6 +224,7 @@ object helpers extends AvatarImageProvider with LinkConverter with RequestCache
/** /**
* Returns the url to the root of assets. * Returns the url to the root of assets.
*/ */
@deprecated("Use assets(path: String)(implicit context: Context) instead.", "4.11.0")
def assets(implicit context: Context): String = s"${context.path}/assets" def assets(implicit context: Context): String = s"${context.path}/assets"
/** /**

View File

@@ -4,7 +4,7 @@
@import gitbucket.core.view.helpers @import gitbucket.core.view.helpers
@gitbucket.core.account.html.main(account, groupNames, "activity"){ @gitbucket.core.account.html.main(account, groupNames, "activity"){
<div class="pull-right"> <div class="pull-right">
<a href="@context.path/@{account.userName}.atom"><img src="@{helpers.assets}/common/images/feed.png" alt="activities"></a> <a href="@context.path/@{account.userName}.atom"><img src="@helpers.assets("/common/images/feed.png")" alt="activities"></a>
</div> </div>
@gitbucket.core.helper.html.activities(activities) @gitbucket.core.helper.html.activities(activities)
} }