| 32 | | getHeight: function() { |
| 33 | | var image = this.$el.find('img'), |
| 34 | | saved, height, headerImageData; |
| 35 | | |
| 36 | | if (image.length) { |
| 37 | | this.$el.find('.inner').hide(); |
| 38 | | } else { |
| 39 | | this.$el.find('.inner').show(); |
| 40 | | return 40; |
| 41 | | } |
| 42 | | |
| 43 | | saved = this.model.get('savedHeight'); |
| 44 | | height = image.height() || saved; |
| 45 | | |
| 46 | | // happens at ready |
| 47 | | if (!height) { |
| 48 | | headerImageData = api.get().header_image_data; |
| 49 | | |
| 50 | | if (headerImageData && headerImageData.width && headerImageData.height) { |
| 51 | | // hardcoded container width |
| 52 | | height = 260 / headerImageData.width * headerImageData.height; |
| 53 | | } |
| 54 | | else { |
| 55 | | // fallback for when no image is set |
| 56 | | height = 40; |
| 57 | | } |
| 58 | | } |
| 59 | | |
| 60 | | return height; |
| 61 | | }, |
| 62 | | |
| 63 | | setPlaceholder: function(_height) { |
| 64 | | var height = _height || this.getHeight(); |
| 65 | | this.model.set('savedHeight', height); |
| 66 | | this.$el.height(height); |
| 67 | | }, |
| 68 | | |