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
15 16 17 18 19 20 21 22 |
# File 'app/controllers/content/repositories_controller.rb', line 15 def create @repository = Repository.new(params[:content_repository]) if @repository.save process_success else process_error end end |
#destroy ⇒ Object
42 43 44 45 46 47 48 |
# File 'app/controllers/content/repositories_controller.rb', line 42 def destroy if @repository.destroy process_success else process_error end end |
#edit ⇒ Object
24 25 |
# File 'app/controllers/content/repositories_controller.rb', line 24 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]).includes(:product, :operatingsystems) end |
#new ⇒ Object
11 12 13 |
# File 'app/controllers/content/repositories_controller.rb', line 11 def new @repository = Repository.new(:unprotected => true) end |
#show ⇒ Object
35 36 37 38 39 40 |
# File 'app/controllers/content/repositories_controller.rb', line 35 def show @details = @repository.retrieve_with_details @sync_history = @repository.sync_history rescue redirect_back_or_to(edit_repository_path) end |
#sync ⇒ Object
50 51 52 53 54 55 |
# File 'app/controllers/content/repositories_controller.rb', line 50 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
27 28 29 30 31 32 33 |
# File 'app/controllers/content/repositories_controller.rb', line 27 def update if @repository.update_attributes(params[:content_repository]) process_success else process_error end end |