Browse Source

Base ui to support uploading of pictures.

pull/96/head
Evan Theurer 11 years ago
parent
commit
c8f53d7758
  1. 50
      static/js/directives/buddypictureupload.js
  2. 4
      static/js/directives/directives.js
  3. 4
      static/partials/buddypicturecapture.html
  4. 11
      static/partials/buddypictureupload.html

50
static/js/directives/buddypictureupload.js

@ -0,0 +1,50 @@ @@ -0,0 +1,50 @@
/*
* Spreed WebRTC.
* Copyright (C) 2013-2014 struktur AG
*
* This file is part of Spreed WebRTC.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
define(['jquery', 'underscore', 'text!partials/buddypictureupload.html'], function($, _, template) {
// buddyPictureUpload
return ["$compile", function($compile) {
var controller = ['$scope', 'safeApply', '$timeout', '$q', function($scope, safeApply, $timeout, $q) {
$scope.showUploadPicture = false;
}];
var link = function($scope, $element) {
$scope.canvasUpload = $element.find("canvas.uploadPrev").get(0);
$($scope.canvasUpload).attr($scope.captureSize);
};
return {
restrict: 'E',
transclude: true,
replace: true,
template: template,
controller: controller,
link: link
};
}];
});

4
static/js/directives/directives.js

@ -26,6 +26,7 @@ define([ @@ -26,6 +26,7 @@ define([
'directives/statusmessage',
'directives/buddylist',
'directives/buddypicturecapture',
'directives/buddypictureupload',
'directives/settings',
'directives/chat',
'directives/audiovideo',
@ -41,7 +42,7 @@ define([ @@ -41,7 +42,7 @@ define([
'directives/pdfcanvas',
'directives/odfcanvas',
'directives/presentation',
'directives/youtubevideo',], function(_, onEnter, onEscape, statusMessage, buddyList, buddyPictureCapture, settings, chat, audioVideo, usability, audioLevel, fileInfo, screenshare, roomBar, socialShare, page, contactRequest, defaultDialog, pdfcanvas, odfcanvas, presentation, youtubevideo) {
'directives/youtubevideo',], function(_, onEnter, onEscape, statusMessage, buddyList, buddyPictureCapture, buddyPictureUpload,settings, chat, audioVideo, usability, audioLevel, fileInfo, screenshare, roomBar, socialShare, page, contactRequest, defaultDialog, pdfcanvas, odfcanvas, presentation, youtubevideo) {
var directives = {
onEnter: onEnter,
@ -49,6 +50,7 @@ define([ @@ -49,6 +50,7 @@ define([
statusMessage: statusMessage,
buddyList: buddyList,
buddyPictureCapture: buddyPictureCapture,
buddyPictureUpload: buddyPictureUpload,
settings: settings,
chat: chat,
audioVideo: audioVideo,

4
static/partials/buddypicturecapture.html

@ -18,7 +18,9 @@ @@ -18,7 +18,9 @@
<a class="btn btn-small btn-primary" ng-disabled="!previewPicture || waitingForPermission" ng-click="setAsProfilePicture()"> {{_('Set as Profile Picture')}}</a>
</div>
</div>
<a class="btn btn-small btn-primary" ng-show="!showTakePicture" ng-disabled="waitingForPermission" ng-click="initPicture()"> {{_('Take picture')}}</a>
<buddy-picture-upload></buddy-picture-upload>
<a class="btn btn-small btn-primary" ng-show="!showTakePicture && !showUploadPicture" ng-disabled="waitingForPermission" ng-click="initPicture()"> {{_('Take picture')}}</a>
<a class="btn btn-small btn-primary" ng-show="!showTakePicture && !showUploadPicture" ng-model="showUploadPicture" btn-checkbox>{{_('Upload picture')}}</a>
<span ng-show="waitingForPermission">
<i class="fa fa-circle-o-notch fa-spin"></i> {{_('Waiting for camera')}}
</span>

11
static/partials/buddypictureupload.html

@ -0,0 +1,11 @@ @@ -0,0 +1,11 @@
<div class="collapse" collapse="!showUploadPicture">
<div class="buddyPictureUpload">
<canvas class="uploadPrev hidden"></canvas>
<img class="preview" ng-class="{previewUpload: previewUpload}" ng-show="previewUpload" ng-src="{{previewUpload}}" />
<p>Please choose a picture to upload</p>
<div><input type="file"></div>
<br>
</div>
<a class="btn btn-small btn-default" ng-click="showUploadPicture = false"> {{_('Cancel')}}</a>
<a class="btn btn-small btn-primary" ng-click="setAsProfilePicture()"> {{_('Set as Profile Picture')}}</a>
</div>
Loading…
Cancel
Save