Feature #14759
closed
Adding project ID to CSS classes at least in issue screen (but whereever it is possibe)
Added by Radek Terber over 11 years ago.
Updated over 10 years ago.
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.
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.
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
- 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
.
- Related to Patch #14767: More CSS classes on various fields added
Also available in: Atom
PDF