Refactored home/ordergroup.

This commit is contained in:
benni 2011-05-16 11:00:52 +02:00
parent 1cf63fc40b
commit 2ee30fee16
4 changed files with 25 additions and 31 deletions

View file

@ -62,11 +62,10 @@ class HomeController < ApplicationController
:order => sort)
respond_to do |format|
format.html # myOrdergroup.haml
format.js { render :partial => "finance/transactions/list" }
format.js { render :layout => false }
end
else
flash[:error] = "Leider bist Du kein Mitglied einer Bestellgruppe"
redirect_to root_path
redirect_to root_path, :alert => "Leider bist Du kein Mitglied einer Bestellgruppe"
end
end

View file

@ -59,7 +59,7 @@ module ApplicationHelper
def sort_td_class_helper(param)
result = 'class="sortup"' if params[:sort] == param
result = 'class="sortdown"' if params[:sort] == param + "_reverse"
return result
result
end
def sort_link_helper(text, key, options = {})
@ -67,23 +67,14 @@ module ApplicationHelper
action = options[:action] || "list"
remote = options[:remote].nil? ? true : options[:remote]
key += "_reverse" if params[:sort] == key
url = url_for(:sort => key, :page => nil, :per_page => per_page)
link_options = {
:url => url_for(:params => params.merge({:sort => key, :page => nil, :per_page => per_page})),
:before => "Element.show('loader')",
:success => "Element.hide('loader')",
:method => :get
}
html_options = {
:title => _("Nach #{text} sortieren"),
:href => url_for(:action => action, :params => params.merge({:sort => key, :page => nil, :per_page => per_page}))
:title => "Nach #{text} sortieren",
:remote => remote
}
if remote
link_to_remote(text, link_options, html_options)
else
link_to(text, link_options[:url], html_options)
end
link_to(text, url, html_options)
end
# Generates a link to the top of the website

View file

@ -14,7 +14,7 @@
<li><%= membership.user.nick -%></li>
<% end -%>
</ul>
<%= remote_link_to('Person einladen', :url => new_invite_path(:id => @ordergroup)) %>
<%= link_to('Person einladen', new_invite_path(:id => @ordergroup), :remote => true) %>
</div>
</div>
@ -23,18 +23,11 @@
<h2>Kontoauszug</h2>
</div>
<div class="column_content">
<p>
<form name="sform" action="" style="display:inline;">
<label for="financial_transaction_note">Filter für Notizen: </label>
<%= form_tag my_ordergroup_url, :method => :get, :style => 'display:inline;', :id => 'transactions_search',
:remote => true do %>
<%= label_tag "financial_transaction_note", "Filter für Notizen:" %>
<%= text_field_tag("query", params['query'], :size => 10 ) %>
</form>
</p>
<%= observe_field 'query', :frequency => 2,
:before => "Element.show('loader')",
:success => "Element.hide('loader')",
:url => {:action => 'ordergroup'},
:with => 'query',
:update => 'transactions' %>
<% end %>
<div id="transactions">
<%= render :partial => "/finance/transactions/list" %>
</div>
@ -42,3 +35,13 @@
</div>
<div id="edit_box" style="display:none"></div>
<% content_for :head do %>
<script type="text/javascript">
$(function() {
$('#query').observe_field(1, function() {
$('#transactions_search').submit();
});
})
</script>
<% end %>

View file

@ -0,0 +1 @@
$('#transactions').html('<%= escape_javascript(render("finance/transactions/list")) %>');