Cleaning up Prototype remnants and refactoring

Moved some stuff, like Nifty Corners, into application.js to speed things up.
This commit is contained in:
Eric Allen 2009-10-16 23:52:52 -04:00
parent 01e4cdb178
commit 67e88acacc
8 changed files with 40 additions and 63 deletions

View file

@ -42,8 +42,3 @@
sortable_element 'list-contexts-active', get_listing_sortable_options
sortable_element 'list-contexts-hidden', get_listing_sortable_options
-%>
<script type="text/javascript">
window.onload=function(){
Nifty("div#context_new_container","normal");
}
</script>

View file

@ -34,9 +34,3 @@
</table>
</div><!-- End of feeds -->
</div>
<script type="text/javascript">
window.onload=function(){
Nifty("div#feedlegend","normal");
}
</script>

View file

@ -15,9 +15,3 @@
</p>
</div><!-- End of feeds -->
</div><!-- End of display_box -->
<script type="text/javascript">
window.onload=function(){
Nifty("div#feedlegend","normal");
}
</script>

View file

@ -125,11 +125,3 @@
<div id="input_box">
<%= render :file => "sidebar/sidebar.html.erb" %>
</div><!-- End of input box -->
<script type="text/javascript">
window.onload=function(){
Nifty("div#feedicons-project","normal");
Nifty("div#feedicons-context","normal");
Nifty("div#feedlegend","normal");
}
</script>

View file

@ -105,35 +105,5 @@
</div>
<%= render :partial => "shared/footer" %>
<script type="text/javascript">
jQuery(document).ready(function() { /* main menu */
jQuery('ul.sf-menu').superfish({
delay: 250,
animation: {opacity:'show',height:'show'},
autoArrows: false,
dropShadows: false,
speed: 'fast'
});
jQuery('ul.sf-item-menu').superfish({ /* context menu */
delay: 100,
animation: {opacity:'show',height:'show'},
autoArrows: false,
dropShadows: false,
speed: 'fast',
onBeforeShow: function() { /* highlight todo */
$(this.parent().parent().parent()).addClass("sf-item-selected");
},
onHide: function() { /* remove hightlight from todo */
$(this.parent().parent().parent()).removeClass("sf-item-selected");
}
});
/* for toggle notes link in mininav */
jQuery("#toggle-notes-nav").click(function () { jQuery(".todo_notes").toggle(); });
/* show the notes of a todo */
TodoBehavior.enableToggleNotes();
Nifty("div#todo_new_action_container","normal");
});
</script>
</body>
</html>

View file

@ -12,13 +12,13 @@
:id => "delete_note_"+note.id.to_s),
{:update => dom_id(note),
:loading => visual_effect(:fade, dom_id(note, 'container')),
:complete => "Element.remove('#{dom_id(note, 'container')}');",
:complete => "$('#{dom_id(note, 'container')}').remove();",
:url => note_path(note),
:method => :delete,
:confirm => "Are you sure that you want to delete the note \'#{note.id.to_s}\'?" },
{ :class => 'delete_note' }) -%>&nbsp;
<%= link_to_function(image_tag( "blank.png", :title => "Edit item", :class=>"edit_item"),
"Element.toggle('#{dom_id(note)}'); Element.toggle('#{dom_id(note, 'edit')}'); Effect.Appear('#{dom_id(note, 'edit')}'); Form.focusFirstElement('#{dom_id(note, 'edit_form')}');" ) + " | " %>
"$('##{dom_id(note)}').toggle(); $('##{dom_id(note, 'edit')}').show(); $('##{dom_id(note, 'edit_form')} textarea').focus();" ) + " | " %>
<%= link_to("In: " + note.project.name, project_path(note.project), :class=>"footer_link" ) %>&nbsp;|&nbsp;
Created: <%= format_date(note.created_at) %>
<% if note.updated_at? -%>
@ -37,4 +37,4 @@
<% end -%>
</div>
</div>
<% note = nil -%>
<% note = nil -%>

View file

@ -4,6 +4,3 @@
<%= submit_tag "Search" %>
<% end %>
</div>
<script type="text/javascript">
Form.focusFirstElement('search-form')
</script>

View file

@ -88,8 +88,8 @@ var TracksForm = {
var TodoBehavior = {
enableToggleNotes: function() {
jQuery(".show_notes").unbind('click').bind('click', function () {
jQuery(this).next().toggle("fast"); return false;
$(".show_notes").unbind('click').bind('click', function () {
$(this).next().toggle("fast"); return false;
});
}
}
@ -281,8 +281,43 @@ function enable_rich_interaction(){
}
$(document).ready(function() {
$('#search-form #search').focus();
/* Nifty corners */
Nifty("div#recurring_new_container","normal");
Nifty("div#context_new_container","normal");
Nifty("div#feedlegend","normal");
Nifty("div#feedicons-project","normal");
Nifty("div#feedicons-context","normal");
Nifty("div#todo_new_action_container","normal");
/* Moved from standard.html.erb layout */
$('ul.sf-menu').superfish({
delay: 250,
animation: {opacity:'show',height:'show'},
autoArrows: false,
dropShadows: false,
speed: 'fast'
});
$('ul.sf-item-menu').superfish({ /* context menu */
delay: 100,
animation: {opacity:'show',height:'show'},
autoArrows: false,
dropShadows: false,
speed: 'fast',
onBeforeShow: function() { /* highlight todo */
$(this.parent().parent().parent()).addClass("sf-item-selected");
},
onHide: function() { /* remove hightlight from todo */
$(this.parent().parent().parent()).removeClass("sf-item-selected");
}
});
/* for toggle notes link in mininav */
$("#toggle-notes-nav").click(function () { jQuery(".todo_notes").toggle(); });
/* show the notes of a todo */
TodoBehavior.enableToggleNotes();
/* fade flashes and alerts in automatically */
$(".alert").fadeOut(8000);