#251: added js-routes gem, updated JS
This commit is contained in:
parent
894d61908b
commit
a91bfe95c9
1
Gemfile
1
Gemfile
|
@ -75,6 +75,7 @@ group :assets do
|
|||
gem 'therubyracer', '~> 0.10.2', :platforms => [:mri, :rbx]
|
||||
gem 'therubyrhino', '~> 1.73.1', :platforms => :jruby
|
||||
gem 'turbo-sprockets-rails3'
|
||||
gem 'js-routes'
|
||||
end
|
||||
|
||||
group :production do
|
||||
|
|
|
@ -170,6 +170,8 @@ GEM
|
|||
jquery-rails (2.0.3)
|
||||
railties (>= 3.1.0, < 5.0)
|
||||
thor (~> 0.14)
|
||||
js-routes (0.9.3)
|
||||
rails (>= 3.2)
|
||||
json (1.8.0)
|
||||
jwt (0.1.8)
|
||||
multi_json (>= 1.5)
|
||||
|
@ -458,6 +460,7 @@ DEPENDENCIES
|
|||
hirb
|
||||
jbuilder (~> 1.4.2)
|
||||
jquery-rails (~> 2.0.2)
|
||||
js-routes
|
||||
mailcatcher
|
||||
meta-tags (~> 1.2.5)
|
||||
meta_request
|
||||
|
|
|
@ -14,7 +14,8 @@ RosaABF.controller('BuildListsController', ['$scope', '$http', '$location', '$ti
|
|||
// Disable 'Search' button
|
||||
$scope.isRequest = true;
|
||||
|
||||
$http.get('/build_lists.json', {params: $location.search()}).success(function(results) {
|
||||
|
||||
$http.get(Routes.build_lists_path({format: 'json'}), {params: $location.search()}).success(function(results) {
|
||||
// Render Server status
|
||||
$scope.server_status = results.server_status;
|
||||
|
||||
|
|
|
@ -25,23 +25,21 @@ var BuildList = function(atts, dictionary) {
|
|||
}
|
||||
|
||||
if (self.project) {
|
||||
self.version_link_url = '/' + self.project.name_with_owner;
|
||||
if (self.last_published_commit_hash) {
|
||||
self.version_link_text = self.last_published_commit_hash + '...' + self.commit_hash;
|
||||
self.version_link_url += '/diff/';
|
||||
self.version_link_url = Routes.diff_path(self.project.owner, self.project.name, self.version_link_text);
|
||||
} else {
|
||||
self.version_link_text = self.commit_hash || self.project_version;
|
||||
self.version_link_url += '/commit/';
|
||||
self.version_link_url = Routes.commit_path(self.project.owner, self.project.name, self.version_link_text);
|
||||
}
|
||||
self.project.url = Routes.project_path(self.project.owner, self.project.name);
|
||||
self.project.name_with_owner = self.project.owner + '/' + self.project.name;
|
||||
}
|
||||
|
||||
self.version_link_url += self.version_link_text;
|
||||
self.project.url = '/' + self.project.name_with_owner;
|
||||
}
|
||||
|
||||
self.save_to_repository_url = '/platforms/' + self.save_to_platform_id + '/repositories/' + self.save_to_repository_id;
|
||||
self.user.url = '/' + self.user.uname;
|
||||
self.save_to_repository_url = Routes.platform_repository_path(self.save_to_platform_id, self.save_to_repository_id);
|
||||
self.user.url = Routes.user_path(self.user.uname);
|
||||
self.human_status = 'build_list.status.' + self.status;
|
||||
self.url = '/build_lists/' + self.id;
|
||||
self.url = Routes.build_list_path(self.id);
|
||||
|
||||
switch (self.status) { // See: app/helpers/build_lists_helper.rb
|
||||
case <%=BuildList::BUILD_PUBLISHED%>: self.status_color = 'success'; break
|
||||
|
|
|
@ -14,15 +14,15 @@ var ProjectRef = function(atts) {
|
|||
self.ui_container = false;
|
||||
|
||||
self.path = function(project) {
|
||||
return '/' + project.fullname + '/tree/' + self.ref;
|
||||
return Routes.tree_path(project.owner.uname, project.name, self.ref);
|
||||
}
|
||||
|
||||
self.diff_path = function(project, current_ref) {
|
||||
return '/' + project.fullname + '/diff/' + current_ref + '...' + self.ref;
|
||||
return Routes.diff_path(project.owner.uname, project.name, current_ref + '...' + self.ref);
|
||||
}
|
||||
|
||||
self.archive_path = function(project, type) {
|
||||
return '/' + project.fullname + '/archive/' + project.name + '-' + self.ref + '.' + type;
|
||||
return Routes.archive_path(project.owner.uname, project.name, project.name + '-' + self.ref, {format: type});
|
||||
}
|
||||
|
||||
//return the scope-safe instance
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
//= require backbone_datalink
|
||||
//= require backbone/rosa
|
||||
|
||||
//= require js-routes
|
||||
// require angular
|
||||
//= require unstable/angular
|
||||
// require angular-resource
|
||||
|
|
|
@ -18,7 +18,8 @@ json.dictionary do
|
|||
json.(user, :id, :uname, :fullname)
|
||||
end
|
||||
json.projects @build_lists.map(&:project).uniq.compact do |project|
|
||||
json.(project, :id, :name_with_owner)
|
||||
json.(project, :id, :name)
|
||||
json.owner project.name_with_owner.gsub(/\/.*/, '')
|
||||
end
|
||||
json.platforms (@build_lists.map(&:build_for_platform) | @build_lists.map(&:save_to_platform)).uniq do |platform|
|
||||
json.(platform, :id, :name)
|
||||
|
|
Loading…
Reference in New Issue