datetimepicker

This commit is contained in:
2014-06-21 14:52:45 +05:30
parent 2df0d89b61
commit 6fdee8a7d6
4 changed files with 36 additions and 1 deletions

View File

@@ -26,6 +26,8 @@
//= require bootstrap/image-gallery.min //= require bootstrap/image-gallery.min
//= require jquery-fileupload //= require jquery-fileupload
// require jquery.remotipart // require jquery.remotipart
//= require jquery.datetimepicker
function insertAttachment(url,name) { function insertAttachment(url,name) {
var ext = url.split('.').pop().toLowerCase(); var ext = url.split('.').pop().toLowerCase();
var img_ext = [ "jpg", "png", "bmp" , "jpeg" ]; var img_ext = [ "jpg", "png", "bmp" , "jpeg" ];

View File

@@ -0,0 +1,30 @@
class DatetimepickerInput < FormtasticBootstrap::Inputs::StringInput
def input_html_options
super
super.merge(:class => "datetimepicker",:value=>builder.to_s)
end
def html_options
super
end
def wrapper_html_options
super.merge(:class=>"")
#super.merge(:class=>"datepicker",'date-date-format'.to_sym=>"%d.%m.%Y")
end
def controls_wrapper_html_options
super.merge(:class=> " date input-append", 'data-date'.to_sym =>I18n.l(Date.today()).to_s, 'data-date-format'.to_sym=>I18n.t('date.formats.default-picker'), 'data-time-format'.to_sym=>"hh:mm" ,)
end
def to_html
bootstrap_wrapping do
builder.text_field(method, input_html_options) +
'<span class="add-on" ><i class="icon-th"></i></span>'.html_safe()
end
end
def options
super
#d.merge(:class=>"datepicker")
#super.merge(:append_content=>'<span class="add-on input-append"
#super.merge(:append_content=>'<span class="add-on" ><i class="icon-th"></i></span>')
end
end

View File

@@ -35,6 +35,9 @@ class Calentry < ActiveRecord::Base
self.public = (self.try(:object).nil?)? (self.calendar.try(:public?)) : object.try(:public?) self.public = (self.try(:object).nil?)? (self.calendar.try(:public?)) : object.try(:public?)
true true
end end
def s_time=(s_time)
start
end
def start_time def start_time
start start
end end

View File

@@ -4,7 +4,7 @@
</div> </div>
<div class="span4"> <div class="span4">
<%= f.input :start, :as => :datepicker %></div><div class="span4"> <%= f.input :start, :as => :datetimepicker %></div><div class="span4">
<%= f.input :dauer , :as => :string, :append=>"h" %></div><div class="span1"> <%= f.input :dauer , :as => :string, :append=>"h" %></div><div class="span1">
<% f.input :typ %></div> <div class="span1"><%= f.check_box :_destroy %> <%= I18n.t 'common.delete' %></div> <% f.input :typ %></div> <div class="span1"><%= f.check_box :_destroy %> <%= I18n.t 'common.delete' %></div>
</div> </div>