Merge pull request #260 from abf/rosa-build:258-removeBackboneJS
#258: Remove Backbone.js
This commit is contained in:
commit
03f60464d1
2
Gemfile
2
Gemfile
|
@ -51,7 +51,6 @@ gem 'meta-tags', '~> 1.2.5', :require => 'meta_tags'
|
||||||
gem "haml-rails", '~> 0.3.4'
|
gem "haml-rails", '~> 0.3.4'
|
||||||
gem 'jquery-rails', '~> 2.0.2'
|
gem 'jquery-rails', '~> 2.0.2'
|
||||||
gem 'ruby-haml-js', '~> 0.0.3'
|
gem 'ruby-haml-js', '~> 0.0.3'
|
||||||
gem 'rails-backbone', '~> 0.7.2'
|
|
||||||
|
|
||||||
gem 'rack-throttle'
|
gem 'rack-throttle'
|
||||||
gem 'rest-client', '~> 1.6.6'
|
gem 'rest-client', '~> 1.6.6'
|
||||||
|
@ -60,6 +59,7 @@ gem 'attr_encrypted', '1.2.1'
|
||||||
gem "gemoji", "~> 1.2.1", require: 'emoji/railtie'
|
gem "gemoji", "~> 1.2.1", require: 'emoji/railtie'
|
||||||
|
|
||||||
# AngularJS related stuff
|
# AngularJS related stuff
|
||||||
|
gem 'underscore-rails'
|
||||||
gem 'angularjs-rails'
|
gem 'angularjs-rails'
|
||||||
gem 'ng-rails-csrf'
|
gem 'ng-rails-csrf'
|
||||||
gem 'momentjs-rails'
|
gem 'momentjs-rails'
|
||||||
|
|
|
@ -114,7 +114,6 @@ GEM
|
||||||
warden (~> 1.2.1)
|
warden (~> 1.2.1)
|
||||||
diff-display (0.0.1)
|
diff-display (0.0.1)
|
||||||
diff-lcs (1.1.3)
|
diff-lcs (1.1.3)
|
||||||
ejs (1.0.0)
|
|
||||||
encryptor (1.1.3)
|
encryptor (1.1.3)
|
||||||
erubis (2.7.0)
|
erubis (2.7.0)
|
||||||
escape_utils (0.2.4)
|
escape_utils (0.2.4)
|
||||||
|
@ -274,10 +273,6 @@ GEM
|
||||||
activesupport (= 3.2.13)
|
activesupport (= 3.2.13)
|
||||||
bundler (~> 1.0)
|
bundler (~> 1.0)
|
||||||
railties (= 3.2.13)
|
railties (= 3.2.13)
|
||||||
rails-backbone (0.7.2)
|
|
||||||
coffee-script (~> 2.2.0)
|
|
||||||
ejs (~> 1.0.0)
|
|
||||||
railties (>= 3.1.0)
|
|
||||||
rails3-generators (1.0.0)
|
rails3-generators (1.0.0)
|
||||||
railties (>= 3.0.0)
|
railties (>= 3.0.0)
|
||||||
rails3-jquery-autocomplete (1.0.11)
|
rails3-jquery-autocomplete (1.0.11)
|
||||||
|
@ -407,6 +402,7 @@ GEM
|
||||||
uglifier (1.2.7)
|
uglifier (1.2.7)
|
||||||
execjs (>= 0.3.0)
|
execjs (>= 0.3.0)
|
||||||
multi_json (~> 1.3)
|
multi_json (~> 1.3)
|
||||||
|
underscore-rails (1.5.1)
|
||||||
unicorn (4.3.1)
|
unicorn (4.3.1)
|
||||||
kgio (~> 2.6)
|
kgio (~> 2.6)
|
||||||
rack
|
rack
|
||||||
|
@ -477,7 +473,6 @@ DEPENDENCIES
|
||||||
pg (~> 0.14.0)
|
pg (~> 0.14.0)
|
||||||
rack-throttle
|
rack-throttle
|
||||||
rails (= 3.2.13)
|
rails (= 3.2.13)
|
||||||
rails-backbone (~> 0.7.2)
|
|
||||||
rails3-generators
|
rails3-generators
|
||||||
rails3-jquery-autocomplete (~> 1.0.7)
|
rails3-jquery-autocomplete (~> 1.0.7)
|
||||||
rake
|
rake
|
||||||
|
@ -504,6 +499,7 @@ DEPENDENCIES
|
||||||
trinidad (~> 1.0.2)
|
trinidad (~> 1.0.2)
|
||||||
turbo-sprockets-rails3
|
turbo-sprockets-rails3
|
||||||
uglifier (~> 1.2.4)
|
uglifier (~> 1.2.4)
|
||||||
|
underscore-rails
|
||||||
unicorn (~> 4.3.1)
|
unicorn (~> 4.3.1)
|
||||||
whenever (~> 0.7.3)
|
whenever (~> 0.7.3)
|
||||||
wikicloth
|
wikicloth
|
||||||
|
|
|
@ -0,0 +1,42 @@
|
||||||
|
RosaABF.controller('BuildListController', ['$scope', '$http', function($scope, $http) {
|
||||||
|
|
||||||
|
$scope.advisoriable_types = <%=BuildList::RELEASE_UPDATE_TYPES%>;
|
||||||
|
|
||||||
|
$scope.build_list = {};
|
||||||
|
$scope.attach_advisory = 'no';
|
||||||
|
// Statuses: advisory_not_found, server_error, continue_input
|
||||||
|
$scope.search_status = 'continue_input';
|
||||||
|
$scope.term = '';
|
||||||
|
$scope.advisory = null;
|
||||||
|
|
||||||
|
|
||||||
|
$scope.search = function() {
|
||||||
|
var params = {query: $scope.term, bl_type: $scope.build_list.update_type, format: 'json'};
|
||||||
|
$http.get(Routes.search_advisories_path(params)).success(function(results) {
|
||||||
|
$scope.search_status = 'continue_input';
|
||||||
|
$scope.advisory = results;
|
||||||
|
$('#attach_advisory').find('.advisory_id').val($scope.advisory.advisory_id);
|
||||||
|
}).error(function(data, status, headers, config) {
|
||||||
|
$scope.search_status = status == 404 ? 'advisory_not_found' : 'server_error';
|
||||||
|
$scope.advisory = null;
|
||||||
|
$('#attach_advisory').find('.advisory_id').val('');
|
||||||
|
});;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
$scope.updateTypeChanged = function() {
|
||||||
|
if (_.contains($scope.advisoriable_types, $scope.build_list.update_type)) {
|
||||||
|
if ($scope.advisory || $scope.term.length > 0) { $scope.search(); }
|
||||||
|
} else {
|
||||||
|
$scope.attach_advisory = 'no';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$scope.attachAdvisoryChanged = function() {
|
||||||
|
if (!_.contains($scope.advisoriable_types, $scope.build_list.update_type)) {
|
||||||
|
$scope.build_list.update_type = $scope.advisoriable_types[0];
|
||||||
|
}
|
||||||
|
$('#build_list_update_type .nonadvisoriable').attr('disabled', ($scope.attach_advisory != 'no'));
|
||||||
|
}
|
||||||
|
|
||||||
|
}]);
|
|
@ -0,0 +1,65 @@
|
||||||
|
RosaABF.controller('CollaboratorsController', ['$scope', 'ApiCollaborator', function($scope, ApiCollaborator) {
|
||||||
|
|
||||||
|
$scope.def_role = "<%=Relation::ROLES.first%>";
|
||||||
|
|
||||||
|
$scope.popup = $('#add_collaborator_form .users-search-popup');
|
||||||
|
$scope.owner = $('#owner_name').val();
|
||||||
|
$scope.project = $('#project_name').val();
|
||||||
|
$scope.resource = ApiCollaborator.resource;
|
||||||
|
$scope.collaborators = [];
|
||||||
|
|
||||||
|
$scope.new_collaborators = [];
|
||||||
|
|
||||||
|
$scope.initNewCollaborator = function(c) {
|
||||||
|
if (c) {
|
||||||
|
c.term = c.actor_name;
|
||||||
|
c.collaborator.role = $scope.def_role;
|
||||||
|
} else {
|
||||||
|
c = {collaborator: {role: $scope.def_role}};
|
||||||
|
}
|
||||||
|
$scope.new_collaborator = c;
|
||||||
|
}
|
||||||
|
$scope.initNewCollaborator();
|
||||||
|
|
||||||
|
$scope.getCollaborators = function() {
|
||||||
|
$scope.collaborators = $scope.resource.query({owner: $scope.owner, project: $scope.project});
|
||||||
|
}
|
||||||
|
$scope.getCollaborators();
|
||||||
|
|
||||||
|
$scope.update = function(collaborator) {
|
||||||
|
collaborator.$update();
|
||||||
|
}
|
||||||
|
|
||||||
|
$scope.deleteCollaborators = function() {
|
||||||
|
var collaborators = [];
|
||||||
|
_.each($scope.collaborators, function(collaborator){
|
||||||
|
if(collaborator.removed) {
|
||||||
|
collaborator.$delete();
|
||||||
|
} else {
|
||||||
|
collaborators.push(collaborator);
|
||||||
|
}
|
||||||
|
$scope.collaborators = collaborators;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
$scope.search = function() {
|
||||||
|
if ($scope.new_collaborator.term.length > 2) {
|
||||||
|
$scope.new_collaborators = $scope.resource.find(
|
||||||
|
{owner: $scope.owner, project: $scope.project, term: $scope.new_collaborator.term});
|
||||||
|
$scope.popup.show();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$scope.select = function(c) {
|
||||||
|
$scope.initNewCollaborator(c);
|
||||||
|
$scope.popup.hide();
|
||||||
|
}
|
||||||
|
|
||||||
|
$scope.add = function() {
|
||||||
|
$scope.new_collaborator.$save(function() {
|
||||||
|
$scope.collaborators.push($scope.new_collaborator);
|
||||||
|
$scope.initNewCollaborator();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
}]);
|
|
@ -0,0 +1,26 @@
|
||||||
|
RosaABF.factory('ApiCollaborator', ['$resource', function($resource) {
|
||||||
|
|
||||||
|
var CollaboratorResource = $resource(
|
||||||
|
'/:owner/:project/collaborators/:id?format=json',
|
||||||
|
{
|
||||||
|
owner: '@project.owner_uname',
|
||||||
|
project: '@project.name',
|
||||||
|
id: '@id'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
update: {
|
||||||
|
method: 'PUT',
|
||||||
|
isArray : false
|
||||||
|
},
|
||||||
|
find: {
|
||||||
|
url: '/:owner/:project/collaborators/find.json',
|
||||||
|
method: 'GET',
|
||||||
|
isArray : true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
return {
|
||||||
|
resource : CollaboratorResource
|
||||||
|
}
|
||||||
|
}]);
|
|
@ -9,10 +9,6 @@
|
||||||
//= require_tree ./lib
|
//= require_tree ./lib
|
||||||
|
|
||||||
//= require underscore
|
//= require underscore
|
||||||
//= require backbone
|
|
||||||
//= require backbone_rails_sync
|
|
||||||
//= require backbone_datalink
|
|
||||||
//= require backbone/rosa
|
|
||||||
|
|
||||||
//= require js-routes
|
//= require js-routes
|
||||||
// require angular
|
// require angular
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
Rosa.bootstrapedData.ROLES = <%= Relation::ROLES.to_json %>;
|
|
|
@ -1,96 +0,0 @@
|
||||||
Rosa.Models.Advisory = Backbone.Model.extend({
|
|
||||||
defaults: {
|
|
||||||
id: null,
|
|
||||||
description: null,
|
|
||||||
references: null,
|
|
||||||
update_type: null,
|
|
||||||
found: false
|
|
||||||
},
|
|
||||||
|
|
||||||
initialize: function() {
|
|
||||||
_.bindAll(this, 'findByAdvisoryID');
|
|
||||||
|
|
||||||
this.url = '/advisories';
|
|
||||||
},
|
|
||||||
|
|
||||||
findByAdvisoryID: function(id, bl_type, options) {
|
|
||||||
var self = this;
|
|
||||||
|
|
||||||
var urlError = function() {
|
|
||||||
throw new Error("A 'url' property or function must be specified");
|
|
||||||
};
|
|
||||||
|
|
||||||
var typeError = function() {
|
|
||||||
throw new Error("A 'bl_type' must be 'security' or 'bugfix'");
|
|
||||||
};
|
|
||||||
|
|
||||||
var idError = function() {
|
|
||||||
throw new Error("A 'id' must be a string at least 4 characters long");
|
|
||||||
};
|
|
||||||
|
|
||||||
if ( (typeof(id) != "string") || (id.length < 4) ) {
|
|
||||||
idError();
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( (bl_type == undefined) || (bl_type == null) || ((bl_type != 'security') && (bl_type != 'bugfix')) ) {
|
|
||||||
typeError();
|
|
||||||
}
|
|
||||||
|
|
||||||
options |= {};
|
|
||||||
var data = _.extend({
|
|
||||||
query: id,
|
|
||||||
bl_type: bl_type
|
|
||||||
}, {});
|
|
||||||
|
|
||||||
var params = _.extend({
|
|
||||||
type: 'GET',
|
|
||||||
dataType: 'json',
|
|
||||||
beforeSend: function( xhr ) {
|
|
||||||
var token = $('meta[name="csrf-token"]').attr('content');
|
|
||||||
if (token) xhr.setRequestHeader('X-CSRF-Token', token);
|
|
||||||
|
|
||||||
self.trigger('search:start');
|
|
||||||
}
|
|
||||||
}, options);
|
|
||||||
|
|
||||||
if (!params.url) {
|
|
||||||
params.url = ((_.isFunction(this.url) ? this.url() : this.url) + '/search') || urlError();
|
|
||||||
}
|
|
||||||
|
|
||||||
params.data = data;
|
|
||||||
|
|
||||||
var complete = options.complete;
|
|
||||||
params.complete = function(jqXHR, textStatus) {
|
|
||||||
//console.log(jqXHR);
|
|
||||||
|
|
||||||
switch (jqXHR.status) {
|
|
||||||
case 200:
|
|
||||||
self.set(_.extend({
|
|
||||||
found: true
|
|
||||||
}, JSON.parse(jqXHR.responseText)), {silent: true});
|
|
||||||
self.trigger('search:end');
|
|
||||||
break
|
|
||||||
|
|
||||||
case 404:
|
|
||||||
self.set(self.defaults, {silent: true});
|
|
||||||
self.trigger('search:end');
|
|
||||||
break
|
|
||||||
|
|
||||||
default:
|
|
||||||
self.set(self.defaults, {silent: true});
|
|
||||||
self.trigger('search:failed');
|
|
||||||
}
|
|
||||||
|
|
||||||
if (complete) complete(jqXHR, textStatus);
|
|
||||||
}
|
|
||||||
|
|
||||||
$.ajax(params);
|
|
||||||
|
|
||||||
return this;
|
|
||||||
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
Rosa.Collections.AdvisoriesCollection = Backbone.Collection.extend({
|
|
||||||
model: Rosa.Models.Advisory
|
|
||||||
});
|
|
|
@ -1,97 +0,0 @@
|
||||||
Rosa.Models.Collaborator = Backbone.Model.extend({
|
|
||||||
paramRoot: 'collaborator',
|
|
||||||
|
|
||||||
defaults: {
|
|
||||||
id: null,
|
|
||||||
actor_id: null,
|
|
||||||
actor_name: null,
|
|
||||||
actor_type: null,
|
|
||||||
avatar: null,
|
|
||||||
actor_path: null,
|
|
||||||
project_id: null,
|
|
||||||
role: null,
|
|
||||||
removed: false
|
|
||||||
},
|
|
||||||
|
|
||||||
changeRole: function(r) {
|
|
||||||
var self = this;
|
|
||||||
this._prevState = this.get('role');
|
|
||||||
this.save({role: r},
|
|
||||||
{wait: true,
|
|
||||||
success: function(model, response) {
|
|
||||||
self.trigger('sync_success');
|
|
||||||
},
|
|
||||||
error: function(model, response) {
|
|
||||||
model.set({role: model._prevState});
|
|
||||||
self.trigger('sync_failed');
|
|
||||||
}
|
|
||||||
});
|
|
||||||
return this;
|
|
||||||
},
|
|
||||||
setRole: function(r) {
|
|
||||||
this.set({ role: r });
|
|
||||||
return this;
|
|
||||||
},
|
|
||||||
toggleRemoved: function() {
|
|
||||||
if (this.get('removed') === false) {
|
|
||||||
this.set({removed: true});
|
|
||||||
} else {
|
|
||||||
this.set({removed: false});
|
|
||||||
}
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
Rosa.Collections.CollaboratorsCollection = Backbone.Collection.extend({
|
|
||||||
model: Rosa.Models.Collaborator,
|
|
||||||
|
|
||||||
initialize: function(coll, opts) {
|
|
||||||
if (opts === undefined || opts['url'] === undefined) {
|
|
||||||
this.url = window.location.pathname;
|
|
||||||
} else {
|
|
||||||
this.url = opts['url'];
|
|
||||||
}
|
|
||||||
this.on('change:removed change:id add', this.sort, this);
|
|
||||||
},
|
|
||||||
comparator: function(m) {
|
|
||||||
var res = ''
|
|
||||||
if (m.get('removed') === true) {
|
|
||||||
res = 0;
|
|
||||||
} else if (m.isNew()) {
|
|
||||||
res = 1;
|
|
||||||
} else { res = 2 }
|
|
||||||
return res + m.get('actor_name');
|
|
||||||
},
|
|
||||||
|
|
||||||
removeMarked: function() {
|
|
||||||
var marked = this.where({removed: true});
|
|
||||||
marked.forEach(function(el) {
|
|
||||||
el.destroy({wait: true, silent: true});
|
|
||||||
});
|
|
||||||
},
|
|
||||||
|
|
||||||
saveAndAdd: function(model) {
|
|
||||||
|
|
||||||
model.urlRoot = this.url;
|
|
||||||
var self = this;
|
|
||||||
model.save({}, {
|
|
||||||
wait: true,
|
|
||||||
success: function(m) {
|
|
||||||
self.add(m.toJSON());
|
|
||||||
}
|
|
||||||
});
|
|
||||||
},
|
|
||||||
|
|
||||||
filterByName: function(term, options) {
|
|
||||||
if (term == "") return this;
|
|
||||||
console.log(term);
|
|
||||||
|
|
||||||
var pattern = new RegExp(term, "i");
|
|
||||||
|
|
||||||
return _(this.filter(function(data) {
|
|
||||||
console.log(data.get("actor_name"));
|
|
||||||
console.log(pattern.test(data.get("actor_name")));
|
|
||||||
return pattern.test(data.get("actor_name"));
|
|
||||||
}));
|
|
||||||
}
|
|
||||||
});
|
|
|
@ -1,15 +0,0 @@
|
||||||
//= require_self
|
|
||||||
//= require ./additionals
|
|
||||||
//= require_tree ./templates
|
|
||||||
//= require_tree ./models
|
|
||||||
//= require_tree ./views
|
|
||||||
//= require_tree ./routers
|
|
||||||
|
|
||||||
window.Rosa = {
|
|
||||||
Models: {},
|
|
||||||
Collections: {},
|
|
||||||
Routers: {},
|
|
||||||
Views: {},
|
|
||||||
|
|
||||||
bootstrapedData: {}
|
|
||||||
}
|
|
|
@ -1,9 +0,0 @@
|
||||||
Rosa.Routers.BuildListsAdvisoriesRouter = Backbone.Router.extend({
|
|
||||||
routes: {},
|
|
||||||
|
|
||||||
initialize: function() {
|
|
||||||
this.advisoriesView = new Rosa.Views.BuildListAdvisoriesView({ model: new Rosa.Models.Advisory() });
|
|
||||||
|
|
||||||
this.advisoriesView.render();
|
|
||||||
}
|
|
||||||
});
|
|
|
@ -1,15 +0,0 @@
|
||||||
Rosa.Routers.CollaboratorsRouter = Backbone.Router.extend({
|
|
||||||
routes: {},
|
|
||||||
|
|
||||||
initialize: function() {
|
|
||||||
this.collaboratorsCollection = new Rosa.Collections.CollaboratorsCollection(Rosa.bootstrapedData.collaborators, { url: window.location.pathname });
|
|
||||||
this.searchCollection = new Rosa.Collections.CollaboratorsCollection(null, { url: window.location.pathname + '/find' });
|
|
||||||
this.tableView = new Rosa.Views.CollaboratorsView({ collection: this.collaboratorsCollection });
|
|
||||||
this.addView = new Rosa.Views.AddCollaboratorView({ collection: this.searchCollection });
|
|
||||||
|
|
||||||
this.addView.on('collaborator_prepared', this.collaboratorsCollection.saveAndAdd, this.collaboratorsCollection);
|
|
||||||
|
|
||||||
this.tableView.render();
|
|
||||||
this.addView.render();
|
|
||||||
}
|
|
||||||
});
|
|
|
@ -1,39 +0,0 @@
|
||||||
%td
|
|
||||||
%span#niceCheckbox1.nicecheck-main{ style: "background-position: 0px 0px; " }
|
|
||||||
- if (removed === true) {
|
|
||||||
%input{ type: 'checkbox', checked: 'checked' }
|
|
||||||
- } else {
|
|
||||||
%input{ type: 'checkbox' }
|
|
||||||
- }
|
|
||||||
|
|
||||||
%td
|
|
||||||
.img
|
|
||||||
%img{ src: avatar, alt: 'avatar' }
|
|
||||||
.forimg
|
|
||||||
%a{ href: actor_path }
|
|
||||||
= actor_name
|
|
||||||
|
|
||||||
- var ROLES = Rosa.bootstrapedData.ROLES;
|
|
||||||
|
|
||||||
- for (var i = 0; i < ROLES.length; i++) {
|
|
||||||
%td
|
|
||||||
.radio
|
|
||||||
- var radio_id = id + '_' + ROLES[i];
|
|
||||||
- var radio_type = 'role[' + id + ']';
|
|
||||||
- if (ROLES[i] === role) {
|
|
||||||
- if ( removed ) {
|
|
||||||
%input.niceRadio{type: 'radio', value: ROLES[i], id: radio_id, name: radio_type, disabled: 'disabled', checked: 'checked'}
|
|
||||||
- } else {
|
|
||||||
%input.niceRadio{type: 'radio', value: ROLES[i], id: radio_id, name: radio_type, checked: 'checked'}
|
|
||||||
- };
|
|
||||||
- } else {
|
|
||||||
- if ( removed ) {
|
|
||||||
%input.niceRadio{type: 'radio', value: ROLES[i], id: radio_id, name: radio_type, disabled: 'disabled' }
|
|
||||||
- } else {
|
|
||||||
%input.niceRadio{type: 'radio', value: ROLES[i], id: radio_id, name: radio_type }
|
|
||||||
- };
|
|
||||||
- }
|
|
||||||
.forradio
|
|
||||||
%label{ for: radio_id }
|
|
||||||
= ROLES[i]
|
|
||||||
- }
|
|
|
@ -1,7 +0,0 @@
|
||||||
%a
|
|
||||||
.collaborator
|
|
||||||
.img
|
|
||||||
%img{width: '16px', src: avatar, alt: 'avatar'}
|
|
||||||
.name
|
|
||||||
= actor_name
|
|
||||||
.both
|
|
|
@ -1,3 +0,0 @@
|
||||||
%li.empty_result
|
|
||||||
%span
|
|
||||||
Nothing found
|
|
|
@ -1,92 +0,0 @@
|
||||||
Rosa.Views.AddCollaboratorView = Backbone.View.extend({
|
|
||||||
result_empty: JST['backbone/templates/shared/autocomplete_result_empty'],
|
|
||||||
|
|
||||||
events: {
|
|
||||||
'click #add_collaborator_button': 'addCollaborator'
|
|
||||||
},
|
|
||||||
|
|
||||||
initialize: function() {
|
|
||||||
_.bindAll(this, 'getData', 'renderAll', 'onFocus', 'selectItem', 'addCollaborator');
|
|
||||||
|
|
||||||
this.$el = $('#add_collaborator_form');
|
|
||||||
this.$_search_input = this.$('#collaborator_name');
|
|
||||||
this.$_image = this.$('.admin-search.withimage img');
|
|
||||||
this.$_role = this.$('#role');
|
|
||||||
|
|
||||||
this.ac = this.$_search_input.autocomplete({
|
|
||||||
minLength: 1,
|
|
||||||
source: this.getData,
|
|
||||||
focus: this.onFocus,
|
|
||||||
select: this.selectItem
|
|
||||||
});
|
|
||||||
this.ac.data("autocomplete")._renderItem = this.addOne;
|
|
||||||
this.ac.data("autocomplete")._renderMenu = this.renderAll;
|
|
||||||
},
|
|
||||||
|
|
||||||
render: function() {
|
|
||||||
return this;
|
|
||||||
},
|
|
||||||
|
|
||||||
getData: function(request, response) {
|
|
||||||
var self = this;
|
|
||||||
var res = this.collection.fetch({
|
|
||||||
data: {term: request.term},
|
|
||||||
wait: true,
|
|
||||||
success: function(collection) {
|
|
||||||
self.$_image.hide();
|
|
||||||
if (collection.length !== 0) {
|
|
||||||
response(collection.models);
|
|
||||||
} else {
|
|
||||||
response([{result_empty: true}]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
},
|
|
||||||
|
|
||||||
addOne: function(ul, item) {
|
|
||||||
var v = new Rosa.Views.SearchedCollaboratorView({ model: item });
|
|
||||||
return v.render().$el.appendTo(ul);
|
|
||||||
},
|
|
||||||
|
|
||||||
renderAll: function( ul, items ) {
|
|
||||||
var self = this;
|
|
||||||
if (items[0]['result_empty'] !== undefined && items[0]['result_empty'] === true) {
|
|
||||||
ul.removeClass('has_results').append(this.result_empty());
|
|
||||||
} else {
|
|
||||||
ul.addClass('has_results');
|
|
||||||
_.each( items, function( item ) {
|
|
||||||
self.addOne( ul, item );
|
|
||||||
});
|
|
||||||
var factor = (items.length > 10) ? 10 : items.length;
|
|
||||||
ul.height(ul.children('li').first() * factor);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
onFocus: function( event, ui ) {
|
|
||||||
this.$_search_input.val(ui.item.get('actor_name'));
|
|
||||||
return false;
|
|
||||||
},
|
|
||||||
|
|
||||||
selectItem: function( event, ui ) {
|
|
||||||
var model = ui.item;
|
|
||||||
this.$_image.attr('src', model.get('avatar')).show();
|
|
||||||
|
|
||||||
this.__selected_item = model;
|
|
||||||
return false;
|
|
||||||
},
|
|
||||||
|
|
||||||
addCollaborator: function(e) {
|
|
||||||
e.preventDefault();
|
|
||||||
var model = this.__selected_item;
|
|
||||||
|
|
||||||
if ( model !== undefined ) {
|
|
||||||
model.setRole(this.$_role.val());
|
|
||||||
this.trigger('collaborator_prepared', model);
|
|
||||||
this.__selected_item = undefined;
|
|
||||||
this.$_image.hide();
|
|
||||||
this.$_search_input.val('');
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
|
@ -1,215 +0,0 @@
|
||||||
Rosa.Views.BuildListAdvisoriesView = Backbone.View.extend({
|
|
||||||
initialize: function() {
|
|
||||||
_.bindAll(this, 'showAdvisory', 'showPreview', 'showForm',
|
|
||||||
'showSearch', 'hideAll', 'displayStatus', 'processSearch',
|
|
||||||
'showInTypeSelect', 'typeSelectChange');
|
|
||||||
|
|
||||||
this.$el = $('#advisory_block');
|
|
||||||
this._$type_select = $('#build_list_update_type');
|
|
||||||
this._$publish_button = $('input[type="submit"][name="publish"]');
|
|
||||||
|
|
||||||
this._$form = this.$('#new_advisory_form');
|
|
||||||
this._$preview = this.$('#advisory_preview');
|
|
||||||
|
|
||||||
this._$search = this.$('#advisory_search_block');
|
|
||||||
this._$search_field = this.$('#advisory_search');
|
|
||||||
this._$not_found = this.$('#advisory_search_block > .advisory_not_found');
|
|
||||||
this._$server_error = this.$('#advisory_search_block > .server_error');
|
|
||||||
this._$continue_input = this.$('#advisory_search_block > .continue_input');
|
|
||||||
this._search_timer = null;
|
|
||||||
|
|
||||||
this._$selector = this.$('#attach_advisory');
|
|
||||||
|
|
||||||
this._state_vars = {};
|
|
||||||
this._state_vars = _.extend({
|
|
||||||
checked_update_type: this._$type_select.val(),
|
|
||||||
header_text: this._$preview.children('h3').html()
|
|
||||||
}, this.state_vars);
|
|
||||||
|
|
||||||
this._$selector.on('change', this.showAdvisory);
|
|
||||||
this._$search_field.on('input keyup', this.processSearch);
|
|
||||||
|
|
||||||
this._$type_select.on('change', this.typeSelectChange);
|
|
||||||
|
|
||||||
this.model.on('search:start', function() {
|
|
||||||
this._$publish_button.prop({disabled: true});
|
|
||||||
}, this);
|
|
||||||
this.model.on('search:end', this.showPreview, this);
|
|
||||||
this.model.on('search:failed', this.handleSearchError, this);
|
|
||||||
},
|
|
||||||
|
|
||||||
showAdvisory: function(ev) {
|
|
||||||
this._$publish_button.prop({disabled: false});
|
|
||||||
switch (this._$selector.val()) {
|
|
||||||
case 'no':
|
|
||||||
this.hideAll();
|
|
||||||
this.showInTypeSelect('all');
|
|
||||||
break
|
|
||||||
case 'new':
|
|
||||||
this.showForm();
|
|
||||||
this.showInTypeSelect('advisoriable');
|
|
||||||
break
|
|
||||||
default:
|
|
||||||
this.showSearch();
|
|
||||||
this.showInTypeSelect('advisoriable');
|
|
||||||
this._$publish_button.prop({disabled: true});
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
typeSelectChange: function(ev) {
|
|
||||||
switch (this._$selector.val()) {
|
|
||||||
case 'no':
|
|
||||||
this._state_vars.checked_update_type = this._$selector.val();
|
|
||||||
break
|
|
||||||
case 'new':
|
|
||||||
break
|
|
||||||
default:
|
|
||||||
this._$search_field.trigger('input');
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
showInTypeSelect: function(type) {
|
|
||||||
var children = this._$type_select.children('option');
|
|
||||||
if (type != 'all') {
|
|
||||||
var visible_ch = children.filter('.' + type);
|
|
||||||
var sel = children.filter(':selected');
|
|
||||||
|
|
||||||
children.prop('disabled', true);
|
|
||||||
visible_ch.prop('disabled', false);
|
|
||||||
if (sel.prop('disabled')) {
|
|
||||||
sel.prop('selected', false);
|
|
||||||
visible_ch.first().prop('selected', true);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
children.prop('disabled', false).prop('selected', false);
|
|
||||||
children.filter('option[value="' + this._state_vars.checked_update_type + '"]').prop('selected', true);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
processSearch: function(ev) {
|
|
||||||
if (ev.type == "keyup") {
|
|
||||||
if (ev.keyCode != 13) {
|
|
||||||
return
|
|
||||||
} else {
|
|
||||||
ev.preventDefault();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
var TIMER_INTERVAL = 500;
|
|
||||||
|
|
||||||
var self = this;
|
|
||||||
|
|
||||||
var timerCallback = function() {
|
|
||||||
if (self._$search_field.val().length > 3) {
|
|
||||||
// real search
|
|
||||||
self.model.findByAdvisoryID(self._$search_field.val(), self._$type_select.val());
|
|
||||||
} else {
|
|
||||||
// hide preview if nothing to show
|
|
||||||
if (self._$preview.is(':visible')) {
|
|
||||||
self._$preview.slideUp();
|
|
||||||
}
|
|
||||||
self.displayStatus('found');
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
if (this.model.get('advisory_id') == this._$search_field.val()) {
|
|
||||||
this.showPreview();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
// timeout before real AJAX request
|
|
||||||
clearTimeout(this._search_timer);
|
|
||||||
this._search_timer = setTimeout(timerCallback, TIMER_INTERVAL);
|
|
||||||
},
|
|
||||||
|
|
||||||
showPreview: function(id) {
|
|
||||||
this._$publish_button.prop({disabled: false});
|
|
||||||
if (this._$form.is(':visible')) {
|
|
||||||
this._$form.slideUp();
|
|
||||||
}
|
|
||||||
var prev = this._$preview;
|
|
||||||
var adv = this.model;
|
|
||||||
if (adv.get('found')) {
|
|
||||||
this._$selector.children('option.advisory_id').val(adv.get('advisory_id'));
|
|
||||||
|
|
||||||
prev.children('h3').html(this._state_vars.header_text + ' ' + adv.get('advisory_id'));
|
|
||||||
prev.children('.descr').html(adv.get('description'));
|
|
||||||
prev.children('.refs').html(adv.get('references'));
|
|
||||||
if (!this._$preview.is(':visible')) {
|
|
||||||
this._$preview.slideDown();
|
|
||||||
}
|
|
||||||
this.displayStatus('found');
|
|
||||||
} else {
|
|
||||||
if (this._$preview.is(':visible')) {
|
|
||||||
this._$preview.slideUp();
|
|
||||||
}
|
|
||||||
this._$publish_button.prop({disabled: true});
|
|
||||||
this.displayStatus('not_found');
|
|
||||||
this._$selector.children('option.advisory_id').val('');
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
showForm: function() {
|
|
||||||
if (this._$preview.is(':visible')) {
|
|
||||||
this._$preview.slideUp();
|
|
||||||
}
|
|
||||||
if (this._$search.is(':visible')) {
|
|
||||||
this._$search.slideUp();
|
|
||||||
}
|
|
||||||
if (!this._$form.is(':visible')) {
|
|
||||||
this._$form.slideDown();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
showSearch: function() {
|
|
||||||
if (this._$form.is(':visible')) {
|
|
||||||
this._$form.slideUp();
|
|
||||||
}
|
|
||||||
if (!this._$search.is(':visible')) {
|
|
||||||
this._$search.slideDown();
|
|
||||||
this._$search_field.trigger('input');
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
handleSearchError: function() {
|
|
||||||
this._$publish_button.prop({disabled: true});
|
|
||||||
this.displayStatus('error');
|
|
||||||
if (this._$preview.is(':visible')) {
|
|
||||||
this._$preview.slideUp();
|
|
||||||
}
|
|
||||||
if (this._$form.is(':visible')) {
|
|
||||||
this._$form.slideUp();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
hideAll: function() {
|
|
||||||
if (this._$preview.is(':visible')) {
|
|
||||||
this._$preview.slideUp();
|
|
||||||
}
|
|
||||||
if (this._$search.is(':visible')) {
|
|
||||||
this._$search.slideUp();
|
|
||||||
}
|
|
||||||
if (this._$form.is(':visible')) {
|
|
||||||
this._$form.slideUp();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
displayStatus: function(st) {
|
|
||||||
var ELEMS = {
|
|
||||||
'found': this._$continue_input,
|
|
||||||
'not_found': this._$not_found,
|
|
||||||
'error': this._$server_error
|
|
||||||
};
|
|
||||||
|
|
||||||
this._$continue_input.hide();
|
|
||||||
this._$not_found.hide();
|
|
||||||
this._$server_error.hide();
|
|
||||||
|
|
||||||
ELEMS[st].show();
|
|
||||||
},
|
|
||||||
|
|
||||||
render: function() {
|
|
||||||
this.showAdvisory();
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
|
@ -1,69 +0,0 @@
|
||||||
Rosa.Views.CollaboratorView = Backbone.View.extend({
|
|
||||||
template: JST['backbone/templates/collaborators/collaborator'],
|
|
||||||
tagName: 'tr',
|
|
||||||
className: 'regular',
|
|
||||||
|
|
||||||
events: {
|
|
||||||
'change input[type="radio"]': 'changeRole',
|
|
||||||
'change input[type="checkbox"]': 'toggleRemoved'
|
|
||||||
},
|
|
||||||
|
|
||||||
initialize: function() {
|
|
||||||
this.$el.attr('id', 'admin-table-members-row' + this.options.model.get('id') + this.options.model.get('actor_type'));
|
|
||||||
this.model.on('change', this.render, this);
|
|
||||||
this.model.on('destroy', this.hide, this);
|
|
||||||
this.model.on('sync_failed', this.syncError, this);
|
|
||||||
this.model.on('sync_success', this.syncSuccess, this);
|
|
||||||
},
|
|
||||||
|
|
||||||
render: function() {
|
|
||||||
if (this.model.get('removed')) {
|
|
||||||
this.$el.addClass('removed');
|
|
||||||
} else {
|
|
||||||
this.$el.removeClass('removed');
|
|
||||||
};
|
|
||||||
this.$el.html(this.template(this.model.toJSON()));
|
|
||||||
return this;
|
|
||||||
},
|
|
||||||
|
|
||||||
changeRole: function(e) {
|
|
||||||
this.$('input[type="radio"]').attr('disabled', 'disabled');
|
|
||||||
this.model.changeRole(e.target.value);
|
|
||||||
},
|
|
||||||
|
|
||||||
toggleRemoved: function(e) {
|
|
||||||
this.model.toggleRemoved();
|
|
||||||
},
|
|
||||||
|
|
||||||
hide: function() {
|
|
||||||
this.remove();
|
|
||||||
},
|
|
||||||
|
|
||||||
syncError: function() {
|
|
||||||
var self = this;
|
|
||||||
this.$el.addClass('sync_error');
|
|
||||||
this.$('td').animate({
|
|
||||||
'background-color': '#FFFFFF'
|
|
||||||
}, {
|
|
||||||
duration: 800,
|
|
||||||
easing: 'easeInCirc',
|
|
||||||
complete: function() {
|
|
||||||
self.$el.removeClass('sync_error');
|
|
||||||
}
|
|
||||||
});
|
|
||||||
},
|
|
||||||
|
|
||||||
syncSuccess: function() {
|
|
||||||
var self = this;
|
|
||||||
this.$el.addClass('sync_success');
|
|
||||||
this.$('td').animate({
|
|
||||||
'background-color': '#FFFFFF'
|
|
||||||
}, {
|
|
||||||
duration: 800,
|
|
||||||
easing: 'easeInCirc',
|
|
||||||
complete: function() {
|
|
||||||
self.$el.removeClass('sync_success');
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
|
@ -1,57 +0,0 @@
|
||||||
Rosa.Views.CollaboratorsView = Backbone.View.extend({
|
|
||||||
initialize: function() {
|
|
||||||
_.bindAll(this, 'deleterClick', 'processFilter', 'addOne');
|
|
||||||
this.setupDeleter();
|
|
||||||
this.setupFilter();
|
|
||||||
this.$el = $('#collaborators > tbody');
|
|
||||||
this.collection.on('reset', this.render, this);
|
|
||||||
this.collection.on('add', this.clearFilter, this);
|
|
||||||
},
|
|
||||||
|
|
||||||
addOne: function(collaborator) {
|
|
||||||
var cView = new Rosa.Views.CollaboratorView({ model: collaborator });
|
|
||||||
this.$el.append(cView.render().$el);
|
|
||||||
},
|
|
||||||
|
|
||||||
render: function() {
|
|
||||||
this.clearFilter();
|
|
||||||
this.$el.empty();
|
|
||||||
this.collection.forEach(this.addOne, this);
|
|
||||||
this._$deleter.show();
|
|
||||||
return this;
|
|
||||||
},
|
|
||||||
|
|
||||||
renderList: function(list) {
|
|
||||||
this.$el.empty();
|
|
||||||
|
|
||||||
list.each(this.addOne);
|
|
||||||
return this;
|
|
||||||
},
|
|
||||||
|
|
||||||
setupDeleter: function() {
|
|
||||||
this._$deleter = $('#collaborators_deleter');
|
|
||||||
this._$deleter.on('click.deleter', this.deleterClick);
|
|
||||||
this._$deleter.attr('title', 'Remove selected rows');
|
|
||||||
},
|
|
||||||
|
|
||||||
deleterClick: function() {
|
|
||||||
this.collection.removeMarked();
|
|
||||||
},
|
|
||||||
|
|
||||||
setupFilter: function() {
|
|
||||||
this._$filter = $('#collaborators thead input[type="text"]');
|
|
||||||
this._$filter.on('keyup', this.processFilter);
|
|
||||||
this.clearFilter();
|
|
||||||
},
|
|
||||||
|
|
||||||
clearFilter: function() {
|
|
||||||
this._$filter.val('');
|
|
||||||
},
|
|
||||||
|
|
||||||
processFilter: function() {
|
|
||||||
var term = this._$filter.val();
|
|
||||||
var list = this.collection.filterByName(term, {excludeRemoved: true});
|
|
||||||
console.log(list);
|
|
||||||
this.renderList(list);
|
|
||||||
}
|
|
||||||
});
|
|
|
@ -1,30 +0,0 @@
|
||||||
Rosa.Views.ProjectModifyView = Backbone.View.extend({
|
|
||||||
initialize: function() {
|
|
||||||
_.bindAll(this, 'checkboxClick');
|
|
||||||
|
|
||||||
this.$checkbox_wrapper = $('#niceCheckbox1');
|
|
||||||
this._$checkbox = this.$checkbox_wrapper.children('#project_is_package').first();
|
|
||||||
this.$maintainer_form = $('#maintainer_form');
|
|
||||||
this.$publish_form = $('#publish_form');
|
|
||||||
this._$publish_checkbox = this.$publish_form.find('#project_publish_i686_into_x86_64').first();
|
|
||||||
|
|
||||||
this.$checkbox_wrapper.on('click', this.checkboxClick);
|
|
||||||
},
|
|
||||||
|
|
||||||
checkboxClick: function() {
|
|
||||||
if (this._$checkbox.is(':checked')) {
|
|
||||||
this.$maintainer_form.slideDown();
|
|
||||||
this.$publish_form.slideDown();
|
|
||||||
} else {
|
|
||||||
this.$maintainer_form.slideUp();
|
|
||||||
this.$publish_form.slideUp();
|
|
||||||
if (this._$publish_checkbox.is(':checked')) {
|
|
||||||
changeCheck(this.$publish_form.find('.niceCheck-main'));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
render: function() {
|
|
||||||
this.checkboxClick();
|
|
||||||
}
|
|
||||||
});
|
|
|
@ -1,12 +0,0 @@
|
||||||
Rosa.Views.SearchedCollaboratorView = Backbone.View.extend({
|
|
||||||
template: JST['backbone/templates/collaborators/searched_collaborator'],
|
|
||||||
tagName: 'li',
|
|
||||||
className: 'item',
|
|
||||||
|
|
||||||
render: function() {
|
|
||||||
this.$el.empty();
|
|
||||||
this.$el.data( "item.autocomplete", this.model )
|
|
||||||
.append(this.template(this.model.toJSON()));
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
})
|
|
|
@ -129,8 +129,8 @@ $(document).ready(function() {
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#assigned-popup .header .icon-remove-circle').live('click', function() {
|
$('.users-search-popup .header .icon-remove-circle').live('click', function() {
|
||||||
$('#assigned-popup').hide();
|
$('.users-search-popup').hide();
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#assigned-container .icon-share').live('click', function() {
|
$('#assigned-container .icon-share').live('click', function() {
|
||||||
|
|
|
@ -894,12 +894,11 @@ ul.ui-autocomplete.has_results {
|
||||||
float: left;
|
float: left;
|
||||||
padding-top: 6px;
|
padding-top: 6px;
|
||||||
}
|
}
|
||||||
#add_collaborator_form div.img {
|
#collaborators {
|
||||||
width: 25px;
|
.img, img {
|
||||||
height: 25px;
|
width: 25px;
|
||||||
}
|
height: 25px;
|
||||||
|
}
|
||||||
#add_collaborator_form div.img img {
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#add_collaborator_form .admin-role .lineForm {
|
#add_collaborator_form .admin-role .lineForm {
|
||||||
|
@ -1011,12 +1010,12 @@ form.mass_build input[type="checkbox"] {
|
||||||
height: 11px;
|
height: 11px;
|
||||||
}
|
}
|
||||||
|
|
||||||
div#new_advisory_form,
|
/*div#new_advisory_form,
|
||||||
div#advisory_preview,
|
div#advisory_preview,
|
||||||
div#advisory_search_block,
|
div#advisory_search_block,
|
||||||
div#advisory_search_block div.info {
|
div#advisory_search_block div.info {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}*/
|
||||||
|
|
||||||
div#advisory_search_block {
|
div#advisory_search_block {
|
||||||
padding-bottom: 15px;
|
padding-bottom: 15px;
|
||||||
|
@ -1964,7 +1963,7 @@ article .activity .top {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#assigned-popup {
|
.users-search-popup {
|
||||||
z-index: 1001;
|
z-index: 1001;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
margin: 5px 0 0 130px;
|
margin: 5px 0 0 130px;
|
||||||
|
@ -1998,7 +1997,7 @@ article .activity .top {
|
||||||
.edit_assignee {
|
.edit_assignee {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
#manage_issue_users_list {
|
.list {
|
||||||
overflow-y: auto;
|
overflow-y: auto;
|
||||||
overflow-x: hidden;
|
overflow-x: hidden;
|
||||||
max-height: 280px;
|
max-height: 280px;
|
||||||
|
|
|
@ -21,9 +21,13 @@ class AdvisoriesController < ApplicationController
|
||||||
|
|
||||||
def search
|
def search
|
||||||
@advisory = Advisory.by_update_type(params[:bl_type]).search_by_id(params[:query]).first
|
@advisory = Advisory.by_update_type(params[:bl_type]).search_by_id(params[:query]).first
|
||||||
raise ActiveRecord::RecordNotFound.new('Not Found') if @advisory.nil?
|
if @advisory.nil?
|
||||||
respond_to do |format|
|
render :nothing => true, :status => 404
|
||||||
format.json { render @advisory }
|
else
|
||||||
|
# respond_to do |format|
|
||||||
|
# format.json { render @advisory }
|
||||||
|
# end
|
||||||
|
render @advisory
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -14,12 +14,6 @@ class Projects::CollaboratorsController < Projects::BaseController
|
||||||
respond_with @collaborators
|
respond_with @collaborators
|
||||||
end
|
end
|
||||||
|
|
||||||
def show
|
|
||||||
end
|
|
||||||
|
|
||||||
def new
|
|
||||||
end
|
|
||||||
|
|
||||||
def find
|
def find
|
||||||
users = User.not_member_of(@project)
|
users = User.not_member_of(@project)
|
||||||
groups = Group.not_member_of(@project)
|
groups = Group.not_member_of(@project)
|
||||||
|
@ -33,9 +27,6 @@ class Projects::CollaboratorsController < Projects::BaseController
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def edit
|
|
||||||
end
|
|
||||||
|
|
||||||
def create
|
def create
|
||||||
@collaborator = Collaborator.new(params[:collaborator])
|
@collaborator = Collaborator.new(params[:collaborator])
|
||||||
@collaborator.project = @project
|
@collaborator.project = @project
|
||||||
|
|
|
@ -4,216 +4,213 @@
|
||||||
%p= @build_list.human_status
|
%p= @build_list.human_status
|
||||||
%p= @build_list.updated_at
|
%p= @build_list.updated_at
|
||||||
.both
|
.both
|
||||||
=form_for @build_list, :url => publish_build_list_path(@build_list), :html => { :class => :form } do |f|
|
%div{'ng-controller' => 'BuildListController'}
|
||||||
%h3= t("layout.build_lists.main_data")
|
=form_for @build_list, :url => publish_build_list_path(@build_list), :html => { :class => :form } do |f|
|
||||||
.leftlist= t("activerecord.attributes.build_list.container_path")
|
%h3= t("layout.build_lists.main_data")
|
||||||
.rightlist
|
.leftlist= t("activerecord.attributes.build_list.container_path")
|
||||||
- if @build_list.container_published?
|
|
||||||
-url = container_url
|
|
||||||
= link_to url, url
|
|
||||||
- elsif @build_list.container_publish?
|
|
||||||
= t("layout.build_lists.creating")
|
|
||||||
.both
|
|
||||||
|
|
||||||
.leftlist= t("activerecord.attributes.build_list.id")
|
|
||||||
.rightlist= @build_list.id
|
|
||||||
.both
|
|
||||||
.leftlist= t("activerecord.attributes.build_list.user")
|
|
||||||
.rightlist
|
|
||||||
= link_to @build_list.user.try(:fullname), @build_list.user
|
|
||||||
.both
|
|
||||||
.leftlist= t("activerecord.attributes.build_list.publisher")
|
|
||||||
.rightlist
|
|
||||||
= link_to @build_list.publisher.try(:fullname), @build_list.publisher if @build_list.publisher
|
|
||||||
.both
|
|
||||||
.leftlist= t("activerecord.attributes.build_list.build_for_platform")
|
|
||||||
.rightlist
|
|
||||||
- bfp = @build_list.build_for_platform
|
|
||||||
- if bfp.present?
|
|
||||||
= link_to(bfp.name, bfp)
|
|
||||||
- else
|
|
||||||
= t("layout.build_lists.platform_deleted")
|
|
||||||
.both
|
|
||||||
.leftlist= t("activerecord.attributes.build_list.save_to_repository")
|
|
||||||
.rightlist
|
|
||||||
= link_to "#{@build_list.save_to_platform.name}/#{@build_list.save_to_repository.name}", [@build_list.save_to_platform, @build_list.save_to_repository]
|
|
||||||
.both
|
|
||||||
.leftlist= t("activerecord.attributes.build_list.include_repos")
|
|
||||||
.rightlist= (@build_list.include_repos||[]).map{|r| Repository.find(r).name}.join(', ')
|
|
||||||
.both
|
|
||||||
.leftlist= t("activerecord.attributes.build_list.update_type")
|
|
||||||
.rightlist
|
|
||||||
- if can?(:publish, @build_list)
|
|
||||||
= f.select :update_type, options_for_select(build_list_classified_update_types, @build_list.update_type)
|
|
||||||
- else
|
|
||||||
= @build_list.update_type
|
|
||||||
.both
|
|
||||||
.leftlist= t("activerecord.attributes.build_list.auto_publish")
|
|
||||||
.rightlist= t("layout.#{@build_list.auto_publish}_")
|
|
||||||
.both
|
|
||||||
.leftlist= t("activerecord.attributes.build_list.auto_create_container")
|
|
||||||
.rightlist= t("layout.#{@build_list.auto_create_container?}_")
|
|
||||||
.both
|
|
||||||
.leftlist= t("activerecord.attributes.build_list.project_version")
|
|
||||||
.rightlist= link_to @build_list.project_version, tree_path(@build_list.project, @build_list.project_version)
|
|
||||||
.both
|
|
||||||
.leftlist= t("diff")
|
|
||||||
.rightlist= build_list_version_link(@build_list, true)
|
|
||||||
.both
|
|
||||||
.leftlist= t("activerecord.attributes.build_list.arch")
|
|
||||||
.rightlist= @build_list.arch.name
|
|
||||||
.both
|
|
||||||
.leftlist= t("activerecord.attributes.build_list.updated_at")
|
|
||||||
.rightlist= @build_list.updated_at
|
|
||||||
.both
|
|
||||||
.leftlist= t("activerecord.attributes.build_list.is_circle")
|
|
||||||
.rightlist= t("layout.#{@build_list.is_circle?}_")
|
|
||||||
.both
|
|
||||||
.leftlist= t("activerecord.attributes.build_list.new_core")
|
|
||||||
.rightlist= t("layout.#{@build_list.new_core?}_")
|
|
||||||
.both
|
|
||||||
|
|
||||||
- if @build_list.extra_build_lists.present? || @build_list.extra_repositories.present?
|
|
||||||
.leftlist= t("activerecord.attributes.build_list.extra_repos")
|
|
||||||
.rightlist
|
.rightlist
|
||||||
- Repository.where(:id => @build_list.extra_repositories).each do |repo|
|
- if @build_list.container_published?
|
||||||
%p= link_to "#{repo.platform.name}/#{repo.name}", [repo.platform, repo]
|
-url = container_url
|
||||||
- BuildList.where(:id => @build_list.extra_build_lists).each do |bl|
|
= link_to url, url
|
||||||
%p= link_to "#{bl.id} (#{bl.project.name} - #{bl.arch.name})", bl
|
- elsif @build_list.container_publish?
|
||||||
|
= t("layout.build_lists.creating")
|
||||||
.both
|
.both
|
||||||
|
|
||||||
- if @build_list.mass_build_id.present?
|
.leftlist= t("activerecord.attributes.build_list.id")
|
||||||
.leftlist= t("activerecord.attributes.mass_build_id")
|
.rightlist= @build_list.id
|
||||||
.rightlist= link_to @build_list.mass_build.name, platform_mass_builds_path(@build_list.save_to_platform)
|
|
||||||
.both
|
.both
|
||||||
|
.leftlist= t("activerecord.attributes.build_list.user")
|
||||||
|
|
||||||
- if @build_list.advisory.present?
|
|
||||||
.leftlist= t("layout.build_lists.attached_advisory")
|
|
||||||
.rightlist= link_to @build_list.advisory.advisory_id, advisory_path(@build_list.advisory)
|
|
||||||
.both
|
|
||||||
- if !@build_list.in_work? && @build_list.started_at
|
|
||||||
%br
|
|
||||||
.leftlist
|
|
||||||
.rightlist= @build_list.human_duration
|
|
||||||
.both
|
|
||||||
- if @build_list.in_work?
|
|
||||||
%br
|
|
||||||
.leftlist
|
|
||||||
.rightlist
|
.rightlist
|
||||||
= "#{@build_list.human_current_duration} / #{@build_list.human_average_build_time}"
|
= link_to @build_list.user.try(:fullname), @build_list.user
|
||||||
|
.both
|
||||||
|
.leftlist= t("activerecord.attributes.build_list.publisher")
|
||||||
|
.rightlist
|
||||||
|
= link_to @build_list.publisher.try(:fullname), @build_list.publisher if @build_list.publisher
|
||||||
|
.both
|
||||||
|
.leftlist= t("activerecord.attributes.build_list.build_for_platform")
|
||||||
|
.rightlist
|
||||||
|
- bfp = @build_list.build_for_platform
|
||||||
|
- if bfp.present?
|
||||||
|
= link_to(bfp.name, bfp)
|
||||||
|
- else
|
||||||
|
= t("layout.build_lists.platform_deleted")
|
||||||
|
.both
|
||||||
|
.leftlist= t("activerecord.attributes.build_list.save_to_repository")
|
||||||
|
.rightlist
|
||||||
|
= link_to "#{@build_list.save_to_platform.name}/#{@build_list.save_to_repository.name}", [@build_list.save_to_platform, @build_list.save_to_repository]
|
||||||
|
.both
|
||||||
|
.leftlist= t("activerecord.attributes.build_list.include_repos")
|
||||||
|
.rightlist= (@build_list.include_repos||[]).map{|r| Repository.find(r).name}.join(', ')
|
||||||
|
.both
|
||||||
|
.leftlist= t("activerecord.attributes.build_list.update_type")
|
||||||
|
.rightlist{'ng-init' => "build_list.update_type = '#{@build_list.update_type}'"}
|
||||||
|
- if can?(:publish, @build_list)
|
||||||
|
= f.select :update_type, options_for_select(build_list_classified_update_types, @build_list.update_type), {}, 'ng-model' => 'build_list.update_type', 'ng-change' => 'updateTypeChanged()'
|
||||||
|
- else
|
||||||
|
= @build_list.update_type
|
||||||
|
.both
|
||||||
|
.leftlist= t("activerecord.attributes.build_list.auto_publish")
|
||||||
|
.rightlist= t("layout.#{@build_list.auto_publish}_")
|
||||||
|
.both
|
||||||
|
.leftlist= t("activerecord.attributes.build_list.auto_create_container")
|
||||||
|
.rightlist= t("layout.#{@build_list.auto_create_container?}_")
|
||||||
|
.both
|
||||||
|
.leftlist= t("activerecord.attributes.build_list.project_version")
|
||||||
|
.rightlist= link_to @build_list.project_version, tree_path(@build_list.project, @build_list.project_version)
|
||||||
|
.both
|
||||||
|
.leftlist= t("diff")
|
||||||
|
.rightlist= build_list_version_link(@build_list, true)
|
||||||
|
.both
|
||||||
|
.leftlist= t("activerecord.attributes.build_list.arch")
|
||||||
|
.rightlist= @build_list.arch.name
|
||||||
|
.both
|
||||||
|
.leftlist= t("activerecord.attributes.build_list.updated_at")
|
||||||
|
.rightlist= @build_list.updated_at
|
||||||
|
.both
|
||||||
|
.leftlist= t("activerecord.attributes.build_list.is_circle")
|
||||||
|
.rightlist= t("layout.#{@build_list.is_circle?}_")
|
||||||
|
.both
|
||||||
|
.leftlist= t("activerecord.attributes.build_list.new_core")
|
||||||
|
.rightlist= t("layout.#{@build_list.new_core?}_")
|
||||||
.both
|
.both
|
||||||
|
|
||||||
- if @build_list.can_cancel? && can?(:cancel, @build_list)
|
- if @build_list.extra_build_lists.present? || @build_list.extra_repositories.present?
|
||||||
= link_to t("layout.build_lists.cancel"), cancel_build_list_path(@build_list),
|
.leftlist= t("activerecord.attributes.build_list.extra_repos")
|
||||||
:method => :put, :confirm => t("layout.confirm"), :class => 'button'
|
|
||||||
|
|
||||||
- if @build_list.save_to_platform.released && @build_list.advisory.nil? && can?(:publish, @build_list)
|
|
||||||
#advisory_block
|
|
||||||
.leftlist= label_tag :attach_advisory, t("layout.build_lists.attached_advisory")
|
|
||||||
.rightlist
|
.rightlist
|
||||||
= select_tag :attach_advisory, advisories_select_options(@advisories)
|
- Repository.where(:id => @build_list.extra_repositories).each do |repo|
|
||||||
%p.hint_text= t("layout.advisories.publication_info", :update_types => BuildList::RELEASE_UPDATE_TYPES.join(', '))
|
%p= link_to "#{repo.platform.name}/#{repo.name}", [repo.platform, repo]
|
||||||
|
- BuildList.where(:id => @build_list.extra_build_lists).each do |bl|
|
||||||
|
%p= link_to "#{bl.id} (#{bl.project.name} - #{bl.arch.name})", bl
|
||||||
.both
|
.both
|
||||||
|
|
||||||
#advisory_search_block
|
- if @build_list.mass_build_id.present?
|
||||||
%h3= t("layout.advisories.search_by_id")
|
.leftlist= t("activerecord.attributes.mass_build_id")
|
||||||
.leftlist= label_tag :advisory_search, t("layout.advisories.search_hint")
|
.rightlist= link_to @build_list.mass_build.name, platform_mass_builds_path(@build_list.save_to_platform)
|
||||||
|
.both
|
||||||
|
|
||||||
|
|
||||||
|
- if @build_list.advisory.present?
|
||||||
|
.leftlist= t("layout.build_lists.attached_advisory")
|
||||||
|
.rightlist= link_to @build_list.advisory.advisory_id, advisory_path(@build_list.advisory)
|
||||||
|
.both
|
||||||
|
- if !@build_list.in_work? && @build_list.started_at
|
||||||
|
%br
|
||||||
|
.leftlist
|
||||||
|
.rightlist= @build_list.human_duration
|
||||||
|
.both
|
||||||
|
- if @build_list.in_work?
|
||||||
|
%br
|
||||||
|
.leftlist
|
||||||
|
.rightlist
|
||||||
|
= "#{@build_list.human_current_duration} / #{@build_list.human_average_build_time}"
|
||||||
|
.both
|
||||||
|
|
||||||
|
- if @build_list.can_cancel? && can?(:cancel, @build_list)
|
||||||
|
= link_to t("layout.build_lists.cancel"), cancel_build_list_path(@build_list),
|
||||||
|
:method => :put, :confirm => t("layout.confirm"), :class => 'button'
|
||||||
|
|
||||||
|
- if @build_list.save_to_platform.released && @build_list.advisory.nil? && can?(:publish, @build_list)
|
||||||
|
#advisory_block
|
||||||
|
.leftlist= label_tag :attach_advisory, t("layout.build_lists.attached_advisory")
|
||||||
.rightlist
|
.rightlist
|
||||||
%input#advisory_search{:type => 'text'}
|
= select_tag :attach_advisory, advisories_select_options(@advisories), 'ng-model' => 'attach_advisory', 'ng-change' => 'attachAdvisoryChanged()'
|
||||||
%p.hint_text= t("layout.advisories.advisory_id_info", :advisory_format => advisory_id_for_hint)
|
%p.hint_text= t("layout.advisories.publication_info", :update_types => BuildList::RELEASE_UPDATE_TYPES.join(', '))
|
||||||
.both
|
|
||||||
- %w(advisory_not_found server_error continue_input).each do |el|
|
|
||||||
.info{:class => el}
|
|
||||||
%p= t("layout.advisories.banners.#{el}")
|
|
||||||
|
|
||||||
#new_advisory_form
|
|
||||||
= f.fields_for @build_list.build_advisory do |f|
|
|
||||||
= render :partial => 'advisories/form', :locals => {:f => f}
|
|
||||||
|
|
||||||
#advisory_preview
|
|
||||||
%h3= t("activerecord.models.advisory") << ' '
|
|
||||||
|
|
||||||
.leftlist= t("activerecord.attributes.advisory.description")
|
|
||||||
.rightlist.descr
|
|
||||||
.both
|
.both
|
||||||
|
|
||||||
.leftlist= t("activerecord.attributes.advisory.references")
|
#advisory_search_block{'ng-show' => 'attach_advisory != "no" && attach_advisory != "new"'}
|
||||||
.rightlist.refs
|
%h3= t("layout.advisories.search_by_id")
|
||||||
.both
|
.leftlist= label_tag :advisory_search, t("layout.advisories.search_hint")
|
||||||
:javascript
|
.rightlist
|
||||||
$(function() {
|
%input#advisory_search{:type => 'text', 'ng-model' => 'term', 'ng-keyup' => 'search()'}
|
||||||
var r = new Rosa.Routers.BuildListsAdvisoriesRouter();
|
%p.hint_text= t("layout.advisories.advisory_id_info", :advisory_format => advisory_id_for_hint)
|
||||||
});
|
.both
|
||||||
|
- I18n.t('layout.advisories.banners').keys.each do |key|
|
||||||
|
.info{:class => key, 'ng-show' => "search_status == '#{key}'"}
|
||||||
|
%p= t("layout.advisories.banners.#{key}")
|
||||||
|
|
||||||
- if @build_list.build_started?
|
#new_advisory_form{'ng-show' => 'attach_advisory == "new"'}
|
||||||
= render 'shared/log', { :build_started => true, :get_log_path => log_build_list_path(@build_list) }
|
= f.fields_for @build_list.build_advisory do |f|
|
||||||
|
= render :partial => 'advisories/form', :locals => {:f => f}
|
||||||
|
|
||||||
- unless @build_list.extra_build_lists_published?
|
#advisory_preview{'ng-show' => 'attach_advisory != "no" && attach_advisory != "new"'}
|
||||||
.flash_notify
|
%h3= t('activerecord.models.advisory') << ' {{advisory.advisory_id}}'
|
||||||
.alert.alert-error= t('layout.build_lists.publish_with_extra_fail')
|
|
||||||
.both
|
|
||||||
|
|
||||||
- if can?(:publish, @build_list)
|
.leftlist= t('activerecord.attributes.advisory.description')
|
||||||
- if @build_list.build_published?
|
.rightlist.descr {{advisory.description}}
|
||||||
= submit_tag t("layout.publish_again"), :confirm => t("layout.publish_again_warning"), :name => 'publish'
|
.both
|
||||||
- elsif can_publish_in_future?(@build_list) && @build_list.extra_build_lists_published?
|
|
||||||
- confirm = @build_list.tests_failed? ? t('layout.build_lists.tests_failed') : t('layout.confirm')
|
|
||||||
= submit_tag t("layout.publish"), :confirm => confirm, :name => 'publish'
|
|
||||||
- if @build_list.can_reject_publish? && can?(:reject_publish, @build_list)
|
|
||||||
= link_to t('layout.reject_publish'), reject_publish_build_list_path(@build_list),
|
|
||||||
:method => :put, :confirm => t("layout.confirm"), :class => 'button reject_publish'
|
|
||||||
- if @build_list.can_create_container? && can?(:create_container, @build_list)
|
|
||||||
= link_to t("layout.build_lists.create_container"), create_container_build_list_path(@build_list),
|
|
||||||
:method => :put, :confirm => t("layout.confirm"), :class => 'button create_container'
|
|
||||||
- if can? :create, @build_list
|
|
||||||
= link_to t('layout.build_lists.recreate_build_list'), new_project_build_list_path(@build_list.project, :build_list_id => @build_list.id), :class => 'button'
|
|
||||||
|
|
||||||
.hr
|
.leftlist= t('activerecord.attributes.advisory.references')
|
||||||
%h3= t("layout.build_lists.items_header")
|
.rightlist.refs {{advisory.references}}
|
||||||
- if @item_groups.blank?
|
.both
|
||||||
%h4.nomargin= t("layout.build_lists.no_items_data")
|
|
||||||
- @item_groups.each_with_index do |group, level|
|
- if @build_list.build_started?
|
||||||
- group.each do |item|
|
= render 'shared/log', { :build_started => true, :get_log_path => log_build_list_path(@build_list) }
|
||||||
%h4.nomargin= "#{item.name} ##{level}"
|
|
||||||
|
- unless @build_list.extra_build_lists_published?
|
||||||
|
.flash_notify
|
||||||
|
.alert.alert-error= t('layout.build_lists.publish_with_extra_fail')
|
||||||
|
.both
|
||||||
|
|
||||||
|
- if can?(:publish, @build_list)
|
||||||
|
- if @build_list.build_published?
|
||||||
|
= submit_tag t("layout.publish_again"), :confirm => t("layout.publish_again_warning"), :name => 'publish'
|
||||||
|
- elsif can_publish_in_future?(@build_list) && @build_list.extra_build_lists_published?
|
||||||
|
- confirm = @build_list.tests_failed? ? t('layout.build_lists.tests_failed') : t('layout.confirm')
|
||||||
|
= submit_tag t("layout.publish"), :confirm => confirm, :name => 'publish'
|
||||||
|
- if @build_list.can_reject_publish? && can?(:reject_publish, @build_list)
|
||||||
|
= link_to t('layout.reject_publish'), reject_publish_build_list_path(@build_list),
|
||||||
|
:method => :put, :confirm => t("layout.confirm"), :class => 'button reject_publish'
|
||||||
|
- if @build_list.can_create_container? && can?(:create_container, @build_list)
|
||||||
|
= link_to t("layout.build_lists.create_container"), create_container_build_list_path(@build_list),
|
||||||
|
:method => :put, :confirm => t("layout.confirm"), :class => 'button create_container'
|
||||||
|
- if can? :create, @build_list
|
||||||
|
= link_to t('layout.build_lists.recreate_build_list'), new_project_build_list_path(@build_list.project, :build_list_id => @build_list.id), :class => 'button'
|
||||||
|
|
||||||
|
.hr
|
||||||
|
%h3= t("layout.build_lists.items_header")
|
||||||
|
- if @item_groups.blank?
|
||||||
|
%h4.nomargin= t("layout.build_lists.no_items_data")
|
||||||
|
- @item_groups.each_with_index do |group, level|
|
||||||
|
- group.each do |item|
|
||||||
|
%h4.nomargin= "#{item.name} ##{level}"
|
||||||
|
%table.tablesorter.width565{:cellpadding => "0", :cellspacing => "0"}
|
||||||
|
%thead
|
||||||
|
%tr
|
||||||
|
%th= t("activerecord.attributes.build_list/item.name")
|
||||||
|
%th= t("activerecord.attributes.build_list/item.version")
|
||||||
|
%th= t("activerecord.attributes.build_list/item.status")
|
||||||
|
%tbody
|
||||||
|
%tr{:class => build_list_item_status_color(item.status)}
|
||||||
|
%td= item.name
|
||||||
|
%td= build_list_item_version_link item
|
||||||
|
%td= item.human_status
|
||||||
|
.both
|
||||||
|
|
||||||
|
- if @build_list.packages.present?
|
||||||
|
.hr
|
||||||
|
%h3= t("layout.build_lists.packages_header")
|
||||||
%table.tablesorter.width565{:cellpadding => "0", :cellspacing => "0"}
|
%table.tablesorter.width565{:cellpadding => "0", :cellspacing => "0"}
|
||||||
%thead
|
%thead
|
||||||
%tr
|
%tr
|
||||||
%th= t("activerecord.attributes.build_list/item.name")
|
%th= t("activerecord.attributes.build_list/package.fullname")
|
||||||
%th= t("activerecord.attributes.build_list/item.version")
|
%th= t("activerecord.attributes.build_list/package.name")
|
||||||
%th= t("activerecord.attributes.build_list/item.status")
|
%th= t("activerecord.attributes.build_list/package.version")
|
||||||
|
%th= t("activerecord.attributes.build_list/package.release")
|
||||||
%tbody
|
%tbody
|
||||||
%tr{:class => build_list_item_status_color(item.status)}
|
- @build_list.packages.each do |package|
|
||||||
%td= item.name
|
%tr
|
||||||
%td= build_list_item_version_link item
|
- if package.sha1.present?
|
||||||
%td= item.human_status
|
%td= link_to package.fullname, "#{APP_CONFIG['file_store_url']}/api/v1/file_stores/#{package.sha1}"
|
||||||
.both
|
- else
|
||||||
|
%td= package.fullname
|
||||||
|
%td= package.name
|
||||||
|
%td= package.version
|
||||||
|
%td= package.release
|
||||||
|
.both
|
||||||
|
|
||||||
- if @build_list.packages.present?
|
- if @build_list.new_core?
|
||||||
.hr
|
.hr
|
||||||
%h3= t("layout.build_lists.packages_header")
|
= render 'platforms/product_build_lists/results', :subject => @build_list
|
||||||
%table.tablesorter.width565{:cellpadding => "0", :cellspacing => "0"}
|
|
||||||
%thead
|
|
||||||
%tr
|
|
||||||
%th= t("activerecord.attributes.build_list/package.fullname")
|
|
||||||
%th= t("activerecord.attributes.build_list/package.name")
|
|
||||||
%th= t("activerecord.attributes.build_list/package.version")
|
|
||||||
%th= t("activerecord.attributes.build_list/package.release")
|
|
||||||
%tbody
|
|
||||||
- @build_list.packages.each do |package|
|
|
||||||
%tr
|
|
||||||
- if package.sha1.present?
|
|
||||||
%td= link_to package.fullname, "#{APP_CONFIG['file_store_url']}/api/v1/file_stores/#{package.sha1}"
|
|
||||||
- else
|
|
||||||
%td= package.fullname
|
|
||||||
%td= package.name
|
|
||||||
%td= package.version
|
|
||||||
%td= package.release
|
|
||||||
.both
|
|
||||||
|
|
||||||
- if @build_list.new_core?
|
|
||||||
.hr
|
|
||||||
= render 'platforms/product_build_lists/results', :subject => @build_list
|
|
||||||
|
|
||||||
:javascript
|
:javascript
|
||||||
$('article .all').addClass('bigpadding');
|
$('article .all').addClass('bigpadding');
|
||||||
|
|
|
@ -1,10 +1,9 @@
|
||||||
json.id collaborator.id
|
json.(collaborator, :id, :actor_name)
|
||||||
|
json.collaborator do # attr_accessible for AngularJS
|
||||||
json.actor_id collaborator.actor_id
|
json.(collaborator, :role, :actor_id, :actor_type, :project_id)
|
||||||
json.actor_name collaborator.actor_name
|
end
|
||||||
json.actor_type collaborator.actor_type
|
json.project do
|
||||||
|
json.(collaborator.project, :name, :owner_uname)
|
||||||
|
end
|
||||||
json.avatar avatar_url(collaborator.actor)
|
json.avatar avatar_url(collaborator.actor)
|
||||||
json.actor_path participant_path(collaborator.actor)
|
json.actor_path participant_path(collaborator.actor)
|
||||||
|
|
||||||
json.project_id collaborator.project_id
|
|
||||||
json.role collaborator.role
|
|
||||||
|
|
|
@ -1,12 +1,3 @@
|
||||||
json.array!(collaborators) do |json, cb|
|
json.array!(collaborators) do |collaborator|
|
||||||
json.id cb.id
|
json.partial! 'projects/collaborators/collaborator', :collaborator => collaborator
|
||||||
|
|
||||||
json.actor_id cb.actor_id
|
|
||||||
json.actor_name cb.actor_name
|
|
||||||
json.actor_type cb.actor_type
|
|
||||||
json.avatar avatar_url(cb.actor)
|
|
||||||
json.actor_path participant_path(cb.actor)
|
|
||||||
|
|
||||||
json.project_id cb.project_id
|
|
||||||
json.role cb.role
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -5,40 +5,70 @@
|
||||||
%a{:name => 'users'}
|
%a{:name => 'users'}
|
||||||
%h3= t("layout.users.list_header")
|
%h3= t("layout.users.list_header")
|
||||||
|
|
||||||
#add_collaborator_form
|
#collaborators{'ng-controller' => 'CollaboratorsController'}
|
||||||
.admin-search.withimage
|
= hidden_field_tag :owner_name, @project.try(:owner).try(:uname)
|
||||||
.img
|
= hidden_field_tag :project_name, @project.try(:name)
|
||||||
%img{ :alt => 'avatar', :src => '', :style => 'display: none;' }
|
|
||||||
= text_field_tag :collaborator_name, nil
|
#add_collaborator_form
|
||||||
|
.admin-search.withimage
|
||||||
|
.img
|
||||||
|
%img{:alt => 'avatar', 'ng-src' => '{{new_collaborator.avatar}}', 'ng-show' => 'new_collaborator.avatar'}
|
||||||
|
= text_field_tag :collaborator_name, nil, 'ng-model' => 'new_collaborator.term', 'ng-keyup' => 'search()'
|
||||||
|
|
||||||
|
.admin-role
|
||||||
|
.lineForm
|
||||||
|
= select_tag 'role', options_for_collaborators_roles_select, 'ng-model' => 'new_collaborator.collaborator.role'
|
||||||
|
.admin-add
|
||||||
|
%a.button{:rel => 'nofollow', :href => '', 'ng-click' => 'add()'}
|
||||||
|
= t('layout.add')
|
||||||
.both
|
.both
|
||||||
.admin-role
|
|
||||||
.lineForm
|
.users-search-popup
|
||||||
= select_tag 'role', options_for_collaborators_roles_select
|
.header
|
||||||
.admin-add
|
.title= t('layout.issues.search_user')
|
||||||
%a{:id => 'add_collaborator_button', :class => 'button', :rel => 'nofollow', :href => 'javascript:void(0)'}
|
%span.icon-remove-circle
|
||||||
= t('layout.add')
|
.list
|
||||||
|
.people{'ng-repeat' => 'c in new_collaborators', 'ng-click' => 'select(c)'}
|
||||||
|
.avatar
|
||||||
|
%img{width: '16px', 'ng-src' => '{{c.avatar}}', alt: 'avatar'}
|
||||||
|
.name {{c.actor_name}}
|
||||||
|
.both
|
||||||
|
|
||||||
|
.nothing{'ng-hide' => 'new_collaborators.length > 0'}= t('layout.issues.nothing_to_show')
|
||||||
|
.both
|
||||||
|
.both
|
||||||
|
|
||||||
|
%table.tablesorter{:cellpadding => "0", :cellspacing => "0"}
|
||||||
|
%thead
|
||||||
|
%tr
|
||||||
|
%th.centered
|
||||||
|
%span.delete{'ng-click' => 'deleteCollaborators()'}
|
||||||
|
%th
|
||||||
|
= t("layout.collaborators.members")
|
||||||
|
%th{:colspan => "3"}
|
||||||
|
= t("layout.collaborators.roles")
|
||||||
|
%tr.search
|
||||||
|
%th{:colspan => "5"}
|
||||||
|
%input{:type => "text", :placeholder => "#{t('layout.filter_by_name')}", 'ng-model' => 'query.actor_name'}
|
||||||
|
|
||||||
|
%tbody
|
||||||
|
%tr{'ng-repeat' => 'c in collaborators | filter:query'}
|
||||||
|
%td
|
||||||
|
%input{:type => 'checkbox', 'ng-model' => 'c.removed' }
|
||||||
|
%td
|
||||||
|
.img
|
||||||
|
%img{'ng-src' => '{{c.avatar}}', alt: 'avatar' }
|
||||||
|
.forimg
|
||||||
|
%a{'ng-href' => '{{c.actor_path}}'} {{c.actor_name}}
|
||||||
|
|
||||||
|
- Relation::ROLES.each do |role|
|
||||||
|
%td
|
||||||
|
.radio
|
||||||
|
%input{:type => 'radio', 'ng-model' => 'c.collaborator.role', :value => role, 'ng-click' => 'update(c)'}
|
||||||
|
.forradio
|
||||||
|
%label= t("layout.collaborators.role_names.#{role}")
|
||||||
|
|
||||||
|
|
||||||
|
%br
|
||||||
|
|
||||||
.both
|
.both
|
||||||
|
|
||||||
%table#collaborators.tablesorter{:cellpadding => "0", :cellspacing => "0"}
|
|
||||||
%thead
|
|
||||||
%tr
|
|
||||||
%th.centered
|
|
||||||
%span#collaborators_deleter.hidden
|
|
||||||
%span.delete
|
|
||||||
%th
|
|
||||||
= t("layout.collaborators.members")
|
|
||||||
%th{:colspan => "3"}
|
|
||||||
= t("layout.collaborators.roles")
|
|
||||||
%tr.search
|
|
||||||
%th{:colspan => "5"}
|
|
||||||
%input{ :type => "text", :placeholder => "#{ t('layout.filter_by_name') }"}
|
|
||||||
%tbody
|
|
||||||
%br
|
|
||||||
|
|
||||||
.both
|
|
||||||
|
|
||||||
:javascript
|
|
||||||
$(function() {
|
|
||||||
Rosa.bootstrapedData.collaborators = #{ render 'collaborators.json.jbuilder', :collaborators => @collaborators };
|
|
||||||
r = new Rosa.Routers.CollaboratorsRouter();
|
|
||||||
});
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#assigned-popup
|
#assigned-popup.users-search-popup
|
||||||
.header
|
.header
|
||||||
.title= t('layout.issues.assign_someone')
|
.title= t('layout.issues.assign_someone')
|
||||||
%span.icon-remove-circle
|
%span.icon-remove-circle
|
||||||
|
@ -10,5 +10,5 @@
|
||||||
- unless [:new, :create].include?(action_name.to_sym)
|
- unless [:new, :create].include?(action_name.to_sym)
|
||||||
= form_for :issue, :url => [@project, @issue], :method => :put, :html => { :class => 'edit_assignee issue'} do |f|
|
= form_for :issue, :url => [@project, @issue], :method => :put, :html => { :class => 'edit_assignee issue'} do |f|
|
||||||
= hidden_field_tag "user-default_assignee", nil, :name => 'issue[assignee_id]'
|
= hidden_field_tag "user-default_assignee", nil, :name => 'issue[assignee_id]'
|
||||||
#manage_issue_users_list
|
.list
|
||||||
= render 'projects/issues/search_collaborators'
|
= render 'projects/issues/search_collaborators'
|
|
@ -1,79 +1,82 @@
|
||||||
- act = controller.action_name.to_sym
|
- act = controller.action_name.to_sym
|
||||||
- if [:new, :create].include? act
|
%div{'ng-controller' => 'ProjectFromController'}
|
||||||
.leftlist= f.label :name
|
- if [:new, :create].include? act
|
||||||
.rightlist= f.text_field :name, :class => 'text_field', :disabled => f.object.try(:persisted?)
|
.leftlist= f.label :name
|
||||||
|
.rightlist= f.text_field :name, :class => 'text_field', :disabled => f.object.try(:persisted?)
|
||||||
|
.both
|
||||||
|
.leftlist= f.label :description
|
||||||
|
.rightlist= f.text_area :description, :class => 'text_field', :cols => 80
|
||||||
.both
|
.both
|
||||||
.leftlist= f.label :description
|
- if [:new, :create].include? act
|
||||||
.rightlist= f.text_area :description, :class => 'text_field', :cols => 80
|
.leftlist= f.label :owner
|
||||||
.both
|
|
||||||
- if [:new, :create].include? act
|
|
||||||
.leftlist= f.label :owner
|
|
||||||
.rightlist
|
|
||||||
= label_tag t("activerecord.attributes.project.who_owns.me")
|
|
||||||
- if Group.can_own_project(current_user).count > 0
|
|
||||||
= radio_button_tag :who_owns, 'me', @who_owns == :me #{}.merge( (@who_owns == :me) ? {:checked => 'checked'} : {} )
|
|
||||||
= label_tag t("activerecord.attributes.project.who_owns.group")
|
|
||||||
= radio_button_tag :who_owns, 'group', @who_owns == :group #{}.merge( (@who_owns == :group) ? {:checked => 'checked'} : {} )
|
|
||||||
-# TODO: Make our own select_box helper with new design, blackjack and bitches!
|
|
||||||
= select_tag :owner_id, options_from_collection_for_select( Group.can_own_project(current_user), :id, :name )
|
|
||||||
- else
|
|
||||||
= hidden_field_tag :who_owns, :me
|
|
||||||
.both
|
|
||||||
|
|
||||||
.leftlist= f.label :visibility
|
|
||||||
.rightlist
|
|
||||||
=# f.select :visibility, Project::VISIBILITIES
|
|
||||||
- Project::VISIBILITIES.each do |visibility|
|
|
||||||
= f.radio_button :visibility, visibility, :class => 'niceRadio'
|
|
||||||
- if visibility == 'open'
|
|
||||||
= image_tag("unlock.png")
|
|
||||||
- else
|
|
||||||
= image_tag("lock.png")
|
|
||||||
= t("activerecord.attributes.project.visibilities.#{visibility}")
|
|
||||||
.both
|
|
||||||
.leftlist
|
|
||||||
\
|
|
||||||
.rightlist
|
|
||||||
.check
|
|
||||||
%span#niceCheckbox1.niceCheck-main= f.check_box :is_package
|
|
||||||
.forcheck= f.label :is_package
|
|
||||||
.both
|
|
||||||
- unless [:new, :create].include? act
|
|
||||||
#publish_form{:class => @project.publish_i686_into_x86_64 ? '' : 'hidden'}
|
|
||||||
.check
|
|
||||||
%span.niceCheck-main= f.check_box :publish_i686_into_x86_64
|
|
||||||
.forcheck= f.label :publish_i686_into_x86_64
|
|
||||||
.both
|
|
||||||
|
|
||||||
.both
|
|
||||||
- if [:edit, :update].include? act
|
|
||||||
.leftlist= f.label :default_branch
|
|
||||||
.rightlist
|
|
||||||
= f.select :default_branch,
|
|
||||||
options_from_collection_for_select( @project.repo.branches,
|
|
||||||
:name, :name, @project.default_branch),
|
|
||||||
:class => 'sel80', :id => 'branch_selector'
|
|
||||||
.both
|
|
||||||
#maintainer_form{:class => @project.is_package ? '' : 'hidden'}
|
|
||||||
= f.hidden_field :maintainer_id, :value => @project.maintainer_id
|
|
||||||
.leftlist
|
|
||||||
= f.label :maintainer
|
|
||||||
.rightlist
|
.rightlist
|
||||||
-# TODO: Maybe use something like Chosen with filter and prepopulated
|
= label_tag t("activerecord.attributes.project.who_owns.me")
|
||||||
-# list of potential maintainers?
|
- if Group.can_own_project(current_user).count > 0
|
||||||
= autocomplete_field_tag :maintainer_name, @project.maintainer.fullname,
|
= radio_button_tag :who_owns, 'me', @who_owns == :me #{}.merge( (@who_owns == :me) ? {:checked => 'checked'} : {} )
|
||||||
autocomplete_maintainers_path(@project.owner, @project),
|
= label_tag t("activerecord.attributes.project.who_owns.group")
|
||||||
:id_element => '#project_maintainer_id',
|
= radio_button_tag :who_owns, 'group', @who_owns == :group #{}.merge( (@who_owns == :group) ? {:checked => 'checked'} : {} )
|
||||||
:placeholder => @project.maintainer.fullname
|
-# TODO: Make our own select_box helper with new design, blackjack and bitches!
|
||||||
- if [:new, :create].include? act
|
= select_tag :owner_id, options_from_collection_for_select( Group.can_own_project(current_user), :id, :name )
|
||||||
.leftlist= f.label :srpm
|
- else
|
||||||
.rightlist= f.file_field :srpm, :class => 'file_field'
|
= hidden_field_tag :who_owns, :me
|
||||||
|
.both
|
||||||
|
|
||||||
|
.leftlist= f.label :visibility
|
||||||
|
.rightlist
|
||||||
|
=# f.select :visibility, Project::VISIBILITIES
|
||||||
|
- Project::VISIBILITIES.each do |visibility|
|
||||||
|
= f.radio_button :visibility, visibility, :class => 'niceRadio'
|
||||||
|
- if visibility == 'open'
|
||||||
|
= image_tag("unlock.png")
|
||||||
|
- else
|
||||||
|
= image_tag("lock.png")
|
||||||
|
= t("activerecord.attributes.project.visibilities.#{visibility}")
|
||||||
.both
|
.both
|
||||||
.leftlist
|
.leftlist
|
||||||
\
|
\
|
||||||
.rightlist= submit_tag t('layout.save'), :class => 'button', :data => {'disable-with' => t('layout.saving')}
|
.rightlist
|
||||||
.both
|
.check= f.check_box :is_package, 'ng-model' => 'project.is_package', 'ng-change' => 'project.publish_i686_into_x86_64 = false'
|
||||||
|
.forcheck= f.label :is_package
|
||||||
|
.both
|
||||||
|
- unless [:new, :create].include? act
|
||||||
|
#publish_form{'ng-show' => 'project.is_package'}
|
||||||
|
.check= f.check_box :publish_i686_into_x86_64, 'ng-model' => 'project.publish_i686_into_x86_64'
|
||||||
|
.forcheck= f.label :publish_i686_into_x86_64
|
||||||
|
.both
|
||||||
|
|
||||||
|
.both
|
||||||
|
- if [:edit, :update].include? act
|
||||||
|
.leftlist= f.label :default_branch
|
||||||
|
.rightlist
|
||||||
|
= f.select :default_branch,
|
||||||
|
options_from_collection_for_select( @project.repo.branches,
|
||||||
|
:name, :name, @project.default_branch),
|
||||||
|
:class => 'sel80', :id => 'branch_selector'
|
||||||
|
.both
|
||||||
|
#maintainer_form{'ng-show' => 'project.is_package'}
|
||||||
|
= f.hidden_field :maintainer_id, :value => @project.maintainer_id
|
||||||
|
.leftlist
|
||||||
|
= f.label :maintainer
|
||||||
|
.rightlist
|
||||||
|
-# TODO: Maybe use something like Chosen with filter and prepopulated
|
||||||
|
-# list of potential maintainers?
|
||||||
|
= autocomplete_field_tag :maintainer_name, @project.maintainer.fullname,
|
||||||
|
autocomplete_maintainers_path(@project.owner, @project),
|
||||||
|
:id_element => '#project_maintainer_id',
|
||||||
|
:placeholder => @project.maintainer.fullname
|
||||||
|
- if [:new, :create].include? act
|
||||||
|
.leftlist= f.label :srpm
|
||||||
|
.rightlist= f.file_field :srpm, :class => 'file_field'
|
||||||
|
.both
|
||||||
|
.leftlist
|
||||||
|
\
|
||||||
|
.rightlist= submit_tag t('layout.save'), :class => 'button', :data => {'disable-with' => t('layout.saving')}
|
||||||
|
.both
|
||||||
|
|
||||||
:javascript
|
:javascript
|
||||||
$(function() {
|
RosaABF.controller('ProjectFromController', ['$scope', function($scope) {
|
||||||
( new Rosa.Views.ProjectModifyView ).render();
|
$scope.project = {
|
||||||
});
|
is_package: #{@project.is_package},
|
||||||
|
publish_i686_into_x86_64: #{@project.publish_i686_into_x86_64}
|
||||||
|
}
|
||||||
|
}]);
|
Loading…
Reference in New Issue