From 6794ca42fbc5d60495a68cf636d622d7d3b24a98 Mon Sep 17 00:00:00 2001 From: Pavel Chipiga Date: Wed, 7 Dec 2011 02:08:46 +0200 Subject: [PATCH] Fix date filter normalization. Add build, freeze, unfreeze confirmation. Refs #2261 --- app/models/build_list/filter.rb | 6 ++++-- app/views/platforms/show.html.haml | 6 +++--- config/routes.rb | 6 +++--- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/app/models/build_list/filter.rb b/app/models/build_list/filter.rb index 214c3619b..f974c3672 100644 --- a/app/models/build_list/filter.rb +++ b/app/models/build_list/filter.rb @@ -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 diff --git a/app/views/platforms/show.html.haml b/app/views/platforms/show.html.haml index 16a1ed623..28acb9d7a 100644 --- a/app/views/platforms/show.html.haml +++ b/app/views/platforms/show.html.haml @@ -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 diff --git a/config/routes.rb b/config/routes.rb index d15f45d02..41fc838b0 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -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