Merge lp:~stephen-stewart/snapweb/disabled-install-buttons-for-oem-types into lp:~snappy-dev/snapweb/trunk

Proposed by Stephen Stewart
Status: Merged
Approved by: Sergio Schvezov
Approved revision: 139
Merged at revision: 138
Proposed branch: lp:~stephen-stewart/snapweb/disabled-install-buttons-for-oem-types
Merge into: lp:~snappy-dev/snapweb/trunk
Diff against target: 198 lines (+56/-25)
9 files modified
www/src/css/installer.css (+9/-2)
www/src/css/snaplist.css (+0/-1)
www/src/js/behaviors/install.js (+5/-0)
www/src/js/models/snap.js (+13/-0)
www/src/js/templates/_installer.hbs (+21/-0)
www/src/js/templates/snap-layout.hbs (+1/-11)
www/src/js/templates/snaplist-item.hbs (+1/-11)
www/src/js/views/snap-layout.js (+3/-0)
www/src/js/views/snaplist-item.js (+3/-0)
To merge this branch: bzr merge lp:~stephen-stewart/snapweb/disabled-install-buttons-for-oem-types
Reviewer Review Type Date Requested Status
Sergio Schvezov Approve
Review via email: mp+258621@code.launchpad.net

Commit message

show only a status (no button) for certain snap type installer actions

To post a comment you must log in.
Revision history for this message
Sergio Schvezov (sergiusens) wrote :

Not being a js person, not sure if what I say is relevant.

review: Needs Information
Revision history for this message
Sergio Schvezov (sergiusens) wrote :

The behavior looks and feels good btw!

139. By Stephen Stewart

fix for clean lint

Revision history for this message
Stephen Stewart (stephen-stewart) wrote :

Completely relevant, especially since i added a linter to tell me these things and appear to have ignore it.

Revision history for this message
Sergio Schvezov (sergiusens) :
review: Approve
Revision history for this message
Sergio Schvezov (sergiusens) wrote :

> Completely relevant, especially since i added a linter to tell me these things
> and appear to have ignore it.

A future MP should make these fail.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'www/src/css/installer.css'
2--- www/src/css/installer.css 2015-05-07 14:37:47 +0000
3+++ www/src/css/installer.css 2015-05-08 14:53:16 +0000
4@@ -4,7 +4,7 @@
5 font-size:15px;
6 }
7
8-.b-installer.b-installer__small {
9+.b-installer.b-installer--small {
10 font-size:13px;
11 width:160px;
12 }
13@@ -26,13 +26,20 @@
14 white-space: nowrap;
15 }
16
17-
18 .b-installer--uninstall .b-installer__button {
19 background-color:#ccc;
20 color:#fff;
21 font-weight:300;
22 }
23
24+.b-installer--disabled .b-installer__button {
25+ font-weight: inherit;
26+ background-color: inherit;
27+ color:#333;
28+ cursor:not-allowed;
29+ text-transform:none;
30+}
31+
32 .b-installer--thinking .b-installer__button {
33 background-color:transparent;
34 cursor:progress;
35
36=== modified file 'www/src/css/snaplist.css'
37--- www/src/css/snaplist.css 2015-05-07 20:00:36 +0000
38+++ www/src/css/snaplist.css 2015-05-08 14:53:16 +0000
39@@ -83,7 +83,6 @@
40 }
41
42 .b-snaplist--row .b-snaplist__actions {
43- flex: 1;
44 }
45
46 .b-snaplist--row .b-installer__message {
47
48=== modified file 'www/src/js/behaviors/install.js'
49--- www/src/js/behaviors/install.js 2015-05-07 19:40:49 +0000
50+++ www/src/js/behaviors/install.js 2015-05-08 14:53:16 +0000
51@@ -77,6 +77,11 @@
52 onInstallClick: function(e) {
53 var model = this.view.model;
54 var status = model.get('status');
55+ var isInstallable = model.get('isInstallable');
56+
57+ if (!isInstallable) {
58+ return;
59+ }
60
61 if (status === CONF.INSTALL_STATE.INSTALLED) {
62 // uninstall
63
64=== modified file 'www/src/js/models/snap.js'
65--- www/src/js/models/snap.js 2015-05-07 20:58:29 +0000
66+++ www/src/js/models/snap.js 2015-05-08 14:53:16 +0000
67@@ -120,9 +120,22 @@
68
69 parse: function(response) {
70
71+ var status = response.status;
72 var type = response.type;
73 var id = response.id;
74
75+ if (
76+ status === CONF.INSTALL_STATE.INSTALLED ||
77+ status === CONF.INSTALL_STATE.UNINSTALLING
78+ ) {
79+ response.isInstalled = true;
80+ } else if (
81+ status === CONF.INSTALL_STATE.UNINSTALLED ||
82+ status === CONF.INSTALL_STATE.INSTALLING
83+ ) {
84+ response.isInstalled = false;
85+ }
86+
87 if (response.hasOwnProperty('icon') && !response.icon.length) {
88 response.icon = this.defaults.icon;
89 }
90
91=== added file 'www/src/js/templates/_installer.hbs'
92--- www/src/js/templates/_installer.hbs 1970-01-01 00:00:00 +0000
93+++ www/src/js/templates/_installer.hbs 2015-05-08 14:53:16 +0000
94@@ -0,0 +1,21 @@
95+{{#if isInstallable}}
96+<div class="b-installer b-installer--small {{ installHTMLClass }}">
97+{{#if installActionString}}
98+<div class="b-installer__button">{{ installActionString }}</div>
99+<div class="b-installer__progress" title="download progress">
100+<div class="b-installer__value"></div>
101+</div>
102+{{/if}}
103+<div class="b-installer__message"></div>
104+</div>
105+{{else}}
106+<div class="b-installer b-installer--small b-installer--disabled {{ installHTMLClass }}">
107+<div class="b-installer__button">
108+{{#if isInstalled}}
109+Installed
110+{{else}}
111+Not installable
112+{{/if}}
113+</div>
114+</div>
115+{{/if}}
116
117=== modified file 'www/src/js/templates/snap-layout.hbs'
118--- www/src/js/templates/snap-layout.hbs 2015-05-07 20:00:36 +0000
119+++ www/src/js/templates/snap-layout.hbs 2015-05-08 14:53:16 +0000
120@@ -7,17 +7,7 @@
121 </p>
122 </div>
123 <div class="b-snap__actions">
124- {{#if isInstallable}}
125- <div class="b-installer {{ installHTMLClass }}">
126- {{#if installActionString}}
127- <div class="b-installer__button">{{ installActionString }}</div>
128- <div class="b-installer__progress" title="download progress">
129- <div class="b-installer__value"></div>
130- </div>
131- {{/if}}
132- <div class="b-installer__message"></div>
133- </div>
134- {{/if}}
135+ {{> installer}}
136 </div>
137 </div>
138 <div class="region-menu"></div>
139
140=== modified file 'www/src/js/templates/snaplist-item.hbs'
141--- www/src/js/templates/snaplist-item.hbs 2015-05-07 20:00:36 +0000
142+++ www/src/js/templates/snaplist-item.hbs 2015-05-08 14:53:16 +0000
143@@ -7,15 +7,5 @@
144 <div class="b-snaplist__origin">{{ origin }}</div>
145 <div class="b-snaplist__type">{{ type }}</div>
146 <div class="b-snaplist__actions">
147- {{#if isInstallable}}
148- <div class="b-installer b-installer__small {{ installHTMLClass }}">
149- {{#if installActionString}}
150- <div class="b-installer__button">{{ installActionString }}</div>
151- <div class="b-installer__progress" title="download progress">
152- <div class="b-installer__value"></div>
153- </div>
154- {{/if}}
155- <div class="b-installer__message"></div>
156- </div>
157- {{/if}}
158+ {{> installer}}
159 </div>
160
161=== modified file 'www/src/js/views/snap-layout.js'
162--- www/src/js/views/snap-layout.js 2015-05-07 15:48:50 +0000
163+++ www/src/js/views/snap-layout.js 2015-05-08 14:53:16 +0000
164@@ -2,6 +2,7 @@
165 var _ = require('lodash');
166 var Backbone = require('backbone');
167 var Marionette = require('backbone.marionette');
168+var Handlebars = require('hbsfy/runtime');
169 var SnapMenuView = require('./snap-menu.js');
170 var SnapDetailView = require('./snap-detail.js');
171 var SnapReviewsView = require('./snap-reviews.js');
172@@ -10,6 +11,8 @@
173 var template = require('../templates/snap-layout.hbs');
174 var CONF = require('../config.js');
175
176+Handlebars.registerPartial('installer', require('../templates/_installer.hbs'));
177+
178 module.exports = Marionette.LayoutView.extend({
179
180 behaviors: {
181
182=== modified file 'www/src/js/views/snaplist-item.js'
183--- www/src/js/views/snaplist-item.js 2015-05-06 18:57:26 +0000
184+++ www/src/js/views/snaplist-item.js 2015-05-08 14:53:16 +0000
185@@ -4,10 +4,13 @@
186 Backbone.$ = $;
187 var Marionette = require('backbone.marionette');
188 var Radio = require('backbone.radio');
189+var Handlebars = require('hbsfy/runtime');
190 var InstallBehavior = require('../behaviors/install.js');
191 var template = require('../templates/snaplist-item.hbs');
192 var snapChannel = Radio.channel('snap');
193
194+Handlebars.registerPartial('installer', require('../templates/_installer.hbs'));
195+
196 module.exports = Marionette.ItemView.extend({
197
198 className: 'b-snaplist__item',

Subscribers

People subscribed via source and target branches