Feature #14759

Adding project ID to CSS classes at least in issue screen (but whereever it is possibe)

Added by Radek Terber over 4 years ago. Updated over 3 years ago.

Status:ClosedStart date:
Priority:NormalDue date:
Assignee:-% Done:

0%

Category:UI
Target version:-
Resolution:

Description

I would appreciate to have textual project ID (not a database numeric ID but the text typed into project form) in page's CSS classes - at leas for issue related pages, but it would be great to have it in all project - related pages (wiki, noews ... etc).

It would allow to distinct renrering of the same part of screend in different projects using custom CSS files.

Concrete use case is that we have UAT (acceptance testing) subrojects of each project, that are targeted to end users with minimal computer experiences. We allows only single tracker in this project (UAT_bug) and want hide all page elements that are not absolutely neccesdsary to make this page as simple as possible.
Since we use redmine for lots of different project type and project-specific settings are limitted, it is not so easy to configure look of issue page in each project differently. I guess this would be a way how to achieve this.

Another way (maybe better) would be to add additional field to project setting (let say "Project category" that's value (if set) would be passed to the CSS class. But in this case I still would put there the project ID.


Related issues

Related to Redmine - Patch #14767: More CSS classes on various fields Closed

History

#1 Updated by Radek Terber over 4 years ago

Also it would be great to add CSS class about tracker and perhaps about issue status into both "static" abd "dynamic" part of issue screen. "Static" part means that which is shown only (and cannot be changed), "dynamic" part meand the form for issue editing.

#2 Updated by Daniel Felix over 4 years ago

You can achive this by adding just one line here: source:/trunk/app/helpers/application_helper.rb#L491

For example replace:

  def body_css_classes
    css = []
    if theme = Redmine::Themes.theme(Setting.ui_theme)
      css << 'theme-' + theme.name
    end

    css << 'controller-' + controller_name
    css << 'action-' + action_name
    css.join(' ')
  end 

with this:

  def body_css_classes
    css = []
    if theme = Redmine::Themes.theme(Setting.ui_theme)
      css << 'theme-' + theme.name
    end

    css << 'project-'+@project.identifier if @project
    css << 'controller-' + controller_name
    css << 'action-' + action_name
    css.join(' ')
  end 

Please note:

css << 'project-'+@project.identifier if @project

Best regards,
Daniel

#3 Updated by Mischa The Evil about 4 years ago

  • Category set to UI
  • Status changed from New to Closed

This has been implemented with r12170 (#14767).

body now includes the project identifier, prepended with project-, when you are navigating a project view.
So for a project with an identifier ecookbook the CSS style would be body.project-ecookbook.

#4 Updated by Mischa The Evil about 4 years ago

  • Related to Patch #14767: More CSS classes on various fields added

Also available in: Atom PDF