[PATCH conductor] BZ797208: Enable push all button on autoupdate
ifarkas at redhat.com
ifarkas at redhat.com
Mon Mar 5 13:00:23 UTC 2012
From: Imre Farkas <ifarkas at redhat.com>
https://bugzilla.redhat.com/show_bug.cgi?id=797208
---
src/app/stylesheets/layout.scss | 5 ++++-
src/app/views/images/show.html.haml | 13 +++++++++++--
src/public/javascripts/backbone/views.js | 14 ++++++++++++++
3 files changed, 29 insertions(+), 3 deletions(-)
diff --git a/src/app/stylesheets/layout.scss b/src/app/stylesheets/layout.scss
index c58d93a..da3f9d9 100644
--- a/src/app/stylesheets/layout.scss
+++ b/src/app/stylesheets/layout.scss
@@ -2920,6 +2920,10 @@ ul.catalog_pretty {
/********************************************* Image show view */
/************************************************************************** */
+#push-all-btn {
+ display: inline;
+}
+
ul.image_builds{
border: 1px solid #ccc;
-webkit-border-radius: 7px 7px 7px 7px; -moz-border-radius: 7px 7px 7px 7px; border-radius: 7px 7px 7px 7px;
@@ -2972,7 +2976,6 @@ ul.image_builds{
}
}
-
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Flat Table Component -- v.0.0.1 [flat_table] (flat_table.scss)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
diff --git a/src/app/views/images/show.html.haml b/src/app/views/images/show.html.haml
index fe9faaa..38e34cf 100644
--- a/src/app/views/images/show.html.haml
+++ b/src/app/views/images/show.html.haml
@@ -45,8 +45,10 @@
- if @account_groups.size > 1
- build_text << '_all'
= button_to t(build_text), rebuild_all_image_path(@image.id), :class => 'button pill'
- - if @build and @build.id == @latest_build
- = button_to t('.push_all'), push_all_image_path(@image.id, :build_id => @build.id), :class => 'button pill'
+ #push-all-btn
+ - if @build and @build.id == @latest_build
+ = button_to t('.push_all'), push_all_image_path(@image.id, :build_id => @build.id), :class => 'button pill'
+
.content
%ul.image_builds
- @account_groups.each do |driver, group|
@@ -257,3 +259,10 @@
</li>
{{/if}}
{{/each}}
+
+%script#pushAllButtonTemplate{ :type => 'text/x-jquery-tmpl' }
+ :plain
+ #{path = push_all_image_path('replace_image_id', :build_id => 'replace_build_id')
+ path = path.sub('replace_image_id', '${image[\'uuid\']}')
+ path = path.sub('replace_build_id', '${build[\'uuid\']}')
+ button_to(t('images.show.push_all'), path, :class => 'button pill')}
diff --git a/src/public/javascripts/backbone/views.js b/src/public/javascripts/backbone/views.js
index 2d6da0d..6a1d823 100644
--- a/src/public/javascripts/backbone/views.js
+++ b/src/public/javascripts/backbone/views.js
@@ -208,5 +208,19 @@ Conductor.Views.ImagesShow = Backbone.View.extend({
$builds.empty();
$('#imageBuildsTemplate').tmpl(this.model.toJSON()).appendTo($builds);
+
+ // Enable/Disable Push All button
+ var $buttonTemplate = $('#pushAllButtonTemplate');
+ var $pushAllBtn = $('#push-all-btn');
+
+ var buildId = this.model.get("build") ? this.model.get("build")['uuid'] : null;
+ var latestBuildId = this.model.get("latest_build_id");
+
+ if (buildId && buildId == latestBuildId) {
+ $pushAllBtn.html($buttonTemplate.tmpl(this.model.toJSON()));
+ }
+ else {
+ $pushAllBtn.empty();
+ }
}
});
--
1.7.6.5
More information about the aeolus-devel
mailing list