Need Help With Datebock plugin

Hi dlo, I was able to successfully install it. BTW, I was using Ruby 1.8.6, Rails 1.2.3, Engines 1.2, and Rake 0.7.2. It took me about 20 minutes to get a test application up and operational using the most current version of Datetime Toolbocks.

-Conrad

Hey Conrad,

You could have used

http://svn.toolbocks.com/demos/datetime_toolbocks/

Instantly up and running app :slight_smile:

Dlo, that might work for you as well. As a working reference anyways. That's whats running on http://datetime.toolbocks.com

Nathaniel.

Hi Nathaniel, I was looking for option(s) to create an inline calendar using the datetime toolbooks?

-Conrad

Hey Conrad,

As I said, I haven't done this before, so there is no "simple" way to do it yet with the library, but the library will provide full access to integrate it. The calendar_options param passes through all the options to the Calendar.setup initialization.

http://www.dynarch.com/demos/jscalendar/simple-2.html

So.. something like this would work....

...... ok so axe all that.

I just spent the morning hacking away at it :slight_smile: And voila... v3.0.3

You can now do this..

<div style="float: right;" id="calendar-container"></div> <%= toolbocks_date_select :model, :column, {}, { :flat => 'calendar-container' } %>

or to have Datetime Toolbocks do everything for you and make it even simpler, try this..

<%= toolbocks_date_select(:model, :column, {}, { :flat => true }) %>

or to do something like the example in the dynarch.com website above..

  <!-- Use a callback for the flat calendar//-->   <script type="text/javascript">   function dateChanged(calendar) {     // Beware that this function is called even if the end-user only     // changed the month/year. In order to determine if a date was     // clicked you can use the dateClicked property of the calendar:     if (calendar.dateClicked) {       // OK, a date was clicked, redirect to /yyyy/mm/dd/index.php       var y = calendar.date.getFullYear();       var m = calendar.date.getMonth(); // integer, 0..11       var d = calendar.date.getDate(); // integer, 1..31

      var url = "/search/" + y + "/" + m + "/" + d;

      // redirect...       // window.location = url;

      // announce a possible URL to go to       alert(url);     }   };   </script>   <%= toolbocks_date_select(:model, :column, {}, { :flat => true, :flatCallback => 'javascript:dateChanged' }) %>

You can also checkout all the demos I use to test with here..

http://svn.toolbocks.com/plugins/datetime_toolbocks/app/views/datetime_toolbocks/_demos.rhtml

Enjoy!

Nathaniel.

Hey Nathaniel, this is some very good work. Now, is it possible to to disable the input field because on an new/edit view screen I would like them to simply use the calendar to set/change the date?

Thanks,

-Conrad

The whole point of the plugin is to extend the date input so you can have phrases in the input field. If you want just a calendar, simply use the Calendar.setup method and pass it whatever options you want (flat, flatCallback, inputField).

To disable the input is like cuting off the hands and legs of the plugin, and I don't recommend doing such :stuck_out_tongue:

Nathaniel.

The whole point of the plugin is to extend the date input so you can have phrases in the input field. If you want just a calendar, simply use the Calendar.setup method and pass it whatever options you want (flat, flatCallback, inputField).

To disable the input is like cuting off the hands and legs of the plugin, and I don't recommend doing such :stuck_out_tongue:

Nathaniel.

hello, i'm having some strange problem with this new plugin - i just can't get it to work with rails 1.2.3 & engine 1.2 =( "undefined method `toolbocks_date_select' for #<#<Class:0x395ac48>: 0x395ac0c>"

although the plugin seems to be loaded correctly: loading plugin from script/../config/../vendor/plugins/ datetime_toolbocks with engine additions Plugin 'datetime_toolbocks': starting load. Attempting to copy plugin plugin asset files from 'script/../config/../ vendor/plugins/datetime_toolbocks/assets' to 'script/../config/../ public/plugin_assets' Plugin 'datetime_toolbocks': loaded.

thanks in advance,

dominik

Did you happen to modify the environment.rb file to add the config.plugins ?

There is a demo app which you can try out just to make sure whatever environment you are in will work properly.

http://svn.toolbocks.com/demos/datetime_toolbocks/

Nathaniel.

yes, i've added config.plugins in the initializer block as mentioned in the readme file.

Rails::Initializer.run do |config|   config.plugins = ["engines", "*"] end

your demo app is working correctly. any idea why it isn't working in my app?

plugin seems to be loaded, since i can open localhost/ datetime_toolbocks, but it can't find the helper method. strange =(

NoMethodError in Datetime_toolbocks#index

Showing vendor/plugins/datetime_toolbocks/app/views/datetime_toolbocks/ index.rhtml where line #11 raised:

undefined method `toolbocks_date_select' for #<#<Class:0x3cfdc44>: 0x3cfdc1c>

just found the problem. forgot to remove the "include DatebocksEngine" in my application helper. now it's running as it's supposed to be - thanks for this great plugin =)