[refs #127] Filter request refactor
This commit is contained in:
parent
34b105675a
commit
0559f1b678
|
@ -14,6 +14,14 @@ class BuildListsController < ApplicationController
|
||||||
load_and_authorize_resource :except => CALLBACK_ACTIONS.concat(NESTED_ACTIONS)
|
load_and_authorize_resource :except => CALLBACK_ACTIONS.concat(NESTED_ACTIONS)
|
||||||
|
|
||||||
def index
|
def index
|
||||||
|
if request.post?
|
||||||
|
new_params = {:filter => {}}
|
||||||
|
params[:filter].each do |k,v|
|
||||||
|
new_params[:filter][k] = v unless v.empty?
|
||||||
|
end
|
||||||
|
|
||||||
|
redirect_to build_lists_path(new_params)
|
||||||
|
else
|
||||||
filter_params = params[:filter] || {}
|
filter_params = params[:filter] || {}
|
||||||
if @project
|
if @project
|
||||||
@action_url = project_build_lists_path(@project)
|
@action_url = project_build_lists_path(@project)
|
||||||
|
@ -30,6 +38,7 @@ class BuildListsController < ApplicationController
|
||||||
{}
|
{}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def new
|
def new
|
||||||
@build_list = BuildList.new
|
@build_list = BuildList.new
|
||||||
|
|
|
@ -68,7 +68,7 @@ class BuildList::Filter
|
||||||
def build_date_from_params(field_name, params)
|
def build_date_from_params(field_name, params)
|
||||||
if params["#{field_name}(1i)"].present? || params["#{field_name}(2i)"].present? || params["#{field_name}(3i)"].present?
|
if params["#{field_name}(1i)"].present? || params["#{field_name}(2i)"].present? || params["#{field_name}(3i)"].present?
|
||||||
Date.civil((params["#{field_name}(1i)"].presence || Date.today.year).to_i,
|
Date.civil((params["#{field_name}(1i)"].presence || Date.today.year).to_i,
|
||||||
(params["#{field_name}(2i)"].presence || Date.today.mohth).to_i,
|
(params["#{field_name}(2i)"].presence || Date.today.month).to_i,
|
||||||
(params["#{field_name}(3i)"].presence || Date.today.day).to_i)
|
(params["#{field_name}(3i)"].presence || Date.today.day).to_i)
|
||||||
else
|
else
|
||||||
nil
|
nil
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
%h2.title= t("layout.build_lists.filter_header")
|
%h2.title= t("layout.build_lists.filter_header")
|
||||||
|
|
||||||
= form_for :filter, :url => @action_url, :html => { :method => :get, :class => :form } do |f|
|
= form_for :filter, :url => @action_url, :html => { :method => :post, :class => :form } do |f|
|
||||||
.columns.wat-cf
|
.columns.wat-cf
|
||||||
.column.left
|
.column.left
|
||||||
.group
|
.group
|
||||||
|
|
|
@ -42,6 +42,8 @@ Rosa::Application.routes.draw do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
match 'build_lists', :via => :post, :to => 'build_lists#index', :as => 'build_lists'
|
||||||
|
|
||||||
resources :auto_build_lists, :only => [:index, :create, :destroy]
|
resources :auto_build_lists, :only => [:index, :create, :destroy]
|
||||||
|
|
||||||
resources :personal_repositories, :only => [:show] do
|
resources :personal_repositories, :only => [:show] do
|
||||||
|
|
Loading…
Reference in New Issue