#291: added friendly_id

This commit is contained in:
Vokhmin Alexey V 2013-09-01 19:33:09 +04:00
parent 8c91a7e4c2
commit 5bebaca4f0
6 changed files with 12 additions and 3 deletions

View File

@ -51,6 +51,7 @@ gem 'meta-tags', '~> 1.2.5', :require => 'meta_tags'
gem "haml-rails", '~> 0.3.4'
gem 'jquery-rails', '~> 2.0.2'
gem 'ruby-haml-js', '~> 0.0.3'
gem 'friendly_id'
gem 'rack-throttle'
gem 'rest-client', '~> 1.6.6'

View File

@ -129,6 +129,8 @@ GEM
faraday (0.8.7)
multipart-post (~> 1.1)
ffi (1.0.11)
friendly_id (4.0.10.1)
activerecord (>= 3.0, < 4.0)
fssm (0.2.10)
gemoji (1.2.1)
github-linguist (2.3.4)
@ -447,6 +449,7 @@ DEPENDENCIES
devise (~> 2.2.3)
diff-display (~> 0.0.1)
factory_girl_rails (~> 4.0.0)
friendly_id
gemoji (~> 1.2.1)
github-linguist (~> 2.3.4)
gollum (~> 2.1.3)

View File

@ -24,6 +24,7 @@ var BuildList = function(atts, dictionary) {
if (self.save_to_platform.personal) {
self.save_to_repository_name += ' (' + self.build_for_platform.name + ')'
}
self.save_to_repository_url = Routes.platform_repository_path(self.save_to_platform.name, self.save_to_repository.name);
}
if (self.project) {
@ -38,8 +39,6 @@ var BuildList = function(atts, dictionary) {
self.project.name_with_owner = self.project.owner + '/' + self.project.name;
}
if (self.save_to_platform_id)
self.save_to_repository_url = Routes.platform_repository_path(self.save_to_platform_id, self.save_to_repository_id);
if (self.user)
self.user.url = Routes.user_path(self.user.uname);
self.url = Routes.build_list_path(self.id);

View File

@ -1,5 +1,8 @@
# -*- encoding : utf-8 -*-
class Platform < ActiveRecord::Base
extend FriendlyId
friendly_id :name
include Modules::Models::FileStoreClean
include Modules::Models::RegenerationStatus

View File

@ -1,5 +1,8 @@
# -*- encoding : utf-8 -*-
class Repository < ActiveRecord::Base
extend FriendlyId
friendly_id :name
LOCK_FILE_NAMES = {:sync => '.sync.lock', :repo => '.repo.lock'}
SORT = {'base' => 1, 'main' => 2, 'contrib' => 3, 'non-free' => 4, 'restricted' => 5}

View File

@ -152,7 +152,7 @@ Rosa::Application.routes.draw do
end
scope :module => 'platforms' do
resources :platforms do
resources :platforms, :constraints => {:id => Platform::NAME_PATTERN} do
resources :private_users, :except => [:show, :destroy, :update]
member do
put :regenerate_metadata