From ec889daf067ec8bea09b7179e797d089a36febbc Mon Sep 17 00:00:00 2001 From: Max Lynch Date: Wed, 9 Oct 2013 19:33:52 -0500 Subject: [PATCH] List updates and directives with it! --- dist/ionic-angular.js | 43 +++++++-- dist/ionic-ios7.css | 23 ++++- dist/ionic.css | 23 ++++- example/toderp2/css/app.css | 7 ++ example/toderp2/index.html | 5 +- example/toderp2/js/controllers.js | 4 +- js/ext/angular/src/directive/ionicList.js | 43 +++++++-- js/ext/angular/test/list.html | 103 ++++++++++++++++++++++ scss/ionic/_listview.scss | 29 ++++++ scss/ionic/_scaffolding.scss | 1 + 10 files changed, 263 insertions(+), 18 deletions(-) create mode 100644 js/ext/angular/test/list.html diff --git a/dist/ionic-angular.js b/dist/ionic-angular.js index c15f0ca5c4..679ecf6027 100644 --- a/dist/ionic-angular.js +++ b/dist/ionic-angular.js @@ -187,24 +187,55 @@ angular.module('ionic.ui.list', ['ionic.service']) restrict: 'E', replace: true, transclude: true, - scope: {}, - template: '', + scope: { + isEditing: '=' + }, + template: '', link: function($scope, $element, $attr) { var lv = new ionic.views.List({el: $element[0]}); } } }) -/* + .directive('listItem', function() { return { restrict: 'E', replace: true, transclude: true, - scope: {} + template: '
  • ' + + '
    ' + + ' ' + + '
    ' + + '
    ' + + '
    ' + + '
    ' + + ' ' + + '
    ' + + '
  • ', + link: function($scope, $element, $attr) { + } } -}); -*/ +}) + +.directive('listItems', function() { + return { + restrict: 'E', + replace: true, + scope: { + isEditing: '=', + items: '=' + }, + template: '', + link: function($scope, $element, $attr) { + var lv = new ionic.views.List({el: $element[0]}); + } + } +}) ; angular.module('ionic.ui.nav', ['ionic.service']) diff --git a/dist/ionic-ios7.css b/dist/ionic-ios7.css index 0c4edbf3b1..bfd2c7cd15 100644 --- a/dist/ionic-ios7.css +++ b/dist/ionic-ios7.css @@ -325,7 +325,8 @@ body { -webkit-text-size-adjust: none; text-size-adjust: none; -webkit-tap-highlight-color: transparent; - -webkit-user-drag: none; } + -webkit-user-drag: none; + -webkit-user-select: none; } .view-full { position: fixed; @@ -1061,6 +1062,12 @@ a.list-item { a.list-item:hover, a.list-item:focus { text-decoration: none; } +.list-editing .list-item-content { + left: 50px; } +.list-editing .list-item-edit { + left: 0px; + opacity: 1; } + .list-item-content { position: relative; background-color: #fff; @@ -1068,6 +1075,20 @@ a.list-item { padding: 15px 15px; -webkit-transition: left 0.2s ease-in-out; } +.list-item-edit { + position: absolute; + z-index: 0; + left: -48px; + top: 0; + width: 48px; + height: 100%; + line-height: 100%; + opacity: 0; + -webkit-transition: left 0.2s ease-in-out, opacity 0.2s ease-in-out; } + .list-item-edit i { + color: #ef4e3a; + font-size: 36px; } + .list-item-buttons { position: absolute; z-index: 0; diff --git a/dist/ionic.css b/dist/ionic.css index 64ed55aa58..0407edece5 100644 --- a/dist/ionic.css +++ b/dist/ionic.css @@ -390,7 +390,8 @@ body { -webkit-text-size-adjust: none; text-size-adjust: none; -webkit-tap-highlight-color: transparent; - -webkit-user-drag: none; } + -webkit-user-drag: none; + -webkit-user-select: none; } .view-full { position: fixed; @@ -1149,6 +1150,12 @@ a.list-item { a.list-item:hover, a.list-item:focus { text-decoration: none; } +.list-editing .list-item-content { + left: 50px; } +.list-editing .list-item-edit { + left: 0px; + opacity: 1; } + .list-item-content { position: relative; background-color: #fff; @@ -1156,6 +1163,20 @@ a.list-item { padding: 15px 15px; -webkit-transition: left 0.2s ease-in-out; } +.list-item-edit { + position: absolute; + z-index: 0; + left: -48px; + top: 0; + width: 48px; + height: 100%; + line-height: 100%; + opacity: 0; + -webkit-transition: left 0.2s ease-in-out, opacity 0.2s ease-in-out; } + .list-item-edit i { + color: #ef4e3a; + font-size: 36px; } + .list-item-buttons { position: absolute; z-index: 0; diff --git a/example/toderp2/css/app.css b/example/toderp2/css/app.css index cb77fc3669..404b2caceb 100644 --- a/example/toderp2/css/app.css +++ b/example/toderp2/css/app.css @@ -50,6 +50,13 @@ color: #4a87ee; } +/* Tasks view */ + +#task-list { +} +#task-list .completed { + text-decoration: line-through; +} @media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) { #signup-view { diff --git a/example/toderp2/index.html b/example/toderp2/index.html index 1a6cd28e90..a10a531786 100644 --- a/example/toderp2/index.html +++ b/example/toderp2/index.html @@ -119,9 +119,10 @@
    - +
  • - {{task.title}} + {{task.title}} +
  • diff --git a/example/toderp2/js/controllers.js b/example/toderp2/js/controllers.js index 788e11ad6b..3b6a1f5c8e 100644 --- a/example/toderp2/js/controllers.js +++ b/example/toderp2/js/controllers.js @@ -25,8 +25,8 @@ angular.module('ionic.todo.controllers', ['ionic.todo']) console.log('Created login Ctrl'); $scope.loginForm = { - email: 'max@drifty.com', - password: 'test' + email: 'ihasmax@gmail.com', + password: 'traintown' }; $scope.close = function() { diff --git a/js/ext/angular/src/directive/ionicList.js b/js/ext/angular/src/directive/ionicList.js index 8bb562a7f6..9fb79357b5 100644 --- a/js/ext/angular/src/directive/ionicList.js +++ b/js/ext/angular/src/directive/ionicList.js @@ -5,21 +5,52 @@ angular.module('ionic.ui.list', ['ionic.service']) restrict: 'E', replace: true, transclude: true, - scope: {}, - template: '', + scope: { + isEditing: '=' + }, + template: '', link: function($scope, $element, $attr) { var lv = new ionic.views.List({el: $element[0]}); } } }) -/* + .directive('listItem', function() { return { restrict: 'E', replace: true, transclude: true, - scope: {} + template: '
  • ' + + '
    ' + + ' ' + + '
    ' + + '
    ' + + '
    ' + + '
    ' + + ' ' + + '
    ' + + '
  • ', + link: function($scope, $element, $attr) { + } } -}); -*/ +}) + +.directive('listItems', function() { + return { + restrict: 'E', + replace: true, + scope: { + isEditing: '=', + items: '=' + }, + template: '', + link: function($scope, $element, $attr) { + var lv = new ionic.views.List({el: $element[0]}); + } + } +}) diff --git a/js/ext/angular/test/list.html b/js/ext/angular/test/list.html new file mode 100644 index 0000000000..32ba8c529a --- /dev/null +++ b/js/ext/angular/test/list.html @@ -0,0 +1,103 @@ + + + + List + + + + + + + + + + + + + + + +
  • +
    + +
    +
    + Item 1 + +
    +
    + +
    +
  • +
  • +
    + Item 2 + +
    +
    + +
    +
  • +
  • +
    + Item 3 + +
    +
    + +
    +
  • +
    + + + +
    + + + + + + + diff --git a/scss/ionic/_listview.scss b/scss/ionic/_listview.scss index 0f9fc13391..ffa77e54c0 100644 --- a/scss/ionic/_listview.scss +++ b/scss/ionic/_listview.scss @@ -88,6 +88,16 @@ a.list-item { } } +.list-editing { + .list-item-content { + left: 50px; + } + .list-item-edit { + left: 0px; + opacity: 1; + } +} + .list-item-content { position: relative; @@ -99,6 +109,25 @@ a.list-item { -webkit-transition: left 0.2s ease-in-out; } + +.list-item-edit { + position: absolute; + z-index: 0; + left: -48px; + top: 0; + width: 48px; + height: 100%; + line-height: 100%; + opacity: 0; + + -webkit-transition: left 0.2s ease-in-out, opacity 0.2s ease-in-out; + + i { + color: $brand-danger; + font-size: 36px; + } +} + .list-item-buttons { position: absolute; z-index: 0; diff --git a/scss/ionic/_scaffolding.scss b/scss/ionic/_scaffolding.scss index 9757d167f7..4dd9d4b067 100644 --- a/scss/ionic/_scaffolding.scss +++ b/scss/ionic/_scaffolding.scss @@ -24,6 +24,7 @@ body { text-size-adjust: none; -webkit-tap-highlight-color: transparent; -webkit-user-drag: none; + -webkit-user-select: none; } .view {