Browse Source

Improved send form on mobile layout

Closes #35
master
Igor Zhukov 11 years ago
parent
commit
355e03d7b7
  1. 3
      app/css/app.css
  2. 79
      app/css/app_mobile.css
  3. BIN
      app/img/icons/IconsetW.png
  4. BIN
      app/img/icons/IconsetW_1x.png
  5. 8
      app/js/directives.js
  6. 8
      app/js/services.js
  7. 5
      app/partials/head.html
  8. 3
      app/partials/im.html

3
app/css/app.css

@ -2084,6 +2084,9 @@ textarea.im_message_field { @@ -2084,6 +2084,9 @@ textarea.im_message_field {
opacity: 1;
}
.im_head_attach {
display: none;
}
.im_attach_input,
.im_media_attach_input {
cursor: pointer;

79
app/css/app_mobile.css

@ -188,11 +188,6 @@ html { @@ -188,11 +188,6 @@ html {
padding-bottom: 18px;
}
.emoji-wysiwyg-editor {
min-height: 34px;
max-height: 150px;
}
.im_dialog_peer {
white-space: normal;
height: 2.84em;
@ -322,5 +317,79 @@ html { @@ -322,5 +317,79 @@ html {
margin: 10px;
}
.im_send_form {
position: relative;
}
.im_send_field_wrap {
margin-right: 45px;
}
.im_media_attach,
.im_attach {
display: none;
}
.im_submit {
padding: 6px 0;
position: absolute;
right: 0;
top: 0;
width: 40px;
min-width: 0;
line-height: 18px;
}
.im_emoji_btn {
position: absolute;
top: -1px;
right: 50px;
}
.emoji-wysiwyg-editor {
min-height: 32px;
max-height: 150px;
padding-right: 30px;
}
.emoji-menu {
margin-left: -158px;
margin-top: -257px;
}
.im_head_attach {
display: block;
float: right;
cursor: pointer;
overflow: hidden;
position: relative;
margin: 5px 0 5px 5px;
height: 34px;
border-radius: 4px;
padding: 3px 7px;
border: 1px solid #497495;
}
.navbar_peer_not_selected .im_head_attach {
display: none;
}
.im_head_attach:hover,
.im_head_attach:active {
background-color: rgba(255,255,255,0.1);
}
.im_head_attach .icon-paperclip {
display: inline-block;
width: 19px;
height: 23px;
vertical-align: text-top;
background: url(../img/icons/IconsetW.png) -12px -672px no-repeat;
background-size: 42px 710px;
opacity: 0.8;
}
.is_1x .im_head_attach .icon-paperclip {
background-image: url(../img/icons/IconsetW_1x.png);
}
.im_head_attach:hover .icon-paperclip,
.im_head_attach:active .icon-paperclip {
opacity: 1;
}
}

BIN
app/img/icons/IconsetW.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 23 KiB

BIN
app/img/icons/IconsetW_1x.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.6 KiB

After

Width:  |  Height:  |  Size: 11 KiB

8
app/js/directives.js

@ -645,7 +645,11 @@ angular.module('myApp.directives', ['myApp.filters']) @@ -645,7 +645,11 @@ angular.module('myApp.directives', ['myApp.filters'])
});
}
fileSelects.on('change', function () {
// Head is sometimes slower
$timeout(function () {
fileSelects
.add('.im_head_attach input')
.on('change', function () {
var self = this;
$scope.$apply(function () {
$scope.draftMessage.files = Array.prototype.slice.call(self.files);
@ -657,6 +661,7 @@ angular.module('myApp.directives', ['myApp.filters']) @@ -657,6 +661,7 @@ angular.module('myApp.directives', ['myApp.filters'])
}, 1000);
});
});
}, 1000);
var sendOnEnter = true,
updateSendSettings = function () {
@ -772,6 +777,7 @@ angular.module('myApp.directives', ['myApp.filters']) @@ -772,6 +777,7 @@ angular.module('myApp.directives', ['myApp.filters'])
$('body').off('dragenter dragleave dragover drop', onDragDropEvent);
$(document).off('paste', onPasteEvent);
$(document).off('keydown', onKeyDown);
fileSelects.off('change');
if (richTextarea) {
$(richTextarea).off('DOMNodeInserted', onPastedImageEvent);
}

8
app/js/services.js

@ -1427,9 +1427,9 @@ angular.module('myApp.services', []) @@ -1427,9 +1427,9 @@ angular.module('myApp.services', [])
} else if (file.type.substr(0, 6) == 'video/') {
attachType = 'video';
fileName = 'video.mp4';
} else if (file.type == 'audio/mpeg' || file.type == 'audio/mp3') {
} else if (file.type.substr(0, 6) == 'audio/') {
attachType = 'audio';
fileName = 'audio.mp3';
fileName = 'audio.' + file.type.split('/')[1] || 'mp3';
} else {
attachType = 'document';
fileName = 'document.' + file.type.split('/')[1];
@ -1497,11 +1497,11 @@ angular.module('myApp.services', []) @@ -1497,11 +1497,11 @@ angular.module('myApp.services', [])
break;
case 'video':
inputMedia = {_: 'inputMediaUploadedVideo', file: inputFile, duration: 0, w: 0, h: 0};
inputMedia = {_: 'inputMediaUploadedVideo', file: inputFile, duration: 0, w: 0, h: 0, mime_type: file.type};
break;
case 'audio':
inputMedia = {_: 'inputMediaUploadedAudio', file: inputFile, duration: 0};
inputMedia = {_: 'inputMediaUploadedAudio', file: inputFile, duration: 0, mime_type: file.type};
break;
case 'document':

5
app/partials/head.html

@ -33,6 +33,11 @@ @@ -33,6 +33,11 @@
</ul>
</div>
<div class="im_head_attach">
<input type="file" class="im_media_attach_input" size="28" multiple="true" accept="image/*, video/*, audio/*" title="Send media"/>
<i class="icon icon-paperclip"></i>
</div>
<div class="navbar-header">
<a class="navbar-brand" href="{{isLoggedIn ? '#/im' : '#/'}}"><span class="tg_head_logo"></span><span class="tg_head_logo_text"></span></a>

3
app/partials/im.html

@ -218,8 +218,11 @@ @@ -218,8 +218,11 @@
/>
</div>
<form my-send-form draft-message="draftMessage" class="im_send_form" ng-submit="sendMessage($event)">
<div class="im_send_field_wrap">
<div class="im_send_dropbox_wrap"> Drop photos here to send </div>
<textarea ng-model="draftMessage.text" placeholder="Write a message..." class="form-control im_message_field"></textarea>
</div>
<div class="im_media_attach pull-right">
<input type="file" class="im_media_attach_input" size="28" multiple="true" accept="image/*, video/*, audio/*" title="Send media"/>

Loading…
Cancel
Save