Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
atruskie committed Jan 9, 2013
2 parents 4ea4c25 + a7830de commit 69e6933
Show file tree
Hide file tree
Showing 22 changed files with 141 additions and 175 deletions.
3 changes: 1 addition & 2 deletions app/assets/javascripts/angular/controllers/sites.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,7 @@ function SiteCtrl($scope, $resource, $routeParams, Project, Site, AudioRecording
$scope.delete = function() {
var doit = confirm("Are you sure you want to delete this site (id {0})?".format(this.site.id));
if (doit) {
siteResource.remove();

siteResource.remove(this.site.id, function(){ console.log('success')}, function(){ console.log('error')});
}
};

Expand Down
2 changes: 2 additions & 0 deletions app/assets/templates/projects_list.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ <h2>Projects</h2>

<p>Projects are a collection of sites that have a common goal.</p>

<p><a href="/projects/new">new Project</a></p>

<ul class="item-list">
<li ng-repeat="project in projects">
<div class="item-text">
Expand Down
14 changes: 3 additions & 11 deletions app/controllers/analysis_items_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ def index
@analysis_items = AnalysisItem.all

respond_to do |format|
format.html # index.html.erb
format.json { render json: @analysis_items }
end
end
Expand All @@ -16,7 +15,6 @@ def show
@analysis_item = AnalysisItem.find(params[:id])

respond_to do |format|
format.html # show.html.erb
format.json { render json: @analysis_item }
end
end
Expand All @@ -27,15 +25,14 @@ def new
@analysis_item = AnalysisItem.new

respond_to do |format|
format.html # new.html.erb
format.json { render json: @analysis_item }
end
end

# GET /analysis_items/1/edit
def edit
@analysis_item = AnalysisItem.find(params[:id])
end
#def edit
# @analysis_item = AnalysisItem.find(params[:id])
#end

# POST /analysis_items
# POST /analysis_items.json
Expand All @@ -44,10 +41,8 @@ def create

respond_to do |format|
if @analysis_item.save
format.html { redirect_to @analysis_item, notice: 'Analysis item was successfully created.' }
format.json { render json: @analysis_item, status: :created, location: @analysis_item }
else
format.html { render action: "new" }
format.json { render json: @analysis_item.errors, status: :unprocessable_entity }
end
end
Expand All @@ -60,10 +55,8 @@ def update

respond_to do |format|
if @analysis_item.update_attributes(params[:analysis_item])
format.html { redirect_to @analysis_item, notice: 'Analysis item was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: "edit" }
format.json { render json: @analysis_item.errors, status: :unprocessable_entity }
end
end
Expand All @@ -76,7 +69,6 @@ def destroy
@analysis_item.destroy

respond_to do |format|
format.html { redirect_to analysis_items_url }
format.json { head :no_content }
end
end
Expand Down
14 changes: 3 additions & 11 deletions app/controllers/analysis_jobs_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ def index
@analysis_jobs = AnalysisJob.all

respond_to do |format|
format.html # index.html.erb
format.json { render json: @analysis_jobs }
end
end
Expand All @@ -16,7 +15,6 @@ def show
@analysis_job = AnalysisJob.find(params[:id])

respond_to do |format|
format.html # show.html.erb
format.json { render json: @analysis_job }
end
end
Expand All @@ -27,15 +25,14 @@ def new
@analysis_job = AnalysisJob.new

respond_to do |format|
format.html # new.html.erb
format.json { render json: @analysis_job }
end
end

# GET /analysis_jobs/1/edit
def edit
@analysis_job = AnalysisJob.find(params[:id])
end
#def edit
# @analysis_job = AnalysisJob.find(params[:id])
#end

# POST /analysis_jobs
# POST /analysis_jobs.json
Expand All @@ -44,10 +41,8 @@ def create

respond_to do |format|
if @analysis_job.save
format.html { redirect_to @analysis_job, notice: 'Analysis job was successfully created.' }
format.json { render json: @analysis_job, status: :created, location: @analysis_job }
else
format.html { render action: "new" }
format.json { render json: @analysis_job.errors, status: :unprocessable_entity }
end
end
Expand All @@ -60,10 +55,8 @@ def update

respond_to do |format|
if @analysis_job.update_attributes(params[:analysis_job])
format.html { redirect_to @analysis_job, notice: 'Analysis job was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: "edit" }
format.json { render json: @analysis_job.errors, status: :unprocessable_entity }
end
end
Expand All @@ -76,7 +69,6 @@ def destroy
@analysis_job.destroy

respond_to do |format|
format.html { redirect_to analysis_jobs_url }
format.json { head :no_content }
end
end
Expand Down
14 changes: 3 additions & 11 deletions app/controllers/analysis_scripts_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ def index
@analysis_scripts = AnalysisScript.all

respond_to do |format|
format.html # index.html.erb
format.json { render json: @analysis_scripts }
end
end
Expand All @@ -16,7 +15,6 @@ def show
@analysis_script = AnalysisScript.find(params[:id])

respond_to do |format|
format.html # show.html.erb
format.json { render json: @analysis_script }
end
end
Expand All @@ -27,15 +25,14 @@ def new
@analysis_script = AnalysisScript.new

respond_to do |format|
format.html # new.html.erb
format.json { render json: @analysis_script }
end
end

# GET /analysis_scripts/1/edit
def edit
@analysis_script = AnalysisScript.find(params[:id])
end
#def edit
# @analysis_script = AnalysisScript.find(params[:id])
#end

# POST /analysis_scripts
# POST /analysis_scripts.json
Expand All @@ -44,10 +41,8 @@ def create

respond_to do |format|
if @analysis_script.save
format.html { redirect_to @analysis_script, notice: 'Analysis script was successfully created.' }
format.json { render json: @analysis_script, status: :created, location: @analysis_script }
else
format.html { render action: "new" }
format.json { render json: @analysis_script.errors, status: :unprocessable_entity }
end
end
Expand All @@ -60,10 +55,8 @@ def update

respond_to do |format|
if @analysis_script.update_attributes(params[:analysis_script])
format.html { redirect_to @analysis_script, notice: 'Analysis script was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: "edit" }
format.json { render json: @analysis_script.errors, status: :unprocessable_entity }
end
end
Expand All @@ -76,7 +69,6 @@ def destroy
@analysis_script.destroy

respond_to do |format|
format.html { redirect_to analysis_scripts_url }
format.json { head :no_content }
end
end
Expand Down
2 changes: 2 additions & 0 deletions app/controllers/api/sessions_controller.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
class Api::SessionsController < Devise::SessionsController
skip_authorization_check :only => [:ping]


=begin
e.g.
Expand Down
17 changes: 13 additions & 4 deletions app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,23 @@ class ApplicationController < ActionController::Base
before_filter :authenticate_user!
protect_from_forgery

# CanCan permisisons
# https://github.com/ryanb/cancan
#check_authorization
## CanCan permisisons
## https://github.com/ryanb/cancan

##Automatically does the following:
##@product = Product.find(params[:id])
##authorize! :discontinue, @product
## ----------------------------------

#check_authorization :unless => :devise_controller?
#load_and_authorize_resource :unless => :devise_controller?
rescue_from CanCan::AccessDenied do |exception|
#redirect_to root_url, :alert => exception.message
##redirect_to root_url, :alert => exception.message
render :json => Api::SessionsController.forbidden_info(current_user).to_json, :status => :forbidden
end

# end CanCan permissions

# userstamp
include Userstamp

Expand Down
13 changes: 4 additions & 9 deletions app/controllers/audio_events_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ def show
@audio_event = AudioEvent.includes(:audio_event_tags).find(params[:id])

respond_to do |format|
format.html # show.html.erb
format.json { render json: @audio_event }
end
end
Expand All @@ -64,16 +63,15 @@ def new
@audio_event = AudioEvent.new

respond_to do |format|
format.html # new.html.erb
format.json { render json: @audio_event }
end
end

# GET /audio_events/1/edit
def edit
@audio_event =
AudioEvent.find(params[:id]).include(:audio_event_tags)
end
#def edit
# @audio_event =
# AudioEvent.find(params[:id]).include(:audio_event_tags)
#end

# POST /audio_events
# POST /audio_events.json
Expand Down Expand Up @@ -102,10 +100,8 @@ def update

respond_to do |format|
if @audio_event.update_attributes(params[:audio_event])
format.html { redirect_to @audio_event, notice: 'Audio event was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: "edit" }
format.json { render json: @audio_event.errors, status: :unprocessable_entity }
end
end
Expand All @@ -118,7 +114,6 @@ def destroy
@audio_event.destroy

respond_to do |format|
format.html { redirect_to audio_events_url }
format.json { head :no_content }
end
end
Expand Down
14 changes: 3 additions & 11 deletions app/controllers/audio_recordings_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ def index
@audio_recordings = AudioRecording.all

respond_to do |format|
format.html # index.html.erb
format.json { render json: @audio_recordings }
end
end
Expand All @@ -16,7 +15,6 @@ def show
@audio_recording = AudioRecording.find(params[:id])

respond_to do |format|
format.html # show.html.erb
format.json { render json: @audio_recording }
end
end
Expand All @@ -27,15 +25,14 @@ def new
@audio_recording = AudioRecording.new

respond_to do |format|
format.html # new.html.erb
format.json { render json: @audio_recording }
end
end

# GET /audio_recordings/1/edit
def edit
@audio_recording = AudioRecording.find(params[:id])
end
#def edit
# @audio_recording = AudioRecording.find(params[:id])
#end

# POST /audio_recordings
# POST /audio_recordings.json
Expand All @@ -44,10 +41,8 @@ def create

respond_to do |format|
if @audio_recording.save
format.html { redirect_to @audio_recording, notice: 'Audio recording was successfully created.' }
format.json { render json: @audio_recording, status: :created, location: @audio_recording }
else
format.html { render action: "new" }
format.json { render json: @audio_recording.errors, status: :unprocessable_entity }
end
end
Expand All @@ -60,10 +55,8 @@ def update

respond_to do |format|
if @audio_recording.update_attributes(params[:audio_recording])
format.html { redirect_to @audio_recording, notice: 'Audio recording was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: "edit" }
format.json { render json: @audio_recording.errors, status: :unprocessable_entity }
end
end
Expand All @@ -76,7 +69,6 @@ def destroy
@audio_recording.destroy

respond_to do |format|
format.html { redirect_to audio_recordings_url }
format.json { head :no_content }
end
end
Expand Down
Loading

0 comments on commit 69e6933

Please sign in to comment.