Merge pull request #423 from abf/rosa-build:fix_api_missing_template

fix ActionView::MissingTemplate
This commit is contained in:
avm 2014-09-10 12:55:07 +04:00
commit 8c4e16d22d
15 changed files with 63 additions and 23 deletions

View File

@ -6,12 +6,13 @@ class Api::V1::AdvisoriesController < Api::V1::BaseController
authorize_resource :build_list, only: [:create, :update] authorize_resource :build_list, only: [:create, :update]
def index def index
@advisories = @advisories.includes(:platforms, :projects). @advisories = @advisories.includes(:platforms, :projects).paginate(paginate_params)
paginate(paginate_params) respond_to :json
end end
def show def show
@packages_info = @advisory.fetch_packages_info @packages_info = @advisory.fetch_packages_info
respond_to :json
end end
def create def create

View File

@ -3,6 +3,7 @@ class Api::V1::ArchesController < Api::V1::BaseController
def index def index
@arches = Arch.order(:id).paginate(paginate_params) @arches = Arch.order(:id).paginate(paginate_params)
respond_to :json
end end
end end

View File

@ -1,6 +1,6 @@
class Api::V1::BaseController < ApplicationController class Api::V1::BaseController < ApplicationController
include PaginateHelper include PaginateHelper
#respond_to :json respond_to :json
helper_method :member_path helper_method :member_path

View File

@ -1,16 +1,20 @@
class Api::V1::BuildListsController < Api::V1::BaseController class Api::V1::BuildListsController < Api::V1::BaseController
before_filter :authenticate_user! before_filter :authenticate_user!
skip_before_filter :authenticate_user!, only: [:show, :index] if APP_CONFIG['anonymous_access'] skip_before_filter :authenticate_user!, only: [:show, :index] if APP_CONFIG['anonymous_access']
load_resource :project, only: :index, parent: false load_resource :project, only: :index, parent: false
load_and_authorize_resource :build_list, only: [:show, :create, :cancel, :publish, :reject_publish, :create_container, :publish_into_testing, :rerun_tests] load_and_authorize_resource :build_list, only: [:show, :create, :cancel, :publish, :reject_publish, :create_container, :publish_into_testing, :rerun_tests]
def show
respond_to :json
end
def index def index
authorize!(:show, @project) if @project authorize!(:show, @project) if @project
filter = BuildList::Filter.new(@project, current_user, current_ability, params[:filter] || {}) filter = BuildList::Filter.new(@project, current_user, current_ability, params[:filter] || {})
@build_lists = filter.find.includes(:save_to_platform, :project, :user, :arch) @build_lists = filter.find.includes(:save_to_platform, :project, :user, :arch)
@build_lists = @build_lists.recent.paginate(paginate_params) @build_lists = @build_lists.recent.paginate(paginate_params)
respond_to :json
end end
def create def create

View File

@ -7,15 +7,17 @@ class Api::V1::GroupsController < Api::V1::BaseController
def index def index
# accessible_by(current_ability) # accessible_by(current_ability)
@groups = current_user.groups.paginate(paginate_params) @groups = current_user.groups.paginate(paginate_params)
respond_to :json
end end
def show def show
respond_to :json
end end
def members def members
@members = @group.members. @members = @group.members.where('actor_id != ?', @group.owner_id)
where('actor_id != ?', @group.owner_id). .order('name').paginate(paginate_params)
order('name').paginate(paginate_params) respond_to :json
end end
def update def update
@ -46,4 +48,4 @@ class Api::V1::GroupsController < Api::V1::BaseController
update_member_in_subject @group, :actors update_member_in_subject @group, :actors
end end
end end

View File

@ -1,6 +1,4 @@
class Api::V1::IssuesController < Api::V1::BaseController class Api::V1::IssuesController < Api::V1::BaseController
respond_to :json
before_filter :authenticate_user! before_filter :authenticate_user!
skip_before_filter :authenticate_user!, only: [:index, :group_index, :show] if APP_CONFIG['anonymous_access'] skip_before_filter :authenticate_user!, only: [:index, :group_index, :show] if APP_CONFIG['anonymous_access']
@ -34,7 +32,11 @@ class Api::V1::IssuesController < Api::V1::BaseController
end end
def show def show
redirect_to api_v1_project_pull_request_path(@project.id, @issue.serial_id) if @issue.pull_request if @issue.pull_request
redirect_to api_v1_project_pull_request_path(@project.id, @issue.serial_id)
else
respond_to :json
end
end end
def create def create
@ -102,7 +104,10 @@ class Api::V1::IssuesController < Api::V1::BaseController
@issues = @issues.where('issues.created_at >= to_timestamp(?)', params[:since]) if params[:since] =~ /\A\d+\z/ @issues = @issues.where('issues.created_at >= to_timestamp(?)', params[:since]) if params[:since] =~ /\A\d+\z/
@issues = @issues.paginate(paginate_params) @issues = @issues.paginate(paginate_params)
render :index
respond_to do |format|
format.json { render :index }
end
end end
def get_all_project_ids default_project_ids def get_all_project_ids default_project_ids

View File

@ -7,5 +7,6 @@ class Api::V1::MaintainersController < Api::V1::BaseController
.actual.by_platform(@platform) .actual.by_platform(@platform)
.like_name(params[:package_name]) .like_name(params[:package_name])
.paginate(paginate_params) .paginate(paginate_params)
respond_to :json
end end
end end

View File

@ -16,16 +16,20 @@ class Api::V1::PlatformsController < Api::V1::BaseController
end end
def index def index
@platforms = @platforms.accessible_by(current_ability, :related). @platforms = @platforms.accessible_by(current_ability, :related)
by_type(params[:type]).paginate(paginate_params) .by_type(params[:type]).paginate(paginate_params)
respond_to :json
end end
def show def show
respond_to :json
end end
def platforms_for_build def platforms_for_build
@platforms = Platform.main.opened.paginate(paginate_params) @platforms = Platform.main.opened.paginate(paginate_params)
render :index respond_to do |format|
format.json { render :index }
end
end end
def create def create
@ -44,6 +48,7 @@ class Api::V1::PlatformsController < Api::V1::BaseController
def members def members
@members = @platform.members.order('name').paginate(paginate_params) @members = @platform.members.order('name').paginate(paginate_params)
respond_to :json
end end
def add_member def add_member

View File

@ -13,6 +13,7 @@ class Api::V1::ProductBuildListsController < Api::V1::BaseController
end end
@product_build_lists = @product_build_lists.joins(:product, :project, :arch) @product_build_lists = @product_build_lists.joins(:product, :project, :arch)
@product_build_lists = @product_build_lists.recent.paginate(paginate_params) @product_build_lists = @product_build_lists.recent.paginate(paginate_params)
respond_to :json
end end
def create def create
@ -24,6 +25,7 @@ class Api::V1::ProductBuildListsController < Api::V1::BaseController
end end
def show def show
respond_to :json
end end
def update def update

View File

@ -13,6 +13,7 @@ class Api::V1::ProductsController < Api::V1::BaseController
end end
def show def show
respond_to :json
end end
def destroy def destroy

View File

@ -6,8 +6,9 @@ class Api::V1::ProjectsController < Api::V1::BaseController
load_and_authorize_resource :project load_and_authorize_resource :project
def index def index
@projects = Project.accessible_by(current_ability, :membered). @projects = Project.accessible_by(current_ability, :membered)
paginate(paginate_params) .paginate(paginate_params)
respond_to :json
end end
def get_id def get_id
@ -16,13 +17,16 @@ class Api::V1::ProjectsController < Api::V1::BaseController
else else
raise ActiveRecord::RecordNotFound raise ActiveRecord::RecordNotFound
end end
respond_to :json
end end
def show def show
respond_to :json
end end
def refs_list def refs_list
@refs = @project.repo.branches + @project.repo.tags.select{ |t| t.commit } @refs = @project.repo.branches + @project.repo.tags.select{ |t| t.commit }
respond_to :json
end end
def update def update
@ -48,6 +52,7 @@ class Api::V1::ProjectsController < Api::V1::BaseController
def members def members
@members = @project.collaborators.order('uname').paginate(paginate_params) @members = @project.collaborators.order('uname').paginate(paginate_params)
respond_to :json
end end
def add_member def add_member

View File

@ -39,6 +39,7 @@ class Api::V1::PullRequestsController < Api::V1::BaseController
def show def show
redirect_to api_v1_project_issue_path(@project.id, @issue.serial_id) if @pull.nil? redirect_to api_v1_project_issue_path(@project.id, @issue.serial_id) if @pull.nil?
respond_to :json
end end
def create def create
@ -95,10 +96,12 @@ class Api::V1::PullRequestsController < Api::V1::BaseController
def commits def commits
@commits = @pull.repo.commits_between(@pull.to_commit, @pull.from_commit).paginate(paginate_params) @commits = @pull.repo.commits_between(@pull.to_commit, @pull.from_commit).paginate(paginate_params)
respond_to :json
end end
def files def files
@stats = @pull.diff_stats.zip(@pull.diff).paginate(paginate_params) @stats = @pull.diff_stats.zip(@pull.diff).paginate(paginate_params)
respond_to :json
end end
def merge def merge
@ -149,7 +152,10 @@ class Api::V1::PullRequestsController < Api::V1::BaseController
@pulls = @pulls.where('issues.created_at >= to_timestamp(?)', params[:since]) if params[:since] =~ /\A\d+\z/ @pulls = @pulls.where('issues.created_at >= to_timestamp(?)', params[:since]) if params[:since] =~ /\A\d+\z/
@pulls = @pulls.paginate(paginate_params) @pulls = @pulls.paginate(paginate_params)
render :index
respond_to do |format|
format.json { render :index }
end
end end
def get_all_project_ids default_project_ids def get_all_project_ids default_project_ids

View File

@ -1,4 +1,5 @@
class Api::V1::RepositoriesController < Api::V1::BaseController class Api::V1::RepositoriesController < Api::V1::BaseController
respond_to :csv, only: :packages
before_filter :authenticate_user! before_filter :authenticate_user!
skip_before_filter :authenticate_user!, only: [:show, :projects] if APP_CONFIG['anonymous_access'] skip_before_filter :authenticate_user!, only: [:show, :projects] if APP_CONFIG['anonymous_access']
@ -6,11 +7,12 @@ class Api::V1::RepositoriesController < Api::V1::BaseController
load_and_authorize_resource :repository, through: :platform, shallow: true load_and_authorize_resource :repository, through: :platform, shallow: true
def show def show
respond_to :json
end end
def projects def projects
@projects = @repository.projects. @projects = @repository.projects.recent.paginate(paginate_params)
recent.paginate(paginate_params) respond_to :json
end end
def update def update
@ -30,6 +32,7 @@ class Api::V1::RepositoriesController < Api::V1::BaseController
end end
def key_pair def key_pair
respond_to :json
end end
# Only one request per 15 minutes for each platform # Only one request per 15 minutes for each platform

View File

@ -7,5 +7,6 @@ class Api::V1::SearchController < Api::V1::BaseController
(params[:type] || 'all'), (params[:type] || 'all'),
paginate_params paginate_params
) )
respond_to :json
end end
end end

View File

@ -7,10 +7,13 @@ class Api::V1::UsersController < Api::V1::BaseController
def show def show
@user = User.opened.find params[:id] # dont show system users @user = User.opened.find params[:id] # dont show system users
respond_to :json
end end
def show_current_user def show_current_user
render :show respond_to do |format|
format.json { render :show }
end
end end
def update def update
@ -35,7 +38,7 @@ class Api::V1::UsersController < Api::V1::BaseController
render_json_response @user, error_message(@user.notifier, 'User notification settings have not been updated'), 422 render_json_response @user, error_message(@user.notifier, 'User notification settings have not been updated'), 422
end end
else else
render :notifiers respond_to :json
end end
end end