Browse files

organization rendezés is javítva

  • Loading branch information...
1 parent fc351db commit 62512e6605894aaa777bfd7625efd733cbd39e01 @rubymood rubymood committed Jan 12, 2012
View
2 app/controllers/organizations_controller.rb
@@ -163,7 +163,7 @@ def show
index_action :list do
- @organizations = Organization.order_by(params[:sort].try.to_sym || :name).paginate(:per_page=>20, :page=>params[:page], :include=>:information_source)
+ @organizations = Organization.apply_scopes(:order_by => parse_sort_param(:name, :updated_at)).paginate(:per_page=>20, :page=>params[:page], :include=>:information_source)
end
show_action :merge do
View
1 app/helpers/application_helper.rb
@@ -10,6 +10,7 @@ def commify(v)
end
def get_sort_param attr, default_order
+ # default_order: az az alapállapot ami első rákattintásnál történik
if default_order == 'desc'
"#{@sort_field != attr || @sort_field == attr && @sort_direction == 'desc' ? '' : '-'}#{attr}"
else
View
6 app/views/interorg_relations/index.dryml
@@ -25,11 +25,11 @@
<div id="litigations_content">
<table-plus-trans without-table-footer>
<order-list:>
- <a href="/transactions/list?sort=value" class="left #{!params[:sort] || params[:sort]=='value' ? 'active' : ''}">Érték szerint</a>
+ <a href="/transactions/list?sort=value" class="left active">Érték szerint</a>
<div class="separator left">|</div>
- <a href="/transactions/list?sort=name" class="left #{params[:sort] && params[:sort]=='-name' ? 'active' : ''}">ABC szerint</a>
+ <a href="/transactions/list?sort=name" class="left">ABC szerint</a>
<div class="separator left">|</div>
- <a href="/transactions/list?sort=-updated_at" class="left #{params[:sort] && params[:sort]=='-updated_at' ? 'active' : ''}">Beviteli sorrendben</a>
+ <a href="/transactions/list?sort=-updated_at" class="left">Beviteli sorrendben</a>
</order-list:>
<page-nav: previous-label="&laquo;" next-label="&raquo;" params="&{ :action=> 'list', :sort=>params[:sort]}"/>
</table-plus-trans>
View
4 app/views/organizations/index.dryml
@@ -25,9 +25,9 @@
<div id="organizations_content">
<table-plus-org fields="this, address, interorg_relations_count, person_to_org_relations_count, information_source" with="&@organizations" without-table-footer>
<order-list:>
- <a href="/organizations/list?sort=-name" class="left #{!params[:sort] || params[:sort]=='-name' ? 'active' : ''}">ABC szerint</a>
+ <a href="/organizations/list?sort=-name" class="left active">ABC szerint</a>
<div class="separator left">|</div>
- <a href="/organizations/list?sort=-updated_at" class="left #{params[:sort] && params[:sort]=='-updated_at' ? 'active' : ''}">Beviteli sorrendben</a>
+ <a href="/organizations/list?sort=-updated_at" class="left">Beviteli sorrendben</a>
</order-list:>
<page-nav: previous-label="&laquo;" next-label="&raquo;" params="&{ :action=> 'list', :sort=>params[:sort]}"/>
</table-plus-org>
View
4 app/views/organizations/list.dryml
@@ -1,8 +1,8 @@
<table-plus-org with="&@organizations" without-table-footer>
<order-list:>
- <a href="/organizations/list?sort=-name" class="left #{!params[:sort] || params[:sort]=='-name' ? 'active' : ''}">ABC szerint</a>
+ <a href="/organizations/list?sort=#{get_sort_param('name', 'desc')}" class="left #{!params[:sort] || @sort_field == 'name' ? 'active' : ''}">ABC szerint</a>
<div class="separator left">|</div>
- <a href="/organizations/list?sort=-updated_at" class="left #{params[:sort] && params[:sort]=='-updated_at' ? 'active' : ''}">Beviteli sorrendben</a>
+ <a href="/organizations/list?sort=#{get_sort_param('updated_at', 'asc')}" class="left #{@sort_field == 'updated_at' ? 'active' : ''}">Beviteli sorrendben</a>
</order-list:>
<page-nav: previous-label="&laquo;" next-label="&raquo;" params="&{ :action=> 'list', :sort=>params[:sort]}"/>
</table-plus-org>

0 comments on commit 62512e6

Please sign in to comment.