Class: Content::RepositoriesController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- Content::RepositoriesController
- Includes:
- Foreman::Controller::AutoCompleteSearch
- Defined in:
- app/controllers/content/repositories_controller.rb
Instance Method Summary collapse
- #create ⇒ Object
- #destroy ⇒ Object
- #edit ⇒ Object
- #index ⇒ Object
- #new ⇒ Object
- #show ⇒ Object
- #sync ⇒ Object
- #update ⇒ Object
Instance Method Details
#create ⇒ Object
22 23 24 25 26 27 28 29 |
# File 'app/controllers/content/repositories_controller.rb', line 22 def create @repository = Repository.new(params[:content_repository]) if @repository.save process_success else process_error end end |
#destroy ⇒ Object
45 46 47 48 49 50 51 |
# File 'app/controllers/content/repositories_controller.rb', line 45 def destroy if @repository.destroy process_success else process_error end end |
#edit ⇒ Object
31 32 |
# File 'app/controllers/content/repositories_controller.rb', line 31 def edit end |
#index ⇒ Object
6 7 8 9 |
# File 'app/controllers/content/repositories_controller.rb', line 6 def index @repositories = Repository.search_for(params[:search], :order => params[:order]). paginate(:page => params[:page]) end |
#new ⇒ Object
11 12 13 14 15 16 17 18 19 20 |
# File 'app/controllers/content/repositories_controller.rb', line 11 def new @repository = case params[:type] when "operatingsystem" Repository::OperatingSystem.new(:unprotected => true) when "product" Repository::Product.new(:originator_id => params[:product_id]) else not_found end end |
#show ⇒ Object
42 43 |
# File 'app/controllers/content/repositories_controller.rb', line 42 def show end |
#sync ⇒ Object
53 54 55 56 57 58 |
# File 'app/controllers/content/repositories_controller.rb', line 53 def sync @repository.sync process_success(:success_msg => _("Successfully started sync for %s") % @repository.to_label) rescue => e process_error(:error_msg => _("Failed to start sync for %s") % @repository.to_label) end |
#update ⇒ Object
34 35 36 37 38 39 40 |
# File 'app/controllers/content/repositories_controller.rb', line 34 def update if @repository.update_attributes(params[:content_repository]) process_success else process_error end end |