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
Showing
11 changed files
with
126 additions
and
65 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,4 +13,10 @@ ul#navigation { | |
li { | ||
display: inline; | ||
} | ||
} | ||
|
||
#admin_bar { | ||
background: white; | ||
padding: 5px; | ||
text-align: center; | ||
} |
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,83 @@ | ||
class Admin::ServicesController < Admin::BaseController | ||
# GET /services | ||
# GET /services.json | ||
def index | ||
@services = Service.all | ||
|
||
respond_to do |format| | ||
format.html # index.html.erb | ||
format.json { render json: @services } | ||
end | ||
end | ||
|
||
# GET /services/1 | ||
# GET /services/1.json | ||
def show | ||
@service = Service.find(params[:id]) | ||
|
||
respond_to do |format| | ||
format.html # show.html.erb | ||
format.json { render json: @service } | ||
end | ||
end | ||
|
||
# GET /services/new | ||
# GET /services/new.json | ||
def new | ||
@service = Service.new | ||
|
||
respond_to do |format| | ||
format.html # new.html.erb | ||
format.json { render json: @service } | ||
end | ||
end | ||
|
||
# GET /services/1/edit | ||
def edit | ||
@service = Service.find(params[:id]) | ||
end | ||
|
||
# POST /services | ||
# POST /services.json | ||
def create | ||
@service = Service.new(params[:service]) | ||
|
||
respond_to do |format| | ||
if @service.save | ||
format.html { redirect_to services_url, notice: 'Service was successfully created.' } | ||
format.json { render json: @service, status: :created, location: @service } | ||
else | ||
format.html { render action: "new" } | ||
format.json { render json: @service.errors, status: :unprocessable_entity } | ||
end | ||
end | ||
end | ||
|
||
# PUT /services/1 | ||
# PUT /services/1.json | ||
def update | ||
@service = Service.find(params[:id]) | ||
|
||
respond_to do |format| | ||
if @service.update_attributes(params[:service]) | ||
format.html { redirect_to admin_services_url, notice: 'Service was successfully updated.' } | ||
format.json { head :no_content } | ||
else | ||
format.html { render action: "edit" } | ||
format.json { render json: @service.errors, status: :unprocessable_entity } | ||
end | ||
end | ||
end | ||
|
||
# DELETE /services/1 | ||
# DELETE /services/1.json | ||
def destroy | ||
@service = Service.find(params[:id]) | ||
@service.destroy | ||
|
||
respond_to do |format| | ||
format.html { redirect_to services_url } | ||
format.json { head :no_content } | ||
end | ||
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
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 |
---|---|---|
@@ -1,2 +1,5 @@ | ||
class Service < ActiveRecord::Base | ||
def to_s | ||
name | ||
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 |
---|---|---|
@@ -1,3 +1,5 @@ | ||
<ul> | ||
<% @projects.each do |project| %> | ||
<%= link_to project, edit_admin_project_path(project) %> | ||
<% end %> | ||
<li><%= link_to project, edit_admin_project_path(project) %></li> | ||
<% end %> | ||
</ul> |
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,13 @@ | ||
<%= form_for ['admin',@service] do |f| %> | ||
<div> | ||
<%= f.label :name %> | ||
<%= f.text_field :name %> | ||
</div> | ||
<div> | ||
<%= f.label :description %> | ||
<%= f.text_area :description %> | ||
</div> | ||
<div> | ||
<%= f.submit %> | ||
</div> | ||
<% 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,5 @@ | ||
<ul> | ||
<% @services.each do |service| %> | ||
<li><%= link_to service, edit_admin_service_path(service) %></li> | ||
<% end %> | ||
</ul> |
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 |
---|---|---|
|
@@ -13,6 +13,7 @@ | |
|
||
namespace :admin do | ||
resources :projects | ||
resources :services | ||
end | ||
|
||
resources :downloads | ||
|