Permalink
Browse files

Moved inline javascripts to a js file.

  • Loading branch information...
1 parent 15cf92c commit f9298c9a0c6e6ec11141621c65d235c41b14b060 @edavis10 committed Mar 8, 2010
Showing with 18 additions and 23 deletions.
  1. +0 −23 app/views/timesheet/_form.rhtml
  2. +1 −0 app/views/timesheet/index.rhtml
  3. +17 −0 assets/javascripts/timesheet.js
@@ -62,26 +62,3 @@
<%= button_to(l(:button_reset), {:controller => 'timesheet', :action => 'reset'}, :method => 'delete') %>
</fieldset>
</div>
-
-<% content_for(:header_tags) do %>
-<script type="text/javascript">
-
-function targetField(label_element) {
- return $(label_element.attributes.for.value);
-}
-
-function selectAllOptions(element) {
- for (var i = 0; i < element.options.length; i++) {
- element.options[i].selected = true;
- }
-}
-
-Event.observe(window, 'load',
- function() {
- $$('label.select_all').each(function(element) {
- Event.observe(element, 'click', function (e) { selectAllOptions(targetField(this)); });
- });
- }
-);
-</script>
-<% end %>
@@ -4,4 +4,5 @@
<% content_for(:header_tags) do %>
<%= stylesheet_link_tag "timesheet.css", :plugin => "timesheet_plugin", :media => 'all' %>
+<%= javascript_include_tag 'timesheet.js', :plugin => 'timesheet_plugin' %>
<% end %>
@@ -0,0 +1,17 @@
+function targetField(label_element) {
+ return $(label_element.attributes.for.value);
+}
+
+function selectAllOptions(element) {
+ for (var i = 0; i < element.options.length; i++) {
+ element.options[i].selected = true;
+ }
+}
+
+Event.observe(window, 'load',
+ function() {
+ $$('label.select_all').each(function(element) {
+ Event.observe(element, 'click', function (e) { selectAllOptions(targetField(this)); });
+ });
+ }
+);

0 comments on commit f9298c9

Please sign in to comment.