Commits

Jacob Moen committed f3ba78c

Project switcher now generates a clean URL (without &projectname=wrongproject appended)

  • Participants
  • Parent commits f72a679

Comments (0)

Files changed (5)

File themes/bootstrap/views/issue/index.php

     $pageSize=Yii::app()->user->getState('pageSize',Yii::app()->params['defaultPageSize']);
 ?>
 <div class="contextual">
-            <?php
-            if (((Yii::app()->controller->id === 'project') || (Yii::app()->controller->id === 'issue')) && (isset($_GET['identifier']))) {
-                if (('issue/view' !== $this->route) && ('issue/update' !== $this->route) && ('issue/create' !== $this->route)) {
-                    $this->widget('DropDownRedirect', array(
-                        'data' => Yii::app()->controller->getProjects(),
-                        'url' => $this->createUrl($this->route, array_merge($_GET, array('identifier' => '__value__'))),
-                        'select' => $_GET['identifier'], //the preselected value
-                        'htmlOptions' => array('style' => 'width:120px !important', 'class' => 'pull-right'),
-                    ));
-                }
-            }
-            ?>
+    <?php
+    if (((Yii::app()->controller->id === 'project') || (Yii::app()->controller->id === 'issue')) && (isset($_GET['identifier']))) {
+        $new_GET = $_GET;
+        unset($new_GET['projectname']);
+        if (('issue/view' !== $this->route) && ('issue/update' !== $this->route) && ('issue/create' !== $this->route)) {
+            $this->widget('DropDownRedirect', array(
+                'data' => Yii::app()->controller->getProjects(),
+                'url' => $this->createUrl($this->route, array_replace($new_GET, array('identifier' => '__value__'))),
+                'select' => $_GET['identifier'], //the preselected value
+                'htmlOptions' => array('style' => 'width:120px !important', 'class' => 'pull-right'),
+            ));
+        }
+    }
+    ?>
 </div>
 <h3 class="issues-icon">Issues</h3>
 <?php echo CHtml::form('issues','get', array('class' => 'floatrightup')); ?>

File themes/bootstrap/views/project/activity.php

 $this->pageTitle = $model->name . ' - Activity - ' . Yii::app()->name;
 ?>
 <div class="contextual">
-            <?php
-            if (((Yii::app()->controller->id === 'project') || (Yii::app()->controller->id === 'issue')) && (isset($_GET['identifier']))) {
-                if (('issue/view' !== $this->route) && ('issue/update' !== $this->route) && ('issue/create' !== $this->route)) {
-                    $this->widget('DropDownRedirect', array(
-                        'data' => Yii::app()->controller->getProjects(),
-                        'url' => $this->createUrl($this->route, array_merge($_GET, array('identifier' => '__value__'))),
-                        'select' => $_GET['identifier'], //the preselected value
-                    ));
-                }
-            }
-            ?>
+    <?php
+    if (((Yii::app()->controller->id === 'project') || (Yii::app()->controller->id === 'issue')) && (isset($_GET['identifier']))) {
+        $new_GET = $_GET;
+        unset($new_GET['projectname']);
+        if (('issue/view' !== $this->route) && ('issue/update' !== $this->route) && ('issue/create' !== $this->route)) {
+            $this->widget('DropDownRedirect', array(
+                'data' => Yii::app()->controller->getProjects(),
+                'url' => $this->createUrl($this->route, array_replace($new_GET, array('identifier' => '__value__'))),
+                'select' => $_GET['identifier'], //the preselected value
+                'htmlOptions' => array('style' => 'width:120px !important', 'class' => 'pull-right'),
+            ));
+        }
+    }
+    ?>
 </div>
 <h3 class="activity-icon">Activity</h3>
 <?php $this->widget('ProjectActivity', array('projectId' => $model->id)); ?>

File themes/bootstrap/views/project/code.php

 $this->pageTitle = $model->name . ' - Code - ' . Yii::app()->name;
 ?>
 <div class="contextual">
-            <?php
-            if (((Yii::app()->controller->id === 'project') || (Yii::app()->controller->id === 'issue')) && (isset($_GET['identifier']))) {
-                if (('issue/view' !== $this->route) && ('issue/update' !== $this->route) && ('issue/create' !== $this->route)) {
-                    $this->widget('DropDownRedirect', array(
-                        'data' => Yii::app()->controller->getProjects(),
-                        'url' => $this->createUrl($this->route, array_merge($_GET, array('identifier' => '__value__'))),
-                        'select' => $_GET['identifier'], //the preselected value
-                    ));
-                }
-            }
-            ?>
+    <?php
+    if (((Yii::app()->controller->id === 'project') || (Yii::app()->controller->id === 'issue')) && (isset($_GET['identifier']))) {
+        $new_GET = $_GET;
+        unset($new_GET['projectname']);
+        if (('issue/view' !== $this->route) && ('issue/update' !== $this->route) && ('issue/create' !== $this->route)) {
+            $this->widget('DropDownRedirect', array(
+                'data' => Yii::app()->controller->getProjects(),
+                'url' => $this->createUrl($this->route, array_replace($new_GET, array('identifier' => '__value__'))),
+                'select' => $_GET['identifier'], //the preselected value
+                'htmlOptions' => array('style' => 'width:120px !important', 'class' => 'pull-right'),
+            ));
+        }
+    }
+    ?>
 </div>
 <h3 class="code-icon">Code</h3>
 <div id="changelog" class="row-fluid">

File themes/bootstrap/views/project/roadmap.php

 $this->pageTitle = $model->name . ' - Roadmap - ' . Yii::app()->name;
 ?>
 <div class="contextual">
-            <?php
-            if (((Yii::app()->controller->id === 'project') || (Yii::app()->controller->id === 'issue')) && (isset($_GET['identifier']))) {
-                if (('issue/view' !== $this->route) && ('issue/update' !== $this->route) && ('issue/create' !== $this->route)) {
-                    $this->widget('DropDownRedirect', array(
-                        'data' => Yii::app()->controller->getProjects(),
-                        'url' => $this->createUrl($this->route, array_merge($_GET, array('identifier' => '__value__'))),
-                        'select' => $_GET['identifier'], //the preselected value
-                    ));
-                }
-            }
-            ?>
+    <?php
+    if (((Yii::app()->controller->id === 'project') || (Yii::app()->controller->id === 'issue')) && (isset($_GET['identifier']))) {
+        $new_GET = $_GET;
+        unset($new_GET['projectname']);
+        if (('issue/view' !== $this->route) && ('issue/update' !== $this->route) && ('issue/create' !== $this->route)) {
+            $this->widget('DropDownRedirect', array(
+                'data' => Yii::app()->controller->getProjects(),
+                'url' => $this->createUrl($this->route, array_replace($new_GET, array('identifier' => '__value__'))),
+                'select' => $_GET['identifier'], //the preselected value
+                'htmlOptions' => array('style' => 'width:120px !important', 'class' => 'pull-right'),
+            ));
+        }
+    }
+    ?>
 </div>
 <h3 class="roadmap-icon">Roadmap</h3>
 <div id="roadmap" class="row-fluid">

File themes/bootstrap/views/project/view.php

 $this->pageTitle = $model->name . ' - Overview - ' . Yii::app()->name;
 ?>
 <div id="project-view" class="row-fluid">
-	<div class="contextual">
-	    <?php
-	    if (((Yii::app()->controller->id === 'project') || (Yii::app()->controller->id === 'issue')) && (isset($_GET['identifier']))) {
-	        if (('issue/view' !== $this->route) && ('issue/update' !== $this->route) && ('issue/create' !== $this->route)) {
-	            $this->widget('DropDownRedirect', array(
-	                'data' => Yii::app()->controller->getProjects(),
-	                'url' => $this->createUrl($this->route, array_merge($_GET, array('identifier' => '__value__'))),
-	                'select' => $_GET['identifier'], //the preselected value
-	            ));
-	        }
-	    }
-	    ?>
-	</div>
+<div class="contextual">
+    <?php
+    if (((Yii::app()->controller->id === 'project') || (Yii::app()->controller->id === 'issue')) && (isset($_GET['identifier']))) {
+        $new_GET = $_GET;
+        unset($new_GET['projectname']);
+        if (('issue/view' !== $this->route) && ('issue/update' !== $this->route) && ('issue/create' !== $this->route)) {
+            $this->widget('DropDownRedirect', array(
+                'data' => Yii::app()->controller->getProjects(),
+                'url' => $this->createUrl($this->route, array_replace($new_GET, array('identifier' => '__value__'))),
+                'select' => $_GET['identifier'], //the preselected value
+                'htmlOptions' => array('style' => 'width:120px !important', 'class' => 'pull-right'),
+            ));
+        }
+    }
+    ?>
+</div>
 	<h3 class="overview-icon">Overview</h3>
 
 <div class="row-fluid">