Sha256: 58bbbc7e0cca37a622dd03f172d2bd4022a1a0af471118725a1b1502ca840d3d
Contents?: true
Size: 1.95 KB
Versions: 17
Compression:
Stored size: 1.95 KB
Contents
<!-- This is the [Bootstrap Datepicker](https://github.com/Nerian/bootstrap-datepicker-rails). You can config some options. For example, to change the date format, language and weekstart you can add this to your front_site.dryml: <def tag="input" for="Date"> <bootstrap-datepicker dateFormat="dd-mm-yyyy" language="es" weekstart="1" merge /> </def> If you do not specify the format, it will attempt to convert I18n.t(:"date.formats.default") from strftime format into the format that the Bootstrap Datepicker likes. Take into account that it's not exactly the same as jquery_ui: year "2000" is represented by "yyyy" instead of "yy". Another alternative to do the same is "extend. It's useful when you want to use "bootstrap-datepicker" directly in a form: <extend tag="bootstrap-datepicker"> <old-bootstrap-datepicker dateFormat="dd-mm-yyyy" language="es" weekstart="1" merge/> </extend> --> <def tag="bootstrap-datepicker" attrs="name, value"> <% options, attrs = attributes.partition_hash(['format', 'weekstart', 'language', 'autoclose']) options["autoclose"] ||= "true" options["format"] ||= begin d=I18n.t(:"date.formats.default") {"%Y" => "yyyy", "%y" => "yy", "%m" => "mm", "%_m" => "m", "%-m" => "m", "%B" => "MM", "%^B" => "MM", "%b" => "M", "%^b" => "M", "%h" => "M", "%d" => "dd", "%-d" => "d", "%j" => "oo", "%D" => "mm/dd/yy", "%F" => "yy-mm-dd", "%x" => "mm/dd/yy"}.each {|rb, js| d.gsub!(rb,js)} d end if this && value.nil? && this.class == Date value = I18n.l(this) end %> <input name="#{name}" value="&value" type="text" class="bootstrap-datepicker" data-date-format="#{options['format']}" data-date-weekstart="#{options['weekstart']}" data-date-autoclose="#{options['autoclose']}" data-date-language="#{options['language']}" merge-attrs /> </def>
Version data entries
17 entries across 17 versions & 1 rubygems