-
Notifications
You must be signed in to change notification settings - Fork 111
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
80fd761
commit a34abec
Showing
93 changed files
with
1,083 additions
and
1,722 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
class Admin::DistributionsController < ApplicationController | ||
before_action :set_distribution, only: %i[show edit update destroy] | ||
|
||
# GET /distributions | ||
def index | ||
@distributions = Distribution.all | ||
end | ||
|
||
# GET /distributions/1 | ||
def show | ||
end | ||
|
||
# GET /distributions/new | ||
def new | ||
@distribution = Distribution.new | ||
end | ||
|
||
# GET /distributions/1/edit | ||
def edit | ||
end | ||
|
||
# POST /distributions | ||
def create | ||
@distribution = Distribution.new(distribution_params) | ||
|
||
if @distribution.save | ||
redirect_to admin_distribution_path(@distribution), notice: "Distribution was successfully created." | ||
else | ||
render :new, status: :unprocessable_entity | ||
end | ||
end | ||
|
||
# PATCH/PUT /distributions/1 | ||
def update | ||
if @distribution.update(distribution_params) | ||
redirect_to admin_distribution_path(@distribution), notice: "Distribution was successfully updated." | ||
else | ||
render :edit, status: :unprocessable_entity | ||
end | ||
end | ||
|
||
# DELETE /distributions/1 | ||
def destroy | ||
@distribution.destroy | ||
redirect_to admin_distributions_url, notice: "Distribution was successfully destroyed." | ||
end | ||
|
||
private | ||
|
||
# Use callbacks to share common setup or constraints between actions. | ||
def set_distribution | ||
@distribution = Distribution.find(params[:id]) | ||
end | ||
|
||
# Only allow a list of trusted parameters through. | ||
def distribution_params | ||
params.require(:distribution).permit(:name, :vendor, :url, :obs_repo_names) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
class Admin::RepositoriesController < ApplicationController | ||
before_action :set_distribution | ||
before_action :set_repository, only: %i[show edit update destroy] | ||
|
||
# GET /repositories | ||
def index | ||
@repositories = @distribution.repositories | ||
end | ||
|
||
# GET /distributions/1/repositories/1 | ||
def show | ||
end | ||
|
||
# GET /distributions/1/repositories/new | ||
def new | ||
@repository = Repository.new | ||
end | ||
|
||
# GET /distributions/1/repositories/1/edit | ||
def edit | ||
end | ||
|
||
# POST /distributions/1/repositories | ||
def create | ||
@repository = @distribution.repositories.new(repository_params) | ||
|
||
if @repository.save | ||
redirect_to admin_distribution_repositories_path(@distribution), notice: "Repository was successfully created." | ||
else | ||
render :new, status: :unprocessable_entity | ||
end | ||
end | ||
|
||
# PATCH/PUT /distributions/1/repositories/1 | ||
def update | ||
if @repository.update(repository_params) | ||
redirect_to admin_distribution_repository_path(@distribution, @repository), notice: "Repository was successfully updated." | ||
else | ||
render :edit, status: :unprocessable_entity | ||
end | ||
end | ||
|
||
# DELETE /distributions/1/repositories/1 | ||
def destroy | ||
@repository.destroy | ||
redirect_to admin_distribution_repositories_path(@distribution), notice: "Repository was successfully destroyed." | ||
end | ||
|
||
private | ||
# Use callbacks to share common setup or constraints between actions. | ||
def set_distribution | ||
@distribution = Distribution.find(params[:distribution_id]) | ||
end | ||
|
||
def set_repository | ||
@repository = @distribution.repositories.find(params[:id]) | ||
end | ||
|
||
# Only allow a list of trusted parameters through. | ||
def repository_params | ||
params.require(:repository).permit(:url, :updateinfo, :revision) | ||
end | ||
end |
Oops, something went wrong.