Skip to content

Commit

Permalink
TheCoder4eu#1155 - add type by js script tags
Browse files Browse the repository at this point in the history
  • Loading branch information
geopossachs committed Oct 17, 2021
1 parent 4678f40 commit 2bc4e3a
Show file tree
Hide file tree
Showing 5 changed files with 198 additions and 194 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,7 @@ public void encodeBegin(FacesContext fc) throws IOException {
private void encodeDefaultLanguageJS(FacesContext fc) throws IOException {
ResponseWriter rw = fc.getResponseWriter();
rw.startElement("script", null);
rw.writeAttribute("type", "text/javascript", null);
rw.write("$.datepicker.setDefaults($.datepicker.regional['" + fc.getViewRoot().getLocale().getLanguage()
+ "']);");
rw.endElement("script");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@
/**
* @author jottyfan
*/
/** This class generates the HTML code of <b:fullcalendar />. */
/**
* This class generates the HTML code of <b:fullcalendar />.
*/
@FacesRenderer(componentFamily = "net.bootsfaces.component", rendererType = "net.bootsfaces.component.fullCalendar.FullCalendar")
public class FullCalendarRenderer extends Renderer {

Expand Down Expand Up @@ -50,7 +52,7 @@ public void encodeEnd(FacesContext context, UIComponent component) throws IOExce

// activate the jquery plugin on that div
rw.startElement("script", null);

rw.writeAttribute("type", "text/javascript", null);
rw.writeText("$(document).ready(function() {", null);
rw.writeText(" $(\"[id='" + clientId + "']\").fullCalendar({", null);
rw.writeText(" lang: '" + lang + "',", null);
Expand All @@ -59,7 +61,7 @@ public void encodeEnd(FacesContext context, UIComponent component) throws IOExce
}
rw.writeText(" allDaySlot: " + fullCalendar.isAllDaySlot() + ",", null);
if (fullCalendar.getSlotDuration() != null) {
rw.writeText(" slotDuration: '" + fullCalendar.getSlotDuration() + "',", null);
rw.writeText(" slotDuration: '" + fullCalendar.getSlotDuration() + "',", null);
}
if (fullCalendar.getDefaultView() != null) {
rw.writeText(" defaultView: '" + fullCalendar.getDefaultView() + "',", null);
Expand Down
Loading

0 comments on commit 2bc4e3a

Please sign in to comment.