Commit 8a6f659aa4fda7c670fca07d67b29a4c7528b237

Authored by OpenWapp Developer

Merge branch 'issue124' of /home/git/repositories/openwapp/openwapp

Showing 2 changed files

app/scripts/views/conversation.js View file @ 8a6f659
... ... @@ -40,7 +40,8 @@
40 40 'keyup input#message-text-input': 'sendTypingActive',
41 41 'click li.location img': 'goToImageViewer',
42 42 'click header > a': 'goToInbox',
43   - 'contextmenu .messages': '_showContextMenu'
  43 + 'contextmenu .messages': '_showContextMenu',
  44 + 'contextmenu .page-wrapper': '_chooseWallpaper'
44 45 },
45 46  
46 47 initialize: function (options) {
47 48  
... ... @@ -119,10 +120,15 @@
119 120  
120 121 this.listenTo(
121 122 global.notifications, 'notification', this._handleNotification);
  123 +
  124 + this._setWallpaper(this.model.get('wallpaper'));
122 125 },
123 126  
124 127 _showContextMenu: function (evt) {
125   - if (evt) { evt.preventDefault(); }
  128 + if (evt) {
  129 + evt.preventDefault();
  130 + evt.stopImmediatePropagation();
  131 + }
126 132  
127 133 var l10n = global.localisation[global.language];
128 134  
... ... @@ -139,6 +145,27 @@
139 145 this.model.removeMessage(messageId);
140 146 listitem.parentNode.removeChild(listitem);
141 147 }
  148 + },
  149 +
  150 + _chooseWallpaper: function (evt) {
  151 + var activity = new MozActivity({
  152 + name: 'pick',
  153 + data: {
  154 + type: 'image/*'
  155 + }
  156 + });
  157 + activity.onsuccess = function () {
  158 + this._setWallpaper(activity.result.blob);
  159 + }.bind(this);
  160 + },
  161 +
  162 + _setWallpaper: function (blob) {
  163 + if (!blob) { return; }
  164 + this.model.set('wallpaper', blob);
  165 + this.model.saveToStorage();
  166 + var background = this.$el.find('#conversation');
  167 + var url = URL.createObjectURL(blob);
  168 + background.css('background-image', 'url(' + url + ')');
142 169 },
143 170  
144 171 _handleNotification: function (notification) {
app/styles/_conversation.sass View file @ 8a6f659
... ... @@ -3,6 +3,8 @@
3 3  
4 4 #conversation
5 5 background-color: #e4e4e4
  6 + background-size: cover
  7 + background-position: center center
6 8 position: absolute
7 9 top: 0
8 10 bottom: 0
... ... @@ -52,6 +54,7 @@
52 54  
53 55 #conversation ul.messages
54 56 padding: 0
  57 + pointer-events: none
55 58 // idle & active indicator
56 59 &:after
57 60 content: ""
... ... @@ -105,6 +108,7 @@
105 108 display: none
106 109 padding-left: 0.2rem
107 110 span.content
  111 + pointer-events: auto
108 112 border-radius: 0 0.5rem 0.5rem 0
109 113 word-wrap: break-word
110 114 position: relative