Skip to content

Commit b976aa1

Browse files
committed
added ngTouch to allow deleting objects using touch screen devices where
double click doesn't work.
1 parent cc8bc3d commit b976aa1

File tree

6 files changed

+59
-25
lines changed

6 files changed

+59
-25
lines changed

app/scripts/app.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Array.prototype.splicePositiveIndex = function() {
1616
return Array.prototype.splice.apply(this, arguments);
1717
};
1818

19-
angular.module('formMailerServiceApp', [ 'ngCookies', 'ngResource', 'ngSanitize', 'ngRoute', 'ui.bootstrap', 'ui.validate' ]).config(function($routeProvider, $locationProvider) {
19+
angular.module('formMailerServiceApp', [ 'ngCookies', 'ngResource', 'ngSanitize', 'ngRoute', 'ui.bootstrap', 'ui.validate', 'ngTouch' ]).config(function($routeProvider, $locationProvider) {
2020
$routeProvider.when('/', {
2121
templateUrl : 'partials/login',
2222
controller : 'LoginCtrl'

app/styles/main.scss

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,17 @@ body {
7373
display: none !important;
7474
}
7575

76+
.leftContent{
77+
display: inline-block;
78+
width: 69%
79+
}
80+
.rightContent{
81+
display: inline-block;
82+
width: 29%;
83+
height: 100%;
84+
vertical-align: middle
85+
}
86+
7687
/* Responsive: Portrait tablets and up */
7788
@media screen and (min-width: 768px) {
7889
.container {

app/views/index.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ <h3 class="text-muted">FormMailer Service Administration</h3>
9393
<script src="bower_components/angular-cookies/angular-cookies.js"></script>
9494
<script src="bower_components/angular-sanitize/angular-sanitize.js"></script>
9595
<script src="bower_components/angular-route/angular-route.js"></script>
96+
<script src="bower_components/angular-touch/angular-touch.js"></script>
9697
<script src="bower_components/angular-bootstrap/ui-bootstrap-tpls.js"></script>
9798
<script
9899
src="bower_components/angular-ui-utils/modules/validate/validate.js"></script>

app/views/partials/admin.html

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,26 @@
88
<table class="table table-striped">
99
<tbody>
1010
<tr ng-repeat='site in sites | filter:query'>
11-
<td>
12-
<h4>{{site.name}}</h4>
13-
<p>
14-
<abbr id='{{site.id}}' title='posting URL'>{{
15-
$location.absUrl().substr(0,$location.absUrl().lastIndexOf('/')+1)
16-
+ 'site/' + site.id }}</abbr> <span class='icon-download-alt'
17-
copy-it data-clipboard-target='{{site.id}}'></span>
18-
</p> <a class='btn btn-primary' ng-click='editSite(site)'>Edit</a>
19-
<a class='btn btn-info' ng-click='cloneSite(site)'>Clone</a>
20-
<a class='btn btn-warning' tooltip-trigger='click'
21-
tooltip='double click to delete'
22-
ng-dblclick='removeSite(site.id)'>X</a>
11+
<td ng-swipe-right="showActions = true">
12+
<div class='leftContent'>
13+
<h4>{{site.name}}</h4>
14+
<p>
15+
<abbr id='{{site.id}}' title='posting URL'>{{
16+
$location.absUrl().substr(0,$location.absUrl().lastIndexOf('/')+1)
17+
+ 'site/' + site.id }}</abbr> <span class='icon-download-alt'
18+
copy-it data-clipboard-target='{{site.id}}'></span>
19+
</p>
20+
<button class='btn btn-primary' ng-click='editSite(site)'>Edit</button>
21+
<button class='btn btn-info' ng-click='cloneSite(site)'>Clone</button>
22+
<button class='btn btn-warning' ng-click="showActions = !showActions">X</button>
23+
</div>
24+
<div ng-show="showActions" class='rightContent'>
25+
<button class='btn btn-danger' ng-click="removeSite(site.id)"
26+
style='float: right; margin-left: 5px'>Delete</button> <button
27+
class='btn' ng-click="showActions = false"
28+
style='float: right;'>Cancel</button>
29+
</div>
30+
2331
</td>
2432
</tr>
2533
</tbody>

app/views/partials/users.html

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,26 @@
77
<table class="table table-striped">
88
<tbody>
99
<tr ng-repeat='user in users | filter:query'>
10-
<td>
11-
<h4>{{user.username}}</h4>
12-
<p><abbr title='Super Admin has full privilege'>{{ user.superAdmin?'Super Admin':'' }}</abbr></p> <a class='btn btn-primary'
13-
ng-click='editUser(user)'>Edit</a> <a class='btn btn-warning'
14-
tooltip-trigger='click' tooltip='double click to delete'
15-
ng-dblclick='removeUser(user.username)'
16-
ng-if='cu.username != user.username'>X</a>
10+
<td
11+
ng-swipe-right="showActions = (cu.username != user.username)">
12+
<div class='leftContent'>
13+
<h4>{{user.username}}</h4>
14+
<p>
15+
<abbr title='Super Admin has full privilege'>{{
16+
user.superAdmin?'Super Admin':'' }}</abbr>
17+
</p>
18+
<button class='btn btn-primary' ng-click='editUser(user)'>Edit</button>
19+
<button class='btn btn-warning'
20+
ng-show='cu.username != user.username'
21+
ng-click="showActions = !showActions">X</button>
22+
</div>
23+
<div ng-show="showActions" class='rightContent'>
24+
<button class='btn btn-danger'
25+
ng-click="removeUser(user.username)"
26+
style='float: right; margin-left: 5px'>Delete</button> <button
27+
class='btn' ng-click="showActions = false"
28+
style='float: right;'>Cancel</button>
29+
</div>
1730
</td>
1831
</tr>
1932
</tbody>

bower.json

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,22 @@
66
"json3": "~3.2.4",
77
"es5-shim": "~2.1.0",
88
"jquery": "~1.10.2",
9-
"jquery-ui" : "~1.10.0",
9+
"jquery-ui": "~1.10.0",
1010
"sass-bootstrap": "~2.3.0",
1111
"angular-resource": "~1.2.0",
1212
"angular-cookies": "~1.2.0",
1313
"angular-sanitize": "~1.2.0",
1414
"angular-route": "~1.2.0",
1515
"angular-bootstrap": "~0.7.0",
16-
"angular-ui-utils" : "~0.0.0",
17-
"zeroclipboard" : "~1.2.0"
16+
"angular-ui-utils": "~0.0.0",
17+
"angular-touch": "~1.2.0",
18+
"zeroclipboard": "~1.2.0"
1819
},
1920
"devDependencies": {
2021
"angular-mocks": "~1.2.0",
2122
"angular-scenario": "~1.2.0"
2223
},
2324
"resolutions": {
24-
"angular": "1.2.4"
25-
}
25+
"angular": ">=1"
26+
}
2627
}

0 commit comments

Comments
 (0)