How to use SortHelper and Filters in a Redmine Plugin?
Added by Marco Nobler almost 14 years ago
Hi all,
i'm developing a Redmine Plugin to get a list of bugs related to a project from a remote system.
I built an "index" action that lists all bugs info in a tabular way.
I'd like to add Sort and Filter functionality to that view and it would be nice for me to use SortHelper and QueryHelper, but i am not much experienced in Ruby on Rails and Redmine platform so i need some help to understand how to use this Helpers in my Controller ans View.
this is my controller:
class BugsController < ApplicationController
unloadable
before_filter :find_project, :authorize, :only => :index
helper :sort
include SortHelper
def index
sort_init 'livello_gravita','asc'
sort_update %w(id livello_grativa name description)
logger.info(@project.nil? ? "@project is nil" : "@project name is = #{@project.name}")
@bugs = Bug.find(:all,:conditions => "title LIKE '%#{@project.name}%'",:order => sort_clause)
and in my index.html.erb i used "sort_header_tag" like this:
<table>
<thead>
<tr>
<%= sort_header_tag('id', :title => 'Identificativo') %>
<%= sort_header_tag('livello_gravita', :caption => 'Livello Gravita') %>
<%= sort_header_tag('name') %>
<%= sort_header_tag('description', :width => 200) %>
</tr>
</thead>
Could please someone help me?
attached is a bmp file where you can see the result of a sorting: the header is duplicated and i see always the "loading" message...
Thanks in advance
Marco Nobler
| bugs_controller.rb (887 Bytes) bugs_controller.rb | bugs_controller.rb | ||
| index.html.erb (667 Bytes) index.html.erb | index.html.erb | ||
| sort_result.JPG (160 KB) sort_result.JPG |