Skip to content
This repository has been archived by the owner on May 18, 2021. It is now read-only.

Commit

Permalink
add ajax sorting to lectures 2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
haukot committed Mar 6, 2014
1 parent ecc22f9 commit dff3a87
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 8 deletions.
5 changes: 5 additions & 0 deletions app/assets/javascripts/web/lectures.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,9 @@ jQuery(document).ready(function ($) {
data: {workshop_id_eq: $('#filter_by_workshop option:selected').val()},
})
});

$('#lectures').on('click', '.sorting a', function() {
$.getScript(this.href);
return false;
});
});
4 changes: 1 addition & 3 deletions app/assets/stylesheets/web/styles.less
Original file line number Diff line number Diff line change
Expand Up @@ -417,9 +417,7 @@ header {
padding: 7px 0 7px 50px !important;
position: relative;
min-height: 55px;
&:first-child, &:nth-child(3), &:nth-child(5), &:nth-child(6), &:nth-child(7) {
line-height: 40px;
}
line-height: 40px;
}
}
}
Expand Down
11 changes: 6 additions & 5 deletions app/views/web/user_lectures/_lectures.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@
%br
- else
%br
#{t('.sort_by')}: 
-#FIXME решение в лоб. Наверняка есть более элегантное решение
= sort_clink(@search, :lecture_votings_count, t('.by_lecture_votings_count'), {default_order: :desc, workshop_id_eq: params[:workshop_id_eq] })
  
= sort_clink(@search, :created_at, t('.by_created_at'), { workshop_id_eq: params[:workshop_id_eq] })
.sorting
#{t('.sort_by')}: 
-#FIXME решение в лоб. Наверняка есть более элегантное решение
= sort_clink(@search, :lecture_votings_count, t('.by_lecture_votings_count'), {default_order: :desc, workshop_id_eq: params[:workshop_id_eq] })
  
= sort_clink(@search, :created_at, t('.by_created_at'), { workshop_id_eq: params[:workshop_id_eq] })
- @lectures.each do |lecture|
%li.lectures__item
.lectures__item-img
Expand Down

0 comments on commit dff3a87

Please sign in to comment.