Merge remote-tracking branch 'origin/release/5.0' into fix/21858-wrong–positioning-of-check–all-in-permissions-view
commit
5ddfc1ec84
Binary file not shown.
Before Width: | Height: | Size: 75 KiB After Width: | Height: | Size: 76 KiB |
Binary file not shown.
Binary file not shown.
@ -0,0 +1,75 @@ |
|||||||
|
//-- copyright |
||||||
|
// OpenProject is a project management system. |
||||||
|
// Copyright (C) 2012-2015 the OpenProject Foundation (OPF) |
||||||
|
// |
||||||
|
// This program is free software; you can redistribute it and/or |
||||||
|
// modify it under the terms of the GNU General Public License version 3. |
||||||
|
// |
||||||
|
// OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows: |
||||||
|
// Copyright (C) 2006-2013 Jean-Philippe Lang |
||||||
|
// Copyright (C) 2010-2013 the ChiliProject Team |
||||||
|
// |
||||||
|
// This program is free software; you can redistribute it and/or |
||||||
|
// modify it under the terms of the GNU General Public License |
||||||
|
// as published by the Free Software Foundation; either version 2 |
||||||
|
// of the License, or (at your option) any later version. |
||||||
|
// |
||||||
|
// This program is distributed in the hope that it will be useful, |
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||||
|
// GNU General Public License for more details. |
||||||
|
// |
||||||
|
// You should have received a copy of the GNU General Public License |
||||||
|
// along with this program; if not, write to the Free Software |
||||||
|
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
||||||
|
// |
||||||
|
// See doc/COPYRIGHT.rdoc for more details. |
||||||
|
//++ |
||||||
|
|
||||||
|
@include breakpoint(680px down) |
||||||
|
body.controller-account |
||||||
|
#login-form, |
||||||
|
#content .login-auth-providers, |
||||||
|
.login_notice_div |
||||||
|
width: 100% |
||||||
|
|
||||||
|
#content .login-auth-providers |
||||||
|
margin-top: 114px |
||||||
|
|
||||||
|
h3:before |
||||||
|
top: -14px |
||||||
|
|
||||||
|
#login-form |
||||||
|
.form--field-container |
||||||
|
@include grid-content(12) |
||||||
|
padding: 0 |
||||||
|
|
||||||
|
.login-options-container |
||||||
|
position: relative |
||||||
|
|
||||||
|
.login-links |
||||||
|
float: none |
||||||
|
position: absolute |
||||||
|
text-align: center |
||||||
|
top: 70px |
||||||
|
width: 100% |
||||||
|
|
||||||
|
a |
||||||
|
display: block |
||||||
|
|
||||||
|
.button |
||||||
|
width: 100% |
||||||
|
|
||||||
|
#new_user |
||||||
|
.login-auth-providers |
||||||
|
margin: 60px 0 |
||||||
|
|
||||||
|
h3 span |
||||||
|
background: transparent |
||||||
|
|
||||||
|
.form--label, |
||||||
|
.form--field-container, |
||||||
|
.form--field-instructions |
||||||
|
@include grid-content(12) |
||||||
|
margin-left: 0 |
||||||
|
padding: 0 |
@ -0,0 +1,55 @@ |
|||||||
|
//-- copyright |
||||||
|
// OpenProject is a project management system. |
||||||
|
// Copyright (C) 2012-2015 the OpenProject Foundation (OPF) |
||||||
|
// |
||||||
|
// This program is free software; you can redistribute it and/or |
||||||
|
// modify it under the terms of the GNU General Public License version 3. |
||||||
|
// |
||||||
|
// OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows: |
||||||
|
// Copyright (C) 2006-2013 Jean-Philippe Lang |
||||||
|
// Copyright (C) 2010-2013 the ChiliProject Team |
||||||
|
// |
||||||
|
// This program is free software; you can redistribute it and/or |
||||||
|
// modify it under the terms of the GNU General Public License |
||||||
|
// as published by the Free Software Foundation; either version 2 |
||||||
|
// of the License, or (at your option) any later version. |
||||||
|
// |
||||||
|
// This program is distributed in the hope that it will be useful, |
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||||
|
// GNU General Public License for more details. |
||||||
|
// |
||||||
|
// You should have received a copy of the GNU General Public License |
||||||
|
// along with this program; if not, write to the Free Software |
||||||
|
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
||||||
|
// |
||||||
|
// See doc/COPYRIGHT.rdoc for more details. |
||||||
|
//++ |
||||||
|
|
||||||
|
@include breakpoint(680px down) |
||||||
|
form |
||||||
|
.grid-block |
||||||
|
display: block |
||||||
|
|
||||||
|
.grid-content |
||||||
|
padding: 0 |
||||||
|
|
||||||
|
.form--label, |
||||||
|
.form--field-container, |
||||||
|
.form--select-container, |
||||||
|
.form--field-instructions |
||||||
|
@include grid-content(12) |
||||||
|
margin-left: 0 |
||||||
|
padding: 0 |
||||||
|
|
||||||
|
.choice .choice--select |
||||||
|
width: 100% |
||||||
|
|
||||||
|
.ui-select-dropdown |
||||||
|
.select2-search |
||||||
|
&:before |
||||||
|
top: 8px !important |
||||||
|
|
||||||
|
&.select2-drop.select2-with-searchbox.select2-drop-active |
||||||
|
margin-top: 0 !important |
||||||
|
top: 1px !important |
@ -0,0 +1,70 @@ |
|||||||
|
//-- copyright |
||||||
|
// OpenProject is a project management system. |
||||||
|
// Copyright (C) 2012-2015 the OpenProject Foundation (OPF) |
||||||
|
// |
||||||
|
// This program is free software; you can redistribute it and/or |
||||||
|
// modify it under the terms of the GNU General Public License version 3. |
||||||
|
// |
||||||
|
// OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows: |
||||||
|
// Copyright (C) 2006-2013 Jean-Philippe Lang |
||||||
|
// Copyright (C) 2010-2013 the ChiliProject Team |
||||||
|
// |
||||||
|
// This program is free software; you can redistribute it and/or |
||||||
|
// modify it under the terms of the GNU General Public License |
||||||
|
// as published by the Free Software Foundation; either version 2 |
||||||
|
// of the License, or (at your option) any later version. |
||||||
|
// |
||||||
|
// This program is distributed in the hope that it will be useful, |
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||||
|
// GNU General Public License for more details. |
||||||
|
// |
||||||
|
// You should have received a copy of the GNU General Public License |
||||||
|
// along with this program; if not, write to the Free Software |
||||||
|
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
||||||
|
// |
||||||
|
// See doc/COPYRIGHT.rdoc for more details. |
||||||
|
//++ |
||||||
|
|
||||||
|
@include breakpoint(680px down) |
||||||
|
html |
||||||
|
min-width: 0 !important |
||||||
|
|
||||||
|
body |
||||||
|
overflow: auto !important |
||||||
|
overflow-y: scroll /* has to be scroll, not auto */ |
||||||
|
-webkit-overflow-scrolling: touch |
||||||
|
|
||||||
|
#main, |
||||||
|
#content |
||||||
|
padding-bottom: 0 !important |
||||||
|
position: relative !important |
||||||
|
top: 0 !important |
||||||
|
|
||||||
|
#main |
||||||
|
overflow: visible |
||||||
|
|
||||||
|
#header |
||||||
|
min-width: 0 !important |
||||||
|
|
||||||
|
#wrapper |
||||||
|
background: #fff !important |
||||||
|
|
||||||
|
#content |
||||||
|
height: 100% !important |
||||||
|
margin: 0 !important |
||||||
|
padding: 20px !important |
||||||
|
width: 100% !important |
||||||
|
|
||||||
|
#main-menu, |
||||||
|
#breadcrumb |
||||||
|
display: none !important |
||||||
|
|
||||||
|
h2 |
||||||
|
font-size: 1.4rem |
||||||
|
|
||||||
|
.hidden-for-mobile |
||||||
|
display: none !important |
||||||
|
|
||||||
|
.jstElements |
||||||
|
display: none |
@ -0,0 +1,41 @@ |
|||||||
|
//-- copyright |
||||||
|
// OpenProject is a project management system. |
||||||
|
// Copyright (C) 2012-2015 the OpenProject Foundation (OPF) |
||||||
|
// |
||||||
|
// This program is free software; you can redistribute it and/or |
||||||
|
// modify it under the terms of the GNU General Public License version 3. |
||||||
|
// |
||||||
|
// OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows: |
||||||
|
// Copyright (C) 2006-2013 Jean-Philippe Lang |
||||||
|
// Copyright (C) 2010-2013 the ChiliProject Team |
||||||
|
// |
||||||
|
// This program is free software; you can redistribute it and/or |
||||||
|
// modify it under the terms of the GNU General Public License |
||||||
|
// as published by the Free Software Foundation; either version 2 |
||||||
|
// of the License, or (at your option) any later version. |
||||||
|
// |
||||||
|
// This program is distributed in the hope that it will be useful, |
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||||
|
// GNU General Public License for more details. |
||||||
|
// |
||||||
|
// You should have received a copy of the GNU General Public License |
||||||
|
// along with this program; if not, write to the Free Software |
||||||
|
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
||||||
|
// |
||||||
|
// See doc/COPYRIGHT.rdoc for more details. |
||||||
|
//++ |
||||||
|
|
||||||
|
// Styles taken from jquery-dropdown plugin: |
||||||
|
// https://github.com/plapier/jquery-dropdown |
||||||
|
// (dual MIT/GPL-Licensed) |
||||||
|
|
||||||
|
@include breakpoint(680px down) |
||||||
|
.dropdown .dropdown-menu, |
||||||
|
.toolbar .legacy-actions-more |
||||||
|
LI > A, |
||||||
|
LABEL |
||||||
|
padding: 8px 13px 8px 10px |
||||||
|
|
||||||
|
.dropdown .dropdown-menu |
||||||
|
min-width: 0 |
@ -0,0 +1,87 @@ |
|||||||
|
//-- copyright |
||||||
|
// OpenProject is a project management system. |
||||||
|
// Copyright (C) 2012-2015 the OpenProject Foundation (OPF) |
||||||
|
// |
||||||
|
// This program is free software; you can redistribute it and/or |
||||||
|
// modify it under the terms of the GNU General Public License version 3. |
||||||
|
// |
||||||
|
// OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows: |
||||||
|
// Copyright (C) 2006-2013 Jean-Philippe Lang |
||||||
|
// Copyright (C) 2010-2013 the ChiliProject Team |
||||||
|
// |
||||||
|
// This program is free software; you can redistribute it and/or |
||||||
|
// modify it under the terms of the GNU General Public License |
||||||
|
// as published by the Free Software Foundation; either version 2 |
||||||
|
// of the License, or (at your option) any later version. |
||||||
|
// |
||||||
|
// This program is distributed in the hope that it will be useful, |
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||||
|
// GNU General Public License for more details. |
||||||
|
// |
||||||
|
// You should have received a copy of the GNU General Public License |
||||||
|
// along with this program; if not, write to the Free Software |
||||||
|
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
||||||
|
// |
||||||
|
// See doc/COPYRIGHT.rdoc for more details. |
||||||
|
//++ |
||||||
|
|
||||||
|
@include breakpoint(680px down) |
||||||
|
#logo |
||||||
|
background-color: transparent |
||||||
|
|
||||||
|
#top-menu |
||||||
|
position: relative !important |
||||||
|
|
||||||
|
#nav-login-content |
||||||
|
float: none |
||||||
|
padding: 15px 20px |
||||||
|
width: 100% |
||||||
|
|
||||||
|
.grid-block |
||||||
|
display: block |
||||||
|
|
||||||
|
.form--field |
||||||
|
padding-right: 0 |
||||||
|
|
||||||
|
.login-auth-providers |
||||||
|
width: 100% !important |
||||||
|
white-space: normal |
||||||
|
|
||||||
|
h3.login-auth-providers-title:before |
||||||
|
border: none !important |
||||||
|
|
||||||
|
.button |
||||||
|
margin-right: 0 |
||||||
|
|
||||||
|
#account-nav-right |
||||||
|
> li |
||||||
|
display: none |
||||||
|
|
||||||
|
&.drop-down |
||||||
|
display: block |
||||||
|
|
||||||
|
> a |
||||||
|
display: block |
||||||
|
padding: 0 |
||||||
|
position: relative |
||||||
|
text-indent: -10000px |
||||||
|
width: 68px |
||||||
|
|
||||||
|
&:after |
||||||
|
content: "\e0d0" !important |
||||||
|
display: block |
||||||
|
font-size: 1.5rem !important |
||||||
|
position: absolute |
||||||
|
right: 20px |
||||||
|
text-indent: 0 |
||||||
|
top: 16px |
||||||
|
z-index: 1000 |
||||||
|
|
||||||
|
+ ul |
||||||
|
width: 100vw |
||||||
|
box-shadow: 1px 1px 4px #cccccc |
||||||
|
border: solid 1px rgba(0, 0, 0, 0.2) |
||||||
|
|
||||||
|
li |
||||||
|
max-width: none |
@ -0,0 +1,195 @@ |
|||||||
|
//-- copyright |
||||||
|
// OpenProject is a project management system. |
||||||
|
// Copyright (C) 2012-2015 the OpenProject Foundation (OPF) |
||||||
|
// |
||||||
|
// This program is free software; you can redistribute it and/or |
||||||
|
// modify it under the terms of the GNU General Public License version 3. |
||||||
|
// |
||||||
|
// OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows: |
||||||
|
// Copyright (C) 2006-2013 Jean-Philippe Lang |
||||||
|
// Copyright (C) 2010-2013 the ChiliProject Team |
||||||
|
// |
||||||
|
// This program is free software; you can redistribute it and/or |
||||||
|
// modify it under the terms of the GNU General Public License |
||||||
|
// as published by the Free Software Foundation; either version 2 |
||||||
|
// of the License, or (at your option) any later version. |
||||||
|
// |
||||||
|
// This program is distributed in the hope that it will be useful, |
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||||
|
// GNU General Public License for more details. |
||||||
|
// |
||||||
|
// You should have received a copy of the GNU General Public License |
||||||
|
// along with this program; if not, write to the Free Software |
||||||
|
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
||||||
|
// |
||||||
|
// See doc/COPYRIGHT.rdoc for more details. |
||||||
|
//++ |
||||||
|
|
||||||
|
@include breakpoint(680px down) |
||||||
|
body.controller-work_packages |
||||||
|
|
||||||
|
&.action-show #content |
||||||
|
overflow: visible |
||||||
|
|
||||||
|
.toolbar-container |
||||||
|
margin-bottom: 4px |
||||||
|
min-height: 0 |
||||||
|
|
||||||
|
.work-packages--show-view |
||||||
|
padding: 0 |
||||||
|
|
||||||
|
#toolbar-items |
||||||
|
background: #fff |
||||||
|
display: flex |
||||||
|
margin-bottom: 20px |
||||||
|
width: calc(100% + 5px) |
||||||
|
|
||||||
|
> li |
||||||
|
-webkit-flex: 1 0 0 |
||||||
|
flex: 1 0 0 |
||||||
|
|
||||||
|
&:first-child |
||||||
|
-webkit-flex: 3 0 0 |
||||||
|
flex: 3 0 0 |
||||||
|
|
||||||
|
button |
||||||
|
width: 100% |
||||||
|
|
||||||
|
.wp-create-button .dropdown |
||||||
|
left: 0 !important |
||||||
|
|
||||||
|
.action_menu_main .dropdown |
||||||
|
left: auto !important |
||||||
|
|
||||||
|
.work-packages--split-view |
||||||
|
display: block |
||||||
|
left: 0 |
||||||
|
padding: 0 |
||||||
|
position: relative |
||||||
|
right: 0 |
||||||
|
top: 0 |
||||||
|
|
||||||
|
.tabrow |
||||||
|
height: auto |
||||||
|
margin: 0.75rem 0 2.5rem 0 |
||||||
|
|
||||||
|
a |
||||||
|
color: $content-link-color |
||||||
|
|
||||||
|
li |
||||||
|
border-top: 2px solid $gray |
||||||
|
font-size: 0.75rem |
||||||
|
margin: 0 |
||||||
|
padding: 8px 0 |
||||||
|
width: 33.33% |
||||||
|
|
||||||
|
&.selected |
||||||
|
border-bottom: 2px solid $content-link-color |
||||||
|
|
||||||
|
.subject-header |
||||||
|
margin: 0 |
||||||
|
padding: 0 |
||||||
|
|
||||||
|
.work-packages--left-panel, |
||||||
|
.work-packages--right-panel |
||||||
|
border: none |
||||||
|
margin: 0 |
||||||
|
min-width: 0 |
||||||
|
overflow: visible |
||||||
|
width: 100% |
||||||
|
|
||||||
|
// Fix for iOS: Otherwise the edit actions toolbar is misplaced |
||||||
|
padding: 0 0 50px 0 |
||||||
|
|
||||||
|
.work-packages--panel-inner |
||||||
|
padding: 0 |
||||||
|
|
||||||
|
&.edit-all-mode |
||||||
|
.work-packages--right-panel |
||||||
|
display: none |
||||||
|
|
||||||
|
.attributes-key-value--key, |
||||||
|
.attributes-key-value--value-container |
||||||
|
@include grid-size(6) |
||||||
|
font-size: 1rem |
||||||
|
margin-bottom: 20px |
||||||
|
|
||||||
|
.inplace-edit--read-value |
||||||
|
padding: 0 |
||||||
|
|
||||||
|
.inplace-editing--container |
||||||
|
border: none |
||||||
|
|
||||||
|
.attributes-key-value--key |
||||||
|
padding: 0 !important |
||||||
|
|
||||||
|
.work-packages--panel-inner > .attributes-group:first-child |
||||||
|
.attributes-group--header |
||||||
|
border-bottom: none |
||||||
|
padding-top: 4px |
||||||
|
|
||||||
|
// Reset margin for mobile, since the wiki toolbar is hidden on mobile |
||||||
|
.inplace-edit.attribute-description |
||||||
|
.inplace-edit--write |
||||||
|
margin-top: 0 |
||||||
|
|
||||||
|
div[class*='work-packages--details--'] |
||||||
|
width: 100% |
||||||
|
|
||||||
|
.inplace-edit--read-value span |
||||||
|
overflow: visible |
||||||
|
white-space: normal |
||||||
|
|
||||||
|
.work-packages--left-panel |
||||||
|
.work-packages--edit-actions |
||||||
|
bottom: -20px |
||||||
|
width: calc(100vw + 20px) |
||||||
|
|
||||||
|
// Stretch description to fullwidth |
||||||
|
.inplace-edit--icon-wrapper |
||||||
|
display: none |
||||||
|
|
||||||
|
.work-package-details-activities-messages |
||||||
|
font-size: 0.9rem |
||||||
|
|
||||||
|
.work-package--new-state |
||||||
|
margin-bottom: 0 |
||||||
|
overflow: visible |
||||||
|
padding-right: 0 |
||||||
|
|
||||||
|
.work-packages--edit-actions |
||||||
|
bottom: 0px !important |
||||||
|
width: calc(100vw + 20px) !important |
||||||
|
|
||||||
|
.detail-panel-description-content .relation h3 |
||||||
|
margin: 0 !important |
||||||
|
padding: 8px 0 !important |
||||||
|
font-size: 1rem |
||||||
|
|
||||||
|
// Work packages list view |
||||||
|
|
||||||
|
.work-packages--page-container |
||||||
|
.toolbar |
||||||
|
padding: 0 |
||||||
|
|
||||||
|
.title-container |
||||||
|
max-width: 40% |
||||||
|
overflow: hidden |
||||||
|
|
||||||
|
span |
||||||
|
display: block |
||||||
|
|
||||||
|
a span span |
||||||
|
overflow: hidden |
||||||
|
text-overflow: ellipsis |
||||||
|
white-space: nowrap |
||||||
|
|
||||||
|
> .work-packages--split-view |
||||||
|
display: block |
||||||
|
|
||||||
|
.work-packages--list-table-area |
||||||
|
position: relative |
||||||
|
|
||||||
|
.work-packages--list |
||||||
|
padding-bottom: 55px |
@ -0,0 +1,83 @@ |
|||||||
|
// -- copyright
|
||||||
|
// OpenProject is a project management system.
|
||||||
|
// Copyright (C) 2012-2015 the OpenProject Foundation (OPF)
|
||||||
|
//
|
||||||
|
// This program is free software; you can redistribute it and/or
|
||||||
|
// modify it under the terms of the GNU General Public License version 3.
|
||||||
|
//
|
||||||
|
// OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
|
||||||
|
// Copyright (C) 2006-2013 Jean-Philippe Lang
|
||||||
|
// Copyright (C) 2010-2013 the ChiliProject Team
|
||||||
|
//
|
||||||
|
// This program is free software; you can redistribute it and/or
|
||||||
|
// modify it under the terms of the GNU General Public License
|
||||||
|
// as published by the Free Software Foundation; either version 2
|
||||||
|
// of the License, or (at your option) any later version.
|
||||||
|
//
|
||||||
|
// This program is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
// GNU General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU General Public License
|
||||||
|
// along with this program; if not, write to the Free Software
|
||||||
|
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
//
|
||||||
|
// See doc/COPYRIGHT.rdoc for more details.
|
||||||
|
// ++
|
||||||
|
|
||||||
|
import {ResponsiveView} from './responsive-view.service'; |
||||||
|
|
||||||
|
var expect = chai.expect; |
||||||
|
|
||||||
|
describe('responsiveView service', () => { |
||||||
|
describe('isSmall method', () => { |
||||||
|
var responsiveView; |
||||||
|
var $window = { |
||||||
|
innerWidth: 0 |
||||||
|
}; |
||||||
|
|
||||||
|
beforeEach(() => { |
||||||
|
angular.mock.module('openproject.responsive', ($provide) => { |
||||||
|
$provide.value('$window', $window); |
||||||
|
}); |
||||||
|
|
||||||
|
angular.mock.inject((_responsiveView_: ResponsiveView) => { |
||||||
|
responsiveView = _responsiveView_; |
||||||
|
$window.innerWidth = responsiveView.small; |
||||||
|
}); |
||||||
|
}); |
||||||
|
|
||||||
|
it('should return true if the window size is less than the "small" value', () => { |
||||||
|
$window.innerWidth -= 10; |
||||||
|
expect(responsiveView.isSmall()).to.be.true; |
||||||
|
}); |
||||||
|
|
||||||
|
it('should return false if the window width is greater than the "small" value', () => { |
||||||
|
$window.innerWidth += 10; |
||||||
|
expect(responsiveView.isSmall()).to.be.false; |
||||||
|
}) |
||||||
|
}); |
||||||
|
|
||||||
|
describe('onResize method', () => { |
||||||
|
var responsiveView, $window; |
||||||
|
|
||||||
|
beforeEach(() => { |
||||||
|
angular.mock.module('openproject.responsive'); |
||||||
|
|
||||||
|
angular.mock.inject((_responsiveView_:ResponsiveView, _$window_:ng.IWindowService) => { |
||||||
|
responsiveView = _responsiveView_; |
||||||
|
$window = _$window_; |
||||||
|
}); |
||||||
|
}); |
||||||
|
|
||||||
|
it('should execute the given callback', () => { |
||||||
|
var callback = sinon.stub(); |
||||||
|
|
||||||
|
responsiveView.onResize(callback); |
||||||
|
angular.element($window).trigger('resize'); |
||||||
|
|
||||||
|
expect(callback.calledOnce).to.be.true; |
||||||
|
}); |
||||||
|
}); |
||||||
|
}); |
@ -0,0 +1,46 @@ |
|||||||
|
// -- copyright
|
||||||
|
// OpenProject is a project management system.
|
||||||
|
// Copyright (C) 2012-2015 the OpenProject Foundation (OPF)
|
||||||
|
//
|
||||||
|
// This program is free software; you can redistribute it and/or
|
||||||
|
// modify it under the terms of the GNU General Public License version 3.
|
||||||
|
//
|
||||||
|
// OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
|
||||||
|
// Copyright (C) 2006-2013 Jean-Philippe Lang
|
||||||
|
// Copyright (C) 2010-2013 the ChiliProject Team
|
||||||
|
//
|
||||||
|
// This program is free software; you can redistribute it and/or
|
||||||
|
// modify it under the terms of the GNU General Public License
|
||||||
|
// as published by the Free Software Foundation; either version 2
|
||||||
|
// of the License, or (at your option) any later version.
|
||||||
|
//
|
||||||
|
// This program is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
// GNU General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU General Public License
|
||||||
|
// along with this program; if not, write to the Free Software
|
||||||
|
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
//
|
||||||
|
// See doc/COPYRIGHT.rdoc for more details.
|
||||||
|
// ++
|
||||||
|
|
||||||
|
export class ResponsiveView { |
||||||
|
|
||||||
|
public small: number = 680; |
||||||
|
|
||||||
|
constructor(public $window: ng.IWindowService) {} |
||||||
|
|
||||||
|
public isSmall(): boolean { |
||||||
|
return this.$window.innerWidth <= this.small; |
||||||
|
} |
||||||
|
|
||||||
|
public onResize(callback) { |
||||||
|
angular.element(this.$window).on('resize', callback); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
angular |
||||||
|
.module('openproject.responsive') |
||||||
|
.service('responsiveView', ResponsiveView); |
@ -0,0 +1,274 @@ |
|||||||
|
// -- copyright
|
||||||
|
// OpenProject is a project management system.
|
||||||
|
// Copyright (C) 2012-2015 the OpenProject Foundation (OPF)
|
||||||
|
//
|
||||||
|
// This program is free software; you can redistribute it and/or
|
||||||
|
// modify it under the terms of the GNU General Public License version 3.
|
||||||
|
//
|
||||||
|
// OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
|
||||||
|
// Copyright (C) 2006-2013 Jean-Philippe Lang
|
||||||
|
// Copyright (C) 2010-2013 the ChiliProject Team
|
||||||
|
//
|
||||||
|
// This program is free software; you can redistribute it and/or
|
||||||
|
// modify it under the terms of the GNU General Public License
|
||||||
|
// as published by the Free Software Foundation; either version 2
|
||||||
|
// of the License, or (at your option) any later version.
|
||||||
|
//
|
||||||
|
// This program is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
// GNU General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU General Public License
|
||||||
|
// along with this program; if not, write to the Free Software
|
||||||
|
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
//
|
||||||
|
// See doc/COPYRIGHT.rdoc for more details.
|
||||||
|
// ++
|
||||||
|
|
||||||
|
interface LocationService extends angular.ILocationService { |
||||||
|
$$rewrite(href: string): string; |
||||||
|
$$parse(url: string): string; |
||||||
|
} |
||||||
|
|
||||||
|
interface BrowserService extends angular.IBrowserService { |
||||||
|
url(): string; |
||||||
|
} |
||||||
|
|
||||||
|
interface WindowService extends angular.IWindowService { |
||||||
|
angular: angular.IAngularStatic; |
||||||
|
} |
||||||
|
|
||||||
|
angular |
||||||
|
.module('openproject') |
||||||
|
.config(($stateProvider: ng.ui.IStateProvider, $urlRouterProvider: ng.ui.IUrlRouterProvider, |
||||||
|
$urlMatcherFactoryProvider: ng.ui.IUrlMatcherFactory) => { |
||||||
|
|
||||||
|
$urlRouterProvider.when('/work_packages/', '/work_packages'); |
||||||
|
$urlMatcherFactoryProvider.strictMode(false); |
||||||
|
|
||||||
|
var panels = { |
||||||
|
get watchers() { |
||||||
|
return { |
||||||
|
url: '/watchers', |
||||||
|
template: '<watchers-panel work-package="workPackage"></watchers-panel>' |
||||||
|
} |
||||||
|
}, |
||||||
|
|
||||||
|
get activity() { |
||||||
|
return { |
||||||
|
url: '/activity', |
||||||
|
template: '<activity-panel work-package="workPackage"></activity-panel>' |
||||||
|
} |
||||||
|
}, |
||||||
|
|
||||||
|
get activityDetails() { |
||||||
|
var activity = this.activity; |
||||||
|
activity.url = '#{activity_no:\d+}'; |
||||||
|
|
||||||
|
return activity; |
||||||
|
}, |
||||||
|
|
||||||
|
get relations() { |
||||||
|
return { |
||||||
|
url: '/relations', |
||||||
|
templateUrl: '/templates/work_packages/tabs/relations.html' |
||||||
|
}; |
||||||
|
} |
||||||
|
}; |
||||||
|
|
||||||
|
$stateProvider |
||||||
|
.state('work-packages', { |
||||||
|
url: '', |
||||||
|
abstract: true, |
||||||
|
templateUrl: '/components/routing/views/work-packages.html', |
||||||
|
controller: 'WorkPackagesController', |
||||||
|
resolve: { |
||||||
|
latestTab: ($state) => { |
||||||
|
var stateName = 'work-packages.list.details.overview'; // the default tab
|
||||||
|
|
||||||
|
return { |
||||||
|
getStateName: () => { |
||||||
|
return stateName; |
||||||
|
}, |
||||||
|
registerState: () => { |
||||||
|
stateName = $state.current.name; |
||||||
|
} |
||||||
|
}; |
||||||
|
} |
||||||
|
} |
||||||
|
}) |
||||||
|
|
||||||
|
.state('work-packages.new', { |
||||||
|
url: '/{projects}/{projectPath}/work_packages/new?type&parent_id', |
||||||
|
templateUrl: '/components/routing/views/work-packages.new.html', |
||||||
|
reloadOnSearch: false |
||||||
|
}) |
||||||
|
|
||||||
|
.state('work-packages.copy', { |
||||||
|
url: '/work_packages/{copiedFromWorkPackageId:[0-9]+}/copy', |
||||||
|
templateUrl: '/components/routing/views/work-packages.new.html' |
||||||
|
}) |
||||||
|
|
||||||
|
.state('work-packages.edit', { |
||||||
|
url: '/{projects}/{projectPath}/work_packages/{workPackageId}/edit', |
||||||
|
params: { |
||||||
|
projectPath: {value: null, squash: true}, |
||||||
|
projects: {value: null, squash: true} |
||||||
|
}, |
||||||
|
|
||||||
|
onEnter: ($state, $stateParams, inplaceEditAll) => { |
||||||
|
inplaceEditAll.start(); |
||||||
|
$state.go('work-packages.list.details.overview', $stateParams); |
||||||
|
} |
||||||
|
}) |
||||||
|
|
||||||
|
.state('work-packages.show', { |
||||||
|
url: '/work_packages/{workPackageId:[0-9]+}?query_props', |
||||||
|
templateUrl: '/components/routing/views/work-packages.show.html', |
||||||
|
controller: 'WorkPackageShowController', |
||||||
|
controllerAs: 'vm', |
||||||
|
resolve: { |
||||||
|
workPackage: (WorkPackageService, $stateParams) => { |
||||||
|
return WorkPackageService.getWorkPackage($stateParams.workPackageId); |
||||||
|
}, |
||||||
|
// TODO hack, get rid of latestTab in ShowController
|
||||||
|
latestTab: ($state) => { |
||||||
|
var stateName = 'work-package.overview'; // the default tab
|
||||||
|
|
||||||
|
return { |
||||||
|
getStateName: () => { |
||||||
|
return stateName; |
||||||
|
}, |
||||||
|
registerState: () => { |
||||||
|
stateName = $state.current.name; |
||||||
|
} |
||||||
|
}; |
||||||
|
} |
||||||
|
}, |
||||||
|
// HACK
|
||||||
|
// This is to avoid problems with the css depending on which page the
|
||||||
|
// browser starts from (deep-link). As we have CSS rules that change the
|
||||||
|
// layout drastically when on the show action (e.g. position: relative)
|
||||||
|
// and this should not be applied to the other states, we need to remove
|
||||||
|
// the trigger used in the CSS. The correct fix would be to alter the
|
||||||
|
// CSS.
|
||||||
|
onEnter: ($state, $timeout) => { |
||||||
|
angular.element('body').addClass('action-show'); |
||||||
|
|
||||||
|
$timeout(() => { |
||||||
|
if ($state.is('work-packages.show')) { |
||||||
|
$state.go('work-packages.show.activity'); |
||||||
|
} |
||||||
|
}); |
||||||
|
}, |
||||||
|
|
||||||
|
onExit: () => { |
||||||
|
angular.element('body').removeClass('action-show'); |
||||||
|
} |
||||||
|
}) |
||||||
|
.state('work-packages.show.activity', panels.activity) |
||||||
|
.state('work-packages.show.activity.details', panels.activityDetails) |
||||||
|
.state('work-packages.show.relations', panels.relations) |
||||||
|
.state('work-packages.show.watchers', panels.watchers) |
||||||
|
|
||||||
|
.state('work-packages.list', { |
||||||
|
url: '/{projects}/{projectPath}/work_packages?query_id&query_props', |
||||||
|
controller: 'WorkPackagesListController', |
||||||
|
templateUrl: '/components/routing/views/work-packages.list.html', |
||||||
|
params: { |
||||||
|
// value: null makes the parameter optional
|
||||||
|
// squash: true avoids duplicate slashes when the paramter is not provided
|
||||||
|
projectPath: {value: null, squash: true}, |
||||||
|
projects: {value: null, squash: true} |
||||||
|
}, |
||||||
|
reloadOnSearch: false, |
||||||
|
// HACK
|
||||||
|
// This is to avoid problems with the css depending on which page the
|
||||||
|
// browser starts from (deep-link). As we have CSS rules that change the
|
||||||
|
// layout drastically when on the index action (e.g. position: absolute,
|
||||||
|
// heigt of footer, ...), and this should not be applied to the other
|
||||||
|
// states, we need to remove the trigger used in the CSS The correct fix
|
||||||
|
// would be to alter the CSS.
|
||||||
|
onEnter: () => { |
||||||
|
angular.element('body').addClass('action-index'); |
||||||
|
}, |
||||||
|
onExit: () => { |
||||||
|
angular.element('body').removeClass('action-index'); |
||||||
|
} |
||||||
|
}) |
||||||
|
.state('work-packages.list.new', { |
||||||
|
url: '/create_new?type&parent_id', |
||||||
|
templateUrl: '/components/routing/views/work-packages.list.new.html', |
||||||
|
reloadOnSearch: false |
||||||
|
}) |
||||||
|
.state('work-packages.list.copy', { |
||||||
|
url: '/details/{copiedFromWorkPackageId:[0-9]+}/copy', |
||||||
|
templateUrl: '/components/routing/views/work-packages.list.new.html', |
||||||
|
reloadOnSearch: false |
||||||
|
}) |
||||||
|
.state('work-packages.list.details', { |
||||||
|
url: '/details/{workPackageId:[0-9]+}', |
||||||
|
templateUrl: '/components/routing/views/work-packages.list.details.html', |
||||||
|
controller: 'WorkPackageDetailsController', |
||||||
|
reloadOnSearch: false, |
||||||
|
resolve: { |
||||||
|
workPackage: (WorkPackageService, $stateParams) => { |
||||||
|
return WorkPackageService.getWorkPackage($stateParams.workPackageId); |
||||||
|
} |
||||||
|
} |
||||||
|
}) |
||||||
|
.state('work-packages.list.details.overview', { |
||||||
|
url: '/overview', |
||||||
|
templateUrl: '/templates/work_packages/tabs/overview.html', |
||||||
|
controller: 'DetailsTabOverviewController', |
||||||
|
controllerAs: 'vm', |
||||||
|
}) |
||||||
|
.state('work-packages.list.details.activity', panels.activity) |
||||||
|
.state('work-packages.list.details.activity.details', panels.activityDetails) |
||||||
|
.state('work-packages.list.details.relations', panels.relations) |
||||||
|
.state('work-packages.list.details.watchers', panels.watchers); |
||||||
|
}) |
||||||
|
|
||||||
|
.run(($location: LocationService, $rootElement: ng.IRootElementService, |
||||||
|
$browser: BrowserService, $rootScope: ng.IRootScopeService, $state: ng.ui.IStateService, |
||||||
|
$window: WindowService) => { |
||||||
|
|
||||||
|
// Our application is still a hybrid one, meaning most routes are still
|
||||||
|
// handled by Rails. As such, we disable the default link-hijacking that
|
||||||
|
// Angular's HTML5-mode turns on.
|
||||||
|
$rootElement.off('click'); |
||||||
|
$rootElement.on('click', 'a[data-ui-route]', (event) => { |
||||||
|
if (!jQuery('body').has('div[ui-view]').length || event.ctrlKey || event.metaKey |
||||||
|
|| event.which === 2) { |
||||||
|
|
||||||
|
return; |
||||||
|
} |
||||||
|
|
||||||
|
// NOTE: making use of event delegation, thus jQuery-only.
|
||||||
|
var elm = jQuery(event.target); |
||||||
|
var absHref = elm.prop('href'); |
||||||
|
var rewrittenUrl = $location.$$rewrite(absHref); |
||||||
|
|
||||||
|
if (absHref && !elm.attr('target') && rewrittenUrl && !event.isDefaultPrevented()) { |
||||||
|
event.preventDefault(); |
||||||
|
|
||||||
|
if (rewrittenUrl !== $browser.url()) { |
||||||
|
// update location manually
|
||||||
|
$location.$$parse(rewrittenUrl); |
||||||
|
$rootScope.$apply(); |
||||||
|
|
||||||
|
// hack to work around FF6 bug 684208 when scenario runner clicks on links
|
||||||
|
$window.angular['ff-684208-preventDefault'] = true; |
||||||
|
} |
||||||
|
} |
||||||
|
}); |
||||||
|
|
||||||
|
$rootScope.$on('$stateChangeStart', (event, toState, toParams) => { |
||||||
|
if (!toParams.projects && toParams.projectPath) { |
||||||
|
toParams.projects = 'projects'; |
||||||
|
$state.go(toState, toParams); |
||||||
|
} |
||||||
|
}); |
||||||
|
} |
||||||
|
); |
@ -1,5 +1,3 @@ |
|||||||
<div id="work-packages-index"> |
<div id="work-packages-index"> |
||||||
|
|
||||||
<div ui-view class="work-packages--page-container"></div> |
<div ui-view class="work-packages--page-container"></div> |
||||||
|
|
||||||
</div> |
</div> |
@ -0,0 +1,41 @@ |
|||||||
|
// -- copyright
|
||||||
|
// OpenProject is a project management system.
|
||||||
|
// Copyright (C) 2012-2015 the OpenProject Foundation (OPF)
|
||||||
|
//
|
||||||
|
// This program is free software; you can redistribute it and/or
|
||||||
|
// modify it under the terms of the GNU General Public License version 3.
|
||||||
|
//
|
||||||
|
// OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
|
||||||
|
// Copyright (C) 2006-2013 Jean-Philippe Lang
|
||||||
|
// Copyright (C) 2010-2013 the ChiliProject Team
|
||||||
|
//
|
||||||
|
// This program is free software; you can redistribute it and/or
|
||||||
|
// modify it under the terms of the GNU General Public License
|
||||||
|
// as published by the Free Software Foundation; either version 2
|
||||||
|
// of the License, or (at your option) any later version.
|
||||||
|
//
|
||||||
|
// This program is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
// GNU General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU General Public License
|
||||||
|
// along with this program; if not, write to the Free Software
|
||||||
|
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
//
|
||||||
|
// See doc/COPYRIGHT.rdoc for more details.
|
||||||
|
// ++
|
||||||
|
|
||||||
|
angular |
||||||
|
.module('openproject.uiComponents') |
||||||
|
.directive('wpToolbar', wpToolbar); |
||||||
|
|
||||||
|
function wpToolbar(): ng.IDirective { |
||||||
|
return { |
||||||
|
restrict: 'A', |
||||||
|
|
||||||
|
link: function(scope: ng.IScope, element: ng.IAugmentedJQuery) { |
||||||
|
|
||||||
|
} |
||||||
|
}; |
||||||
|
} |
@ -1,265 +0,0 @@ |
|||||||
//-- copyright
|
|
||||||
// OpenProject is a project management system.
|
|
||||||
// Copyright (C) 2012-2015 the OpenProject Foundation (OPF)
|
|
||||||
//
|
|
||||||
// This program is free software; you can redistribute it and/or
|
|
||||||
// modify it under the terms of the GNU General Public License version 3.
|
|
||||||
//
|
|
||||||
// OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
|
|
||||||
// Copyright (C) 2006-2013 Jean-Philippe Lang
|
|
||||||
// Copyright (C) 2010-2013 the ChiliProject Team
|
|
||||||
//
|
|
||||||
// This program is free software; you can redistribute it and/or
|
|
||||||
// modify it under the terms of the GNU General Public License
|
|
||||||
// as published by the Free Software Foundation; either version 2
|
|
||||||
// of the License, or (at your option) any later version.
|
|
||||||
//
|
|
||||||
// This program is distributed in the hope that it will be useful,
|
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
// GNU General Public License for more details.
|
|
||||||
//
|
|
||||||
// You should have received a copy of the GNU General Public License
|
|
||||||
// along with this program; if not, write to the Free Software
|
|
||||||
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
||||||
//
|
|
||||||
// See doc/COPYRIGHT.rdoc for more details.
|
|
||||||
//++
|
|
||||||
|
|
||||||
angular.module('openproject') |
|
||||||
|
|
||||||
.config([ |
|
||||||
'$stateProvider', |
|
||||||
'$urlRouterProvider', |
|
||||||
'$urlMatcherFactoryProvider', |
|
||||||
function($stateProvider, $urlRouterProvider, $urlMatcherFactoryProvider) { |
|
||||||
|
|
||||||
$urlRouterProvider.when('/work_packages/', '/work_packages'); |
|
||||||
$urlMatcherFactoryProvider.strictMode(false); |
|
||||||
|
|
||||||
var panels = { |
|
||||||
get watchers() { |
|
||||||
return { |
|
||||||
url: '/watchers', |
|
||||||
template: '<watchers-panel work-package="workPackage"></watchers-panel>' |
|
||||||
} |
|
||||||
}, |
|
||||||
|
|
||||||
get activity() { |
|
||||||
return { |
|
||||||
url: '/activity', |
|
||||||
template: '<activity-panel work-package="workPackage"></activity-panel>' |
|
||||||
} |
|
||||||
}, |
|
||||||
|
|
||||||
get activityDetails() { |
|
||||||
var activity = this.activity; |
|
||||||
activity.url = '#{activity_no:\d+}'; |
|
||||||
|
|
||||||
return activity; |
|
||||||
} |
|
||||||
}; |
|
||||||
|
|
||||||
$stateProvider |
|
||||||
.state('work-packages', { |
|
||||||
url: '', |
|
||||||
abstract: true, |
|
||||||
templateUrl: '/templates/work_packages.html', |
|
||||||
controller: 'WorkPackagesController', |
|
||||||
resolve: { |
|
||||||
latestTab: function($state) { |
|
||||||
var stateName = 'work-packages.list.details.overview'; // the default tab
|
|
||||||
|
|
||||||
return { |
|
||||||
getStateName: function() { |
|
||||||
return stateName; |
|
||||||
}, |
|
||||||
registerState: function() { |
|
||||||
stateName = $state.current.name; |
|
||||||
} |
|
||||||
}; |
|
||||||
} |
|
||||||
} |
|
||||||
}) |
|
||||||
|
|
||||||
.state('work-packages.new', { |
|
||||||
url: '/{projects}/{projectPath}/work_packages/new?type&parent_id', |
|
||||||
templateUrl: '/components/routes/partials/work-packages.new.html', |
|
||||||
controllerAs: 'vm', |
|
||||||
reloadOnSearch: false |
|
||||||
}) |
|
||||||
|
|
||||||
.state('work-packages.copy', { |
|
||||||
url: '/work_packages/{copiedFromWorkPackageId:[0-9]+}/copy', |
|
||||||
templateUrl: '/components/routes/partials/work-packages.new.html' |
|
||||||
}) |
|
||||||
|
|
||||||
.state('work-packages.edit', { |
|
||||||
url: '/{projects}/{projectPath}/work_packages/{workPackageId}/edit', |
|
||||||
params: { |
|
||||||
projectPath: { value: null, squash: true }, |
|
||||||
projects: { value: null, squash: true } |
|
||||||
}, |
|
||||||
|
|
||||||
onEnter: function ($state, $stateParams, inplaceEditAll) { |
|
||||||
inplaceEditAll.start(); |
|
||||||
$state.go('work-packages.list.details.overview', $stateParams); |
|
||||||
} |
|
||||||
}) |
|
||||||
|
|
||||||
.state('work-packages.show', { |
|
||||||
url: '/work_packages/{workPackageId:[0-9]+}?query_props', |
|
||||||
templateUrl: '/components/routes/partials/work-packages.show.html', |
|
||||||
controller: 'WorkPackageShowController', |
|
||||||
controllerAs: 'vm', |
|
||||||
resolve: { |
|
||||||
workPackage: function(WorkPackageService, $stateParams) { |
|
||||||
return WorkPackageService.getWorkPackage($stateParams.workPackageId); |
|
||||||
}, |
|
||||||
// TODO hack, get rid of latestTab in ShowController
|
|
||||||
latestTab: function($state) { |
|
||||||
var stateName = 'work-package.overview'; // the default tab
|
|
||||||
|
|
||||||
return { |
|
||||||
getStateName: function() { |
|
||||||
return stateName; |
|
||||||
}, |
|
||||||
registerState: function() { |
|
||||||
stateName = $state.current.name; |
|
||||||
} |
|
||||||
}; |
|
||||||
} |
|
||||||
}, |
|
||||||
// HACK
|
|
||||||
// This is to avoid problems with the css depending on which page the
|
|
||||||
// browser starts from (deep-link). As we have CSS rules that change the
|
|
||||||
// layout drastically when on the show action (e.g. position: relative)
|
|
||||||
// and this should not be applied to the other states, we need to remove
|
|
||||||
// the trigger used in the CSS. The correct fix would be to alter the
|
|
||||||
// CSS.
|
|
||||||
onEnter: function($state, $timeout){ |
|
||||||
angular.element('body').addClass('action-show'); |
|
||||||
|
|
||||||
$timeout(function () { |
|
||||||
if ($state.is('work-packages.show')) { |
|
||||||
$state.go('work-packages.show.activity'); |
|
||||||
} |
|
||||||
}); |
|
||||||
}, |
|
||||||
|
|
||||||
onExit: function(){ |
|
||||||
angular.element('body').removeClass('action-show'); |
|
||||||
} |
|
||||||
}) |
|
||||||
.state('work-packages.show.activity', panels.activity) |
|
||||||
.state('work-packages.show.activity.details', panels.activityDetails) |
|
||||||
.state('work-packages.show.relations', { |
|
||||||
url: '/relations', |
|
||||||
templateUrl: '/templates/work_packages/tabs/relations.html' |
|
||||||
}) |
|
||||||
.state('work-packages.show.watchers', panels.watchers) |
|
||||||
|
|
||||||
.state('work-packages.list', { |
|
||||||
url: '/{projects}/{projectPath}/work_packages?query_id&query_props', |
|
||||||
controller: 'WorkPackagesListController', |
|
||||||
templateUrl: '/components/routes/partials/work-packages.list.html', |
|
||||||
params: { |
|
||||||
// value: null makes the parameter optional
|
|
||||||
// squash: true avoids duplicate slashes when the paramter is not provided
|
|
||||||
projectPath: { value: null, squash: true }, |
|
||||||
projects: { value: null, squash: true } |
|
||||||
}, |
|
||||||
reloadOnSearch: false, |
|
||||||
// HACK
|
|
||||||
// This is to avoid problems with the css depending on which page the
|
|
||||||
// browser starts from (deep-link). As we have CSS rules that change the
|
|
||||||
// layout drastically when on the index action (e.g. position: absolute,
|
|
||||||
// heigt of footer, ...), and this should not be applied to the other
|
|
||||||
// states, we need to remove the trigger used in the CSS The correct fix
|
|
||||||
// would be to alter the CSS.
|
|
||||||
onEnter: function(){ |
|
||||||
angular.element('body').addClass('action-index'); |
|
||||||
}, |
|
||||||
onExit: function(){ |
|
||||||
angular.element('body').removeClass('action-index'); |
|
||||||
} |
|
||||||
}) |
|
||||||
.state('work-packages.list.new', { |
|
||||||
url: '/create_new?type&parent_id', |
|
||||||
templateUrl: '/components/routes/partials/work-packages.list.new.html', |
|
||||||
reloadOnSearch: false |
|
||||||
}) |
|
||||||
.state('work-packages.list.copy', { |
|
||||||
url: '/details/{copiedFromWorkPackageId:[0-9]+}/copy', |
|
||||||
templateUrl: '/components/routes/partials/work-packages.list.new.html', |
|
||||||
reloadOnSearch: false |
|
||||||
}) |
|
||||||
.state('work-packages.list.details', { |
|
||||||
url: '/details/{workPackageId:[0-9]+}', |
|
||||||
templateUrl: '/components/routes/partials/work-packages.list.details.html', |
|
||||||
controller: 'WorkPackageDetailsController', |
|
||||||
reloadOnSearch: false, |
|
||||||
resolve: { |
|
||||||
workPackage: function(WorkPackageService, $stateParams) { |
|
||||||
return WorkPackageService.getWorkPackage($stateParams.workPackageId); |
|
||||||
} |
|
||||||
} |
|
||||||
}) |
|
||||||
.state('work-packages.list.details.overview', { |
|
||||||
url: '/overview', |
|
||||||
controller: 'DetailsTabOverviewController', |
|
||||||
templateUrl: '/templates/work_packages/tabs/overview.html', |
|
||||||
controllerAs: 'vm', |
|
||||||
}) |
|
||||||
.state('work-packages.list.details.activity', panels.activity) |
|
||||||
.state('work-packages.list.details.activity.details', panels.activityDetails) |
|
||||||
.state('work-packages.list.details.relations', { |
|
||||||
url: '/relations', |
|
||||||
templateUrl: '/templates/work_packages/tabs/relations.html', |
|
||||||
}) |
|
||||||
.state('work-packages.list.details.watchers', panels.watchers); |
|
||||||
}]) |
|
||||||
|
|
||||||
.run([ |
|
||||||
'$location', |
|
||||||
'$rootElement', |
|
||||||
'$browser', |
|
||||||
'$rootScope', |
|
||||||
'$state', |
|
||||||
function($location, $rootElement, $browser, $rootScope, $state) { |
|
||||||
// Our application is still a hybrid one, meaning most routes are still
|
|
||||||
// handled by Rails. As such, we disable the default link-hijacking that
|
|
||||||
// Angular's HTML5-mode turns on.
|
|
||||||
$rootElement.off('click'); |
|
||||||
$rootElement.on('click', 'a[data-ui-route]', function(event) { |
|
||||||
if (!jQuery('body').has('div[ui-view]').length) { return; } |
|
||||||
if (event.ctrlKey || event.metaKey || event.which === 2) { return; } |
|
||||||
|
|
||||||
// NOTE: making use of event delegation, thus jQuery-only.
|
|
||||||
var elm = jQuery(event.target); |
|
||||||
var absHref = elm.prop('href'); |
|
||||||
var rewrittenUrl = $location.$$rewrite(absHref); |
|
||||||
|
|
||||||
if (absHref && !elm.attr('target') && |
|
||||||
rewrittenUrl && |
|
||||||
!event.isDefaultPrevented()) { |
|
||||||
|
|
||||||
event.preventDefault(); |
|
||||||
if (rewrittenUrl !== $browser.url()) { |
|
||||||
// update location manually
|
|
||||||
$location.$$parse(rewrittenUrl); |
|
||||||
$rootScope.$apply(); |
|
||||||
// hack to work around FF6 bug 684208 when scenario runner clicks on links
|
|
||||||
window.angular['ff-684208-preventDefault'] = true; |
|
||||||
} |
|
||||||
} |
|
||||||
}); |
|
||||||
|
|
||||||
$rootScope.$on('$stateChangeStart', function(event, toState, toParams){ |
|
||||||
if (!toParams.projects && toParams.projectPath) { |
|
||||||
toParams.projects = 'projects'; |
|
||||||
$state.go(toState, toParams); |
|
||||||
} |
|
||||||
}); |
|
||||||
} |
|
||||||
]); |
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue