Skip to content
This repository was archived by the owner on Mar 4, 2025. It is now read-only.

Commit 3c5a2cf

Browse files
committed
Merge pull request #11 from appirio-tech/image-viewer
Add Image Slide Viewer & Image Viewer Header
2 parents 616e12b + dd0575d commit 3c5a2cf

23 files changed

+738
-4
lines changed

dist/example.js

Lines changed: 83 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,16 @@
9090
controller: 'DateInputExampleController as vm',
9191
templateUrl: 'views/date-input.example.html'
9292
};
93+
states['image-viewer'] = {
94+
url: '/image-viewer',
95+
controller: 'ImageViewerExampleController as vm',
96+
templateUrl: 'views/image-viewer.example.html'
97+
};
98+
states['image-viewer-header'] = {
99+
url: '/image-viewer-header',
100+
controller: 'ImageViewerHeaderExampleController as vm',
101+
templateUrl: 'views/image-viewer-header.example.html'
102+
};
93103
states['dropdown'] = {
94104
url: '/dropdown',
95105
controller: 'DropdownExampleController as vm',
@@ -260,11 +270,83 @@ $templateCache.put("views/fitted-width.example.html","<h1>Fitted Width</h1><ul c
260270
$templateCache.put("views/flush-height.example.html","<div flush-height=flush-height style=background-color:grey>Flush Height</div>");
261271
$templateCache.put("views/focus-on-click.example.html","<button type=button focus-on-click=focus-on-click class=focus-on-click>should have red border when focused</button>");
262272
$templateCache.put("views/full-height.example.html","<div full-height=full-height style=background-color:grey>Full Height</div>");
273+
$templateCache.put("views/image-viewer-header.example.html","<image-viewer-header avatar={{vm.avatar}} handle={{vm.handle}} title={{vm.title}} toggle-comments=vm.toggleComments() comments-allowed=comments-allowed download-allowed=download-allowed></image-viewer-header>");
274+
$templateCache.put("views/image-viewer.example.html","<modal show=true background-click-close=background-click-close><image-viewer-header></image-viewer-header><image-slide-viewer files=vm.files starting-file=vm.startingFile show-notifications=vm.showNotifications></image-slide-viewer></modal>");
263275
$templateCache.put("views/loader.example.html","<loader></loader>");
264276
$templateCache.put("views/lock-height.example.html","<input type=text ng-model=vm.height><div style=\"height: {{ vm.height }}; background-color:green; overflow: hidden; padding:50px\" class=\"flex column\"><div lock-height=no-height style=\"background-color:grey; overflow:auto; font-size:36px;\" class=\"animate lock-height flex-grow\"><ul><li ng-repeat=\"n in [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1] track by $index\">Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</li></ul></div></div>");
265277
$templateCache.put("views/modal.example.html","<button ng-click=\"vm.show = true\">Show</button><modal show=vm.show background-click-close=background-click-close><img src=http://petdogss.com/wp-content/uploads/2015/01/attention-seeking-puppy.jpg></modal>");
266278
$templateCache.put("views/scroll.example.html","<button type=button scroll-element=section2>Scroll to Section 2</button><div id=section1 class=scrollSection><h2>Section 1</h2></div><div id=section2 class=scrollSection><h2>Section 2</h2></div>");
267279
$templateCache.put("views/selectable.example.html","<p>button.widest.biggest(ng-model=\"vm.value\" selectable=true)</p><br><button ng-model=vm.value selectable=selectable class=\"action widest biggest\"></button><hr><p>button.wider.big(ng-model=\"vm.value\" label=\"show me the money\" selectable=\"action\")</p><br><button ng-model=vm.value label=\"show me the money\" selectable=action class=\"wider big\"></button><hr><label>Show me the money?</label><p>button(ng-model=\"vm.value\" label=\"yes\" value=\"true\" selectable=\"action\")</p><br><button ng-model=vm.value label=yes value=true selectable=action></button><br><p>button(ng-model=\"vm.value\" label=\"no\" value=\"false\" selectable=\"action\")</p><br><button ng-model=vm.value label=no value=false selectable=action></button><hr><img src=http://i.perezhilton.com/wp-content/uploads/2013/07/tumblr_m3bwbqnjig1rrgbmqo1_500.gif ng-show=vm.value><label>Tracking a list</label><p>button(ng-model=\"vm.fruits\" label=\"apples\" value=\"vm.apples\" selectable=\"action\")</p><br><button ng-model=vm.fruits label=apples value=vm.apples selectable=action></button><br><p>button(ng-model=\"vm.fruits\" label=\"oranges\" value=\"vm.oranges\" selectable=\"action\")</p><br><button ng-model=vm.fruits label=oranges value=vm.oranges selectable=action></button><br><p>button(ng-model=\"vm.fruits\" label=\"mangos\" value=\"vm.mangos\" selectable=\"action\")</p><br><button ng-model=vm.fruits label=mangos value=vm.mangos selectable=action></button><br><div class=fruits>{{ vm.fruits }}</div>");
268280
$templateCache.put("views/selected-button.example.html","<selected-button ng-model=vm.value></selected-button><hr><selected-button ng-model=vm.value label=\"show me the money\"></selected-button><hr><h2>Show me the money?</h2><selected-button ng-model=vm.value label=yes value=true></selected-button><br><selected-button ng-model=vm.value label=no value=false></selected-button><hr><img src=http://i.perezhilton.com/wp-content/uploads/2013/07/tumblr_m3bwbqnjig1rrgbmqo1_500.gif ng-show=vm.value><h2>Tracking a list</h2><selected-button ng-model=vm.fruits label=apples value=vm.apples></selected-button><br><selected-button ng-model=vm.fruits label=oranges value=vm.oranges></selected-button><br><selected-button ng-model=vm.fruits label=mangos value=vm.mangos></selected-button><br><div class=fruits>{{ vm.fruits }}</div>");
269281
$templateCache.put("views/simple-countdown.example.html","<simple-countdown end=2015-12-10T19:41:15.354Z></simple-countdown>");
270-
$templateCache.put("views/tooltip.example.html","<div class=username><input type=text name=username ng-model=vm.username required placeholder=Username class=widest><div class=\"tooltip elevated\"><div class=arrow></div><p>Your username is public, please pick one that is:</p><p>Use letters, numbers, and these special characters: (-_.{}[])</p></div></div>");}]);
282+
$templateCache.put("views/tooltip.example.html","<div class=username><input type=text name=username ng-model=vm.username required placeholder=Username class=widest><div class=\"tooltip elevated\"><div class=arrow></div><p>Your username is public, please pick one that is:</p><p>Use letters, numbers, and these special characters: (-_.{}[])</p></div></div>");}]);
283+
(function() {
284+
'use strict';
285+
var ImageViewerExampleController;
286+
287+
ImageViewerExampleController = function($scope, $stateParams) {
288+
var activate, vm;
289+
vm = this;
290+
vm.userHandle = "batman";
291+
vm.userAvatar = "http://www.topcoder.com/i/m/cardiboy_big.jpg";
292+
vm.showNotifications = false;
293+
vm.files = [
294+
{
295+
fileId: "abc",
296+
path: "work/1447877190406-e9c02ed7-00bf-4e52-8c57-4d73fec009ac/9be085da-2013-44e9-8701-507a03c6716e/Screen Shot 2015-12-01 at 1.13.17 PM.png",
297+
caption: "this is an image",
298+
url: "/images/flower.png"
299+
}, {
300+
fileId: "def",
301+
path: "work/1447877190406-e9c02ed7-00bf-4e52-8c57-4d73fec009ac/cff190d6-c11e-4a42-ab32-9ea37f163334/Screen Shot 2015-12-01 at 1.13.17 PM.png",
302+
caption: "this is an image also",
303+
url: "/images/flower.png"
304+
}, {
305+
fileId: "ghi",
306+
path: "work/1447877190406-e9c02ed7-00bf-4e52-8c57-4d73fec009ac/88e9df7c-96d2-482f-936d-a5dece0c67bf/Screen Shot 2015-12-01 at 1.01.35 PM.png",
307+
caption: "this is a different image",
308+
url: "/images/phone.jpg"
309+
}, {
310+
fileId: "klm",
311+
path: "work/1447877190406-e9c02ed7-00bf-4e52-8c57-4d73fec009ac/fe819b7d-2534-4878-994b-35f7b2fec185/Screen Shot 2015-12-01 at 12.35.18 PM.png",
312+
caption: "this is another one of the images",
313+
url: "/images/turtles-breaking.jpg"
314+
}
315+
];
316+
vm.startingFile = vm.files[1];
317+
activate = function() {
318+
return vm;
319+
};
320+
return activate();
321+
};
322+
323+
ImageViewerExampleController.$inject = ['$scope', '$stateParams'];
324+
325+
angular.module('example').controller('ImageViewerExampleController', ImageViewerExampleController);
326+
327+
}).call(this);
328+
329+
(function() {
330+
'use strict';
331+
var ImageViewerHeaderExampleController;
332+
333+
ImageViewerHeaderExampleController = function($scope) {
334+
var activate, vm;
335+
vm = this;
336+
vm.avatar = "http://www.topcoder.com/i/m/cardiboy_big.jpg";
337+
vm.handle = "Darth Vader";
338+
vm.title = "Hello World Report";
339+
vm.toggleComments = function() {
340+
return alert('comment toggled');
341+
};
342+
activate = function() {
343+
return vm;
344+
};
345+
return activate();
346+
};
347+
348+
ImageViewerHeaderExampleController.$inject = ['$scope'];
349+
350+
angular.module('appirio-tech-ng-ui-components').controller('ImageViewerHeaderExampleController', ImageViewerHeaderExampleController);
351+
352+
}).call(this);

dist/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<link rel="stylesheet" href="main.css">
55

66

7-
</head><body><ul class="nav flex center"><li><a ui-sref="avatar">Avatar</a></li><li><a ui-sref="countdown">Countdown</a></li><li><a ui-sref="simple-countdown">Simple Countdown</a></li><li><a ui-sref="loader">Loader</a></li><li><a ui-sref="filters">Filters</a></li><li><a ui-sref="modal">Modal</a></li><li><a ui-sref="focus-on-click">Focus on click</a></li><li><a ui-sref="checkbox">Checkbox</a></li><li><a ui-sref="selected-button" style="text-decoration: line-through;">Selected Button</a></li><li><a ui-sref="selectable">Selectable</a></li><li><a ui-sref="scroll">Scroll</a></li><li><a ui-sref="flush-height">Flush Height</a></li><li><a ui-sref="full-height">Full Height</a></li><li><a ui-sref="fitted-width">Fitted Width</a></li><li><a ui-sref="lock-height">Lock Height</a></li><li><a ui-sref="tooltip">Tooltip</a></li><li><a ui-sref="date-input">Date Input</a></li><li><a ui-sref="dropdown">Dropdown</a></li></ul><main role="main" ui-view="" class="layout-main {{ pageClass }}"></main><end></end><end></end><end></end><end></end>
7+
</head><body><ul class="nav flex center"><li><a ui-sref="avatar">Avatar</a></li><li><a ui-sref="countdown">Countdown</a></li><li><a ui-sref="simple-countdown">Simple Countdown</a></li><li><a ui-sref="loader">Loader</a></li><li><a ui-sref="filters">Filters</a></li><li><a ui-sref="modal">Modal</a></li><li><a ui-sref="focus-on-click">Focus on click</a></li><li><a ui-sref="checkbox">Checkbox</a></li><li><a ui-sref="selected-button" style="text-decoration: line-through;">Selected Button</a></li><li><a ui-sref="selectable">Selectable</a></li><li><a ui-sref="scroll">Scroll</a></li><li><a ui-sref="flush-height">Flush Height</a></li><li><a ui-sref="full-height">Full Height</a></li><li><a ui-sref="fitted-width">Fitted Width</a></li><li><a ui-sref="lock-height">Lock Height</a></li><li><a ui-sref="tooltip">Tooltip</a></li><li><a ui-sref="date-input">Date Input</a></li><li><a ui-sref="image-viewer">Image Viewer</a></li><li><a ui-sref="image-viewer-header">Image Viewer Header</a></li><li><a ui-sref="dropdown">Dropdown</a></li></ul><main role="main" ui-view="" class="layout-main {{ pageClass }}"></main><end></end><end></end><end></end><end></end>
88
<script src="lib.js"></script>
99
<script src="main.js"></script>
1010
<script src="example.js"></script>

dist/main.css

Lines changed: 104 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/main.js

Lines changed: 149 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ angular.module("appirio-tech-ng-ui-components").run(["$templateCache", function(
1212
$templateCache.put("views/checkbox.directive.html","<div class=\"flex middle\"><button ng-class=\"{\'checked\': ngModel}\" ng-click=vm.toggle() type=button class=clean><div ng-hide=ngModel class=\"icon plus hollow\"></div><div ng-show=ngModel class=\"icon checkmark active\"></div></button><label ng-if=label ng-click=vm.toggle()>{{ label }}</label></div>");
1313
$templateCache.put("views/countdown.directive.html","<ul class=countdown><li ng-if=\"vm.days &gt; 0\"><span class=value>{{ vm.days }}</span><span class=unit>day<span ng-if=\"vm.days &gt; 1\">s</span></span></li><li ng-if=\"vm.hours &gt; 0 || vm.days &gt; 0\"><span class=value>{{ vm.hours }}</span><span class=unit>hr<span ng-if=\"vm.hours &gt; 1\">s</span></span></li><li ng-if=\"vm.minutes &gt; 0 || vm.hours &gt; 0 || vm.days &gt; 0\"><span class=value>{{ vm.minutes }}</span><span class=unit>min<span ng-if=\"vm.minutes &gt; 1\">s</span></span></li><li><span class=value>{{ vm.seconds }}</span><span class=unit>sec<span ng-if=\"vm.seconds &gt; 1\">s</span></span></li></ul>");
1414
$templateCache.put("views/date-input.directive.html","<div class=\"flex middle\"><input type=text ng-model=date placeholder=\"{{ placeHolder }}\"><button class=clean><div class=\"icon warning\"></div></button></div>");
15+
$templateCache.put("views/image-viewer-header.directive.html","<main class=\"flex column light-bg\"><div class=\"header flex space-between\"><div class=\"user flex middle\"><a href={{vm.generateProfileUrl(vm.handle)}} target=_blank><avatar avatar-url=\"{{ vm.avatar }}\"></avatar></a><a href={{vm.generateProfileUrl(vm.handle)}} target=_blank><p class=name>{{ vm.handle }}</p></a></div><div class=icons><button ng-if=vm.downloadAllowed class=clean><a href=\"{{ vm.downloadUrl }}\" target=_blank><div class=\"icon download\"></div></a></button><button ng-click=vm.toggleComments() ng-if=vm.commentsAllowed class=clean><div class=\"icon bubble\"></div></button></div></div><p ng-if=vm.title class=title>{{vm.title}}</p><hr></main>");
16+
$templateCache.put("views/image-viewer.directive.html","<main class=\"flex column middle light-bg\"><div class=\"content flex flex-grow\"><div class=\"slideshow flex column flex-grow\"><div class=\"preview flex center flex-grow flex-shrink\"><div class=\"previous flex flex-grow\"><a ng-class=\"{invisible: !vm.prevFile}\" ng-click=vm.viewPrevious() class=arrow-previous><button class=\"clean icon arrow\"></button></a></div><div class=\"image flex column center\"><div class=img-container><p ng-if=vm.file.name class=file-name>{{ vm.file.name }}</p><p ng-if=vm.file.caption class=file-caption>{{ vm.file.caption }}</p><img ng-src=\"{{ vm.file.url }}\"></div></div><div class=\"next flex flex-grow\"><a ng-class=\"{invisible: !vm.nextFile}\" ng-click=vm.viewNext() class=arrow-next><button class=\"clean icon arrow right\"></button></a></div></div><ul class=thumbnails><li ng-repeat=\"file in vm.files\" ng-class=\"{ elevated: !vm.isCurrent(file) }\" class=thumbnail><a href=\"{{ file.detailUrl }}\"><img ng-src=\"{{ file.url }}\"><div ng-if=\"file.unreadMessages &gt; 0 &amp;&amp; vm.showNotifications\" class=\"notification absolute\">{{ file.unreadMessages }}</div></a></li></ul></div></div></main>");
1517
$templateCache.put("views/loader.directive.html","<div class=container><div class=loader></div></div>");
1618
$templateCache.put("views/modal.directive.html","");
1719
$templateCache.put("views/selectable.directive.html","<div ng-show=\"!label &amp;&amp; !vm.isSelected()\">Select</div><div ng-show=\"!label &amp;&amp; vm.isSelected()\">Selected</div><div ng-show=label>{{ label }}</div><div class=icon-container><div class=\"icon checkmark-white smallest\"></div></div>");
@@ -562,6 +564,55 @@ $templateCache.put("views/simple-countdown.directive.html","<p>{{vm.timeRemainin
562564

563565
}).call(this);
564566

567+
(function() {
568+
'use strict';
569+
var directive;
570+
571+
directive = function() {
572+
return {
573+
restrict: 'E',
574+
controller: 'ImageViewerController as vm',
575+
templateUrl: 'views/image-viewer.directive.html',
576+
scope: {
577+
files: '=',
578+
startingFile: '=',
579+
onFileChange: '&',
580+
showNotifications: '@'
581+
}
582+
};
583+
};
584+
585+
angular.module('appirio-tech-ng-ui-components').directive('imageSlideViewer', directive);
586+
587+
}).call(this);
588+
589+
(function() {
590+
'use strict';
591+
var dir;
592+
593+
dir = function() {
594+
return {
595+
restrict: 'E',
596+
templateUrl: 'views/image-viewer-header.directive.html',
597+
controller: 'ImageViewerHeaderController as vm',
598+
scope: {
599+
avatar: '@',
600+
handle: '@',
601+
title: '@',
602+
commentsAllowed: '@',
603+
downloadAllowed: '@',
604+
downloadUrl: '@',
605+
toggleComments: '&'
606+
}
607+
};
608+
};
609+
610+
dir.$inject = [];
611+
612+
angular.module('appirio-tech-ng-ui-components').directive('imageViewerHeader', dir);
613+
614+
}).call(this);
615+
565616
(function() {
566617
'use strict';
567618
var directive;
@@ -748,6 +799,104 @@ $templateCache.put("views/simple-countdown.directive.html","<p>{{vm.timeRemainin
748799

749800
}).call(this);
750801

802+
(function() {
803+
'use strict';
804+
var ImageViewerController;
805+
806+
ImageViewerController = function($scope) {
807+
var activate, startingFile, updateFiles, vm;
808+
vm = this;
809+
vm.files = $scope.files;
810+
vm.showNotifications = $scope.showNotifications;
811+
startingFile = $scope.startingFile;
812+
vm.onFileChange = $scope.onFileChange;
813+
vm.prevFile = null;
814+
vm.nextFile = null;
815+
updateFiles = function() {
816+
if (vm.currentIndex + 1 < vm.files.length) {
817+
vm.nextFile = true;
818+
} else {
819+
vm.nextFile = null;
820+
}
821+
if (vm.currentIndex - 1 >= 0) {
822+
return vm.prevFile = true;
823+
} else {
824+
return vm.prevFile = null;
825+
}
826+
};
827+
activate = function() {
828+
vm.file = startingFile;
829+
vm.currentIndex = vm.files.indexOf(vm.file);
830+
vm.nextFile = vm.currentIndex + 1 < vm.files.length;
831+
vm.prevFile = vm.currentIndex - 1 >= 0;
832+
if (vm.onFileChange) {
833+
return vm.onFileChange({
834+
file: vm.file
835+
});
836+
}
837+
};
838+
vm.viewNext = function() {
839+
vm.file = vm.files[vm.currentIndex + 1];
840+
vm.currentIndex = vm.files.indexOf(vm.file);
841+
updateFiles();
842+
if (vm.onFileChange) {
843+
return vm.onFileChange({
844+
file: vm.file
845+
});
846+
}
847+
};
848+
vm.viewPrevious = function() {
849+
vm.file = vm.files[vm.currentIndex - 1];
850+
vm.currentIndex = vm.files.indexOf(vm.file);
851+
updateFiles();
852+
if (vm.onFileChange) {
853+
return vm.onFileChange({
854+
file: vm.file
855+
});
856+
}
857+
};
858+
vm.isCurrent = function(file) {
859+
return vm.files.indexOf(file === vm.currentIndex);
860+
};
861+
activate();
862+
return vm;
863+
};
864+
865+
ImageViewerController.$inject = ['$scope'];
866+
867+
angular.module('appirio-tech-ng-ui-components').controller('ImageViewerController', ImageViewerController);
868+
869+
}).call(this);
870+
871+
(function() {
872+
'use strict';
873+
var ImageViewerHeaderController;
874+
875+
ImageViewerHeaderController = function($scope) {
876+
var activate, vm;
877+
vm = this;
878+
vm.avatar = $scope.avatar;
879+
vm.handle = $scope.handle;
880+
vm.title = $scope.title;
881+
vm.commentsAllowed = $scope.commentsAllowed;
882+
vm.downloadAllowed = $scope.downloadAllowed;
883+
vm.toggleComments = $scope.toggleComments;
884+
vm.downloadUrl = $scope.downloadUrl;
885+
vm.generateProfileUrl = function(handle) {
886+
return "https://www.topcoder.com/members/" + handle;
887+
};
888+
activate = function() {
889+
return vm;
890+
};
891+
return activate();
892+
};
893+
894+
ImageViewerHeaderController.$inject = ['$scope'];
895+
896+
angular.module('appirio-tech-ng-ui-components').controller('ImageViewerHeaderController', ImageViewerHeaderController);
897+
898+
}).call(this);
899+
751900
(function() {
752901
'use strict';
753902
var filter;

example/css-files.jade

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@
1111
- cssPaths.push('tooltip')
1212
- cssPaths.push('simple-countdown')
1313
- cssPaths.push('date-input')
14+
- cssPaths.push('image-viewer')
15+
- cssPaths.push('image-viewer-header')
16+
1417

1518
- var landscapes = []
1619
- var desktops = []

example/images/flower.png

1.01 MB
Loading

example/images/phone.jpg

233 KB
Loading

example/js-files.jade

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@
1111
- examples.push('dropdown.example.controller')
1212
- examples.push('date-input.example')
1313
- examples.push('example-templates')
14+
- examples.push('image-viewer-example.controller')
15+
- examples.push('image-viewer-header-example.controller')
16+
1417

1518
- var directives = []
1619
- directives.push('avatar')
@@ -28,6 +31,8 @@
2831
- directives.push('fitted-width')
2932
- directives.push('lock-height')
3033
- directives.push('date-input')
34+
- directives.push('image-viewer')
35+
- directives.push('image-viewer-header')
3136
- directives.push('dropdown')
3237

3338
- var controllers = []
@@ -36,6 +41,9 @@
3641
- controllers.push('checkbox')
3742
- controllers.push('selected-button')
3843
- controllers.push('date-input')
44+
- controllers.push('image-viewer')
45+
- controllers.push('image-viewer-header')
46+
3947

4048
- var elements = []
4149

example/nav.jade

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,5 +50,12 @@ ul.nav.flex.center
5050
li
5151
a(ui-sref="date-input") Date Input
5252

53+
li
54+
a(ui-sref="image-viewer") Image Viewer
55+
56+
li
57+
a(ui-sref="image-viewer-header") Image Viewer Header
58+
5359
li
5460
a(ui-sref="dropdown") Dropdown
61+

0 commit comments

Comments
 (0)