Merge branch 'easy_urpmi'

Conflicts:
	app/controllers/application_controller.rb
This commit is contained in:
Pavel Chipiga 2011-10-21 17:57:29 +03:00
commit b61797e896
3 changed files with 17 additions and 3 deletions

View File

@ -23,6 +23,7 @@ gem "russian"
gem "grit"
gem 'whenever', :require => false
gem 'delayed_job'
gem 'whenever', :require => false
gem 'unicorn'
group :production do

View File

@ -2,10 +2,10 @@
class ApplicationController < ActionController::Base
protect_from_forgery
layout :layout_by_resource
private
def get_role(object_id, object_type, target_id, target_type)
rel=Relation.where(:object_id=>object_id, :object_type=>object_type, :target_id=>target_id, :target_type=>target_type).first
return (rel) ? rel.roles : nil
Relation.where(:object_id=>object_id, :object_type=>object_type, :target_id=>target_id, :target_type=>target_type).first.try(:roles)
end
def checkaccess

View File

@ -7,7 +7,20 @@ class PlatformsController < ApplicationController
before_filter :get_paths, :only => [:new, :create]
def index
@platforms = Platform.paginate(:page => params[:platform_page])
respond_to do |format|
format.html { @platforms = Platform.paginate(:page => params[:platform_page]) }
format.json do
@platforms = Platform.where(:distrib_type => 'mandriva', :visibility => 'open', :platform_type => 'main')
render :json => {
:platforms => @platforms.map do |p|
{:name => p.name,
:architectures => ['i586', 'x86_64'],
:repositories => p.repositories.map(&:name),
:url => "http://abs.rosalab.ru/downloads/platforms/#{p.name}/repository"}
end
}
end
end
end
def show