View Issue Details

IDProjectCategoryView StatusLast Update
0011995mantisbthtmlpublic2014-12-08 00:34
Reporterbrandonjackson Assigned Todaryn  
PrioritynormalSeverityfeatureReproducibilityhave not tried
Status closedResolutionfixed 
Product Versiongit trunk 
Target Version1.3.0-beta.1Fixed in Version1.3.0-beta.1 
Summary0011995: Add CSS IDs to html elements for styling and javascript access.
Description

I've added some ID's to several of the tables in the header to make CSS-based customizations easier. For example, by adding an id to the mantis logo it can be hidden using #logo-image{display: none;}, as opposed to editing config files and creating replacement html files. These changes should be completely unobtrusive, and are an easy step that can be taken to make Mantis designer friendly.

Also, I've created a div which encloses everything within the body tags with the ID of mantis. This was discussed in issue 2814. It will allow designers to distinguish between elements from mantis and their cms. Also, it allows mantis to have a fixed-width and centered layout if a designer so desires.

Tagspatch, redesign
Attached Files
new-element-ids.patch (5,433 bytes)   
From 4e11175e96bc057f79f23e5c3be4d39e792ae547 Mon Sep 17 00:00:00 2001
From: Brandon Jackson <brandonscottjackson@gmail.com>
Date: Sat, 5 Jun 2010 00:28:03 -0500
Subject: [PATCH 1/6] Added wrapper div

---
 core/html_api.php |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/core/html_api.php b/core/html_api.php
index 590b389..9f10ae5 100644
--- a/core/html_api.php
+++ b/core/html_api.php
@@ -446,6 +446,7 @@ function html_body_begin() {
  * @return null
  */
 function html_header() {
+	echo '<div class="wrapper">', "\n";
 	$t_title = config_get( 'page_title' );
 	if( !is_blank( $t_title ) ) {
 		echo '<div class="center"><span class="pagetitle">', string_display( $t_title ), '</span></div>', "\n";
@@ -711,6 +712,8 @@ function html_footer( $p_file = null ) {
 	}
 
 	echo "</div>\n";
+	echo "</div>\n";
+
 }
 
 /**
-- 
1.7.0.3


From 0794384deee4ab39ae00c6f24c59a8f40b734822 Mon Sep 17 00:00:00 2001
From: Brandon Jackson <brandonscottjackson@gmail.com>
Date: Sat, 5 Jun 2010 00:34:29 -0500
Subject: [PATCH 2/6] Added menubar id

---
 core/html_api.php |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/core/html_api.php b/core/html_api.php
index 9f10ae5..ebda025 100644
--- a/core/html_api.php
+++ b/core/html_api.php
@@ -764,7 +764,7 @@ function print_menu() {
 		$t_protected = current_user_get_field( 'protected' );
 		$t_current_project = helper_get_current_project();
 
-		echo '<table class="width100" cellspacing="0">';
+		echo '<table id="menubar" class="width100" cellspacing="0">';
 		echo '<tr>';
 		echo '<td class="menu">';
 		$t_menu_options = array();
-- 
1.7.0.3


From 3c1255c7595de49292d25acb9869490388f3a3fc Mon Sep 17 00:00:00 2001
From: Brandon Jackson <brandonscottjackson@gmail.com>
Date: Sat, 5 Jun 2010 00:35:33 -0500
Subject: [PATCH 3/6] Changed wrapper identiftier from class to id

---
 core/html_api.php |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/core/html_api.php b/core/html_api.php
index ebda025..19e80e8 100644
--- a/core/html_api.php
+++ b/core/html_api.php
@@ -446,7 +446,7 @@ function html_body_begin() {
  * @return null
  */
 function html_header() {
-	echo '<div class="wrapper">', "\n";
+	echo '<div id="wrapper">', "\n";
 	$t_title = config_get( 'page_title' );
 	if( !is_blank( $t_title ) ) {
 		echo '<div class="center"><span class="pagetitle">', string_display( $t_title ), '</span></div>', "\n";
-- 
1.7.0.3


From 550166551c5e43b3e895817c8b32c3b0e924e679 Mon Sep 17 00:00:00 2001
From: Brandon Jackson <brandonscottjackson@gmail.com>
Date: Sat, 5 Jun 2010 00:37:37 -0500
Subject: [PATCH 4/6] Added IDs to logo and banner

---
 core/html_api.php |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/core/html_api.php b/core/html_api.php
index 19e80e8..ce3bda3 100644
--- a/core/html_api.php
+++ b/core/html_api.php
@@ -482,11 +482,11 @@ function html_top_banner() {
 			$t_align = 'left';
 		}
 
-		echo '<div align="', $t_align, '">';
+		echo '<div id="banner" align="', $t_align, '">';
 		if( $t_show_url ) {
-			echo '<a href="', config_get( 'logo_url' ), '">';
+			echo '<a id="logo-link" href="', config_get( 'logo_url' ), '">';
 		}
-		echo '<img border="0" alt="Mantis Bug Tracker" src="' . helper_mantis_url( config_get( 'logo_image' ) ) . '" />';
+		echo '<img border="0" id="logo-image" alt="Mantis Bug Tracker" src="' . helper_mantis_url( config_get( 'logo_image' ) ) . '" />';
 		if( $t_show_url ) {
 			echo '</a>';
 		}
-- 
1.7.0.3


From c97f60e1f45c9e1c0d260bff446f2db2fefa24c0 Mon Sep 17 00:00:00 2001
From: Brandon Jackson <brandonscottjackson@gmail.com>
Date: Sat, 5 Jun 2010 00:49:49 -0500
Subject: [PATCH 5/6] Finished adding IDs to header HTML

---
 core/html_api.php |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/core/html_api.php b/core/html_api.php
index ce3bda3..95cefa5 100644
--- a/core/html_api.php
+++ b/core/html_api.php
@@ -507,7 +507,7 @@ function html_login_info() {
 	$t_now = date( config_get( 'complete_date_format' ) );
 	$t_realname = current_user_get_field( 'realname' );
 
-	echo '<table class="hide">';
+	echo '<table class="hide" id="login-info">';
 	echo '<tr>';
 	echo '<td class="login-info-left">';
 	if( current_user_is_anonymous() ) {
@@ -764,7 +764,7 @@ function print_menu() {
 		$t_protected = current_user_get_field( 'protected' );
 		$t_current_project = helper_get_current_project();
 
-		echo '<table id="menubar" class="width100" cellspacing="0">';
+		echo '<table id="menu-bar" class="width100" cellspacing="0">';
 		echo '<tr>';
 		echo '<td class="menu">';
 		$t_menu_options = array();
-- 
1.7.0.3


From 2a6082fed74cc6e4c2056769aea70c6c7342b427 Mon Sep 17 00:00:00 2001
From: Brandon Jackson <brandonscottjackson@gmail.com>
Date: Sat, 5 Jun 2010 01:05:14 -0500
Subject: [PATCH 6/6] Renamed wrapper to mantis

---
 core/html_api.php |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/core/html_api.php b/core/html_api.php
index 95cefa5..29a67ce 100644
--- a/core/html_api.php
+++ b/core/html_api.php
@@ -446,7 +446,7 @@ function html_body_begin() {
  * @return null
  */
 function html_header() {
-	echo '<div id="wrapper">', "\n";
+	echo '<div id="mantis">', "\n";
 	$t_title = config_get( 'page_title' );
 	if( !is_blank( $t_title ) ) {
 		echo '<div class="center"><span class="pagetitle">', string_display( $t_title ), '</span></div>', "\n";
-- 
1.7.0.3

new-element-ids.patch (5,433 bytes)   

Relationships

related to 0015721 closedgrangeway Functionality to consider porting to master-2.0.x 

Activities

djcarr

djcarr

2010-06-14 23:52

reporter   ~0025850

Last edited: 2010-06-14 23:53

I too have spent some time getting CSS control over the print_menu() function.

Instead of printing the <a href>s out directly, could they perhaps call a new function eg:

function string_get_menu_option_link( $page_url, $lang_string ) {
return [a href="' . helper_mantis_url( $page_url ) . '"]' . lang_get( $lang_string ) . '[/a]';
}

(replace [] with &lt;>)

Then it becomes quite trivial for a customisation effort to wrap this with span or other tags using the $lang_string as the identifier.

daryn

daryn

2010-08-13 12:51

reporter   ~0026305

Patch merged with following changes:

Modified mantis wrapper to include plugin output for the EVENT_LAYOUT_BODY_BEGIN
and EVENT_LAYOUT_BODY_END events.

Modified menu-bar to be a class and named it main-menu-container as it the main
menu may appear above and below the content and with new styling may not be a bar.

Added a content wrapper to isolate the content from the template elements.

daryn

daryn

2010-08-24 10:27

reporter   ~0026453

Added some ids on bug change status page.

daryn

daryn

2010-08-25 02:09

reporter   ~0026463

Added ids and classes on view all bug filter.

grangeway

grangeway

2013-04-05 17:57

reporter   ~0036381

Marking as 'acknowledged' not resolved/closed to track that change gets ported to master-2.0.x branch

Related Changesets

MantisBT: master 0c379c9d

2010-08-13 12:34

daryn


Details Diff
Fix 0011995 - Merge patch for adding id's and classes to layout elements
with some minor changes. Added a content wrapper also.

Contributed-by: Brandon Jackson <brandonscottjackson@gmail.com
Signed-off-by: Daryn Warriner <daryn@iivip.com>
Affected Issues
0011995
mod - core/html_api.php Diff File

MantisBT: master 729d5530

2010-08-13 13:29

daryn


Details Diff
Fix 0011995 - Add containers and ids to allow styling of various menus. Affected Issues
0011995
mod - core/html_api.php Diff File

MantisBT: master ca23cc99

2010-08-24 10:23

daryn


Details Diff
Bug 0011995 - Add a css id and name to bug change status form. Affected Issues
0011995
mod - bug_change_status_page.php Diff File

MantisBT: master a50748bb

2010-08-24 10:24

daryn


Details Diff
Bug 0011995 - Add css id to bugnote row on bug change status page. This should eventually
be a div rather than a table row.
Affected Issues
0011995
mod - bug_change_status_page.php Diff File

MantisBT: master 6b5e037c

2010-08-25 01:31

daryn


Details Diff
Bug 0011826, Bug 0011995, Fix invalid html in the view all bug filter. Add divs, classes and id's
where necessary to facilitate moving style elements into css and inline
javascript into javascript files.
Affected Issues
0011826, 0011995
mod - css/default.css Diff File
mod - core/filter_api.php Diff File
mod - javascript/dev/common.js Diff File
mod - javascript/common.js Diff File

MantisBT: master 7ec1d497

2010-08-27 13:00

daryn


Details Diff
Issue 0011826 - Remove all inline JavaScript from MantisBT (use external scripts instead)
Issue 0011995 - Add CSS IDs to html elements for styling and javascript access.
Affected Issues
0011826, 0011995
mod - css/default.css Diff File
mod - core/html_api.php Diff File
mod - javascript/dev/common.js Diff File
mod - javascript/common.js Diff File