Skip to content

Commit c618746

Browse files
Edit/Create Projects on page in a popup
1 parent 3130e60 commit c618746

File tree

7 files changed

+244
-78
lines changed

7 files changed

+244
-78
lines changed

app/scripts/controllers/projects.js

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,35 @@ angular.module('openshiftConsole')
109109
onSortChange: update
110110
};
111111

112+
$scope.showNewProjectPanel = false;
113+
114+
$scope.createProject = function() {
115+
$scope.showNewProjectPanel = true;
116+
};
117+
118+
$scope.closeNewProjectPanel = function() {
119+
$scope.showNewProjectPanel = false;
120+
};
121+
122+
$scope.onNewProject = function() {
123+
$scope.showNewProjectPanel = false;
124+
};
125+
126+
$scope.showEditProjectPanel = false;
127+
128+
$scope.editProject = function(project) {
129+
$scope.editingProject = project;
130+
$scope.showEditProjectPanel = true;
131+
};
132+
133+
$scope.closeEditProjectPanel = function() {
134+
$scope.showEditProjectPanel = false;
135+
};
136+
137+
$scope.onEditProject = function() {
138+
$scope.showEditProjectPanel = false;
139+
};
140+
112141
$scope.$watch('search.text', _.debounce(function(searchText) {
113142
$scope.keywords = filterKeywords = KeywordService.generateKeywords(searchText);
114143
$scope.$apply(filterProjects);

app/styles/_projects.less

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,11 +87,18 @@
8787
justify-content: flex-end;
8888
margin: -27px 0 0 0;
8989
@media (min-width: 660px) {
90+
display: block;
9091
margin-bottom: 20px;
9192
margin-left: 40px;
9293
margin-top: 0;
9394
order: 2;
9495
}
96+
97+
.origin-modal-popup {
98+
@media (min-width: @screen-sm-min) {
99+
width: 370px;
100+
}
101+
}
95102
}
96103
.projects-options {
97104
display: flex;
@@ -157,4 +164,18 @@
157164
.project-info:hover {
158165
background-color: @table-bg-hover;
159166
}
167+
168+
.origin-modal-popup {
169+
@media (min-width: @screen-sm-min) {
170+
margin-left: -10px;
171+
margin-top: -25px;
172+
width: 370px;
173+
}
174+
175+
&.position-above {
176+
@media (min-width: @screen-sm-min) {
177+
margin-top: 20px;
178+
}
179+
}
180+
}
160181
}

app/views/projects.html

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,13 @@ <h2 class="text-center">Loading...</h2>
2525
<h1>My Projects</h1>
2626
<div class="projects-options">
2727
<div class="projects-add" ng-if="canCreate">
28-
<a href="create-project" class="btn btn-md btn-primary">
28+
<button ng-click="createProject()" class="btn btn-md btn-primary">
29+
<span class="fa fa-plus"></span>
2930
Create Project
30-
</a>
31+
</button>
32+
<origin-modal-popup shown="showNewProjectPanel" modal-title="Create Project" on-close="closeNewProjectPanel()">
33+
<create-project is-dialog="true" redirect-action="onNewProject" on-cancel="closeNewProjectPanel"></create-project>
34+
</origin-modal-popup>
3135
</div>
3236
<div class="projects-search">
3337
<form role="form" class="search-pf has-button">
@@ -101,7 +105,7 @@ <h2 class="h1">
101105
</a>
102106
</li>
103107
<li role="menuitem">
104-
<a ng-href="project/{{project.metadata.name}}/edit?then=./">
108+
<a ng-href="" ng-click="editProject(project)">
105109
Edit Project
106110
</a>
107111
</li>
@@ -120,6 +124,9 @@ <h2 class="h1">
120124
</ul>
121125
</div>
122126
</div>
127+
<origin-modal-popup shown="showEditProjectPanel && editingProject === project" modal-title="Edit Project" on-close="closeEditProjectPanel()">
128+
<edit-project project="project" is-dialog="true" redirect-action="onEditProject" on-cancel="closeEditProjectPanel"></edit-project>
129+
</origin-modal-popup>
123130
</div>
124131
</div>
125132
<p class="projects-instructions" ng-if="canCreate === false" ng-include="'views/_cannot-create-project.html'"></p>

0 commit comments

Comments
 (0)