Project

General

Profile

Patch #32847 » body_css.patch

Patches application_helper and application_controller adding ability to add custom css class from controller to view body tag... - Aleksandar Pavic, 2020-01-21 07:43

View differences:

app/controllers/application_controller.rb Sun Jan 19 02:44:29 2020 +0000 → app/controllers/application_controller.rb Tue Jan 21 07:36:44 2020 +0100
529 529
    request.xhr? ? false : 'base'
530 530
  end
531 531

  
532
  #adds css class to body tag of layout
533
  def add_body_css_class(css_class)
534
    @css ||= []
535
    @css << css_class
536
  end
537

  
532 538
  def render_feed(items, options={})
533 539
    @items = (items || []).to_a
534 540
    @items.sort! {|x,y| y.event_datetime <=> x.event_datetime }
app/helpers/application_helper.rb Sun Jan 19 02:44:29 2020 +0000 → app/helpers/application_helper.rb Tue Jan 21 07:36:44 2020 +0100
637 637
  # Returns the theme, controller name, and action as css classes for the
638 638
  # HTML body.
639 639
  def body_css_classes
640
    css = []
640
    @css ||= []
641 641
    if theme = Redmine::Themes.theme(Setting.ui_theme)
642
      css << 'theme-' + theme.name
642
      @css << 'theme-' + theme.name
643 643
    end
644 644

  
645
    css << 'project-' + @project.identifier if @project && @project.identifier.present?
646
    css << 'has-main-menu' if display_main_menu?(@project)
647
    css << 'controller-' + controller_name
648
    css << 'action-' + action_name
649
    css << 'avatars-' + (Setting.gravatar_enabled? ? 'on' : 'off')
645
    @css << 'project-' + @project.identifier if @project && @project.identifier.present?
646
    @css << 'has-main-menu' if display_main_menu?(@project)
647
    @css << 'controller-' + controller_name
648
    @css << 'action-' + action_name
649
    @css << 'avatars-' + (Setting.gravatar_enabled? ? 'on' : 'off')
650 650
    if UserPreference::TEXTAREA_FONT_OPTIONS.include?(User.current.pref.textarea_font)
651
      css << "textarea-#{User.current.pref.textarea_font}"
651
      @css << "textarea-#{User.current.pref.textarea_font}"
652 652
    end
653
    css.join(' ')
653
    @css.join(' ')
654 654
  end
655 655

  
656 656
  def accesskey(s)
    (1-1/1)