Forum: Ruby on Rails cannot get datebocks to work

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Kim (Guest)
on 2007-02-24 17:10
Hi,
Does anybody in here having experience with getting datebocks to work.
I have installed engines and datebocks-engines according to the
instructions on http://datebocks.inimit.com/
The error I get is this one:

Showing app/views/layouts/view.rhtml where line #7 raised:

undefined method `engine_javascript' for #<#<Class:0x480b50c>:0x480b4e4>

Extracted source (around line #7):

4: <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
5: <head>
6:   <meta http-equiv="content-type" content="text/html;charset=UTF-8"
/>
7:   <%= engine_javascript "datebocks_engine", "calendar",
"lang/calendar-en", "calendar-setup" %>
8:   <%= engine_stylesheet "datebocks_engine",
"calendar-win2k-cold-1.css" %>
9:   <title>View: <%= controller.action_name %></title>
10:   <%= stylesheet_link_tag 'scaffold' %>

has something chaned in datebocks or engine since the instructions were
written?

Thanks,

Kim.
Nshbrown N. (Guest)
on 2007-02-25 04:31
(Received via mailing list)
Hey Kim,

Darrell and I are working on getting it up to speed with Engines 1.2
and Rails 1.2.x

Stay tunned!

Nathaniel.

On 2/24/07, Kim <removed_email_address@domain.invalid> wrote:
>
> 9:   <title>View: <%= controller.action_name %></title>
> Posted via http://www.ruby-forum.com/.
>
> >
>


--
Nathaniel Steven Henry Brown

Toll Free: 1-877-446-4647
Vancouver: 604-724-6624
Ezra Z. (Guest)
on 2007-02-25 04:54
(Received via mailing list)
Don't know if you saw this but someone converted dateboks to be a
normal plugin with no engines depedency

http://atmos.org/2007/2/1/datebocks-as-a-plugin

Cheers-
-Ezra



On Feb 24, 2007, at 6:30 PM, Nathaniel B. wrote:

> On 2/24/07, Kim <removed_email_address@domain.invalid> wrote:
>> undefined method `engine_javascript' for #<#<Class:0x480b50c>:
>> 7:   <%= engine_javascript "datebocks_engine", "calendar",
>> Thanks,
> --
> Nathaniel Steven Henry Brown
>
> Toll Free: 1-877-446-4647
> Vancouver: 604-724-6624
>
> >

-- Ezra Z.
-- Lead Rails Evangelist
-- removed_email_address@domain.invalid
-- Engine Y., Serious Rails Hosting
-- (866) 518-YARD (9273)
Nshbrown N. (Guest)
on 2007-02-25 05:32
(Received via mailing list)
Thanks Ezra, but I'll stick with my engines :)

On 2/24/07, Ezra Z. <removed_email_address@domain.invalid> wrote:
>
> >
> >>
> >> 6:   <meta http-equiv="content-type" content="text/
> >> were
> >>
> -- Ezra Z.
> -- Lead Rails Evangelist
> -- removed_email_address@domain.invalid
> -- Engine Y., Serious Rails Hosting
> -- (866) 518-YARD (9273)
>
>
>
> >
>


--
Nathaniel Steven Henry Brown

Toll Free: 1-877-446-4647
Vancouver: 604-724-6624
Kim (Guest)
on 2007-02-26 22:16
Thank's for the suggestion - it works fine!

Ezra Z. wrote:
> Don't know if you saw this but someone converted dateboks to be a
> normal plugin with no engines depedency
>
> http://atmos.org/2007/2/1/datebocks-as-a-plugin
davertron (Guest)
on 2007-03-13 22:38
Does someone have a copy of this plugin somewhere?  I want to use this
(I've tried using the engines version and I get the same error as Kim
above...) but the link above seems to be dead.

Ezra Z. wrote:
> Don't know if you saw this but someone converted dateboks to be a
> normal plugin with no engines depedency
>
> http://atmos.org/2007/2/1/datebocks-as-a-plugin
>
> Cheers-
> -Ezra
-446-4647
>> Vancouver: 604-724-6624
>>
>> >
>
> -- Ezra Z.
> -- Lead Rails Evangelist
> -- removed_email_address@domain.invalid
> -- Engine Y., Serious Rails Hosting
> -- (866) 518-YARD (9273)
Long (Guest)
on 2007-04-18 21:35
(Received via mailing list)
Say, is this plugin still available? I get status 500 when accessing the
SVN

http://svn.caboo.se/plugins/atmos/calendar_date_selector

-- Long

----- Original Message -----
From: "Ezra Z." <removed_email_address@domain.invalid>
To: <removed_email_address@domain.invalid>
Sent: Saturday, February 24, 2007 9:54 PM
Subject: [Rails] Re: cannot get datebocks to work
Nshbrown N. (Guest)
on 2007-04-18 21:47
(Received via mailing list)
Hey Long,

The new release I put out has a ton of new features which the plugin
version will not have. Still not pleased that it attempted to get
forked (especially with the tone and intention that was communicated
by the announcement)... but what do ya say :)

Nathaniel.

On 4/18/07, Long <removed_email_address@domain.invalid> wrote:
> Sent: Saturday, February 24, 2007 9:54 PM
> > Cheers-
> > -Ezra
> >
> >
>
>
> >
>


--
Nathaniel Steven Henry Brown

Toll Free: 1-877-446-4647
Vancouver: 604-724-6624
Long (Guest)
on 2007-04-18 23:00
(Received via mailing list)
Hi Nathaniel,

I do think your plugin has a lot to offer and it is a great contribution
to the Rails community. I would consider using it on a per-project
basis.
Though, for now I am looking for a simple calendar picker that I can
easily customize its behavior. Also, I do need to have multiple
calendars
on the same view.

I don't know enough about engines (reading it), but my initial thought
is a) avoid having more dependencies and b) if I can help it, avoid
bulking
up the application.

Falling short of re-inventing the wheel, I am open to other options.

-- Long
Michael (Guest)
on 2007-04-19 01:50
Long wrote:
> Hi Nathaniel,
>
......
easily customize its behavior. Also, I do need to have multiple
calendars
on the same view.
.......

Long,

I use the old version "datebox_engine" and have multiple calendars on
the same view without any problems at all.  You should be able to search
either this forum or the engines forum for the fix that I applied to
make it work (very, very simple).  I thought Nathaniel added that
ability in the "datebocks" version but have not had a need to migrate to
it to find out.

All in all, I found the engine to be very easy to get up and running and
am greatly appreciative to Nathaniel for his work.

Regards,

Michael
Long (Guest)
on 2007-04-19 05:21
(Received via mailing list)
Michael wrote:
> Long,
>
Hi Michael,

I assume you mean this link ...
http://lists.rubyonrails.org/pipermail/rails/2006-...

Perhaps Nathaniel can integrate this with the new plugin. I believe it
is on his to-do list.

An aside question, can you explain the origin of EOL? Is this documented
somewhere, perhaps with Ruby doc?

-- Long
giorgio (Guest)
on 2007-04-19 06:31
(Received via mailing list)
Personally I had so much trouble with DateBocks  that I just
downloaded the Dynarch Javascript calendar and wrote a short helper
method to create a tag for it in views.

It was much quicker than trying to get DateBocks working correctly.

Cheers
George
bbebop (Guest)
on 2007-04-19 07:00
(Received via mailing list)
Giorgio,

Mind sharing the Dynarch helper method?
Michael (Guest)
on 2007-04-19 07:08
Long wrote:
> Michael wrote:
>> Long,
>>
> Hi Michael,
>
> I assume you mean this link ...
> http://lists.rubyonrails.org/pipermail/rails/2006-...
>
> Perhaps Nathaniel can integrate this with the new plugin. I believe it
> is on his to-do list.
>
> An aside question, can you explain the origin of EOL? Is this documented
> somewhere, perhaps with Ruby doc?
>
> -- Long

Long,

I post on ruby-forum.com - but I did look up the link you displayed and
that looks like the right post that I was talking about.  If you search
the engines forum at ruby-forum then I think I made some subsequent
posts as well.

I sent the patch to Nathaniel and I thought he put it in his latest
version...not sure why he wouldn't have because it makes it so much more
useful (IMHO).

To answer your question about EOL - I have no idea.  I'm sure it was
either in the code that I played with or it was in some other code that
I saw somewhere along the lines!  :-)

I am really not a very skilled ruby/rails developer at all.  I managed
to get date_box working really quickly.  In fact, it was quite simple to
go in and change to meet my needs (like the multiple calendars per
page).  Not certain why so many posters here have had problems with it.
Maybe the datebocks is significantly different from date_box that I
used.  Shortly after I made my original posts, I had at least three
people respond that got it up and running with the change as well.

Anyway, best of luck.  I don't monitor the forums very often (nor the
email account that the responses go to) so my apologies if I don't
respond very quickly.

Michael
Nshbrown N. (Guest)
on 2007-04-19 07:59
(Received via mailing list)
What errors did you have? Seeing as it's an open source project
intended to help people, would be great if you were able to share what
broke, even if you didn't fix it. I might be able to fix it on my end
for others at least.

Nathaniel.

On 4/18/07, giorgio <removed_email_address@domain.invalid> wrote:
>
>
> >
>


--
Nathaniel Steven Henry Brown

Toll Free: 1-877-446-4647
Vancouver: 604-724-6624
Nshbrown N. (Guest)
on 2007-04-19 08:11
(Received via mailing list)
Hey Michael,

Many thanks for the encouragement.

The new version, Datetime Toolbocks has significant improvements.
Allowing you to be able to create multiple datetime toolbocks, as well
as having it use the value within the model itself.

The EOL abiqious name that is basically a stream input Start & end
phrase. It can really be whatever you want...

my_new_var = <<-ANYTHING
All the text within here can also have #{variables} and will not
matter whether there are "quotes".
ANYTHING

I didn't need to CIN to a variable, as the last variable/string
created within any method is the return value, which in this case is
used within the value.

Nathaniel.

On 4/18/07, Michael <removed_email_address@domain.invalid> wrote:
> > Perhaps Nathaniel can Hey  this with the new plugin. I believe it
> that looks like the right post that I was talking about.  If you search
>
> respond very quickly.
>
> Michael
>
> --
> Posted via http://www.ruby-forum.com/.
>
> >
>


--
Nathaniel Steven Henry Brown

Toll Free: 1-877-446-4647
Vancouver: 604-724-6624
Long (Guest)
on 2007-04-19 08:45
(Received via mailing list)
I want to thank you both for sharing your insights here.

Nathaniel, I did see that the multiple datetime was a to-do item
on your project home page. Perhaps, it needs to be updated.

I thought the <<-EOL usage in the helper method was interesting.
It certainly makes cranking out html much easier, especially without
having to worry about quotes ... so I learned something new today ;)

Cheers,

-- Long
Nshbrown N. (Guest)
on 2007-04-19 11:18
(Received via mailing list)
Hey Long,

The "Ability to have two calendars side by side for start/end dates"
is specific to a constrained second calendar based on the first cal.

It would be useful for planning a range, or a flight arrival/departure
dates, etc.

Having two fields, even with unique customization for each is entirely
possible. Lots of development went into this specifically.

Nathaniel.

On 4/18/07, Long <removed_email_address@domain.invalid> wrote:
> Cheers,
> > The new version, Datetime Toolbocks has significant improvements.
> >
> > > >> Long,
> > > > somewhere, perhaps with Ruby doc?
> > > I sent the patch to Nathaniel and I thought he put it in his latest
> > > page).  Not certain why so many posters here have had problems with it.
> > > --
> > > Posted via http://www.ruby-forum.com/.
> > >
>
>
> >
>


--
Nathaniel Steven Henry Brown

Toll Free: 1-877-446-4647
Vancouver: 604-724-6624
giorgio (Guest)
on 2007-04-19 12:23
(Received via mailing list)
Hi Nathaniel,

Sorry to be negative about what you have put alot of work into.
My problems were mainly javascript errors I think as I finally got the
calendar to appear after running the rake javascript update task on
your webpage.

I still had the problem that the dates always displayed in the input
field as yyyy-mm-dd and I couldn't figure out how to change it.....
maybe I didn't spend long enough!

Also all the phrase entries seem to be hard coded to American date
formats (ie enter 05/06 and it will assume mm/dd and again I couldn't
see any way to change the defaults...

Finally there seems to be an awfull lot of stuff installed when you
install the plugin!

Cheers
George
giorgio (Guest)
on 2007-04-19 12:25
(Received via mailing list)
bbebop,

Here is what I use as a helper with the dynarch calendar:
It may not be the smartest way (I've only been playing with rails for
a month) but is seems to work :

module CalendarHelper
# The following files are required to be able to use the calendar
popup:
# public/stylesheets/calendar/*.css
# public/javascripts/calendar/*.js
# public/images/calendar/*.gif
#
# In the <head> section of the html (normally in the layout) you will
require the following
# <%= stylesheet_link_tag  'calendar/calendar-win2k-1.css', :media =>
"screen" %>
# <%= javascript_include_tag 'calendar/calendar', 'calendar/calendar-
en', 'calendar/calendar-setup' %>
# Note that this is the basic istallation and other css files etc are
available
# The dateformats are hard coded tp dd mmm yyyy etc so helper will
need altering if
# a different format is required
#
# from the template the call looks like:
# Default version
# <%= calendar_tag :client, :date_of_birth  %>
# Example of html options (disabled)
# <%= calendar_tag :client, :date_of_birth , {:disabled=> "true"} %>
# Example with time as well
# <%= calendar_tag :meeting, :date_and_time , {},{:show_time=>"true"}
%>

  def calendar_tag(object_name, method, options =
{},calendar_options={})
    input_field_id= "#{object_name}_#{method}"
    input_field_name="#{object_name}[#{method}]"
    object = instance_eval("@#{object_name}")
    date = object.send(method)
    if !date.blank?
      if calendar_options[:show_time]
        value= date.strftime("%d %b %Y %I:%M %p")
      else
        value= date.strftime("%d %b %Y")
      end
    end

    image_id=input_field_id + "_btn"

    options[:type]="text"
    options[:name]=input_field_name
    options[:id]=input_field_id
    options[:value]=value
    if calendar_options[:show_time]
      options[:size]=20
    else
      options[:size]=16
    end
    input_tag=tag("input",options)

    img_options=Hash.new
    img_options[:src]="/images/calendar/img.gif"
    img_options[:id]=image_id
    img_options[:style]="cursor: pointer; border: 1px solid red;"
    img_options[:title]="Date selector"
    img_options[:onmouseover]="this.style.background='red';"
    img_options[:onmouseout]="this.style.background=''"
    img_options[:disabled]="true" if !options[:disabled].blank?

    image_tag=tag("img",img_options)


    js_tag =      '<script type="text/javascript">'
    js_tag +=     'Calendar.setup('
    js_tag +=       '{'
    js_tag +=       'inputField :' + %Q("#{input_field_id}")
    if calendar_options[:show_time]
      js_tag +=       ',ifFormat : "%d %b %Y %I:%M %p"' #  dd mmm yyyy
hh:mm pm
      js_tag +=       ',showsTime : true'
      js_tag +=       ',timeFormat : 12'
    else
      js_tag +=       ',ifFormat : "%d %b %Y"' #  dd mmm yyyy
    end
    js_tag +=       ',weekNumbers : false'
    js_tag +=       ',button : ' + %Q("#{image_id}")
    js_tag +=       '}'
    js_tag +=     ');'
    js_tag +=     '</script>'

    input_tag  + image_tag + js_tag
  end
end
This topic is locked and can not be replied to.