From: Jan Provaznik jprovazn@redhat.com
--- src/app/controllers/image_controller.rb | 57 ------------------------------ src/app/controllers/images_controller.rb | 57 ++++++++++++++++++++++++++++++ src/app/helpers/image_helper.rb | 2 - 3 files changed, 57 insertions(+), 59 deletions(-) delete mode 100644 src/app/controllers/image_controller.rb create mode 100644 src/app/controllers/images_controller.rb delete mode 100644 src/app/helpers/image_helper.rb
diff --git a/src/app/controllers/image_controller.rb b/src/app/controllers/image_controller.rb deleted file mode 100644 index 8cd8cbe..0000000 --- a/src/app/controllers/image_controller.rb +++ /dev/null @@ -1,57 +0,0 @@ -# -# Copyright (C) 2009 Red Hat, Inc. -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; version 2 of the License. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, -# MA 02110-1301, USA. A copy of the GNU General Public License is -# also available at http://www.gnu.org/copyleft/gpl.html. - -# Filters added to this controller apply to all controllers in the application. -# Likewise, all the methods added will be available for all controllers. - -class ImageController < ApplicationController - before_filter :require_user - - def section_id - 'build' - end - - def index - end - - def cancel - Image.update(params[:id], :status => Image::STATE_CANCELED) - redirect_to :controller => 'templates', :action => 'new', :params => {'image_descriptor[id]' => params[:template_id], :tab => 'software'} - end - - def show - if params[:create_instance] - redirect_to :controller => 'instances', :action => 'new', 'instance[image_id]' => (params[:ids] || []).first - end - - require_privilege(Privilege::IMAGE_VIEW) - - @order_dir = params[:order_dir] == 'desc' ? 'desc' : 'asc' - @order = params[:order] || 'name' - @images = Image.search_filter(params[:search], Image::SEARCHABLE_COLUMNS).paginate( - :page => params[:page] || 1, - :order => @order + ' ' + @order_dir, - :include => :instances - ) - - if request.xhr? and params[:partial] - render :partial => 'images' - return - end - end -end diff --git a/src/app/controllers/images_controller.rb b/src/app/controllers/images_controller.rb new file mode 100644 index 0000000..3f8623b --- /dev/null +++ b/src/app/controllers/images_controller.rb @@ -0,0 +1,57 @@ +# +# Copyright (C) 2009 Red Hat, Inc. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, +# MA 02110-1301, USA. A copy of the GNU General Public License is +# also available at http://www.gnu.org/copyleft/gpl.html. + +# Filters added to this controller apply to all controllers in the application. +# Likewise, all the methods added will be available for all controllers. + +class ImagesController < ApplicationController + before_filter :require_user + + def section_id + 'build' + end + + def index + end + + def cancel + Image.update(params[:id], :status => Image::STATE_CANCELED) + redirect_to :controller => 'templates', :action => 'new', :params => {'image_descriptor[id]' => params[:template_id], :tab => 'software'} + end + + def show + if params[:create_instance] + redirect_to :controller => 'instances', :action => 'new', 'instance[image_id]' => (params[:ids] || []).first + end + + require_privilege(Privilege::IMAGE_VIEW) + + @order_dir = params[:order_dir] == 'desc' ? 'desc' : 'asc' + @order = params[:order] || 'name' + @images = Image.search_filter(params[:search], Image::SEARCHABLE_COLUMNS).paginate( + :page => params[:page] || 1, + :order => @order + ' ' + @order_dir, + :include => :instances + ) + + if request.xhr? and params[:partial] + render :partial => 'images' + return + end + end +end diff --git a/src/app/helpers/image_helper.rb b/src/app/helpers/image_helper.rb deleted file mode 100644 index b1092d1..0000000 --- a/src/app/helpers/image_helper.rb +++ /dev/null @@ -1,2 +0,0 @@ -module ImageHelper -end
From: Jan Provaznik jprovazn@redhat.com
--- src/app/controllers/image_controller.rb | 57 ------------------------------ src/app/controllers/images_controller.rb | 57 ++++++++++++++++++++++++++++++ src/app/helpers/image_helper.rb | 2 - src/app/views/image/_images.haml | 18 --------- src/app/views/image/show.haml | 20 ---------- src/app/views/images/_images.haml | 18 +++++++++ src/app/views/images/show.haml | 20 ++++++++++ 7 files changed, 95 insertions(+), 97 deletions(-) delete mode 100644 src/app/controllers/image_controller.rb create mode 100644 src/app/controllers/images_controller.rb delete mode 100644 src/app/helpers/image_helper.rb delete mode 100644 src/app/views/image/_images.haml delete mode 100644 src/app/views/image/show.haml create mode 100644 src/app/views/images/_images.haml create mode 100644 src/app/views/images/show.haml
diff --git a/src/app/controllers/image_controller.rb b/src/app/controllers/image_controller.rb deleted file mode 100644 index 8cd8cbe..0000000 --- a/src/app/controllers/image_controller.rb +++ /dev/null @@ -1,57 +0,0 @@ -# -# Copyright (C) 2009 Red Hat, Inc. -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; version 2 of the License. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, -# MA 02110-1301, USA. A copy of the GNU General Public License is -# also available at http://www.gnu.org/copyleft/gpl.html. - -# Filters added to this controller apply to all controllers in the application. -# Likewise, all the methods added will be available for all controllers. - -class ImageController < ApplicationController - before_filter :require_user - - def section_id - 'build' - end - - def index - end - - def cancel - Image.update(params[:id], :status => Image::STATE_CANCELED) - redirect_to :controller => 'templates', :action => 'new', :params => {'image_descriptor[id]' => params[:template_id], :tab => 'software'} - end - - def show - if params[:create_instance] - redirect_to :controller => 'instances', :action => 'new', 'instance[image_id]' => (params[:ids] || []).first - end - - require_privilege(Privilege::IMAGE_VIEW) - - @order_dir = params[:order_dir] == 'desc' ? 'desc' : 'asc' - @order = params[:order] || 'name' - @images = Image.search_filter(params[:search], Image::SEARCHABLE_COLUMNS).paginate( - :page => params[:page] || 1, - :order => @order + ' ' + @order_dir, - :include => :instances - ) - - if request.xhr? and params[:partial] - render :partial => 'images' - return - end - end -end diff --git a/src/app/controllers/images_controller.rb b/src/app/controllers/images_controller.rb new file mode 100644 index 0000000..3f8623b --- /dev/null +++ b/src/app/controllers/images_controller.rb @@ -0,0 +1,57 @@ +# +# Copyright (C) 2009 Red Hat, Inc. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, +# MA 02110-1301, USA. A copy of the GNU General Public License is +# also available at http://www.gnu.org/copyleft/gpl.html. + +# Filters added to this controller apply to all controllers in the application. +# Likewise, all the methods added will be available for all controllers. + +class ImagesController < ApplicationController + before_filter :require_user + + def section_id + 'build' + end + + def index + end + + def cancel + Image.update(params[:id], :status => Image::STATE_CANCELED) + redirect_to :controller => 'templates', :action => 'new', :params => {'image_descriptor[id]' => params[:template_id], :tab => 'software'} + end + + def show + if params[:create_instance] + redirect_to :controller => 'instances', :action => 'new', 'instance[image_id]' => (params[:ids] || []).first + end + + require_privilege(Privilege::IMAGE_VIEW) + + @order_dir = params[:order_dir] == 'desc' ? 'desc' : 'asc' + @order = params[:order] || 'name' + @images = Image.search_filter(params[:search], Image::SEARCHABLE_COLUMNS).paginate( + :page => params[:page] || 1, + :order => @order + ' ' + @order_dir, + :include => :instances + ) + + if request.xhr? and params[:partial] + render :partial => 'images' + return + end + end +end diff --git a/src/app/helpers/image_helper.rb b/src/app/helpers/image_helper.rb deleted file mode 100644 index b1092d1..0000000 --- a/src/app/helpers/image_helper.rb +++ /dev/null @@ -1,2 +0,0 @@ -module ImageHelper -end diff --git a/src/app/views/image/_images.haml b/src/app/views/image/_images.haml deleted file mode 100644 index d37f1d3..0000000 --- a/src/app/views/image/_images.haml +++ /dev/null @@ -1,18 +0,0 @@ -- columns = [ | - {:id => 'id', :header => ''}, | - {:id => 'name', :header => 'Name', :sortable => true}, | -] | - -- opts = { :order => @order, - :order_dir => @order_dir, - :title => 'list of templates', - :check_all => 'id', - :header => defined?(header) ? header : nil, - :footer => defined?(footer) ? footer : nil, - :single_select => @single_select || false } - -= paginated_table('images_table', columns, @images, opts) do |rec| - %tr{:class => "#{cycle('even', 'odd')}"} - %td= check_box_tag 'ids[]', rec.id - %td{:class => 'image_name'}= rec.image.name - /%td= rec.instances.count diff --git a/src/app/views/image/show.haml b/src/app/views/image/show.haml deleted file mode 100644 index eeb823e..0000000 --- a/src/app/views/image/show.haml +++ /dev/null @@ -1,20 +0,0 @@ -- content_for :scripts do - :javascript - $(document).ready(function() { - // bind listener, which enables "create instance" button if - // only 1 row is selected - $("#images_table").click(function() { - var checked_count = $('input[name="ids[]"]:checked', $("#images_table")).length; - $('input[name="create_instance"]').attr('disabled', checked_count != 1); - }); - - // uncheck all on load and disable create button - $('input[name="ids[]"]:checked', $("#images_table")).attr('checked', false); - $('input[name="create_instance"]').attr('disabled', true); - }); - -- buttons = capture_haml do - .action_buttons - = submit_tag "Create instance", :name => "create_instance" - -= render :partial => 'images', :locals => {:footer => buttons} diff --git a/src/app/views/images/_images.haml b/src/app/views/images/_images.haml new file mode 100644 index 0000000..d37f1d3 --- /dev/null +++ b/src/app/views/images/_images.haml @@ -0,0 +1,18 @@ +- columns = [ | + {:id => 'id', :header => ''}, | + {:id => 'name', :header => 'Name', :sortable => true}, | +] | + +- opts = { :order => @order, + :order_dir => @order_dir, + :title => 'list of templates', + :check_all => 'id', + :header => defined?(header) ? header : nil, + :footer => defined?(footer) ? footer : nil, + :single_select => @single_select || false } + += paginated_table('images_table', columns, @images, opts) do |rec| + %tr{:class => "#{cycle('even', 'odd')}"} + %td= check_box_tag 'ids[]', rec.id + %td{:class => 'image_name'}= rec.image.name + /%td= rec.instances.count diff --git a/src/app/views/images/show.haml b/src/app/views/images/show.haml new file mode 100644 index 0000000..eeb823e --- /dev/null +++ b/src/app/views/images/show.haml @@ -0,0 +1,20 @@ +- content_for :scripts do + :javascript + $(document).ready(function() { + // bind listener, which enables "create instance" button if + // only 1 row is selected + $("#images_table").click(function() { + var checked_count = $('input[name="ids[]"]:checked', $("#images_table")).length; + $('input[name="create_instance"]').attr('disabled', checked_count != 1); + }); + + // uncheck all on load and disable create button + $('input[name="ids[]"]:checked', $("#images_table")).attr('checked', false); + $('input[name="create_instance"]').attr('disabled', true); + }); + +- buttons = capture_haml do + .action_buttons + = submit_tag "Create instance", :name => "create_instance" + += render :partial => 'images', :locals => {:footer => buttons}
Forgot to rename image views, sending again :(.
On 11/16/2010 01:23 PM, jprovazn@redhat.com wrote:
From: Jan Provaznikjprovazn@redhat.com
src/app/controllers/image_controller.rb | 57 ------------------------------ src/app/controllers/images_controller.rb | 57 ++++++++++++++++++++++++++++++ src/app/helpers/image_helper.rb | 2 - 3 files changed, 57 insertions(+), 59 deletions(-) delete mode 100644 src/app/controllers/image_controller.rb create mode 100644 src/app/controllers/images_controller.rb delete mode 100644 src/app/helpers/image_helper.rb
diff --git a/src/app/controllers/image_controller.rb b/src/app/controllers/image_controller.rb deleted file mode 100644 index 8cd8cbe..0000000 --- a/src/app/controllers/image_controller.rb +++ /dev/null @@ -1,57 +0,0 @@ -# -# Copyright (C) 2009 Red Hat, Inc. -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; version 2 of the License. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, -# MA 02110-1301, USA. A copy of the GNU General Public License is -# also available at http://www.gnu.org/copyleft/gpl.html.
-# Filters added to this controller apply to all controllers in the application. -# Likewise, all the methods added will be available for all controllers.
-class ImageController< ApplicationController
- before_filter :require_user
- def section_id
- 'build'
- end
- def index
- end
- def cancel
- Image.update(params[:id], :status => Image::STATE_CANCELED)
- redirect_to :controller => 'templates', :action => 'new', :params => {'image_descriptor[id]' => params[:template_id], :tab => 'software'}
- end
- def show
- if params[:create_instance]
redirect_to :controller => 'instances', :action => 'new', 'instance[image_id]' => (params[:ids] || []).first
- end
- require_privilege(Privilege::IMAGE_VIEW)
- @order_dir = params[:order_dir] == 'desc' ? 'desc' : 'asc'
- @order = params[:order] || 'name'
- @images = Image.search_filter(params[:search], Image::SEARCHABLE_COLUMNS).paginate(
:page => params[:page] || 1,
:order => @order + ' ' + @order_dir,
:include => :instances
- )
- if request.xhr? and params[:partial]
render :partial => 'images'
return
- end
- end
-end diff --git a/src/app/controllers/images_controller.rb b/src/app/controllers/images_controller.rb new file mode 100644 index 0000000..3f8623b --- /dev/null +++ b/src/app/controllers/images_controller.rb @@ -0,0 +1,57 @@ +# +# Copyright (C) 2009 Red Hat, Inc. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, +# MA 02110-1301, USA. A copy of the GNU General Public License is +# also available at http://www.gnu.org/copyleft/gpl.html.
+# Filters added to this controller apply to all controllers in the application. +# Likewise, all the methods added will be available for all controllers.
+class ImagesController< ApplicationController
- before_filter :require_user
- def section_id
- 'build'
- end
- def index
- end
- def cancel
- Image.update(params[:id], :status => Image::STATE_CANCELED)
- redirect_to :controller => 'templates', :action => 'new', :params => {'image_descriptor[id]' => params[:template_id], :tab => 'software'}
- end
- def show
- if params[:create_instance]
redirect_to :controller => 'instances', :action => 'new', 'instance[image_id]' => (params[:ids] || []).first
- end
- require_privilege(Privilege::IMAGE_VIEW)
- @order_dir = params[:order_dir] == 'desc' ? 'desc' : 'asc'
- @order = params[:order] || 'name'
- @images = Image.search_filter(params[:search], Image::SEARCHABLE_COLUMNS).paginate(
:page => params[:page] || 1,
:order => @order + ' ' + @order_dir,
:include => :instances
- )
- if request.xhr? and params[:partial]
render :partial => 'images'
return
- end
- end
+end diff --git a/src/app/helpers/image_helper.rb b/src/app/helpers/image_helper.rb deleted file mode 100644 index b1092d1..0000000 --- a/src/app/helpers/image_helper.rb +++ /dev/null @@ -1,2 +0,0 @@ -module ImageHelper -end
deltacloud-devel@lists.fedorahosted.org