ManageIQ/manageiq-ui-classic

View on GitHub
app/views/ops/_settings_custom_logos_tab.html.haml

Summary

Maintainability
Test Coverage
- if @sb[:active_tab] == "settings_custom_logos"
  - url = url_for_only_path(:action => 'settings_form_field_changed', :id => "#{@sb[:active_tab].split('_')[1]}_#{@sb[:active_tab].split('_').last}")
  %h3= _("Custom Logo Image (Shown on top right of all screens)")
  - if File.exist?(@logo_file)
    = image_tag("/upload/custom_logo.png?#{rand(99_999_999)}")
  - else
    = render :partial => 'layouts/info_msg', :locals => {:message => _("No custom logo image has been uploaded yet.")}
  = form_tag({:action    => "upload_logo"},
             :class     => "form-horizontal",
             :multipart => true,
             :method    => :post) do
    .form-group
      .col-md-4
        = render :partial => "shared/file_chooser", :locals => {:object_name => "upload", :method => "logo"}
      .col-md-6
        = submit_tag(_("Upload"),
                    :id    => "upload",
                    :class => "btn btn-default")
        = _("* Requirements: File-type - PNG; Dimensions - 350x70.")
  - if File.exist?(@logo_file)
    %br/
    %form.form-horizontal
      .form-group
        %label.col-md-2.control-label
          = _("Use Custom Logo Image")
        .col-md-8
          = check_box_tag("server_uselogo", true, @edit[:new][:server][:custom_logo], :data => {:on_text => _('Yes'), :off_text => _('No')})
  %hr
  %h3= _("Custom Login & 'About' Screen Background Image")
  - if File.exist?(@login_logo_file)
    = image_tag("/upload/custom_login_logo.png?#{rand(99_999_999)}",
                :height => 400,
                :width  => 675)
    %br/
    = succeed "*" do
      %br/
    = _("Image shown at 25% of actual size")
    %br/
    %br/
  - else
    = render :partial => 'layouts/info_msg', :locals => {:message => _("No custom login image has been uploaded yet.")}
  = form_tag({:action    => "upload_login_logo"},
             :class     => "form-horizontal",
             :multipart => true,
             :method    => :post) do
    .form-group
      .col-md-4
        = render :partial => "shared/file_chooser", :locals => {:object_name => "login", :method => "logo"}
      .col-md-6
        = submit_tag(_("Upload"),
                    :class => "btn btn-default")
        = _("* Requirements: File-type - PNG; Dimensions - 1280x1000.")

  - if File.exist?(@login_logo_file)
    %br/
    %form.form-horizontal
      .form-group
        %label.col-md-2.control-label
          = _("Use Custom Login & 'About' Screen Background Image")
        .col-md-8
          = check_box_tag("server_useloginlogo", true, @edit[:new][:server][:custom_login_logo], :data => {:on_text => _('Yes'), :off_text => _('No')})
  %hr
  %h3=_("Custom Brand Image (Shown on top left of all screens and above login panel)")
  - if File.exist?(@login_brand_file)
    = image_tag("/upload/custom_brand.png?#{rand(99_999_999)}")
    %br/
    %br/
  - else
    = render :partial => 'layouts/info_msg', :locals => {:message => _("No custom login brand image has been uploaded yet.")}
  = form_tag({:action    => "upload_login_brand"},
             :class     => "form-horizontal",
             :multipart => true,
             :method    => :post) do
    .form-group
      .col-md-4
        = render :partial => "shared/file_chooser", :locals => {:object_name => "brand", :method => "logo"}
      .col-md-6
        = submit_tag(_("Upload"), :class => "btn btn-default")
        = _("* Requirements: File-type - PNG;")
      .col-md-8
        .spacer
        = _("(Note: Login brand can be resized using /public/custom.css)")

  - if File.exist?(@login_brand_file)
    %br/
    %form.form-horizontal
      .form-group
        %label.col-md-2.control-label
          = _("Use Custom Brand Image")
        .col-md-8
          = check_box_tag("server_usebrand", true, @edit[:new][:server][:custom_brand], :data => {:on_text => _('Yes'), :off_text => _('No')})
  %hr
  %h3=_("Custom Favicon")
  - if File.exist?(@favicon_file)
    = image_tag("/upload/custom_favicon.ico?#{rand(99_999_999)}")
    %br/
    %br/
  - else
    = render :partial => 'layouts/info_msg', :locals => {:message => _("No custom favicon has been uploaded yet.")}
  = form_tag({:action    => "upload_favicon"},
             :class     => "form-horizontal",
             :multipart => true,
             :method    => :post) do
    .form-group
      .col-md-4
        = render :partial => "shared/file_chooser", :locals => {:object_name => "favicon", :method => "logo"}
      .col-md-6
        = submit_tag(_("Upload"), :class => "btn btn-default")
        = _("* Requirements: File-type - ICO;")

  - if File.exist?(@favicon_file)
    %br/
    %form.form-horizontal
      .form-group
        %label.col-md-2.control-label
          = _("Use Custom Favicon")
        .col-md-8
          = check_box_tag("server_usefavicon", true, @edit[:new][:server][:custom_favicon], :data => {:on_text => _('Yes'), :off_text => _('No')})
  %hr
  %h3
    = _("Custom Login Panel Text (")
    %span#text_count= @edit[:new][:notes] ? @edit[:new][:notes].length : 0
    \/ 500)
  = text_area_tag("login_text",
                  @edit[:new][:server][:custom_login_text],
                  :rows                       => 5,
                  :maxlength                  => "500",
                  :class                      => "form-control",
                  :counter                    => "text_count",
                  "data-miq_check_max_length" => true,
                  "data-miq_observe"          => {:interval => '.5', :url => url}.to_json)
  %br/
  %form.form-horizontal
    .form-group
      %label.col-md-2.control-label
        = _("Use Custom Login Text")
      .col-md-8
        = check_box_tag("server_uselogintext", true, @edit[:new][:server][:use_custom_login_text], :data => {:on_text => _('Yes'), :off_text => _('No')})
      :javascript
        miqInitBootstrapSwitch('server_uselogintext', "#{url}");
        miqInitBootstrapSwitch('server_uselogo', "#{url}");
        miqInitBootstrapSwitch('server_useloginlogo', "#{url}");
        miqInitBootstrapSwitch('server_usebrand', "#{url}");
        miqInitBootstrapSwitch('server_usefavicon', "#{url}");