New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[RFE] Allow to upload and display a custom brand image on login/header #4376
Conversation
= 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; Dimensions - AAAAxBBBB.") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@epwinchell I need the sizes from you here 😉 🍻
@miq-bot add_reviewer @dclarizio |
d227c3b
to
130c2ba
Compare
@skateman can you provide before/after screenshots |
Seems ok for me, can we get UX review ? |
@Loicavenel The upload UX hasn't changed. There's nothing new here from that perspective. |
@epwinchell logo was on the right before... and on the left |
@Loicavenel This just creates an upload feature for the existing brand image on the top left. The custom logo on the top right hasn't changed. |
@epwinchell here my issue here: 1 - Now, we can have 2 logos one of the left, one of the right... 2 - We are removing Red Hat logo, I don't know the rules in RH for this.. it is why I want to UX involved.. I don't know if other products are doing this. @Rohoover can you help me here... |
@terezanovotna (CF UX), can you take a look at this as well? . . . I'm pretty sure we allow customers to totally use their own branding if they choose. |
We do have customers who do their own branding. They have for years and in the past, it was easier. Some recent changes have made that more difficult for re-branding and this change will allow them yet again to do this in an easier fashion. I spoke with Loic about his concern, however, in this case, this is a feature we want in and supports many customers. |
@@ -1104,11 +1106,16 @@ def settings_set_form_vars_logos | |||
if @edit[:current].config[:server][:custom_login_logo].nil? | |||
@edit[:current].config[:server][:custom_login_logo] = false # Set default custom_logo flag | |||
end | |||
if @edit[:current].config[:server][:custom_brand].nil? | |||
@edit[:current].config[:server][:custom_brand] = false # Set default custom_logo flag |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Comment is wrong. https://twitter.com/nzkoz/status/538892801941848064
File.open(typ == "custom" ? @@logo_file : @@login_logo_file, "wb") { |f| f.write(fld[:logo].read) } | ||
msg = typ == "custom" ? _('Custom logo file "%{name}" uploaded') : _('Custom login file "%{name}" uploaded') | ||
add_flash(msg % {:name => fld[:logo].original_filename}) | ||
File.open(file, "wb") { |f| f.write(field[:logo].read) } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A little simpler File.write(field[:logo].read, :mode => "wb")
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't really make sense? Should I put this into the block, or replace the whole line? I haven't found any documentation for this.
private | ||
|
||
def logo_dir | ||
dir = File.expand_path(Rails.root.join('public', 'upload')) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can use the Pathname object directly instead of relying on the File class methods
dir = Rails.root.join('public', 'upload').expand_path
Dir.mkdir(dir) unless dir.exist?
dir.to_s
@skateman Where is the code that sets the custom_login setting in the settings (just want to make sure it's being done accurately. |
From what I see, LGTM! It should be ok to remove RH branding and replace it with another. We should then say more about RH branding within the About Modal |
@Fryguy I don't understand the question, everything should be in the files I touched. |
There is some valuable information here on cobranding: https://brand.redhat.com/logos/cobranding/ That said, this isn't quite the same case (RH Logo + Partner logo on the same page). I would continue to do what was previously done, unless it directly runs counter to what's outlined in the link above. |
@miq-bot rm_label pending core |
@miq-bot add_label enhancement, gaprindashvili/yes |
@miq-bot add_label fine/yes |
%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'}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing gettext in {:on_text => 'Yes', :off_text => 'No'}
9ebc62c
to
6ebe4e8
Compare
msg = typ == "custom" ? _('Custom logo file "%{name}" uploaded') : _('Custom login file "%{name}" uploaded') | ||
add_flash(msg % {:name => fld[:logo].original_filename}) | ||
File.open(file, "wb") { |f| f.write(field[:logo].read) } | ||
add_flash('%{image} "%{name}" uploaded' % {:image => text, :name => field[:logo].original_filename}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing gettext.
6ebe4e8
to
af86d5e
Compare
msg = typ == "custom" ? _('Custom logo file "%{name}" uploaded') : _('Custom login file "%{name}" uploaded') | ||
add_flash(msg % {:name => fld[:logo].original_filename}) | ||
File.open(file, "wb") { |f| f.write(field[:logo].read) } | ||
add_flash(_('%{image} "%{name}" uploaded') % {:image => text, :name => field[:logo].original_filename}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
%{}
won't work in a '...'
string, right? You have to use "..."
here.
af86d5e
to
da1cfb5
Compare
Checked commits skateman/manageiq-ui-classic@712c431~...da1cfb5 with ruby 2.3.3, rubocop 0.52.1, haml-lint 0.20.0, and yamllint 1.10.0 **
app/controllers/ops_controller/settings/common.rb
|
This PR creates a brand image upload feature under the custom logo tab, eliminating the need to manually change the html, css, and drop images into the public folder. The image appears on the login screen and the main header. The code in the area was awful, so I also did a little refactoring.
@miq-bot add_reviewer @epwinchell
@miq-bot add_reviewer @martinpovolny
@miq-bot add_label pending core
Depends on: ManageIQ/manageiq#17773
RFE BZ: https://bugzilla.redhat.com/show_bug.cgi?id=1471301