X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/edd8bf77394a667246b548b169914002858e13d6..afffd3bf4b80cd5f7d2674f513ed8f0b3dc02601:/app/views/user_blocks/edit.html.erb diff --git a/app/views/user_blocks/edit.html.erb b/app/views/user_blocks/edit.html.erb index a5b165e9a..6e030051d 100644 --- a/app/views/user_blocks/edit.html.erb +++ b/app/views/user_blocks/edit.html.erb @@ -12,15 +12,25 @@ <%= bootstrap_form_for(@user_block) do |f| %> <%= f.richtext_field :reason, :cols => 80, :rows => 20, :format => @user_block.reason_format %> - <%= f.form_group do %> - <%= label_tag "user_block_period", t(".period"), :class => "form-label" %> - <%= select_tag("user_block_period", - options_for_select(UserBlock::PERIODS.collect { |h| [block_duration_in_words(h.hours), h.to_s] }, params[:user_block_period]), - :class => "form-select") %> - <% end %> + <% if @user_block.active? %> + <%= f.form_group do %> + <%= label_tag "user_block_period", t(".period"), :class => "form-label" %> + <%= select_tag "user_block_period", + options_for_select(UserBlock::PERIODS.collect { |h| [block_duration_in_words(h.hours), h.to_s] }, + UserBlock::PERIODS.min_by { |h| (params[:user_block_period].to_i - h).abs }), + :class => "form-select" %> + <% end %> + + <%= f.form_group :needs_view do %> + <%= f.check_box :needs_view %> + <% end %> + <% else %> +