Fix date filter normalization. Add build, freeze, unfreeze confirmation. Refs #2261

This commit is contained in:
Pavel Chipiga 2011-12-07 02:08:46 +02:00
parent c3fce82e9e
commit 6794ca42fb
3 changed files with 10 additions and 8 deletions

View File

@ -62,8 +62,10 @@ class BuildList::Filter
end
def build_date_from_params(field_name, params)
if params["#{field_name.to_s}(1i)"].present? || params["#{field_name.to_s}(2i)"].present? || params["#{field_name.to_s}(3i)"].present?
Date.civil(params["#{field_name.to_s}(1i)"].to_i, params["#{field_name.to_s}(2i)"].to_i, params["#{field_name.to_s}(3i)"].to_i)
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,
(params["#{field_name}(2i)"].presence || Date.today.mohth).to_i,
(params["#{field_name}(3i)"].presence || Date.today.day).to_i)
else
nil
end

View File

@ -59,11 +59,11 @@
-#= link_to image_tag("web-app-theme/icons/application_edit.png", :alt => t("layout.edit")) + " " + t("layout.edit"), edit_platform_path(@platform), :class => "button"
= link_to image_tag("web-app-theme/icons/cross.png", :alt => t("layout.delete")) + " " + t("layout.delete"), platform_path(@platform), :method => "delete", :class => "button", :confirm => t("layout.platforms.confirm_delete") if can? :delete, @platform
- if @platform.released?
= link_to t("layout.platforms.unfreeze"), unfreeze_platform_path(@platform), :confirm => I18n.t("layout.platforms.confirm_unfreeze"), :class => "button" if can? :unfreeze, @platform
= link_to t("layout.platforms.unfreeze"), unfreeze_platform_path(@platform), :confirm => I18n.t("layout.platforms.confirm_unfreeze"), :method => :post, :class => "button" if can? :unfreeze, @platform
- else
= link_to t("layout.platforms.freeze"), freeze_platform_path(@platform), :confirm => I18n.t("layout.platforms.confirm_freeze"), :class => "button" if can? :freeze, @platform
= link_to t("layout.platforms.freeze"), freeze_platform_path(@platform), :confirm => I18n.t("layout.platforms.confirm_freeze"), :method => :post, :class => "button" if can? :freeze, @platform
= link_to "Клонировать", clone_platform_path(@platform), :class => "button" if can? :clone, @platform
= link_to t("layout.platforms.build_all"), build_all_platform_path(@platform), :class => "button" if can? :build_all, @platform
= link_to t("layout.platforms.build_all"), build_all_platform_path(@platform), :confirm => I18n.t("layout.confirm"), :method => :post, :class => "button" if can? :build_all, @platform
%a{ :name => "repositories" }
.block

View File

@ -41,11 +41,11 @@ Rosa::Application.routes.draw do
resources :private_users, :except => [:show, :destroy, :update]
member do
get 'freeze'
get 'unfreeze'
post 'freeze'
post 'unfreeze'
get 'clone'
post 'clone'
get 'build_all'
post 'build_all'
end
collection do