<%
  # Redmine plugin for Document Management System "Features"
  #
  # Vít Jonáš <vit.jonas@gmail.com>, Daniel Munn <dan.munn@munnster.co.uk>, Karel Pičman <karel.picman@kontron.com>
  #
  # This file is part of Redmine DMSF plugin.
  #
  # Redmine DMSF plugin is free software: you can redistribute it and/or modify it under the terms of the GNU General
  # Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any
  # later version.
  #
  # Redmine DMSF plugin is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
  # the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
  # more details.
  #
  # You should have received a copy of the GNU General Public License along with Redmine DMSF plugin. If not, see
  # <https://www.gnu.org/licenses/>.
%>

<%= label_tag(label_tag_name, l(:label_dmsf_version)) %>
<%= select_tag select_tag_name_major, options_for_select(DmsfUploadHelper::major_version_select_options,
      DmsfUploadHelper::gui_version(revision_or_upload.major_version)),
      class: 'dmsf-select-version' %>
<b>.</b>
<% if revision_or_upload.patch_version.present? && (DmsfUploadHelper::gui_version(revision_or_upload.patch_version) != ' ') %>
  <%= select_tag select_tag_name_minor, options_for_select(DmsfUploadHelper::minor_version_select_options,
        DmsfUploadHelper::gui_version(revision_or_upload.minor_version)),
        class: 'dmsf-select-version' %>
  <b>.</b>
  <%= select_tag select_tag_name_patch, options_for_select(DmsfUploadHelper::patch_version_select_options,
        DmsfUploadHelper::gui_version(DmsfUploadHelper.increase_version(revision_or_upload.patch_version))),
        class: 'dmsf-select-version' %>
<% else %>
  <% if revision_or_upload.minor_version %>
    <% minor_version = DmsfUploadHelper::gui_version(DmsfUploadHelper.increase_version(revision_or_upload.minor_version)) %>
  <% else %>
    <% minor_version = '' %>
  <% end %>
  <%= select_tag select_tag_name_minor,
                 options_for_select(DmsfUploadHelper::minor_version_select_options, minor_version),
                 class: 'dmsf-select-version' %>
  <b>.</b>
  <%= select_tag select_tag_name_patch, options_for_select(DmsfUploadHelper::patch_version_select_options, ' '),
                 class: 'dmsf-select-version' %>
<% end %>
