Open colors field per default when a custom theme is selected

pull/7966/head
Henriette Dinger 5 years ago
parent f067c4702e
commit 1e3b5adc61
  1. 1
      app/assets/stylesheets/layout/_colors.sass
  2. 10
      app/views/custom_styles/show.html.erb
  3. 2
      config/locales/en.yml
  4. 2
      spec/views/custom_styles/show.html.erb_spec.rb

@ -28,7 +28,6 @@
.color--preview
margin-top: auto
margin-right: 5px
margin-bottom: auto
border: 1px solid #000
border-radius: 4px

@ -156,22 +156,24 @@ See docs/COPYRIGHT.rdoc for more details.
<%= form_tag update_design_colors_path, method: :post, class: "form" do %>
<section class="form--section">
<fieldset class="form--fieldset -collapsible collapsed">
<fieldset class="form--fieldset -collapsible <%= 'collapsed' unless @current_theme.empty? %> ">
<legend class="form--fieldset-legend"><%= I18n.t(:label_advanced_settings) %></legend>
<% DesignColor.setables.each do |design_color| %>
<div class="form--field -required">
<label class="form--label"><%= I18n.t("admin.custom_styles.colors.#{design_color.variable}") %>:</label>
<span class="form--field-container">
<div class="form--field-affix">
<%= icon_for_color(OpenStruct.new(variable: design_color.variable,
hexcode: design_color.get_hexcode),
data: { target: "#design_colors_" + design_color.variable }) %>
</div>
<span class="form--text-field-container">
<%= styled_text_field_tag "design_colors[]" + design_color.variable,
design_color.hexcode,
placeholder: DesignColor.defaults[design_color.variable] %>
</span>
</span>
<%= icon_for_color(OpenStruct.new(variable: design_color.variable,
hexcode: design_color.get_hexcode),
data: { target: "#design_colors_" + design_color.variable }) %>
<div class="form--field-instructions">
<% instruction_key = "admin.custom_styles.instructions.#{design_color.variable}" %>
<% if I18n.exists?(instruction_key, :en) %>

@ -61,7 +61,7 @@ en:
enterprise_notice: "As a special 'Thank you!' for their financial contribution to develop OpenProject, this tiny feature is only available for Enterprise Edition support subscribers."
manage_colors: "Edit color select options"
instructions:
alternative-color: "Strong accent color, typically used for most the important button on a screen."
alternative-color: "Strong accent color, typically used for the most important button on a screen."
content-link-color: "Font color of most of the links."
primary-color: "Main color."
primary-color-dark: "Typically a darker version of the main color used for hover effects."

@ -38,6 +38,7 @@ describe 'custom_styles/show', type: :view do
context "no custom logo yet" do
before do
assign(:custom_style, CustomStyle.new)
assign(:current_theme, '')
allow(view).to receive(:options_for_select).and_return('')
render
end
@ -50,6 +51,7 @@ describe 'custom_styles/show', type: :view do
context "with existing custom logo" do
before do
assign(:custom_style, FactoryBot.build(:custom_style_with_logo))
assign(:current_theme, '')
allow(view).to receive(:options_for_select).and_return('')
render
end

Loading…
Cancel
Save