Skip to content

Commit

Permalink
Fix #666: TimeAgo combine JS, add license info to notice.txt, minor f…
Browse files Browse the repository at this point in the history
…ormatting.
  • Loading branch information
melloware committed Mar 21, 2019
1 parent 260f02f commit d56eeb4
Show file tree
Hide file tree
Showing 6 changed files with 75 additions and 68 deletions.
1 change: 1 addition & 0 deletions pom.xml
Expand Up @@ -73,6 +73,7 @@
<include>slideout/**</include>
<include>social/**</include>
<include>speedtest/**</include>
<include>timeago/*.js</include>
<include>timepicker/**</include>
<include>timer/**</include>
<include>tooltip/**</include>
Expand Down
133 changes: 67 additions & 66 deletions src/main/java/org/primefaces/extensions/component/timeago/TimeAgo.java
Expand Up @@ -18,10 +18,12 @@
import java.util.Arrays;
import java.util.List;
import java.util.Locale;

import javax.faces.application.ResourceDependencies;
import javax.faces.application.ResourceDependency;
import javax.faces.component.UIComponentBase;
import javax.faces.context.FacesContext;

import org.primefaces.component.api.Widget;
import org.primefaces.extensions.util.MessageFactory;
import org.primefaces.util.ComponentUtils;
Expand All @@ -34,10 +36,9 @@
* @since 7.0.1
*/
@ResourceDependencies({
@ResourceDependency(library = "primefaces", name = "jquery/jquery.js"),
@ResourceDependency(library = "primefaces", name = "core.js"),
@ResourceDependency(library = "primefaces-extensions", name = "timeago/jquery.timeago.js"),
@ResourceDependency(library = "primefaces-extensions", name = "timeago/timeago-widget.js")
@ResourceDependency(library = "primefaces", name = "jquery/jquery.js"),
@ResourceDependency(library = "primefaces", name = "core.js"),
@ResourceDependency(library = "primefaces-extensions", name = "timeago/timeago.js"),
})
public class TimeAgo extends UIComponentBase implements Widget {

Expand All @@ -48,65 +49,65 @@ public class TimeAgo extends UIComponentBase implements Widget {
public static final String STYLE_CLASS = "ui-timeago ui-widget";

private static final List<String> BUNDLED_LOCALES = Arrays.asList(
"af",
"am",
"ar",
"az",
"be",
"bg",
"bs",
"ca",
"cs",
"cy",
"da",
"de",
"dv",
"el",
"en",
"es",
"et",
"eu",
"fa",
"fi",
"fr",
"gl",
"he",
"hr",
"hu",
"hy",
"id",
"is",
"it",
"ja",
"jv",
"ko",
"ky",
"lt",
"lv",
"mk",
"nl",
"no",
"pl",
"pt-br",
"pt",
"ro",
"rs",
"ru",
"rw",
"si",
"sk",
"sl",
"sq",
"sr",
"sv",
"th",
"tr",
"uk",
"ur",
"uz",
"vi",
"zh-cn",
"zh-tw");
"af",
"am",
"ar",
"az",
"be",
"bg",
"bs",
"ca",
"cs",
"cy",
"da",
"de",
"dv",
"el",
"en",
"es",
"et",
"eu",
"fa",
"fi",
"fr",
"gl",
"he",
"hr",
"hu",
"hy",
"id",
"is",
"it",
"ja",
"jv",
"ko",
"ky",
"lt",
"lv",
"mk",
"nl",
"no",
"pl",
"pt-br",
"pt",
"ro",
"rs",
"ru",
"rw",
"si",
"sk",
"sl",
"sq",
"sr",
"sv",
"th",
"tr",
"uk",
"ur",
"uz",
"vi",
"zh-cn",
"zh-tw");

// @formatter:off
public enum PropertyKeys {
Expand All @@ -123,9 +124,9 @@ public TimeAgo() {
final String i18nAbbr = getBundledLocaleAbbr(MessageFactory.getLocale());
if (i18nAbbr != null) {
ResourceUtils.addComponentResource(FacesContext.getCurrentInstance(),
"timeago/i18n/jquery.timeago." + i18nAbbr + ".js",
"primefaces-extensions",
"body");
"timeago/i18n/jquery.timeago." + i18nAbbr + ".js",
"primefaces-extensions",
"body");
}
}

Expand Down
Expand Up @@ -19,15 +19,19 @@
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.TimeZone;

import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.context.ResponseWriter;

import org.primefaces.renderkit.CoreRenderer;
import org.primefaces.util.WidgetBuilder;

/**
* <code>TimeAgo</code> component renderer.
*
* @author Jasper de Vries &lt;jepsar@gmail.com&gt;
* @since 7.0.1
*/
public class TimeAgoRenderer extends CoreRenderer {

Expand Down Expand Up @@ -87,7 +91,7 @@ protected String format(final Object value) {
}

protected String format(final Date value) {
SimpleDateFormat sdf = new SimpleDateFormat(DATE_FORMAT);
final SimpleDateFormat sdf = new SimpleDateFormat(DATE_FORMAT);
sdf.setTimeZone(TimeZone.getTimeZone("UTC"));
return sdf.format(value);
}
Expand Down
3 changes: 2 additions & 1 deletion src/main/resources/META-INF/NOTICE.txt
Expand Up @@ -21,4 +21,5 @@ This product includes software developed by Marijn Haverbeke (http://codemirror.
This product includes software developed by Artem Tabalin (https://github.com/tabalinas/jssocials)
This product includes software developed by Handsoncode sp. z o.o. (https://github.com/handsontable/handsontable)
This product includes software developed by Xuebin Dong (@dabeng) (https://github.com/dabeng/OrgChart)
This product includes software developed by Jack O'Connor (@jackocnr) (https://github.com/jackocnr/intl-tel-input)
This product includes software developed by Jack O'Connor (@jackocnr) (https://github.com/jackocnr/intl-tel-input)
This product includes software developed by Ryan McGeary (@rmm5t) (https://github.com/rmm5t/jquery-timeago)
File renamed without changes.

0 comments on commit d56eeb4

Please sign in to comment.