Skip to content

Commit 934436c

Browse files
committed
Pad title reminder
Closes #49 Using a second modal ui-yield-to, due to a limitation in mobile-angular-ui See mcasimir/mobile-angular-ui#286
1 parent 51714b4 commit 934436c

File tree

6 files changed

+47
-5
lines changed

6 files changed

+47
-5
lines changed

bower.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"angular-translate": "2.x",
1111
"angular-translate-loader-static-files": "2.x",
1212
"angular-route": "1.x",
13-
"mobile-angular-ui": "1.2.x",
13+
"mobile-angular-ui": ">= 1.2.0-rc.3",
1414
"font-awesome": "4.2",
1515
"angular-bootstrap": "latest",
1616
"angular-ui-select": "~0.9.6",

src/html/index.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,5 +49,7 @@
4949
</div>
5050

5151
<div ui-yield-to="modals"></div>
52+
<!-- Need support for several ui-content-for https://github.com/mcasimir/mobile-angular-ui/pull/286 -->
53+
<div ui-yield-to="modals2"></div>
5254
</body>
5355
</html>

src/js/controllers/pad.js

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ angular.module('Pear2Pear')
1717
});
1818
}])
1919
.controller('PadCtrl', [
20-
'pear', '$scope', '$route', '$location',
21-
function(pear, $scope, $route, $location){
20+
'pear', '$rootScope', '$scope', '$route', '$location', 'SharedState',
21+
function(pear, $rootScope, $scope, $route, $location, SharedState){
2222

2323
$scope.urlId = pear.urlId;
2424
$scope.communityId = $route.current.params.communityId;
@@ -40,4 +40,19 @@ angular.module('Pear2Pear')
4040
return id === 'pad' ? 'active' : '';
4141
};
4242

43+
$scope.titleReminder = function titleReminder() {
44+
SharedState.turnOff('projectTitleReminder');
45+
46+
document.querySelector('.project-title input').focus();
47+
};
48+
49+
// Do not leave pad without giving a title to the project
50+
$rootScope.$on('$routeChangeStart', function(event) {
51+
if ($scope.project.title === undefined || $scope.project.title === '') {
52+
event.preventDefault();
53+
54+
SharedState.turnOn('projectTitleReminder');
55+
}
56+
});
57+
4358
}]);

src/l10n/en.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,11 @@
101101
},
102102
"task_list_label": "Project tasks:",
103103
"title" : {
104-
"placeholder" : "Project without a title"
104+
"placeholder" : "Project without a title",
105+
"reminder": {
106+
"button": "Got it!",
107+
"body": "Please, introduce a title so other participants identify your project easily"
108+
}
105109
},
106110
"project_name": "Project name",
107111
"project_status": "Status",

src/l10n/es.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,11 @@
102102
},
103103
"task_list_label": "Tareas del proyecto:",
104104
"title" : {
105-
"placeholder" : "Proyecto sin titulo"
105+
"placeholder" : "Proyecto sin titulo",
106+
"reminder": {
107+
"button": "¡Hecho!",
108+
"body": "Por favor, introduce un título para que otros participantes identifiquen la propuesta fácilmente"
109+
}
106110
},
107111
"project_name": "Nombre del proyecto",
108112
"project_status": "Estado",

src/templates/pad/show.html

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,20 @@
99
<div id="pad" class="section pad" hm-swiperight="showChat()">
1010
<div class="swellrt-editor" ng-model="project.pad" placeholder="{{ 'pad.placeholder' | translate }}"></div>
1111
</div>
12+
13+
14+
<!-- Uses a second modal ui-yield-to. See https://github.com/mcasimir/mobile-angular-ui/pull/286 -->
15+
<div ui-content-for="modals2">
16+
<div class="modal modal-overlay" ui-if="projectTitleReminder" ui-state="projectTitleReminder">
17+
<div class="modal-dialog">
18+
<div class="modal-content">
19+
<div class="modal-body">
20+
<span translate>project.title.reminder.body
21+
</div>
22+
<div class="modal-footer">
23+
<button class="btn btn-primary project-title-reminder-btn" ng-click="titleReminder()" translate>project.title.reminder.button</button>
24+
</div>
25+
</div>
26+
</div>
27+
</div>
28+
</div>

0 commit comments

Comments
 (0)