From e86a54ac3935e64343d52a76074a139a0bc3c643 Mon Sep 17 00:00:00 2001 From: Matt Moriarity Date: Sat, 28 Jul 2007 14:04:32 -0400 Subject: [PATCH] Factored sidebar draggables into application.js --- app/views/layouts/application.haml | 11 +++++------ public/javascripts/application.js | 16 ++++++++++++++++ 2 files changed, 21 insertions(+), 6 deletions(-) diff --git a/app/views/layouts/application.haml b/app/views/layouts/application.haml index 291c86e..e6b4942 100644 --- a/app/views/layouts/application.haml +++ b/app/views/layouts/application.haml @@ -2,7 +2,10 @@ %html %head %title Lyrix - = javascript_include_tag :defaults + = javascript_include_tag *%w(prototype effects dragdrop controls) + - %w(lowpro remote).each do |js| + = javascript_include_tag "lowpro/#{js}" + = javascript_include_tag 'application' = stylesheet_link_tag 'application' %body #sidebar @@ -12,7 +15,7 @@ %li{:class => class_for_song(s), :id => dom_id(s)} = image_tag('cd.png', :align => 'top', :border => 0, :class => 'drag_me') = link_to s.title, edit_song_path(s) - = draggable_element(dom_id(s), :revert => true, :handle => "'drag_me'") + /= draggable_element(dom_id(s), :revert => true, :handle => "'drag_me'") %li#new_song = image_tag('cd_add.png', :align => 'top') = link_to 'Add a new song...', new_song_path @@ -25,10 +28,6 @@ %li#new_show = image_tag('film_add.png', :align => 'top') = link_to 'Add a new show...', new_show_path - / #navbar - / lyrix :: - / = link_to image_tag('cd.png', :border => 0) + ' songs', songs_path, :class => 'no_underline' - / = link_to image_tag('film.png', :border => 0) + ' shows', shows_path, :class => 'no_underline' #content %p#success_box{:style => 'display:none'} = image_tag('information.png') diff --git a/public/javascripts/application.js b/public/javascripts/application.js index fe45776..b31ff58 100644 --- a/public/javascripts/application.js +++ b/public/javascripts/application.js @@ -1,2 +1,18 @@ // Place your application-specific JavaScript functions and classes here // This file is automatically included by javascript_include_tag :defaults + +Lyrix = {}; // Our own little namespace. + +// Just a behaviors extraction of Script.aculo.us Draggable +Lyrix.Draggable = Behavior.create({ + initialize: function(options) { + this.draggable = new Draggable(this.element, options); + } +}); + +Event.addBehavior({ + '.song': Lyrix.Draggable({handle: 'drag_me', revert: true}), + '#songs_list': function() { + + } +}); \ No newline at end of file -- 2.11.4.GIT