From f6ec81bb35f50cadf861f3ba1e1552a091343bfe Mon Sep 17 00:00:00 2001 From: Vokhmin Alexey V Date: Wed, 20 Mar 2013 19:06:25 +0400 Subject: [PATCH 01/68] #37: update UI for "Assignee" Issues and PullRequests --- app/assets/javascripts/extra/tracker.js | 117 +++++++++++------- app/assets/stylesheets/design/custom.scss | 76 ++++++++++++ app/assets/stylesheets/design/main.scss | 2 +- app/controllers/projects/issues_controller.rb | 1 + app/views/projects/issues/_header.html.haml | 32 ++++- .../projects/issues/_manage_sidebar.html.haml | 26 ---- .../issues/_search_collaborators.html.haml | 11 +- .../pull_requests/_index_sidebar.html.haml | 15 ++- vendor/assets/stylesheets/bootstrap.css | 6 + 9 files changed, 209 insertions(+), 77 deletions(-) diff --git a/app/assets/javascripts/extra/tracker.js b/app/assets/javascripts/extra/tracker.js index 58c099d01..3f96f7709 100644 --- a/app/assets/javascripts/extra/tracker.js +++ b/app/assets/javascripts/extra/tracker.js @@ -137,30 +137,61 @@ $(document).ready(function() { return false; }); - function remAssignee(form) { - var el = form.find('.people.selected.remove_assignee'); - var id = el.attr('id'); - $('#manage_issue_users_list .add_assignee.people.selected').removeClass('select'); - el.remove(); - } - - $('.add_assignee.people.selected').live('click', function() { - var form_new = $('form.issue'); - var form_edit = $('form.edit_form.issue'); - form_new.find('#people-span').fadeOut(0); - remAssignee(form_new); - var clone = $(this).clone().removeClass('add_assignee').addClass('remove_assignee'); - form_new.find('#issue_assignee').html(clone); - $('.current_assignee').html(clone.removeClass('select')); - $(this).addClass('select'); + $('#assigned-popup .header .icon-remove-circle').live('click', function() { + $('#assigned-popup').hide(); }); - $('.remove_assignee.people.selected').live('click', function() { - var form = $('form.issue, form.edit_form issue'); - form.find('#people-span').fadeIn(0); - remAssignee(form); + $('.assigned .icon-share').live('click', function() { + $('#assigned-popup').show(); }); + // function remAssignee(form) { + // var el = form.find('.people.selected.remove_assignee'); + // var id = el.attr('id'); + // $('#manage_issue_users_list .add_assignee.people.selected').removeClass('select'); + // el.remove(); + // } + + $('#assigned-popup .people.selected').live('click', function() { + // var form_new = $('form.issue'); + // var form_edit = $('form.edit_form.issue'); + // form_new.find('#people-span').fadeOut(0); + // remAssignee(form_new); + // var clone = $(this).clone().removeClass('add_assignee').addClass('remove_assignee'); + // form_new.find('#issue_assignee').html(clone); + // $('.current_assignee').html(clone.removeClass('select')); + // $(this).addClass('select'); + + var form = $('#assigned-popup .edit_assignee'); + $.ajax({ + type: 'PUT', + url: form.attr("action"), + data: $(this).find('input').serialize(), + success: function(data){ + $('#assigned-popup').hide(); + window.location.reload(); + // $('.current_assignee .people').removeClass('remove_assignee selected').addClass('nopointer'); + // $('form#search_user, .button.update_assignee').fadeOut(0); + // $('.button.manage_assignee').fadeIn(0); + // $('#manage_issue_users_list').html(''); + }, + error: function(data){ + alert('error'); // TODO remove + } + }); + return false; + + + + + }); + + // $('.remove_assignee.people.selected').live('click', function() { + // var form = $('form.issue, form.edit_form issue'); + // form.find('#people-span').fadeIn(0); + // remAssignee(form); + // }); + function remLabel(form, id) { var el = form.find('.label.remove_label'+'#'+id); var label = $('#'+id+'.remove_label.label.selected'); @@ -251,11 +282,11 @@ $(document).ready(function() { return false; }); - $('.button.manage_assignee').live('click', function() { - $('form#search_user, .button.update_assignee').fadeIn(0); - $('.current_assignee .people').addClass('remove_assignee selected').removeClass('nopointer'); - $(this).fadeOut(0); - }); + // $('.button.manage_assignee').live('click', function() { + // $('form#search_user, .button.update_assignee').fadeIn(0); + // $('.current_assignee .people').addClass('remove_assignee selected').removeClass('nopointer'); + // $(this).fadeOut(0); + // }); $('.button.manage_labels').live('click', function() { $('.button.update_labels').fadeIn(0); @@ -264,24 +295,24 @@ $(document).ready(function() { $(this).fadeOut(0); }); - $('.button.update_assignee').live('click', function() { - var form = $('form.edit_assignee.issue'); - $.ajax({ - type: 'POST', - url: form.attr("action"), - data: form.serialize(), - success: function(data){ - $('.current_assignee .people').removeClass('remove_assignee selected').addClass('nopointer'); - $('form#search_user, .button.update_assignee').fadeOut(0); - $('.button.manage_assignee').fadeIn(0); - $('#manage_issue_users_list').html(''); - }, - error: function(data){ - alert('error'); // TODO remove - } - }); - return false; - }); + // $('.button.update_assignee').live('click', function() { + // var form = $('form.edit_assignee.issue'); + // $.ajax({ + // type: 'POST', + // url: form.attr("action"), + // data: form.serialize(), + // success: function(data){ + // $('.current_assignee .people').removeClass('remove_assignee selected').addClass('nopointer'); + // $('form#search_user, .button.update_assignee').fadeOut(0); + // $('.button.manage_assignee').fadeIn(0); + // $('#manage_issue_users_list').html(''); + // }, + // error: function(data){ + // alert('error'); // TODO remove + // } + // }); + // return false; + // }); $('.button.update_labels').live('click', function() { var form = $('form.edit_labels.issue'); diff --git a/app/assets/stylesheets/design/custom.scss b/app/assets/stylesheets/design/custom.scss index 0fba4a2d9..5e63bf78b 100644 --- a/app/assets/stylesheets/design/custom.scss +++ b/app/assets/stylesheets/design/custom.scss @@ -1887,4 +1887,80 @@ table#myTable thead tr.search th form.button_to div input { text-align: center; padding: 7px 5px 3px; } +} + +article .activity .top { + + .created { + opacity: 0.8; + span { + float: none; + margin-right: 5px; + } + } + .assigned { + padding: 10px 20px; + border: 1px solid #D6D6D6; + margin: 10px -7px; + border-left: none; + border-right: none; + .icon-share { + cursor: pointer; + } + .image { + width: auto; + height: auto; + margin: -1px 10px 0 0; + } + } +} + +#assigned-popup { + position: absolute; + margin: 5px 0 0 130px; + display: none; + min-width: 230px; + border: 1px solid #b3cce0; + background: #FFF; + -moz-border-radius: 5px; + -webkit-border-radius: 5px; + border-radius: 5px; + .header .icon-remove-circle { + cursor: pointer; + float: right; + } + .header { + padding: 10px; + background: #dcecfa; + border-bottom: 1px solid #D6D6D6; + font-weight: bold; + .title { display: inline-block; } + } + form { + padding: 10px 15px 10px 10px; + border-bottom: 1px solid #D6D6D6; + input { + width: 100%; + max-width: 100%; + } + } + .edit_assignee { + display: none; + } + #manage_issue_users_list { + overflow-y: auto; + overflow-x: hidden; + max-height: 280px; + .people, .nothing { + margin: 0; + width: 100%; + padding: 10px 20px 10px 10px; + } + .clear { + opacity: 0.8; + } + .nothing { + color: #D6D6D6; + } + } } \ No newline at end of file diff --git a/app/assets/stylesheets/design/main.scss b/app/assets/stylesheets/design/main.scss index a50b7991f..d2742971c 100644 --- a/app/assets/stylesheets/design/main.scss +++ b/app/assets/stylesheets/design/main.scss @@ -762,7 +762,7 @@ article div.activity div.top div.text { font-size: 12px; } -article div.activity div.top div.text span.name { +article div.activity div.top span.name { font-weight: 700; } diff --git a/app/controllers/projects/issues_controller.rb b/app/controllers/projects/issues_controller.rb index 03d5ca7b5..eee695f31 100644 --- a/app/controllers/projects/issues_controller.rb +++ b/app/controllers/projects/issues_controller.rb @@ -95,6 +95,7 @@ class Projects::IssuesController < Projects::BaseController users = User.joins(:groups => :projects).where(:projects => {:id => @project.id}).where("users.uname ILIKE ?", search) users2 = @project.collaborators.where("users.uname ILIKE ?", search) @users = (users + users2).uniq.sort {|x,y| x.uname <=> y.uname}.first(10) + @issue = Issue.where(:id => params[:id]).first render :partial => 'search_collaborators' end diff --git a/app/views/projects/issues/_header.html.haml b/app/views/projects/issues/_header.html.haml index afb64f810..0d0a9f1f7 100644 --- a/app/views/projects/issues/_header.html.haml +++ b/app/views/projects/issues/_header.html.haml @@ -1,13 +1,35 @@ -%h3.issue_title=@issue.title .activity .top .image =image_tag(avatar_url(@issue.user, :medium), :alt => 'avatar') if @issue.user .text - %span.name=link_to(@issue.user.fullname, user_path(@issue.user)) if @issue.user - %br/ - %span.date=@issue.created_at.to_s(:long) - %br/ + .created + %span.date=@issue.created_at.to_s(:long) + - if @issue.user + %span.date=t("layout.by") + %span.name=link_to(@issue.user.fullname, user_path(@issue.user)) + %h3.issue_title=@issue.title + .both + .assigned + - if @issue.assignee + .image + =image_tag(avatar_url(@issue.assignee, :micro), :alt => 'avatar') + %span.name= link_to(@issue.assign_uname, user_path(@issue.assignee)) + %span= 'is assigned' + - else + %span= "No one is assigned" + -if can?(:update, @issue) || @issue.new_record? + %span.icon-share + #assigned-popup + .header + .title= 'Assign someone to this issue' + %span.icon-remove-circle + =form_tag search_collaborators_project_issues_path(@project, :id => @issue.id), :id => 'search_user', :method => :get do + =tracker_search_field(:search_user, t('layout.issues.search_user')) + =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]' + #manage_issue_users_list + =render 'projects/issues/search_collaborators' .both .fulltext.view.issue_body.formatted.cm-s-default.md_and_cm=markdown @issue.body .both diff --git a/app/views/projects/issues/_manage_sidebar.html.haml b/app/views/projects/issues/_manage_sidebar.html.haml index 9b819e38c..98144b2d2 100644 --- a/app/views/projects/issues/_manage_sidebar.html.haml +++ b/app/views/projects/issues/_manage_sidebar.html.haml @@ -9,32 +9,6 @@ - if can_manage =form_tag [@project, @issue], :id => 'update_issue_status', :method => :put do =hidden_field_tag "issue_status", @issue.closed? ? 'closed' : 'open', :name => "issue[status]" - .bordered.nopadding - %h3=t('layout.issues.assignee') - - if @issue.persisted? - -if can_manage - =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]' - .current_assignee - - if @issue.assignee - #user-0.people.nopointer - .avatar=image_tag avatar_url(@issue.assignee), :alt => 'avatar' - .name=@issue.assignee.fullname - =hidden_field_tag "user-0", @issue.assignee.id, :name => 'issue[assignee_id]' - .both - - elsif @issue.assignee - .people.nopointer - .avatar=image_tag avatar_url(@issue.assignee), :alt => 'avatar' - .name=@issue.assignee.fullname - .both - =link_to(t('layout.issues.assignee_manage'), '#', :class => "button tmargin10 manage_assignee") if can_manage - - if can_manage - =form_tag search_collaborators_project_issues_path(@project), :id => 'search_user', :method => :get, :style => @issue.persisted? ? 'display:none' : '' do - =tracker_search_field(:search_user, t('layout.issues.search_user')) - #manage_issue_users_list - =render 'search_collaborators' - =link_to(t('layout.issues.done'), '#', :class => "button tmargin10 update_assignee", :style => 'display:none') if can_manage - .block %h3=t('layout.issues.labels') - if can_manage diff --git a/app/views/projects/issues/_search_collaborators.html.haml b/app/views/projects/issues/_search_collaborators.html.haml index ca5cec807..a1ed9f775 100644 --- a/app/views/projects/issues/_search_collaborators.html.haml +++ b/app/views/projects/issues/_search_collaborators.html.haml @@ -1,6 +1,15 @@ -- (@users || []).each_with_index do |user, index| +- if @issue.try(:assignee) + .people.clear.selected + %span.icon-remove-circle + = 'Clear assignee' + =hidden_field_tag "user-nil", nil, :name => 'issue[assignee_id]' + +- users = (@users || []) +- users.each_with_index do |user, index| .people.selected{:id => "user-#{index}", :class => 'add_assignee'} .avatar= image_tag(avatar_url(user), :alt => 'avatar') .name=user.fullname =hidden_field_tag "user-#{index}", user.id, :name => 'issue[assignee_id]' .both +- if users.empty? + .nothing= 'Nothing to show' \ No newline at end of file diff --git a/app/views/projects/pull_requests/_index_sidebar.html.haml b/app/views/projects/pull_requests/_index_sidebar.html.haml index 0e78b5edd..953ed5631 100644 --- a/app/views/projects/pull_requests/_index_sidebar.html.haml +++ b/app/views/projects/pull_requests/_index_sidebar.html.haml @@ -1,5 +1,18 @@ -content_for :sidebar do - =form_tag project_pull_requests_path(@project), :id => 'filter_pull_requests', :method => :get, :class => 'ajax_search_form' do + - if current_user + =form_tag project_pull_requests_path(@project), :id => 'filter_pull_requests', :method => :get do + .bordered.nopadding + %h3=t("layout.issues.accessory") + %table + %tr + %td.width18=radio_button_tag :myradio, 'all', !@is_assigned_to_me, {:id => 'myradio1', :class => 'niceRadio', :name => 'filter'} + %td.width135=t("layout.issues.all") + %td.width30.right=@project.issues.joins(:pull_request).count + %tr + %td=radio_button_tag :myradio, 'to_me', @is_assigned_to_me, {:id => 'myradio1', :class => 'niceRadio', :name => 'filter'} + %td=t("layout.issues.to_me") + %td.width30.right=@project.issues.joins(:pull_request).where(:assignee_id => current_user.id).count + =form_tag project_pull_requests_path(@project), :id => 'search_pull_requests', :method => :get, :class => 'ajax_search_form' do .bordered.bpadding20 - search = params[:search_pull_request].present? ? params[:search_pull_request] : t('layout.pull_requests.search') =tracker_search_field(:search_pull_request, search) diff --git a/vendor/assets/stylesheets/bootstrap.css b/vendor/assets/stylesheets/bootstrap.css index 3dfd442cd..27a4aa4bf 100644 --- a/vendor/assets/stylesheets/bootstrap.css +++ b/vendor/assets/stylesheets/bootstrap.css @@ -834,4 +834,10 @@ a.badge:hover { } .icon-chevron-down { background-position: -313px -119px; +} +.icon-share { + background-position: -120px -72px; +} +.icon-remove-circle { + background-position: -168px -96px; } \ No newline at end of file From 5239be28278bedfb4ee4e42c2e93d35806863afe Mon Sep 17 00:00:00 2001 From: Vokhmin Alexey V Date: Wed, 20 Mar 2013 19:22:13 +0400 Subject: [PATCH 02/68] #37: update filter by "Accessory" for PullRequests --- app/controllers/projects/pull_requests_controller.rb | 1 + app/views/projects/pull_requests/_index_sidebar.html.haml | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/app/controllers/projects/pull_requests_controller.rb b/app/controllers/projects/pull_requests_controller.rb index 6bbe19f8c..e998e36fd 100644 --- a/app/controllers/projects/pull_requests_controller.rb +++ b/app/controllers/projects/pull_requests_controller.rb @@ -90,6 +90,7 @@ class Projects::PullRequestsController < Projects::BaseController def index(status = 200) @issues_with_pull_request = @project.issues.joins(:pull_request) + @issues_with_pull_request = @issues_with_pull_request.where(:assignee_id => current_user.id) if @is_assigned_to_me = params[:filter] == 'to_me' @issues_with_pull_request = @issues_with_pull_request.search(params[:search_pull_request]) if params[:search_pull_request] !~ /#{t('layout.pull_requests.search')}/ @opened_issues, @closed_issues = @issues_with_pull_request.not_closed_or_merged.count, @issues_with_pull_request.closed_or_merged.count diff --git a/app/views/projects/pull_requests/_index_sidebar.html.haml b/app/views/projects/pull_requests/_index_sidebar.html.haml index 953ed5631..50220ff7e 100644 --- a/app/views/projects/pull_requests/_index_sidebar.html.haml +++ b/app/views/projects/pull_requests/_index_sidebar.html.haml @@ -1,6 +1,6 @@ -content_for :sidebar do - if current_user - =form_tag project_pull_requests_path(@project), :id => 'filter_pull_requests', :method => :get do + =form_tag project_pull_requests_path(@project), :id => 'filter_issues', :method => :get do .bordered.nopadding %h3=t("layout.issues.accessory") %table @@ -12,7 +12,7 @@ %td=radio_button_tag :myradio, 'to_me', @is_assigned_to_me, {:id => 'myradio1', :class => 'niceRadio', :name => 'filter'} %td=t("layout.issues.to_me") %td.width30.right=@project.issues.joins(:pull_request).where(:assignee_id => current_user.id).count - =form_tag project_pull_requests_path(@project), :id => 'search_pull_requests', :method => :get, :class => 'ajax_search_form' do + =form_tag project_pull_requests_path(@project), :id => 'filter_pull_requests', :method => :get, :class => 'ajax_search_form' do .bordered.bpadding20 - search = params[:search_pull_request].present? ? params[:search_pull_request] : t('layout.pull_requests.search') =tracker_search_field(:search_pull_request, search) From a9ab9ab5a6d1dfa1d8089193e7c0a5b3632ba5d2 Mon Sep 17 00:00:00 2001 From: Vokhmin Alexey V Date: Wed, 20 Mar 2013 20:05:37 +0400 Subject: [PATCH 03/68] #37: update text labels --- app/views/projects/issues/_index_sidebar.html.haml | 3 +-- app/views/projects/pull_requests/_index_sidebar.html.haml | 7 +++---- config/locales/models/issue.en.yml | 3 +-- config/locales/models/issue.ru.yml | 3 +-- config/locales/models/pull_request.en.yml | 2 ++ config/locales/models/pull_request.ru.yml | 2 ++ 6 files changed, 10 insertions(+), 10 deletions(-) diff --git a/app/views/projects/issues/_index_sidebar.html.haml b/app/views/projects/issues/_index_sidebar.html.haml index 1b81c3ac6..51e7e8e18 100644 --- a/app/views/projects/issues/_index_sidebar.html.haml +++ b/app/views/projects/issues/_index_sidebar.html.haml @@ -1,8 +1,7 @@ -content_for :sidebar do - if current_user =form_tag project_issues_path(@project), :id => 'filter_issues', :method => :get do - .bordered.nopadding - %h3=t("layout.issues.accessory") + .bordered %table %tr %td.width18=radio_button_tag :myradio, 'all', !@is_assigned_to_me, {:id => 'myradio1', :class => 'niceRadio', :name => 'filter'} diff --git a/app/views/projects/pull_requests/_index_sidebar.html.haml b/app/views/projects/pull_requests/_index_sidebar.html.haml index 50220ff7e..05c051d32 100644 --- a/app/views/projects/pull_requests/_index_sidebar.html.haml +++ b/app/views/projects/pull_requests/_index_sidebar.html.haml @@ -1,16 +1,15 @@ -content_for :sidebar do - if current_user =form_tag project_pull_requests_path(@project), :id => 'filter_issues', :method => :get do - .bordered.nopadding - %h3=t("layout.issues.accessory") + .bordered %table %tr %td.width18=radio_button_tag :myradio, 'all', !@is_assigned_to_me, {:id => 'myradio1', :class => 'niceRadio', :name => 'filter'} - %td.width135=t("layout.issues.all") + %td.width135=t("layout.pull_requests.all") %td.width30.right=@project.issues.joins(:pull_request).count %tr %td=radio_button_tag :myradio, 'to_me', @is_assigned_to_me, {:id => 'myradio1', :class => 'niceRadio', :name => 'filter'} - %td=t("layout.issues.to_me") + %td=t("layout.pull_requests.to_me") %td.width30.right=@project.issues.joins(:pull_request).where(:assignee_id => current_user.id).count =form_tag project_pull_requests_path(@project), :id => 'filter_pull_requests', :method => :get, :class => 'ajax_search_form' do .bordered.bpadding20 diff --git a/config/locales/models/issue.en.yml b/config/locales/models/issue.en.yml index 3a7ab6ed1..2887f0f9f 100644 --- a/config/locales/models/issue.en.yml +++ b/config/locales/models/issue.en.yml @@ -11,9 +11,8 @@ en: layout: issues: - accessory: Accessory issues list: List - all: All + all: All issues to_me: Assigned to me edit: Edit search: Find issue... diff --git a/config/locales/models/issue.ru.yml b/config/locales/models/issue.ru.yml index 7a5e696eb..2660ba6b1 100644 --- a/config/locales/models/issue.ru.yml +++ b/config/locales/models/issue.ru.yml @@ -11,9 +11,8 @@ ru: layout: issues: - accessory: Принадлежность заданий list: Список - all: Все + all: Все задачи to_me: Назначенные мне edit: Редактировать search: Найти задачу... diff --git a/config/locales/models/pull_request.en.yml b/config/locales/models/pull_request.en.yml index 7c0c28f8f..156bf8192 100644 --- a/config/locales/models/pull_request.en.yml +++ b/config/locales/models/pull_request.en.yml @@ -56,4 +56,6 @@ en: layout: pull_requests: search: Find pull request... + all: All requests + to_me: Assigned to me view_full_changes: View full changes diff --git a/config/locales/models/pull_request.ru.yml b/config/locales/models/pull_request.ru.yml index 91efadf28..26dd0f761 100644 --- a/config/locales/models/pull_request.ru.yml +++ b/config/locales/models/pull_request.ru.yml @@ -57,4 +57,6 @@ ru: layout: pull_requests: search: Найти пул реквест... + all: Все пул реквесты + to_me: Назначенные мне view_full_changes: Посмотреть все изменения From 4261e250e8ceeea388acefbd17247729874f27f6 Mon Sep 17 00:00:00 2001 From: Vokhmin Alexey V Date: Thu, 21 Mar 2013 00:36:22 +0400 Subject: [PATCH 04/68] #37: updated "assigned" for PullRequests --- app/assets/javascripts/extra/tracker.js | 17 ++++++-- app/assets/stylesheets/design/custom.scss | 41 ++++++++++++++----- .../projects/issues/_assigned_popup.html.haml | 12 ++++++ app/views/projects/issues/_form.html.haml | 13 ++++-- app/views/projects/issues/_header.html.haml | 29 +++++-------- .../issues/_search_collaborators.html.haml | 20 +++++---- app/views/projects/issues/new.html.haml | 6 +-- .../projects/pull_requests/new.html.haml | 14 +++++++ 8 files changed, 108 insertions(+), 44 deletions(-) create mode 100644 app/views/projects/issues/_assigned_popup.html.haml diff --git a/app/assets/javascripts/extra/tracker.js b/app/assets/javascripts/extra/tracker.js index 3f96f7709..5793e0ca6 100644 --- a/app/assets/javascripts/extra/tracker.js +++ b/app/assets/javascripts/extra/tracker.js @@ -141,7 +141,7 @@ $(document).ready(function() { $('#assigned-popup').hide(); }); - $('.assigned .icon-share').live('click', function() { + $('#assigned-container .icon-share').live('click', function() { $('#assigned-popup').show(); }); @@ -163,13 +163,18 @@ $(document).ready(function() { // $(this).addClass('select'); var form = $('#assigned-popup .edit_assignee'); + var item = $(this); + if (form.length == 0) { + updateAssignedUser(item); + return false; + } $.ajax({ type: 'PUT', url: form.attr("action"), data: $(this).find('input').serialize(), success: function(data){ - $('#assigned-popup').hide(); - window.location.reload(); + updateAssignedUser(item); + // window.location.reload(); // $('.current_assignee .people').removeClass('remove_assignee selected').addClass('nopointer'); // $('form#search_user, .button.update_assignee').fadeOut(0); // $('.button.manage_assignee').fadeIn(0); @@ -334,3 +339,9 @@ $(document).ready(function() { }); }); + +function updateAssignedUser(item) { + $('#assigned-popup').hide(); + var container = item.find('.container').clone(); + $('#assigned-container .user-container').empty().append(container.html()); +} diff --git a/app/assets/stylesheets/design/custom.scss b/app/assets/stylesheets/design/custom.scss index 5e63bf78b..c6dbf8ce9 100644 --- a/app/assets/stylesheets/design/custom.scss +++ b/app/assets/stylesheets/design/custom.scss @@ -1898,23 +1898,40 @@ article .activity .top { margin-right: 5px; } } - .assigned { + .assigned-header { padding: 10px 20px; border: 1px solid #D6D6D6; margin: 10px -7px; border-left: none; border-right: none; - .icon-share { - cursor: pointer; - } - .image { - width: auto; - height: auto; - margin: -1px 10px 0 0; - } } } +#assigned-container { + .icon-share { + cursor: pointer; + margin-top: -2px; + } + .image { + float: left; + width: 16px; + height: 16px; + margin: -1px 5px 0 0; + img { + position: absolute; + width: 16px; + height: 16px; + } + } + .user-container { + display: inline-block; + } + span { + padding-left: 5px; + } +} + + #assigned-popup { position: absolute; margin: 5px 0 0 130px; @@ -1924,6 +1941,7 @@ article .activity .top { background: #FFF; -moz-border-radius: 5px; -webkit-border-radius: 5px; + box-shadow: 0 3px 7px rgba(0, 0, 0, 0.3); border-radius: 5px; .header .icon-remove-circle { cursor: pointer; @@ -1962,5 +1980,8 @@ article .activity .top { .nothing { color: #D6D6D6; } + .container { + display: none; + } } -} \ No newline at end of file +} diff --git a/app/views/projects/issues/_assigned_popup.html.haml b/app/views/projects/issues/_assigned_popup.html.haml new file mode 100644 index 000000000..07d5f32d3 --- /dev/null +++ b/app/views/projects/issues/_assigned_popup.html.haml @@ -0,0 +1,12 @@ +#assigned-popup + .header + .title= 'Assign someone to this issue' + %span.icon-remove-circle + = form_tag search_collaborators_project_issues_path(@project, :id => @issue.id), :id => 'search_user', :method => :get do + = tracker_search_field(:search_user, t('layout.issues.search_user')) + + - unless [:new, :create].include?(action_name.to_sym) + = 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]' + #manage_issue_users_list + = render 'projects/issues/search_collaborators' \ No newline at end of file diff --git a/app/views/projects/issues/_form.html.haml b/app/views/projects/issues/_form.html.haml index 01b6a0a1a..35909cfcc 100644 --- a/app/views/projects/issues/_form.html.haml +++ b/app/views/projects/issues/_form.html.haml @@ -1,8 +1,15 @@ =render 'title_body', :f => f, :id => 'new' .leftlist= t('activerecord.attributes.issue.assignee') + ':' -.rightlist - %span#people-span.small-text= t('layout.issues.choose_user_on_left') - #issue_assignee +#assigned-container.rightlist + .user-container + - if @issue.assignee + .image + =image_tag(avatar_url(@issue.assignee, :micro), :alt => 'avatar') + %span.name= link_to(@issue.assign_uname, user_path(@issue.assignee)) + %span= 'is assigned' + - else + %span= "No one is assigned" + %span.icon-share .both .leftlist= t('layout.issues.labels') + ':' .rightlist diff --git a/app/views/projects/issues/_header.html.haml b/app/views/projects/issues/_header.html.haml index 0d0a9f1f7..cd832b59f 100644 --- a/app/views/projects/issues/_header.html.haml +++ b/app/views/projects/issues/_header.html.haml @@ -10,26 +10,19 @@ %span.name=link_to(@issue.user.fullname, user_path(@issue.user)) %h3.issue_title=@issue.title .both - .assigned - - if @issue.assignee - .image - =image_tag(avatar_url(@issue.assignee, :micro), :alt => 'avatar') - %span.name= link_to(@issue.assign_uname, user_path(@issue.assignee)) - %span= 'is assigned' - - else - %span= "No one is assigned" + #assigned-container.assigned-header + .user-container + - if @issue.assignee + .image + =image_tag(avatar_url(@issue.assignee, :micro), :alt => 'avatar') + %span.name= link_to(@issue.assign_uname, user_path(@issue.assignee)) + %span= 'is assigned' + - else + %span= "No one is assigned" -if can?(:update, @issue) || @issue.new_record? %span.icon-share - #assigned-popup - .header - .title= 'Assign someone to this issue' - %span.icon-remove-circle - =form_tag search_collaborators_project_issues_path(@project, :id => @issue.id), :id => 'search_user', :method => :get do - =tracker_search_field(:search_user, t('layout.issues.search_user')) - =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]' - #manage_issue_users_list - =render 'projects/issues/search_collaborators' + =render 'projects/issues/assigned_popup' + .both .fulltext.view.issue_body.formatted.cm-s-default.md_and_cm=markdown @issue.body .both diff --git a/app/views/projects/issues/_search_collaborators.html.haml b/app/views/projects/issues/_search_collaborators.html.haml index a1ed9f775..f2de9f4c9 100644 --- a/app/views/projects/issues/_search_collaborators.html.haml +++ b/app/views/projects/issues/_search_collaborators.html.haml @@ -1,15 +1,21 @@ -- if @issue.try(:assignee) - .people.clear.selected - %span.icon-remove-circle - = 'Clear assignee' - =hidden_field_tag "user-nil", nil, :name => 'issue[assignee_id]' +.people.clear.selected + %span.icon-remove-circle + = 'Clear assignee' + .container + %span= "No one is assigned" + = hidden_field_tag "user-nil", nil, :name => "issue[assignee_id]" - users = (@users || []) - users.each_with_index do |user, index| .people.selected{:id => "user-#{index}", :class => 'add_assignee'} .avatar= image_tag(avatar_url(user), :alt => 'avatar') - .name=user.fullname - =hidden_field_tag "user-#{index}", user.id, :name => 'issue[assignee_id]' + .name= user.fullname + .container + .image + =image_tag(avatar_url(user, :micro), :alt => 'avatar') + %span.name= link_to(user.uname, user_path(user)) + %span= 'is assigned' + = hidden_field_tag "user-#{index}", user.id, :name => "issue[assignee_id]" .both - if users.empty? .nothing= 'Nothing to show' \ No newline at end of file diff --git a/app/views/projects/issues/new.html.haml b/app/views/projects/issues/new.html.haml index a59cc7a10..2c5519fa0 100644 --- a/app/views/projects/issues/new.html.haml +++ b/app/views/projects/issues/new.html.haml @@ -3,8 +3,8 @@ -render 'manage_sidebar' %h3.bpadding10= t("layout.issues.create_header") -= form_for :issue, :url => project_issues_path(@project), :html => { :class => 'form issue' } do |f| +=render 'projects/issues/assigned_popup' += form_for :issue, :url => project_issues_path(@project), :html => { :class => 'form issue new' } do |f| = render "form", :f => f =hidden_field_tag :preview_url, project_md_preview_path(@project) -= render "projects/comments/markdown_help" - += render "projects/comments/markdown_help" \ No newline at end of file diff --git a/app/views/projects/pull_requests/new.html.haml b/app/views/projects/pull_requests/new.html.haml index 6ad43d4de..9e29f4510 100644 --- a/app/views/projects/pull_requests/new.html.haml +++ b/app/views/projects/pull_requests/new.html.haml @@ -7,6 +7,7 @@ .tab-content.pull_diff_fix #discussion.tab-pane.active =hidden_field_tag :update_action, new_project_pull_request_path + =render 'projects/issues/assigned_popup' =form_for @pull, :url => (@pull.already? ? new_project_pull_request_path : project_pull_requests_path), :html => {:class => 'well well-large', :method => (@pull.already? ? :get : :post)} do |f| .leftlist=f.label :from_project, t("#{ar}.from_project"), :class => :label @@ -31,6 +32,19 @@ %div{:class => @pull.ready? ? 'notice' : 'alert'} =pull_status @pull .both + + .leftlist.big-list= t('activerecord.attributes.issue.assignee') + ':' + #assigned-container.rightlist + .user-container + - if @issue.assignee + .image + =image_tag(avatar_url(@issue.assignee, :micro), :alt => 'avatar') + %span.name= link_to(@issue.assign_uname, user_path(@issue.assignee)) + %span= 'is assigned' + - else + %span= "No one is assigned" + %span.icon-share + .both .leftlist.big-list .rightlist =f.submit t('.submit'), :class => 'btn btn-primary disabled', 'data-loading-text' => t('layout.processing'), :id => 'create_pull' unless @pull.already? From c3a9246d09c27b45d4440f52436106d13dba67e8 Mon Sep 17 00:00:00 2001 From: Vokhmin Alexey V Date: Thu, 21 Mar 2013 00:46:33 +0400 Subject: [PATCH 05/68] #37: fix for assignee User to PullRequest --- app/controllers/projects/pull_requests_controller.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/app/controllers/projects/pull_requests_controller.rb b/app/controllers/projects/pull_requests_controller.rb index e998e36fd..ce8f51d27 100644 --- a/app/controllers/projects/pull_requests_controller.rb +++ b/app/controllers/projects/pull_requests_controller.rb @@ -37,6 +37,7 @@ class Projects::PullRequestsController < Projects::BaseController authorize! :read, to_project @pull = to_project.pull_requests.new pull_params + @pull.issue.assignee_id = (params[:issue] || {})[:assignee_id] @pull.issue.user, @pull.issue.project, @pull.from_project = current_user, to_project, @project @pull.from_project_owner_uname = @pull.from_project.owner.uname @pull.from_project_name = @pull.from_project.name From 3ea7cfbe328cc0c8ee94abaaa6753791a256fc07 Mon Sep 17 00:00:00 2001 From: Vokhmin Alexey V Date: Thu, 21 Mar 2013 00:48:24 +0400 Subject: [PATCH 06/68] #37: remove unnecessary code --- app/assets/javascripts/extra/tracker.js | 74 +++---------------------- 1 file changed, 9 insertions(+), 65 deletions(-) diff --git a/app/assets/javascripts/extra/tracker.js b/app/assets/javascripts/extra/tracker.js index 5793e0ca6..c9051ff95 100644 --- a/app/assets/javascripts/extra/tracker.js +++ b/app/assets/javascripts/extra/tracker.js @@ -145,23 +145,7 @@ $(document).ready(function() { $('#assigned-popup').show(); }); - // function remAssignee(form) { - // var el = form.find('.people.selected.remove_assignee'); - // var id = el.attr('id'); - // $('#manage_issue_users_list .add_assignee.people.selected').removeClass('select'); - // el.remove(); - // } - $('#assigned-popup .people.selected').live('click', function() { - // var form_new = $('form.issue'); - // var form_edit = $('form.edit_form.issue'); - // form_new.find('#people-span').fadeOut(0); - // remAssignee(form_new); - // var clone = $(this).clone().removeClass('add_assignee').addClass('remove_assignee'); - // form_new.find('#issue_assignee').html(clone); - // $('.current_assignee').html(clone.removeClass('select')); - // $(this).addClass('select'); - var form = $('#assigned-popup .edit_assignee'); var item = $(this); if (form.length == 0) { @@ -174,38 +158,14 @@ $(document).ready(function() { data: $(this).find('input').serialize(), success: function(data){ updateAssignedUser(item); - // window.location.reload(); - // $('.current_assignee .people').removeClass('remove_assignee selected').addClass('nopointer'); - // $('form#search_user, .button.update_assignee').fadeOut(0); - // $('.button.manage_assignee').fadeIn(0); - // $('#manage_issue_users_list').html(''); }, error: function(data){ alert('error'); // TODO remove } }); return false; - - - - }); - // $('.remove_assignee.people.selected').live('click', function() { - // var form = $('form.issue, form.edit_form issue'); - // form.find('#people-span').fadeIn(0); - // remAssignee(form); - // }); - - function remLabel(form, id) { - var el = form.find('.label.remove_label'+'#'+id); - var label = $('#'+id+'.remove_label.label.selected'); - label.find('.flag').fadeIn(0); - label.find('.labeltext.selected').removeClass('selected').attr('style', ''); - label.fadeIn('slow'); - el.fadeOut('slow').remove(); - } - $('.add_label.label').live('click', function() { $(this).addClass('selected').removeClass('add_label').addClass('remove_label'); $(this).find('.labeltext').addClass('selected'); @@ -287,12 +247,6 @@ $(document).ready(function() { return false; }); - // $('.button.manage_assignee').live('click', function() { - // $('form#search_user, .button.update_assignee').fadeIn(0); - // $('.current_assignee .people').addClass('remove_assignee selected').removeClass('nopointer'); - // $(this).fadeOut(0); - // }); - $('.button.manage_labels').live('click', function() { $('.button.update_labels').fadeIn(0); $('.current_labels .label .labeltext.selected').parent().addClass('remove_label selected').removeClass('nopointer'); @@ -300,25 +254,6 @@ $(document).ready(function() { $(this).fadeOut(0); }); - // $('.button.update_assignee').live('click', function() { - // var form = $('form.edit_assignee.issue'); - // $.ajax({ - // type: 'POST', - // url: form.attr("action"), - // data: form.serialize(), - // success: function(data){ - // $('.current_assignee .people').removeClass('remove_assignee selected').addClass('nopointer'); - // $('form#search_user, .button.update_assignee').fadeOut(0); - // $('.button.manage_assignee').fadeIn(0); - // $('#manage_issue_users_list').html(''); - // }, - // error: function(data){ - // alert('error'); // TODO remove - // } - // }); - // return false; - // }); - $('.button.update_labels').live('click', function() { var form = $('form.edit_labels.issue'); $.ajax({ @@ -345,3 +280,12 @@ function updateAssignedUser(item) { var container = item.find('.container').clone(); $('#assigned-container .user-container').empty().append(container.html()); } + +function remLabel(form, id) { + var el = form.find('.label.remove_label'+'#'+id); + var label = $('#'+id+'.remove_label.label.selected'); + label.find('.flag').fadeIn(0); + label.find('.labeltext.selected').removeClass('selected').attr('style', ''); + label.fadeIn('slow'); + el.fadeOut('slow').remove(); +} \ No newline at end of file From 3037520ab550cc7ce3eae24233336618fe14abb1 Mon Sep 17 00:00:00 2001 From: Vokhmin Alexey V Date: Thu, 21 Mar 2013 00:59:25 +0400 Subject: [PATCH 07/68] #37: update text messages --- app/views/projects/issues/_form.html.haml | 4 ++-- app/views/projects/issues/_header.html.haml | 4 ++-- app/views/projects/issues/_search_collaborators.html.haml | 8 ++++---- app/views/projects/pull_requests/new.html.haml | 4 ++-- config/locales/models/issue.en.yml | 4 ++++ config/locales/models/issue.ru.yml | 4 ++++ 6 files changed, 18 insertions(+), 10 deletions(-) diff --git a/app/views/projects/issues/_form.html.haml b/app/views/projects/issues/_form.html.haml index 35909cfcc..d404aa6d0 100644 --- a/app/views/projects/issues/_form.html.haml +++ b/app/views/projects/issues/_form.html.haml @@ -6,9 +6,9 @@ .image =image_tag(avatar_url(@issue.assignee, :micro), :alt => 'avatar') %span.name= link_to(@issue.assign_uname, user_path(@issue.assignee)) - %span= 'is assigned' + %span= t('layout.issues.is_assigned') - else - %span= "No one is assigned" + %span= t('layout.issues.no_one_is_assigned') %span.icon-share .both .leftlist= t('layout.issues.labels') + ':' diff --git a/app/views/projects/issues/_header.html.haml b/app/views/projects/issues/_header.html.haml index cd832b59f..44ed7a70f 100644 --- a/app/views/projects/issues/_header.html.haml +++ b/app/views/projects/issues/_header.html.haml @@ -16,9 +16,9 @@ .image =image_tag(avatar_url(@issue.assignee, :micro), :alt => 'avatar') %span.name= link_to(@issue.assign_uname, user_path(@issue.assignee)) - %span= 'is assigned' + %span= t('layout.issues.is_assigned') - else - %span= "No one is assigned" + %span= t('layout.issues.no_one_is_assigned') -if can?(:update, @issue) || @issue.new_record? %span.icon-share =render 'projects/issues/assigned_popup' diff --git a/app/views/projects/issues/_search_collaborators.html.haml b/app/views/projects/issues/_search_collaborators.html.haml index f2de9f4c9..cc58a6076 100644 --- a/app/views/projects/issues/_search_collaborators.html.haml +++ b/app/views/projects/issues/_search_collaborators.html.haml @@ -1,8 +1,8 @@ .people.clear.selected %span.icon-remove-circle - = 'Clear assignee' + = t('layout.issues.clear_assignee') .container - %span= "No one is assigned" + %span= t('layout.issues.no_one_is_assigned') = hidden_field_tag "user-nil", nil, :name => "issue[assignee_id]" - users = (@users || []) @@ -14,8 +14,8 @@ .image =image_tag(avatar_url(user, :micro), :alt => 'avatar') %span.name= link_to(user.uname, user_path(user)) - %span= 'is assigned' + %span= t('layout.issues.is_assigned') = hidden_field_tag "user-#{index}", user.id, :name => "issue[assignee_id]" .both - if users.empty? - .nothing= 'Nothing to show' \ No newline at end of file + .nothing= t('layout.issues.nothing_to_show') \ No newline at end of file diff --git a/app/views/projects/pull_requests/new.html.haml b/app/views/projects/pull_requests/new.html.haml index 9e29f4510..b7392c882 100644 --- a/app/views/projects/pull_requests/new.html.haml +++ b/app/views/projects/pull_requests/new.html.haml @@ -40,9 +40,9 @@ .image =image_tag(avatar_url(@issue.assignee, :micro), :alt => 'avatar') %span.name= link_to(@issue.assign_uname, user_path(@issue.assignee)) - %span= 'is assigned' + %span= t('layout.issues.is_assigned') - else - %span= "No one is assigned" + %span= t('layout.issues.no_one_is_assigned') %span.icon-share .both .leftlist.big-list diff --git a/config/locales/models/issue.en.yml b/config/locales/models/issue.en.yml index 2887f0f9f..21e42e102 100644 --- a/config/locales/models/issue.en.yml +++ b/config/locales/models/issue.en.yml @@ -11,6 +11,10 @@ en: layout: issues: + is_assigned: is assigned + clear_assignee: Clear assignee + nothing_to_show: Nothing to show + no_one_is_assigned: No one is assigned list: List all: All issues to_me: Assigned to me diff --git a/config/locales/models/issue.ru.yml b/config/locales/models/issue.ru.yml index 2660ba6b1..f636e67da 100644 --- a/config/locales/models/issue.ru.yml +++ b/config/locales/models/issue.ru.yml @@ -11,6 +11,10 @@ ru: layout: issues: + is_assigned: назначен + clear_assignee: Убрать назначение + nothing_to_show: Никто не найден + no_one_is_assigned: Никто не назначен list: Список all: Все задачи to_me: Назначенные мне From 26c2a26680647c75e6a0472333c3cadc1c848c7d Mon Sep 17 00:00:00 2001 From: Vokhmin Alexey V Date: Thu, 21 Mar 2013 14:54:47 +0400 Subject: [PATCH 08/68] #37: update styles, text message --- app/assets/javascripts/extra/tracker.js | 2 +- app/assets/stylesheets/design/custom.scss | 15 +++++---------- .../projects/issues/_assigned_popup.html.haml | 2 +- app/views/projects/issues/_form.html.haml | 2 +- app/views/projects/issues/_header.html.haml | 6 +++--- app/views/projects/pull_requests/new.html.haml | 2 +- config/locales/models/issue.en.yml | 1 + config/locales/models/issue.ru.yml | 1 + 8 files changed, 14 insertions(+), 17 deletions(-) diff --git a/app/assets/javascripts/extra/tracker.js b/app/assets/javascripts/extra/tracker.js index c9051ff95..d358f9b31 100644 --- a/app/assets/javascripts/extra/tracker.js +++ b/app/assets/javascripts/extra/tracker.js @@ -278,7 +278,7 @@ $(document).ready(function() { function updateAssignedUser(item) { $('#assigned-popup').hide(); var container = item.find('.container').clone(); - $('#assigned-container .user-container').empty().append(container.html()); + $('#assigned-container .user-container').empty().append(container.html()).append(''); } function remLabel(form, id) { diff --git a/app/assets/stylesheets/design/custom.scss b/app/assets/stylesheets/design/custom.scss index c6dbf8ce9..cef509faa 100644 --- a/app/assets/stylesheets/design/custom.scss +++ b/app/assets/stylesheets/design/custom.scss @@ -1910,24 +1910,19 @@ article .activity .top { #assigned-container { .icon-share { cursor: pointer; - margin-top: -2px; } .image { float: left; - width: 16px; - height: 16px; + width: auto; + height: auto; margin: -1px 5px 0 0; img { - position: absolute; width: 16px; height: 16px; } } - .user-container { - display: inline-block; - } - span { - padding-left: 5px; + .name { + margin-left: 5px; } } @@ -1936,7 +1931,7 @@ article .activity .top { position: absolute; margin: 5px 0 0 130px; display: none; - min-width: 230px; + min-width: 240px; border: 1px solid #b3cce0; background: #FFF; -moz-border-radius: 5px; diff --git a/app/views/projects/issues/_assigned_popup.html.haml b/app/views/projects/issues/_assigned_popup.html.haml index 07d5f32d3..851d4951c 100644 --- a/app/views/projects/issues/_assigned_popup.html.haml +++ b/app/views/projects/issues/_assigned_popup.html.haml @@ -1,6 +1,6 @@ #assigned-popup .header - .title= 'Assign someone to this issue' + .title= t('layout.issues.assign_someone') %span.icon-remove-circle = form_tag search_collaborators_project_issues_path(@project, :id => @issue.id), :id => 'search_user', :method => :get do = tracker_search_field(:search_user, t('layout.issues.search_user')) diff --git a/app/views/projects/issues/_form.html.haml b/app/views/projects/issues/_form.html.haml index d404aa6d0..314a830c1 100644 --- a/app/views/projects/issues/_form.html.haml +++ b/app/views/projects/issues/_form.html.haml @@ -9,7 +9,7 @@ %span= t('layout.issues.is_assigned') - else %span= t('layout.issues.no_one_is_assigned') - %span.icon-share + %span.icon-share .both .leftlist= t('layout.issues.labels') + ':' .rightlist diff --git a/app/views/projects/issues/_header.html.haml b/app/views/projects/issues/_header.html.haml index 44ed7a70f..32ecb00a1 100644 --- a/app/views/projects/issues/_header.html.haml +++ b/app/views/projects/issues/_header.html.haml @@ -19,9 +19,9 @@ %span= t('layout.issues.is_assigned') - else %span= t('layout.issues.no_one_is_assigned') - -if can?(:update, @issue) || @issue.new_record? - %span.icon-share - =render 'projects/issues/assigned_popup' + -if can?(:update, @issue) || @issue.new_record? + %span.icon-share + =render 'projects/issues/assigned_popup' .both .fulltext.view.issue_body.formatted.cm-s-default.md_and_cm=markdown @issue.body diff --git a/app/views/projects/pull_requests/new.html.haml b/app/views/projects/pull_requests/new.html.haml index b7392c882..79a542b64 100644 --- a/app/views/projects/pull_requests/new.html.haml +++ b/app/views/projects/pull_requests/new.html.haml @@ -43,7 +43,7 @@ %span= t('layout.issues.is_assigned') - else %span= t('layout.issues.no_one_is_assigned') - %span.icon-share + %span.icon-share .both .leftlist.big-list .rightlist diff --git a/config/locales/models/issue.en.yml b/config/locales/models/issue.en.yml index 21e42e102..c06dfd908 100644 --- a/config/locales/models/issue.en.yml +++ b/config/locales/models/issue.en.yml @@ -15,6 +15,7 @@ en: clear_assignee: Clear assignee nothing_to_show: Nothing to show no_one_is_assigned: No one is assigned + assign_someone: Assign someone to this issue list: List all: All issues to_me: Assigned to me diff --git a/config/locales/models/issue.ru.yml b/config/locales/models/issue.ru.yml index f636e67da..1e1e3c190 100644 --- a/config/locales/models/issue.ru.yml +++ b/config/locales/models/issue.ru.yml @@ -15,6 +15,7 @@ ru: clear_assignee: Убрать назначение nothing_to_show: Никто не найден no_one_is_assigned: Никто не назначен + assign_someone: Назначить кого-либо на задачу list: Список all: Все задачи to_me: Назначенные мне From 9a2fc870cf6227b1c9d7b95afe83921903341279 Mon Sep 17 00:00:00 2001 From: Vokhmin Alexey V Date: Thu, 21 Mar 2013 15:07:08 +0400 Subject: [PATCH 09/68] #37: moved some code into the partial --- app/views/projects/issues/_form.html.haml | 10 +--------- app/views/projects/issues/_header.html.haml | 12 +----------- .../projects/issues/_search_collaborators.html.haml | 2 +- app/views/projects/issues/_user_container.html.haml | 10 ++++++++++ app/views/projects/pull_requests/new.html.haml | 10 +--------- 5 files changed, 14 insertions(+), 30 deletions(-) create mode 100644 app/views/projects/issues/_user_container.html.haml diff --git a/app/views/projects/issues/_form.html.haml b/app/views/projects/issues/_form.html.haml index 314a830c1..a0948aebb 100644 --- a/app/views/projects/issues/_form.html.haml +++ b/app/views/projects/issues/_form.html.haml @@ -1,15 +1,7 @@ =render 'title_body', :f => f, :id => 'new' .leftlist= t('activerecord.attributes.issue.assignee') + ':' #assigned-container.rightlist - .user-container - - if @issue.assignee - .image - =image_tag(avatar_url(@issue.assignee, :micro), :alt => 'avatar') - %span.name= link_to(@issue.assign_uname, user_path(@issue.assignee)) - %span= t('layout.issues.is_assigned') - - else - %span= t('layout.issues.no_one_is_assigned') - %span.icon-share + =render 'user_container', :user => @issue.assignee .both .leftlist= t('layout.issues.labels') + ':' .rightlist diff --git a/app/views/projects/issues/_header.html.haml b/app/views/projects/issues/_header.html.haml index 32ecb00a1..e487fddcc 100644 --- a/app/views/projects/issues/_header.html.haml +++ b/app/views/projects/issues/_header.html.haml @@ -11,18 +11,8 @@ %h3.issue_title=@issue.title .both #assigned-container.assigned-header - .user-container - - if @issue.assignee - .image - =image_tag(avatar_url(@issue.assignee, :micro), :alt => 'avatar') - %span.name= link_to(@issue.assign_uname, user_path(@issue.assignee)) - %span= t('layout.issues.is_assigned') - - else - %span= t('layout.issues.no_one_is_assigned') - -if can?(:update, @issue) || @issue.new_record? - %span.icon-share + =render 'projects/issues/user_container', :user => @issue.assignee =render 'projects/issues/assigned_popup' - .both .fulltext.view.issue_body.formatted.cm-s-default.md_and_cm=markdown @issue.body .both diff --git a/app/views/projects/issues/_search_collaborators.html.haml b/app/views/projects/issues/_search_collaborators.html.haml index cc58a6076..0d36330cd 100644 --- a/app/views/projects/issues/_search_collaborators.html.haml +++ b/app/views/projects/issues/_search_collaborators.html.haml @@ -12,7 +12,7 @@ .name= user.fullname .container .image - =image_tag(avatar_url(user, :micro), :alt => 'avatar') + = image_tag(avatar_url(user, :micro), :alt => 'avatar') %span.name= link_to(user.uname, user_path(user)) %span= t('layout.issues.is_assigned') = hidden_field_tag "user-#{index}", user.id, :name => "issue[assignee_id]" diff --git a/app/views/projects/issues/_user_container.html.haml b/app/views/projects/issues/_user_container.html.haml new file mode 100644 index 000000000..63a37e54c --- /dev/null +++ b/app/views/projects/issues/_user_container.html.haml @@ -0,0 +1,10 @@ +.user-container + - if user + .image + =image_tag(avatar_url(user, :micro), :alt => 'avatar') + %span.name= link_to(user.uname, user_path(user)) + %span= t('layout.issues.is_assigned') + - else + %span= t('layout.issues.no_one_is_assigned') + -if can?(:update, @issue) || @issue.new_record? + %span.icon-share \ No newline at end of file diff --git a/app/views/projects/pull_requests/new.html.haml b/app/views/projects/pull_requests/new.html.haml index 79a542b64..a4d30a2d8 100644 --- a/app/views/projects/pull_requests/new.html.haml +++ b/app/views/projects/pull_requests/new.html.haml @@ -35,15 +35,7 @@ .leftlist.big-list= t('activerecord.attributes.issue.assignee') + ':' #assigned-container.rightlist - .user-container - - if @issue.assignee - .image - =image_tag(avatar_url(@issue.assignee, :micro), :alt => 'avatar') - %span.name= link_to(@issue.assign_uname, user_path(@issue.assignee)) - %span= t('layout.issues.is_assigned') - - else - %span= t('layout.issues.no_one_is_assigned') - %span.icon-share + =render 'projects/issues/user_container', :user => @pull.assignee .both .leftlist.big-list .rightlist From c43c87cf04cb7c7a87db2f688ba1b98cd311473e Mon Sep 17 00:00:00 2001 From: Vokhmin Alexey V Date: Thu, 21 Mar 2013 15:09:58 +0400 Subject: [PATCH 10/68] #37: small refactoring according to Alexander's comment --- app/views/projects/issues/_header.html.haml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/projects/issues/_header.html.haml b/app/views/projects/issues/_header.html.haml index e487fddcc..83adc3ef4 100644 --- a/app/views/projects/issues/_header.html.haml +++ b/app/views/projects/issues/_header.html.haml @@ -6,7 +6,7 @@ .created %span.date=@issue.created_at.to_s(:long) - if @issue.user - %span.date=t("layout.by") + %span.date=t('layout.by') %span.name=link_to(@issue.user.fullname, user_path(@issue.user)) %h3.issue_title=@issue.title .both From 922ab778f494c86ba55dc26ae95d555fc78ff938 Mon Sep 17 00:00:00 2001 From: Vokhmin Alexey V Date: Thu, 21 Mar 2013 22:14:07 +0400 Subject: [PATCH 11/68] #37: search user by keyup instead of 'press enter' --- app/assets/javascripts/extra/tracker.js | 22 ++++++------------- app/assets/stylesheets/design/custom.scss | 2 +- .../projects/issues/_assigned_popup.html.haml | 4 +++- 3 files changed, 11 insertions(+), 17 deletions(-) diff --git a/app/assets/javascripts/extra/tracker.js b/app/assets/javascripts/extra/tracker.js index d358f9b31..7acee8c69 100644 --- a/app/assets/javascripts/extra/tracker.js +++ b/app/assets/javascripts/extra/tracker.js @@ -115,24 +115,16 @@ $(document).ready(function() { return false; }; - $('#search_user').live('submit', function() { - var id = $(this).attr('id'); - if(id.indexOf('user') != -1) { // FIXME - var which = 'users'; - } - else if (id.indexOf('labels') != -1) { - var which = 'labels'; - } - $.ajax({ + var isSearchUser = null; + $('#search_user').on('keyup', function() { + if (isSearchUser != null) { isSearchUser.abort(); } + isSearchUser = $.ajax({ type: 'GET', - url: $(this).attr("action"), + url: $('#search_user_path').attr('path'), data: $(this).serialize(), success: function(data){ - $('#manage_issue_'+ which +'_list').html(data); - }, - error: function(data){ - alert('error') // TODO remove - } + $('#manage_issue_users_list').html(data); + } }); return false; }); diff --git a/app/assets/stylesheets/design/custom.scss b/app/assets/stylesheets/design/custom.scss index cef509faa..9c52d8eca 100644 --- a/app/assets/stylesheets/design/custom.scss +++ b/app/assets/stylesheets/design/custom.scss @@ -1949,7 +1949,7 @@ article .activity .top { font-weight: bold; .title { display: inline-block; } } - form { + .search-container { padding: 10px 15px 10px 10px; border-bottom: 1px solid #D6D6D6; input { diff --git a/app/views/projects/issues/_assigned_popup.html.haml b/app/views/projects/issues/_assigned_popup.html.haml index 851d4951c..0b11772dc 100644 --- a/app/views/projects/issues/_assigned_popup.html.haml +++ b/app/views/projects/issues/_assigned_popup.html.haml @@ -2,9 +2,11 @@ .header .title= t('layout.issues.assign_someone') %span.icon-remove-circle - = form_tag search_collaborators_project_issues_path(@project, :id => @issue.id), :id => 'search_user', :method => :get do + .search-container + #search_user_path{:path => search_collaborators_project_issues_path(@project, :id => @issue.id)} = tracker_search_field(:search_user, t('layout.issues.search_user')) + - unless [:new, :create].include?(action_name.to_sym) = 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]' From 8e2115931454eecf63f4a3e2baccd562e10d257c Mon Sep 17 00:00:00 2001 From: Vokhmin Alexey V Date: Fri, 22 Mar 2013 01:20:36 +0400 Subject: [PATCH 12/68] #37: some styles changes --- app/assets/stylesheets/design/custom.scss | 19 +++++++++++-------- app/controllers/projects/base_controller.rb | 7 +++++++ app/controllers/projects/issues_controller.rb | 6 +----- .../projects/pull_requests_controller.rb | 1 + .../projects/issues/_assigned_popup.html.haml | 2 +- app/views/projects/issues/_header.html.haml | 12 ++++++------ 6 files changed, 27 insertions(+), 20 deletions(-) diff --git a/app/assets/stylesheets/design/custom.scss b/app/assets/stylesheets/design/custom.scss index 9c52d8eca..c78e15046 100644 --- a/app/assets/stylesheets/design/custom.scss +++ b/app/assets/stylesheets/design/custom.scss @@ -1892,12 +1892,18 @@ table#myTable thead tr.search th form.button_to div input { article .activity .top { .created { - opacity: 0.8; - span { - float: none; - margin-right: 5px; + margin-left: 50px; + span, a { + font-size: 11px; } } + .issue_title.text { + max-width: none; + } + h3.issue_title { + margin: 5px 0 0; + font-size: 18px; + } .assigned-header { padding: 10px 20px; border: 1px solid #D6D6D6; @@ -1969,12 +1975,9 @@ article .activity .top { width: 100%; padding: 10px 20px 10px 10px; } - .clear { + .clear, .nothing { opacity: 0.8; } - .nothing { - color: #D6D6D6; - } .container { display: none; } diff --git a/app/controllers/projects/base_controller.rb b/app/controllers/projects/base_controller.rb index 41bf3b8d9..d2f20e6a5 100644 --- a/app/controllers/projects/base_controller.rb +++ b/app/controllers/projects/base_controller.rb @@ -5,6 +5,13 @@ class Projects::BaseController < ApplicationController protected + def find_collaborators + search = "%#{params[:search_user]}%" + users = User.joins(:groups => :projects).where(:projects => {:id => @project.id}).where("users.uname ILIKE ?", search) + users2 = @project.collaborators.where("users.uname ILIKE ?", search) + @users = (users + users2).uniq.sort {|x,y| x.uname <=> y.uname}.first(10) + end + def find_project @project = Project.find_by_owner_and_name!(params[:owner_name], params[:project_name]) if params[:owner_name] && params[:project_name] end diff --git a/app/controllers/projects/issues_controller.rb b/app/controllers/projects/issues_controller.rb index eee695f31..b4b03d4fd 100644 --- a/app/controllers/projects/issues_controller.rb +++ b/app/controllers/projects/issues_controller.rb @@ -6,6 +6,7 @@ class Projects::IssuesController < Projects::BaseController load_resource :project load_and_authorize_resource :issue, :through => :project, :find_by => :serial_id, :only => [:show, :edit, :update, :destroy, :new, :create, :index] before_filter :load_and_authorize_label, :only => NON_RESTFUL_ACTION + before_filter :find_collaborators, :only => [:new, :create, :show, :search_collaborators] layout false, :only => [:update, :search_collaborators] @@ -91,11 +92,6 @@ class Projects::IssuesController < Projects::BaseController end def search_collaborators - search = "%#{params[:search_user]}%" - users = User.joins(:groups => :projects).where(:projects => {:id => @project.id}).where("users.uname ILIKE ?", search) - users2 = @project.collaborators.where("users.uname ILIKE ?", search) - @users = (users + users2).uniq.sort {|x,y| x.uname <=> y.uname}.first(10) - @issue = Issue.where(:id => params[:id]).first render :partial => 'search_collaborators' end diff --git a/app/controllers/projects/pull_requests_controller.rb b/app/controllers/projects/pull_requests_controller.rb index ce8f51d27..5a4e7cbd9 100644 --- a/app/controllers/projects/pull_requests_controller.rb +++ b/app/controllers/projects/pull_requests_controller.rb @@ -6,6 +6,7 @@ class Projects::PullRequestsController < Projects::BaseController load_resource :issue, :through => :project, :find_by => :serial_id, :parent => false, :except => [:index, :autocomplete_to_project] load_and_authorize_resource :instance_name => :pull, :through => :issue, :singleton => true, :except => [:index, :autocomplete_to_project] + before_filter :find_collaborators, :only => [:new, :create, :show] def new to_project = find_destination_project(false) diff --git a/app/views/projects/issues/_assigned_popup.html.haml b/app/views/projects/issues/_assigned_popup.html.haml index 0b11772dc..8f31e036e 100644 --- a/app/views/projects/issues/_assigned_popup.html.haml +++ b/app/views/projects/issues/_assigned_popup.html.haml @@ -3,7 +3,7 @@ .title= t('layout.issues.assign_someone') %span.icon-remove-circle .search-container - #search_user_path{:path => search_collaborators_project_issues_path(@project, :id => @issue.id)} + #search_user_path{:path => search_collaborators_project_issues_path(@project)} = tracker_search_field(:search_user, t('layout.issues.search_user')) diff --git a/app/views/projects/issues/_header.html.haml b/app/views/projects/issues/_header.html.haml index 83adc3ef4..2f56a9a2e 100644 --- a/app/views/projects/issues/_header.html.haml +++ b/app/views/projects/issues/_header.html.haml @@ -2,12 +2,12 @@ .top .image =image_tag(avatar_url(@issue.user, :medium), :alt => 'avatar') if @issue.user - .text - .created - %span.date=@issue.created_at.to_s(:long) - - if @issue.user - %span.date=t('layout.by') - %span.name=link_to(@issue.user.fullname, user_path(@issue.user)) + .created + %span=@issue.created_at.to_s(:long) + - if @issue.user + %span= t('layout.by') + %span.name=link_to(@issue.user.fullname, user_path(@issue.user)) + .text.issue_title %h3.issue_title=@issue.title .both #assigned-container.assigned-header From 770bb48d354230d3304a7ea84b26326e1982fd8b Mon Sep 17 00:00:00 2001 From: Vokhmin Alexey V Date: Fri, 22 Mar 2013 01:31:39 +0400 Subject: [PATCH 13/68] #37: update styles for Issue title --- app/assets/stylesheets/design/custom.scss | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/assets/stylesheets/design/custom.scss b/app/assets/stylesheets/design/custom.scss index c78e15046..d6fbed8e5 100644 --- a/app/assets/stylesheets/design/custom.scss +++ b/app/assets/stylesheets/design/custom.scss @@ -1899,6 +1899,9 @@ article .activity .top { } .issue_title.text { max-width: none; + float: none; + margin-left: 50px; + padding: 0; } h3.issue_title { margin: 5px 0 0; From 6a9e270a5cb5d0051535e1a7e06fc555a9efb7de Mon Sep 17 00:00:00 2001 From: Vokhmin Alexey V Date: Fri, 22 Mar 2013 18:06:13 +0400 Subject: [PATCH 14/68] #31: add 'autostart' field to Product model --- app/models/product.rb | 23 +++- app/models/product_build_list.rb | 3 +- app/views/platforms/products/_form.html.haml | 10 +- config/locales/models/product.en.yml | 5 + config/locales/models/product.ru.yml | 5 + ...elete_to_product_and_product_build_list.rb | 6 + db/schema.rb | 118 +++++++++--------- 7 files changed, 107 insertions(+), 63 deletions(-) create mode 100644 db/migrate/20130322132919_add_autostart_and_not_delete_to_product_and_product_build_list.rb diff --git a/app/models/product.rb b/app/models/product.rb index 240646523..b7e7f8067 100644 --- a/app/models/product.rb +++ b/app/models/product.rb @@ -6,9 +6,21 @@ class Product < ActiveRecord::Base belongs_to :project has_many :product_build_lists, :dependent => :destroy + ONCE_A_12_HOURS = 0 + ONCE_A_DAY = 1 + ONCE_A_WEEK = 2 + + AUTOSTART_STATUSES = [ONCE_A_12_HOURS, ONCE_A_DAY, ONCE_A_WEEK] + HUMAN_AUTOSTART_STATUSES = { + ONCE_A_12_HOURS => :once_a_12_hours, + ONCE_A_DAY => :once_a_day, + ONCE_A_WEEK => :once_a_week + } + validates :name, :presence => true, :uniqueness => {:scope => :platform_id} validates :project_id, :presence => true validates :main_script, :params, :length => { :maximum => 255 } + validates :autostart, :numericality => true, :inclusion => {:in => AUTOSTART_STATUSES}, :allow_blank => true scope :recent, order("#{table_name}.name ASC") @@ -17,7 +29,8 @@ class Product < ActiveRecord::Base :project_id, :main_script, :params, - :platform_id + :platform_id, + :autostart attr_readonly :platform_id def full_clone(attrs = {}) @@ -30,4 +43,12 @@ class Product < ActiveRecord::Base end end + def human_status + self.class.human_status(status) + end + + def self.human_status(status) + I18n.t("layout.products.autostart_statuses.#{HUMAN_AUTOSTART_STATUSES[status]}") + end + end diff --git a/app/models/product_build_list.rb b/app/models/product_build_list.rb index 98d0b68e6..7eff2f790 100644 --- a/app/models/product_build_list.rb +++ b/app/models/product_build_list.rb @@ -53,7 +53,8 @@ class ProductBuildList < ActiveRecord::Base :project_version, :commit_hash, :arch_id, - :product_id + :product_id, + :not_delete attr_readonly :product_id serialize :results, Array diff --git a/app/views/platforms/products/_form.html.haml b/app/views/platforms/products/_form.html.haml index d7a7fecaf..228d249f2 100644 --- a/app/views/platforms/products/_form.html.haml +++ b/app/views/platforms/products/_form.html.haml @@ -1,17 +1,21 @@ -.leftlist= f.label :name, t("activerecord.attributes.product.name"), :class => :label +.leftlist= f.label :name .rightlist= f.text_field :name, :class => 'text_field' .both -.leftlist= f.label :description, t("activerecord.attributes.product.description"), :class => :label +.leftlist= f.label :description .rightlist= f.text_area :description, :class => 'text_field resizable', :cols => 80 .both -.leftlist= f.label :project, t("activerecord.attributes.product.project"), :class => :label +.leftlist= f.label :project .rightlist= f.autocomplete_field :project, autocomplete_project_platform_products_path(@platform), :id_element => 'src_project_id', :name => 'src_project', :value => @product.project.try(:name_with_owner) .both = render 'def_fields', :f => f +.leftlist= f.label :autostart +.rightlist= f.select :autostart, Product::AUTOSTART_STATUSES.collect{|status| [Product.human_status(status), status]}, {:include_blank => true, :selected => @product.autostart} +.both + .button_block = submit_tag t("layout.save") %span.text_button_padding= t("layout.or") diff --git a/config/locales/models/product.en.yml b/config/locales/models/product.en.yml index df7e20768..cb7889a7e 100644 --- a/config/locales/models/product.en.yml +++ b/config/locales/models/product.en.yml @@ -11,6 +11,10 @@ en: new_header: New product edit_header: Product editing confirm_delete: Are you sure you want to delete this product? + autostart_statuses: + once_a_12_hours: Once a 12 hours + once_a_day: Once a day + once_a_week: Once a week flash: product: @@ -25,6 +29,7 @@ en: product: Product attributes: product: + autostart: Autostart name: Name description: Description platform_id: Platform diff --git a/config/locales/models/product.ru.yml b/config/locales/models/product.ru.yml index f1cbf6fc1..ed41793dc 100644 --- a/config/locales/models/product.ru.yml +++ b/config/locales/models/product.ru.yml @@ -11,6 +11,10 @@ ru: new_header: Новый продукт edit_header: Редактирование продукта confirm_delete: Вы уверены, что хотите удалить этот продукт? + autostart_statuses: + once_a_12_hours: Раз в 12 часов + once_a_day: Раз в день + once_a_week: Раз в неделю flash: product: @@ -25,6 +29,7 @@ ru: product: Продукт attributes: product: + autostart: Автостарт name: Название description: Описание platform_id: Платформа diff --git a/db/migrate/20130322132919_add_autostart_and_not_delete_to_product_and_product_build_list.rb b/db/migrate/20130322132919_add_autostart_and_not_delete_to_product_and_product_build_list.rb new file mode 100644 index 000000000..d62e9df50 --- /dev/null +++ b/db/migrate/20130322132919_add_autostart_and_not_delete_to_product_and_product_build_list.rb @@ -0,0 +1,6 @@ +class AddAutostartAndNotDeleteToProductAndProductBuildList < ActiveRecord::Migration + def change + add_column :products, :autostart, :integer, :default => nil + add_column :product_build_lists, :not_delete, :boolean, :default => false + end +end diff --git a/db/schema.rb b/db/schema.rb index 625a20902..4383777d7 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,14 +11,14 @@ # # It's strongly recommended to check this file into your version control system. -ActiveRecord::Schema.define(:version => 20130227102900) do +ActiveRecord::Schema.define(:version => 20130322132919) do create_table "activity_feeds", :force => true do |t| t.integer "user_id", :null => false t.string "kind" t.text "data" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false + t.datetime "created_at" + t.datetime "updated_at" end create_table "advisories", :force => true do |t| @@ -53,8 +53,8 @@ ActiveRecord::Schema.define(:version => 20130227102900) do create_table "arches", :force => true do |t| t.string "name", :null => false - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false + t.datetime "created_at" + t.datetime "updated_at" end add_index "arches", ["name"], :name => "index_arches_on_name", :unique => true @@ -63,8 +63,8 @@ ActiveRecord::Schema.define(:version => 20130227102900) do t.integer "user_id" t.string "provider" t.string "uid" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false + t.datetime "created_at" + t.datetime "updated_at" end add_index "authentications", ["provider", "uid"], :name => "index_authentications_on_provider_and_uid", :unique => true @@ -75,8 +75,8 @@ ActiveRecord::Schema.define(:version => 20130227102900) do t.integer "level" t.integer "status" t.integer "build_list_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false + t.datetime "created_at" + t.datetime "updated_at" t.string "version" end @@ -110,8 +110,8 @@ ActiveRecord::Schema.define(:version => 20130227102900) do t.integer "project_id" t.integer "arch_id" t.datetime "notified_at" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false + t.datetime "created_at" + t.datetime "updated_at" t.boolean "is_circle", :default => false t.text "additional_repos" t.string "name" @@ -149,8 +149,8 @@ ActiveRecord::Schema.define(:version => 20130227102900) do t.string "commentable_type" t.integer "user_id" t.text "body" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false + t.datetime "created_at" + t.datetime "updated_at" t.decimal "commentable_id", :precision => 50, :scale => 0 t.integer "project_id" t.text "data" @@ -168,8 +168,8 @@ ActiveRecord::Schema.define(:version => 20130227102900) do t.string "controller" t.string "action" t.text "message" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false + t.datetime "created_at" + t.datetime "updated_at" end create_table "flash_notifies", :force => true do |t| @@ -183,8 +183,8 @@ ActiveRecord::Schema.define(:version => 20130227102900) do create_table "groups", :force => true do |t| t.integer "owner_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false + t.datetime "created_at" + t.datetime "updated_at" t.string "uname" t.integer "own_projects_count", :default => 0, :null => false t.text "description" @@ -201,8 +201,8 @@ ActiveRecord::Schema.define(:version => 20130227102900) do t.string "title" t.text "body" t.string "status", :default => "open" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false + t.datetime "created_at" + t.datetime "updated_at" t.integer "user_id" t.datetime "closed_at" t.integer "closed_by" @@ -279,14 +279,14 @@ ActiveRecord::Schema.define(:version => 20130227102900) do t.string "description" t.string "name", :null => false t.integer "parent_platform_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false + t.datetime "created_at" + t.datetime "updated_at" t.boolean "released", :default => false, :null => false t.integer "owner_id" t.string "owner_type" t.string "visibility", :default => "open", :null => false t.string "platform_type", :default => "main", :null => false - t.string "distrib_type" + t.string "distrib_type", :null => false end add_index "platforms", ["name"], :name => "index_platforms_on_name", :unique => true, :case_sensitive => false @@ -295,16 +295,16 @@ ActiveRecord::Schema.define(:version => 20130227102900) do t.integer "platform_id" t.string "login" t.string "password" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false + t.datetime "created_at" + t.datetime "updated_at" t.integer "user_id" end create_table "product_build_lists", :force => true do |t| t.integer "product_id" - t.integer "status", :default => 3, :null => false - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false + t.integer "status", :default => 2, :null => false + t.datetime "created_at" + t.datetime "updated_at" t.integer "project_id" t.string "project_version" t.string "commit_hash" @@ -314,6 +314,7 @@ ActiveRecord::Schema.define(:version => 20130227102900) do t.integer "arch_id" t.integer "time_living" t.integer "user_id" + t.boolean "not_delete", :default => false end add_index "product_build_lists", ["product_id"], :name => "index_product_build_lists_on_product_id" @@ -321,13 +322,14 @@ ActiveRecord::Schema.define(:version => 20130227102900) do create_table "products", :force => true do |t| t.string "name", :null => false t.integer "platform_id", :null => false - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false + t.datetime "created_at" + t.datetime "updated_at" t.text "description" t.integer "project_id" t.string "params" t.string "main_script" t.integer "time_living" + t.integer "autostart" end create_table "project_imports", :force => true do |t| @@ -335,8 +337,8 @@ ActiveRecord::Schema.define(:version => 20130227102900) do t.string "name" t.string "version" t.datetime "file_mtime" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false + t.datetime "created_at" + t.datetime "updated_at" t.integer "platform_id" end @@ -355,27 +357,27 @@ ActiveRecord::Schema.define(:version => 20130227102900) do create_table "project_to_repositories", :force => true do |t| t.integer "project_id" t.integer "repository_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false + t.datetime "created_at" + t.datetime "updated_at" end add_index "project_to_repositories", ["repository_id", "project_id"], :name => "index_project_to_repositories_on_repository_id_and_project_id", :unique => true create_table "projects", :force => true do |t| t.string "name" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false + t.datetime "created_at" + t.datetime "updated_at" t.integer "owner_id" t.string "owner_type" t.string "visibility", :default => "open" t.text "description" t.string "ancestry" t.boolean "has_issues", :default => true - t.boolean "has_wiki", :default => false t.string "srpm_file_name" - t.string "srpm_content_type" t.integer "srpm_file_size" t.datetime "srpm_updated_at" + t.string "srpm_content_type" + t.boolean "has_wiki", :default => false t.string "default_branch", :default => "master" t.boolean "is_package", :default => true, :null => false t.integer "average_build_time", :default => 0, :null => false @@ -406,8 +408,8 @@ ActiveRecord::Schema.define(:version => 20130227102900) do t.string "token" t.boolean "approved", :default => false t.boolean "rejected", :default => false - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false + t.datetime "created_at" + t.datetime "updated_at" t.string "interest" t.text "more" t.string "language" @@ -421,16 +423,16 @@ ActiveRecord::Schema.define(:version => 20130227102900) do t.string "actor_type" t.integer "target_id" t.string "target_type" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false + t.datetime "created_at" + t.datetime "updated_at" t.string "role" end create_table "repositories", :force => true do |t| t.string "description", :null => false t.integer "platform_id", :null => false - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false + t.datetime "created_at" + t.datetime "updated_at" t.string "name", :null => false t.boolean "publish_without_qa", :default => true end @@ -444,8 +446,8 @@ ActiveRecord::Schema.define(:version => 20130227102900) do t.boolean "new_comment_reply", :default => true t.boolean "new_issue", :default => true t.boolean "issue_assign", :default => true - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false + t.datetime "created_at" + t.datetime "updated_at" t.boolean "new_comment_commit_owner", :default => true t.boolean "new_comment_commit_repo_owner", :default => true t.boolean "new_comment_commit_commentor", :default => true @@ -468,8 +470,8 @@ ActiveRecord::Schema.define(:version => 20130227102900) do create_table "subscribes", :force => true do |t| t.string "subscribeable_type" t.integer "user_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false + t.datetime "created_at" + t.datetime "updated_at" t.boolean "status", :default => true t.integer "project_id" t.decimal "subscribeable_id", :precision => 50, :scale => 0 @@ -477,21 +479,18 @@ ActiveRecord::Schema.define(:version => 20130227102900) do create_table "users", :force => true do |t| t.string "name" - t.string "email", :default => "", :null => false - t.string "encrypted_password", :default => "", :null => false + t.string "email", :default => "", :null => false + t.string "encrypted_password", :limit => 128, :default => "", :null => false t.string "reset_password_token" t.datetime "reset_password_sent_at" t.datetime "remember_created_at" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false + t.datetime "created_at" + t.datetime "updated_at" t.text "ssh_key" t.string "uname" t.string "role" - t.string "language", :default => "en" - t.integer "own_projects_count", :default => 0, :null => false - t.string "confirmation_token" - t.datetime "confirmed_at" - t.datetime "confirmation_sent_at" + t.string "language", :default => "en" + t.integer "own_projects_count", :default => 0, :null => false t.text "professional_experience" t.string "site" t.string "company" @@ -500,11 +499,14 @@ ActiveRecord::Schema.define(:version => 20130227102900) do t.string "avatar_content_type" t.integer "avatar_file_size" t.datetime "avatar_updated_at" - t.integer "failed_attempts", :default => 0 + t.integer "failed_attempts", :default => 0 t.string "unlock_token" t.datetime "locked_at" + t.string "confirmation_token" + t.datetime "confirmed_at" + t.datetime "confirmation_sent_at" t.string "authentication_token" - t.integer "build_priority", :default => 50 + t.integer "build_priority", :default => 50 end add_index "users", ["authentication_token"], :name => "index_users_on_authentication_token" From 3865332e8a435faa0be060411fdf6c38c1d71caa Mon Sep 17 00:00:00 2001 From: Vokhmin Alexey V Date: Fri, 22 Mar 2013 20:04:29 +0400 Subject: [PATCH 15/68] #31: add UI for save product_build_list --- .../product_build_lists_controller.rb | 12 +++++++++++- app/models/ability.rb | 2 +- app/models/product_build_list.rb | 3 ++- .../product_build_lists/show.html.haml | 18 ++++++++++++++++++ .../locales/models/product_build_list.en.yml | 7 ++++++- .../locales/models/product_build_list.ru.yml | 7 ++++++- config/routes.rb | 2 +- ...19_autostart_iso_build_on_regular_basis.rb} | 3 ++- db/schema.rb | 1 + 9 files changed, 48 insertions(+), 7 deletions(-) rename db/migrate/{20130322132919_add_autostart_and_not_delete_to_product_and_product_build_list.rb => 20130322132919_autostart_iso_build_on_regular_basis.rb} (53%) diff --git a/app/controllers/platforms/product_build_lists_controller.rb b/app/controllers/platforms/product_build_lists_controller.rb index 51ebfb1a9..3087736e7 100644 --- a/app/controllers/platforms/product_build_lists_controller.rb +++ b/app/controllers/platforms/product_build_lists_controller.rb @@ -6,7 +6,7 @@ class Platforms::ProductBuildListsController < Platforms::BaseController load_and_authorize_resource :platform, :except => :index load_and_authorize_resource :product, :through => :platform, :except => :index load_and_authorize_resource :product_build_list, :through => :product, :except => :index - load_and_authorize_resource :only => [:index, :show, :log, :cancel] + load_and_authorize_resource :only => [:index, :show, :log, :cancel, :update] def new product = @product_build_list.product @@ -23,6 +23,16 @@ class Platforms::ProductBuildListsController < Platforms::BaseController def show end + def update + if @product_build_list.update_attributes(params[:product_build_list]) + flash[:notice] = t('flash.product_build_list.updated') + else + flash[:error] = t('flash.product_build_list.update_error') + flash[:warning] = @product_build_list.errors.full_messages.join('. ') + end + redirect_to platform_product_product_build_list_path(@platform, @product, @product_build_list) + end + def cancel if @product_build_list.cancel notice = t('layout.build_lists.will_be_canceled') diff --git a/app/models/ability.rb b/app/models/ability.rb index f7d26c011..951a28fc7 100644 --- a/app/models/ability.rb +++ b/app/models/ability.rb @@ -117,7 +117,7 @@ class Ability can(:read, Product, read_relations_for('products', 'platforms')) {|product| product.platform.main?} can([:create, :update, :destroy, :clone], Product) {|product| local_admin? product.platform and product.platform.main?} - can([:create, :cancel], ProductBuildList) {|pbl| can?(:update, pbl.product)} + can([:create, :cancel, :update], ProductBuildList) {|pbl| can?(:update, pbl.product)} can(:destroy, ProductBuildList) {|pbl| can?(:destroy, pbl.product)} can [:read, :create], PrivateUser, :platform => {:owner_type => 'User', :owner_id => user.id} diff --git a/app/models/product_build_list.rb b/app/models/product_build_list.rb index 7eff2f790..3420249e7 100644 --- a/app/models/product_build_list.rb +++ b/app/models/product_build_list.rb @@ -54,7 +54,8 @@ class ProductBuildList < ActiveRecord::Base :commit_hash, :arch_id, :product_id, - :not_delete + :not_delete, + :autostarted attr_readonly :product_id serialize :results, Array diff --git a/app/views/platforms/product_build_lists/show.html.haml b/app/views/platforms/product_build_lists/show.html.haml index 6af23ac72..eab087bb8 100644 --- a/app/views/platforms/product_build_lists/show.html.haml +++ b/app/views/platforms/product_build_lists/show.html.haml @@ -35,6 +35,24 @@ - if pbl.build_started? || pbl.build_canceling? = render 'shared/log', { :build_started => true, :get_log_path => log_platform_product_product_build_list_path(pbl.product.platform, pbl.product, pbl) } +- if pbl.build_completed? && can?(:update, pbl) + = form_for pbl, :url => platform_product_product_build_list_path(pbl.product.platform, pbl.product, pbl) do |f| + .leftlist= f.label :not_delete + .rightlist + = f.select :not_delete, [false, true].collect{|status| [t("layout.#{status}_"), status]}, {:selected => pbl.not_delete} + .both + %br + = submit_tag t('layout.update') + .both + - unless pbl.not_delete + .flash_notify + .alert.alert-error + - if pbl.autostarted? + = t('layout.product_build_lists.will_be_exist_2_weeks') + - else + = t('layout.product_build_lists.will_be_exist_3_months') + .both + = render 'results', :subject => pbl :javascript diff --git a/config/locales/models/product_build_list.en.yml b/config/locales/models/product_build_list.en.yml index 35e45dd80..35a8ae2a5 100644 --- a/config/locales/models/product_build_list.en.yml +++ b/config/locales/models/product_build_list.en.yml @@ -1,6 +1,8 @@ en: layout: product_build_lists: + will_be_exist_2_weeks: Product build list will be exist in two weeks + will_be_exist_3_months: Product build list will be exist in three months logs: Logs (last 100 lines) work_env: Work environment iso_builder_folder: folder with contents of the GIT project @@ -29,6 +31,7 @@ en: activerecord: attributes: product_build_list: + not_delete: Not delete id: Id user: User product: Product @@ -52,4 +55,6 @@ en: product_build_list: no_project: Project for build should be exist delete: Product build list deleted - delete_error: Unable to delete product build list \ No newline at end of file + delete_error: Unable to delete product build list + updated: Product build list updated + update_error: Unable to update product build list \ No newline at end of file diff --git a/config/locales/models/product_build_list.ru.yml b/config/locales/models/product_build_list.ru.yml index 9741cd1b3..baecbdfb4 100644 --- a/config/locales/models/product_build_list.ru.yml +++ b/config/locales/models/product_build_list.ru.yml @@ -1,6 +1,8 @@ ru: layout: product_build_lists: + will_be_exist_2_weeks: Cборочный лист продукта будет доступен в течение двух недель + will_be_exist_3_months: Cборочный лист продукта будет доступен в течение трех месяцев logs: Логи (последнии 100 строк) work_env: Рабочее пространство iso_builder_folder: папка с содержимым GIT проекта @@ -29,6 +31,7 @@ ru: activerecord: attributes: product_build_list: + not_delete: Не удалять id: Id user: Пользователь product: Продукт @@ -52,4 +55,6 @@ ru: product_build_list: no_project: Проект для сборки должен присутствовать delete: Сборочный лист продукта удален - delete_error: Не удалось удалить cборочный лист продукта \ No newline at end of file + delete_error: Не удалось удалить cборочный лист продукта + updated: Cборочный лист продукта успешно обновлен + update_error: Не удалось обновить cборочный лист продукта \ No newline at end of file diff --git a/config/routes.rb b/config/routes.rb index 4d5e5c11c..e3882c1c9 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -162,7 +162,7 @@ Rosa::Application.routes.draw do end resources :key_pairs, :only => [:create, :index, :destroy] resources :products do - resources :product_build_lists, :only => [:create, :destroy, :new, :show] do + resources :product_build_lists, :only => [:create, :destroy, :new, :show, :update] do member { get :log put :cancel diff --git a/db/migrate/20130322132919_add_autostart_and_not_delete_to_product_and_product_build_list.rb b/db/migrate/20130322132919_autostart_iso_build_on_regular_basis.rb similarity index 53% rename from db/migrate/20130322132919_add_autostart_and_not_delete_to_product_and_product_build_list.rb rename to db/migrate/20130322132919_autostart_iso_build_on_regular_basis.rb index d62e9df50..a52c4877b 100644 --- a/db/migrate/20130322132919_add_autostart_and_not_delete_to_product_and_product_build_list.rb +++ b/db/migrate/20130322132919_autostart_iso_build_on_regular_basis.rb @@ -1,6 +1,7 @@ -class AddAutostartAndNotDeleteToProductAndProductBuildList < ActiveRecord::Migration +class AutostartIsoBuildOnRegularBasis < ActiveRecord::Migration def change add_column :products, :autostart, :integer, :default => nil add_column :product_build_lists, :not_delete, :boolean, :default => false + add_column :product_build_lists, :autostarted, :boolean, :default => false end end diff --git a/db/schema.rb b/db/schema.rb index 4383777d7..355e77730 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -315,6 +315,7 @@ ActiveRecord::Schema.define(:version => 20130322132919) do t.integer "time_living" t.integer "user_id" t.boolean "not_delete", :default => false + t.boolean "autostarted", :default => false end add_index "product_build_lists", ["product_id"], :name => "index_product_build_lists_on_product_id" From a5e122dc63fefd528aa06c01c5b3cd9854173ae2 Mon Sep 17 00:00:00 2001 From: Vokhmin Alexey V Date: Fri, 22 Mar 2013 20:15:37 +0400 Subject: [PATCH 16/68] #31: rename 'autostart' field to 'autostart_status' in Product model --- app/models/product.rb | 17 +++++++++++------ app/views/platforms/products/_form.html.haml | 4 ++-- config/locales/models/product.en.yml | 2 +- config/locales/models/product.ru.yml | 2 +- ...2919_autostart_iso_build_on_regular_basis.rb | 2 +- db/schema.rb | 6 +++--- 6 files changed, 19 insertions(+), 14 deletions(-) diff --git a/app/models/product.rb b/app/models/product.rb index b7e7f8067..0f5d5eca3 100644 --- a/app/models/product.rb +++ b/app/models/product.rb @@ -20,7 +20,8 @@ class Product < ActiveRecord::Base validates :name, :presence => true, :uniqueness => {:scope => :platform_id} validates :project_id, :presence => true validates :main_script, :params, :length => { :maximum => 255 } - validates :autostart, :numericality => true, :inclusion => {:in => AUTOSTART_STATUSES}, :allow_blank => true + validates :autostart_status, :numericality => true, + :inclusion => {:in => AUTOSTART_STATUSES}, :allow_blank => true scope :recent, order("#{table_name}.name ASC") @@ -30,7 +31,7 @@ class Product < ActiveRecord::Base :main_script, :params, :platform_id, - :autostart + :autostart_status attr_readonly :platform_id def full_clone(attrs = {}) @@ -43,12 +44,16 @@ class Product < ActiveRecord::Base end end - def human_status - self.class.human_status(status) + def human_autostart_status + self.class.human_autostart_status(autostart_status) end - def self.human_status(status) - I18n.t("layout.products.autostart_statuses.#{HUMAN_AUTOSTART_STATUSES[status]}") + def self.human_autostart_status(autostart_status) + I18n.t("layout.products.autostart_statuses.#{HUMAN_AUTOSTART_STATUSES[autostart_status]}") end + # def self.autostart_iso_builds(autostart_status) + # Product.where(:autostart_status => autostart_status) + # end + end diff --git a/app/views/platforms/products/_form.html.haml b/app/views/platforms/products/_form.html.haml index 228d249f2..e1759d958 100644 --- a/app/views/platforms/products/_form.html.haml +++ b/app/views/platforms/products/_form.html.haml @@ -12,8 +12,8 @@ = render 'def_fields', :f => f -.leftlist= f.label :autostart -.rightlist= f.select :autostart, Product::AUTOSTART_STATUSES.collect{|status| [Product.human_status(status), status]}, {:include_blank => true, :selected => @product.autostart} +.leftlist= f.label :autostart_status +.rightlist= f.select :autostart_status, Product::AUTOSTART_STATUSES.collect{|status| [Product.human_autostart_status(status), status]}, {:include_blank => true, :selected => @product.autostart_status} .both .button_block diff --git a/config/locales/models/product.en.yml b/config/locales/models/product.en.yml index cb7889a7e..df3d3f26d 100644 --- a/config/locales/models/product.en.yml +++ b/config/locales/models/product.en.yml @@ -29,7 +29,7 @@ en: product: Product attributes: product: - autostart: Autostart + autostart_status: Autostart name: Name description: Description platform_id: Platform diff --git a/config/locales/models/product.ru.yml b/config/locales/models/product.ru.yml index ed41793dc..a96929744 100644 --- a/config/locales/models/product.ru.yml +++ b/config/locales/models/product.ru.yml @@ -29,7 +29,7 @@ ru: product: Продукт attributes: product: - autostart: Автостарт + autostart_status: Автостарт name: Название description: Описание platform_id: Платформа diff --git a/db/migrate/20130322132919_autostart_iso_build_on_regular_basis.rb b/db/migrate/20130322132919_autostart_iso_build_on_regular_basis.rb index a52c4877b..e60b17fe5 100644 --- a/db/migrate/20130322132919_autostart_iso_build_on_regular_basis.rb +++ b/db/migrate/20130322132919_autostart_iso_build_on_regular_basis.rb @@ -1,6 +1,6 @@ class AutostartIsoBuildOnRegularBasis < ActiveRecord::Migration def change - add_column :products, :autostart, :integer, :default => nil + add_column :products, :autostart_status, :integer, :default => nil add_column :product_build_lists, :not_delete, :boolean, :default => false add_column :product_build_lists, :autostarted, :boolean, :default => false end diff --git a/db/schema.rb b/db/schema.rb index 355e77730..ce331079b 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -321,8 +321,8 @@ ActiveRecord::Schema.define(:version => 20130322132919) do add_index "product_build_lists", ["product_id"], :name => "index_product_build_lists_on_product_id" create_table "products", :force => true do |t| - t.string "name", :null => false - t.integer "platform_id", :null => false + t.string "name", :null => false + t.integer "platform_id", :null => false t.datetime "created_at" t.datetime "updated_at" t.text "description" @@ -330,7 +330,7 @@ ActiveRecord::Schema.define(:version => 20130322132919) do t.string "params" t.string "main_script" t.integer "time_living" - t.integer "autostart" + t.integer "autostart_status" end create_table "project_imports", :force => true do |t| From 8f324606097bf7d7169ee3a8052121dbb3af14b9 Mon Sep 17 00:00:00 2001 From: Vokhmin Alexey V Date: Fri, 22 Mar 2013 20:58:53 +0400 Subject: [PATCH 17/68] #31: update UI, add #autostart_iso_builds method into Product model --- app/models/platform.rb | 6 +++--- app/models/product.rb | 15 ++++++++++++--- .../platforms/product_build_lists/show.html.haml | 2 ++ config/locales/models/product_build_list.en.yml | 1 + config/locales/models/product_build_list.ru.yml | 1 + 5 files changed, 19 insertions(+), 6 deletions(-) diff --git a/app/models/platform.rb b/app/models/platform.rb index 4a1cd3608..29d4f8d2f 100644 --- a/app/models/platform.rb +++ b/app/models/platform.rb @@ -182,6 +182,9 @@ class Platform < ActiveRecord::Base end later :destroy, :queue => :clone_build + def default_host + EventLog.current_controller.request.host_with_port rescue ::Rosa::Application.config.action_mailer.default_url_options[:host] + end protected @@ -189,9 +192,6 @@ class Platform < ActiveRecord::Base system("mkdir -p -m 0777 #{build_path([name, 'repository'])}") end - def default_host - EventLog.current_controller.request.host_with_port rescue ::Rosa::Application.config.action_mailer.default_url_options[:host] - end def build_path(dir) File.join(APP_CONFIG['root_path'], 'platforms', dir) diff --git a/app/models/product.rb b/app/models/product.rb index 0f5d5eca3..8f9ca1fde 100644 --- a/app/models/product.rb +++ b/app/models/product.rb @@ -52,8 +52,17 @@ class Product < ActiveRecord::Base I18n.t("layout.products.autostart_statuses.#{HUMAN_AUTOSTART_STATUSES[autostart_status]}") end - # def self.autostart_iso_builds(autostart_status) - # Product.where(:autostart_status => autostart_status) - # end + def self.autostart_iso_builds(autostart_status) + Product.where(:autostart_status => autostart_status).each do |product| + pbl = product.product_build_lists.new(:autostarted => true) + [:params, :main_script, :time_living, :project].each do |k| + pbl.send "#{k}=", product.send(k) + end + owner = product.platform.owner + pbl.user = owner.is_a?(User) ? owner : owner.owner + pbl.base_url = "http://#{product.platform.default_host}" + pbl.save + end + end end diff --git a/app/views/platforms/product_build_lists/show.html.haml b/app/views/platforms/product_build_lists/show.html.haml index eab087bb8..4c3f3569a 100644 --- a/app/views/platforms/product_build_lists/show.html.haml +++ b/app/views/platforms/product_build_lists/show.html.haml @@ -25,6 +25,8 @@ = render 'show_field', :key => :time_living, :value => (pbl.time_living / 60) += render 'show_field', :key => :autostarted, :value => t("layout.#{pbl.autostarted}_") + = render 'show_field', :key => :notified_at, :value => l(pbl.updated_at, :format => :long) - if pbl.can_cancel? && can?(:cancel, pbl) diff --git a/config/locales/models/product_build_list.en.yml b/config/locales/models/product_build_list.en.yml index 35a8ae2a5..2a711bd90 100644 --- a/config/locales/models/product_build_list.en.yml +++ b/config/locales/models/product_build_list.en.yml @@ -31,6 +31,7 @@ en: activerecord: attributes: product_build_list: + autostarted: Autostart not_delete: Not delete id: Id user: User diff --git a/config/locales/models/product_build_list.ru.yml b/config/locales/models/product_build_list.ru.yml index baecbdfb4..00dde5ad7 100644 --- a/config/locales/models/product_build_list.ru.yml +++ b/config/locales/models/product_build_list.ru.yml @@ -31,6 +31,7 @@ ru: activerecord: attributes: product_build_list: + autostarted: Автоматически запущен not_delete: Не удалять id: Id user: Пользователь From e528127f8549555b00897db8611049e1e4e9b23e Mon Sep 17 00:00:00 2001 From: Vokhmin Alexey V Date: Fri, 22 Mar 2013 21:17:40 +0400 Subject: [PATCH 18/68] #31: add autostart ISO to schedule.rb --- app/models/product.rb | 14 ++++++++++++-- config/schedule.rb | 13 +++++++++++++ 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/app/models/product.rb b/app/models/product.rb index 8f9ca1fde..0f2c2b5bb 100644 --- a/app/models/product.rb +++ b/app/models/product.rb @@ -52,15 +52,25 @@ class Product < ActiveRecord::Base I18n.t("layout.products.autostart_statuses.#{HUMAN_AUTOSTART_STATUSES[autostart_status]}") end + class << self + HUMAN_AUTOSTART_STATUSES.each do |autostart_status, human_autostart_status| + define_method "autostart_iso_builds_#{human_autostart_status}" do + autostart_iso_builds autostart_status + end + end + end + def self.autostart_iso_builds(autostart_status) Product.where(:autostart_status => autostart_status).each do |product| - pbl = product.product_build_lists.new(:autostarted => true) + pbl = product.product_build_lists.new( + :autostarted => true, + :base_url => "http://#{product.platform.default_host}" + ) [:params, :main_script, :time_living, :project].each do |k| pbl.send "#{k}=", product.send(k) end owner = product.platform.owner pbl.user = owner.is_a?(User) ? owner : owner.owner - pbl.base_url = "http://#{product.platform.default_host}" pbl.save end end diff --git a/config/schedule.rb b/config/schedule.rb index 97cf5991f..92d28d47c 100644 --- a/config/schedule.rb +++ b/config/schedule.rb @@ -25,4 +25,17 @@ end every 3.minute do runner 'AbfWorker::BuildListsPublishTaskManager.new.run', :output => 'log/task_manager.log' +end + +every :day, :at => '4am' do + runner 'Product.autostart_iso_builds_once_a_12_hours', :output => 'log/autostart_iso_builds.log' + runner 'Product.autostart_iso_builds_once_a_day', :output => 'log/autostart_iso_builds.log' +end + +every :day, :at => '4pm' do + runner 'Product.autostart_iso_builds_once_a_12_hours', :output => 'log/autostart_iso_builds.log' +end + +every :sunday, :at => '4am' do + runner 'Product.autostart_iso_builds_once_a_week', :output => 'log/autostart_iso_builds.log' end \ No newline at end of file From 1fc21448ceda6e2e71651d1b4669efbedb87cb28 Mon Sep 17 00:00:00 2001 From: Vokhmin Alexey V Date: Fri, 22 Mar 2013 22:18:54 +0400 Subject: [PATCH 19/68] #31: add task for removing outdated ProductBuildLists --- app/models/product_build_list.rb | 5 +++++ config/schedule.rb | 12 ++++++++---- lib/tasks/.gitkeep | 0 lib/tasks/product_build_list.rake | 14 ++++++++++++++ 4 files changed, 27 insertions(+), 4 deletions(-) delete mode 100644 lib/tasks/.gitkeep create mode 100644 lib/tasks/product_build_list.rake diff --git a/app/models/product_build_list.rb b/app/models/product_build_list.rb index 3420249e7..833636af9 100644 --- a/app/models/product_build_list.rb +++ b/app/models/product_build_list.rb @@ -6,6 +6,9 @@ class ProductBuildList < ActiveRecord::Base include AbfWorker::ModelHelper delegate :url_helpers, to: 'Rails.application.routes' + LIVE_TIME = 2.week # for autostart + MAX_LIVE_TIME = 3.month # for manual start; + BUILD_COMPLETED = 0 BUILD_FAILED = 1 BUILD_PENDING = 2 @@ -65,6 +68,8 @@ class ProductBuildList < ActiveRecord::Base scope :for_user, lambda { |user| where(:user_id => user.id) } scope :scoped_to_product_name, lambda {|product_name| joins(:product).where('products.name LIKE ?', "%#{product_name}%")} scope :recent, order("#{table_name}.updated_at DESC") + scope :outdated, where(:not_delete => false). + where("(#{table_name}.created_at < ? AND #{table_name}.autostarted is TRUE) OR #{table_name}.created_at < ?", Time.now - LIVE_TIME, Time.now - MAX_LIVE_TIME) after_create :add_job_to_abf_worker_queue before_destroy :can_destroy? diff --git a/config/schedule.rb b/config/schedule.rb index 92d28d47c..318eabf95 100644 --- a/config/schedule.rb +++ b/config/schedule.rb @@ -7,19 +7,23 @@ # runner "Download.parse_and_remove_nginx_log" #end -every 1.day, :at => '4:00 am' do +every :day, :at => '4:10 am' do + rake "product_build_list:clear:outdated", :output => 'log/product_build_list_clear.log' +end + +every :day, :at => '4:00 am' do rake "import:sync:all", :output => 'log/sync.log' end -every 1.day, :at => '3:50 am' do +every :day, :at => '3:50 am' do rake "buildlist:clear:outdated", :output => 'log/build_list_clear.log' end -every 1.day, :at => '3:30 am' do +every :day, :at => '3:30 am' do rake "pull_requests:clear", :output => 'log/pull_requests_clear.log' end -every 1.day, :at => '3:00 am' do +every :day, :at => '3:00 am' do rake "activity_feeds:clear", :output => 'log/activity_feeds.log' end diff --git a/lib/tasks/.gitkeep b/lib/tasks/.gitkeep deleted file mode 100644 index e69de29bb..000000000 diff --git a/lib/tasks/product_build_list.rake b/lib/tasks/product_build_list.rake new file mode 100644 index 000000000..892f7e343 --- /dev/null +++ b/lib/tasks/product_build_list.rake @@ -0,0 +1,14 @@ + +namespace :product_build_list do + + namespace :clear do + desc 'Remove outdated ProductBuildLists' + task :outdated => :environment do + say "[#{Time.zone.now}] Removing outdated ProductBuildLists" + say "[#{Time.zone.now}] There are #{ProductBuildList.outdated.count} outdated ProductBuildLists" + ProductBuildList.outdated.destroy_all + say "[#{Time.zone.now}] Outdated BuildLists have been removed" + end + end + +end From 820fdcfa85774f90447c6455f8a09a76182ba322 Mon Sep 17 00:00:00 2001 From: Vokhmin Alexey V Date: Fri, 22 Mar 2013 22:56:32 +0400 Subject: [PATCH 20/68] #31: add #update action to ProductBuildList API, print new fields in API --- app/controllers/api/v1/product_build_lists_controller.rb | 5 +++++ app/controllers/platforms/product_build_lists_controller.rb | 2 +- app/models/product.rb | 4 ++-- app/models/product_build_list.rb | 3 +-- app/views/api/v1/product_build_lists/show.json.jbuilder | 2 +- app/views/api/v1/products/_product.json.jbuilder | 2 +- config/routes.rb | 2 +- 7 files changed, 12 insertions(+), 8 deletions(-) diff --git a/app/controllers/api/v1/product_build_lists_controller.rb b/app/controllers/api/v1/product_build_lists_controller.rb index 83c6b6fd8..ba840f6a4 100644 --- a/app/controllers/api/v1/product_build_lists_controller.rb +++ b/app/controllers/api/v1/product_build_lists_controller.rb @@ -27,6 +27,11 @@ class Api::V1::ProductBuildListsController < Api::V1::BaseController def show end + def update + params[:product_build_list] = {:not_delete => (params[:product_build_list] || {})[:not_delete]} + update_subject @product_build_list + end + def destroy destroy_subject @product_build_list end diff --git a/app/controllers/platforms/product_build_lists_controller.rb b/app/controllers/platforms/product_build_lists_controller.rb index 3087736e7..05f19331c 100644 --- a/app/controllers/platforms/product_build_lists_controller.rb +++ b/app/controllers/platforms/product_build_lists_controller.rb @@ -24,7 +24,7 @@ class Platforms::ProductBuildListsController < Platforms::BaseController end def update - if @product_build_list.update_attributes(params[:product_build_list]) + if @product_build_list.update_attributes(:not_delete => (params[:product_build_list] || {})[:not_delete]) flash[:notice] = t('flash.product_build_list.updated') else flash[:error] = t('flash.product_build_list.update_error') diff --git a/app/models/product.rb b/app/models/product.rb index 0f2c2b5bb..a2107e350 100644 --- a/app/models/product.rb +++ b/app/models/product.rb @@ -63,14 +63,14 @@ class Product < ActiveRecord::Base def self.autostart_iso_builds(autostart_status) Product.where(:autostart_status => autostart_status).each do |product| pbl = product.product_build_lists.new( - :autostarted => true, - :base_url => "http://#{product.platform.default_host}" + :base_url => "http://#{product.platform.default_host}" ) [:params, :main_script, :time_living, :project].each do |k| pbl.send "#{k}=", product.send(k) end owner = product.platform.owner pbl.user = owner.is_a?(User) ? owner : owner.owner + pbl.autostarted = true pbl.save end end diff --git a/app/models/product_build_list.rb b/app/models/product_build_list.rb index 833636af9..04c104d04 100644 --- a/app/models/product_build_list.rb +++ b/app/models/product_build_list.rb @@ -57,8 +57,7 @@ class ProductBuildList < ActiveRecord::Base :commit_hash, :arch_id, :product_id, - :not_delete, - :autostarted + :not_delete attr_readonly :product_id serialize :results, Array diff --git a/app/views/api/v1/product_build_lists/show.json.jbuilder b/app/views/api/v1/product_build_lists/show.json.jbuilder index 04362cf4a..6ab1d8594 100644 --- a/app/views/api/v1/product_build_lists/show.json.jbuilder +++ b/app/views/api/v1/product_build_lists/show.json.jbuilder @@ -1,6 +1,6 @@ json.product_build_list do |json| json.partial! 'product_build_list', :product_build_list => @product_build_list, :json => json - json.(@product_build_list, :commit_hash, :main_script, :params) + json.(@product_build_list, :commit_hash, :main_script, :params, :not_delete, :autostarted) json.product do |json_product| json.partial! 'api/v1/products/product', diff --git a/app/views/api/v1/products/_product.json.jbuilder b/app/views/api/v1/products/_product.json.jbuilder index 9aa376470..afb3907b9 100644 --- a/app/views/api/v1/products/_product.json.jbuilder +++ b/app/views/api/v1/products/_product.json.jbuilder @@ -1,3 +1,3 @@ -json.(product, :id, :name, :description, :main_script, :params, :time_living) +json.(product, :id, :name, :description, :main_script, :params, :time_living, :autostart_status) json.url api_v1_product_path(product, :format => :json) diff --git a/config/routes.rb b/config/routes.rb index e3882c1c9..374d4f8ec 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -78,7 +78,7 @@ Rosa::Application.routes.draw do resources :products, :only => [:show, :update, :create, :destroy] do resources :product_build_lists, :only => :index end - resources :product_build_lists, :only => [:index, :show, :destroy, :create] do + resources :product_build_lists, :only => [:index, :show, :destroy, :create, :update] do put :cancel, :on => :member end #resources :ssh_keys, :only => [:index, :create, :destroy] From 72950e299c149763e65a350678472b406174286f Mon Sep 17 00:00:00 2001 From: Vokhmin Alexey V Date: Fri, 22 Mar 2013 23:11:47 +0400 Subject: [PATCH 21/68] #31: some fixes for #autostart_iso_builds method --- app/models/product.rb | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/app/models/product.rb b/app/models/product.rb index a2107e350..f273d9041 100644 --- a/app/models/product.rb +++ b/app/models/product.rb @@ -65,12 +65,14 @@ class Product < ActiveRecord::Base pbl = product.product_build_lists.new( :base_url => "http://#{product.platform.default_host}" ) - [:params, :main_script, :time_living, :project].each do |k| + [:params, :main_script, :project].each do |k| pbl.send "#{k}=", product.send(k) end owner = product.platform.owner - pbl.user = owner.is_a?(User) ? owner : owner.owner - pbl.autostarted = true + pbl.user = owner.is_a?(User) ? owner : owner.owner + pbl.autostarted = true + pbl.time_living = product.time_living / 60 + pbl.project_version = product.project.default_branch pbl.save end end From 296627557efac6a625e7b7aaa86240d5d8759d9a Mon Sep 17 00:00:00 2001 From: Vokhmin Alexey V Date: Fri, 22 Mar 2013 23:14:06 +0400 Subject: [PATCH 22/68] #31: small refactoring of #autostart_iso_builds method --- app/models/product.rb | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/app/models/product.rb b/app/models/product.rb index f273d9041..765ca8346 100644 --- a/app/models/product.rb +++ b/app/models/product.rb @@ -62,15 +62,14 @@ class Product < ActiveRecord::Base def self.autostart_iso_builds(autostart_status) Product.where(:autostart_status => autostart_status).each do |product| - pbl = product.product_build_lists.new( - :base_url => "http://#{product.platform.default_host}" - ) + pbl = product.product_build_lists.new [:params, :main_script, :project].each do |k| pbl.send "#{k}=", product.send(k) end owner = product.platform.owner pbl.user = owner.is_a?(User) ? owner : owner.owner pbl.autostarted = true + pbl.base_url = "http://#{product.platform.default_host}" pbl.time_living = product.time_living / 60 pbl.project_version = product.project.default_branch pbl.save From 39984d254cfcac84ab509fd37c3a78f7d8d22663 Mon Sep 17 00:00:00 2001 From: "Vladmir Sharhsov(warpc)" Date: Mon, 25 Mar 2013 16:16:46 +0400 Subject: [PATCH 23/68] New favicon --- public/favicon.ico | Bin 1150 -> 1150 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/public/favicon.ico b/public/favicon.ico index 4ec0d298859a6e33a6cc40f7a502354b8cad5f76..f7966978df47c8be66e4f904c752bf521e6fdaa3 100644 GIT binary patch literal 1150 zcmbtT&ubGw6rP~sLBx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_ z6SAg53mD*f@Z|i&p43m&UQtACgmJkJTBrpbb03kpyo^>;fh5%*$L-vy=EPDDIQ`?? zBaNIlpe_Fx10z}ZRJ-Ptai@QXr(T?%DZH+X6CdcvAYh0yD}QTF8q!wwuhYl$ZW!U< z0rjZWr<9K>?&f$+vH!h44o_ogZ{NMVvQ|u{(z`B~x9oCBWtx+ZVwGB&AG#SUpJ8nK U6k~U4Y^(l{aMn(ow8Rkm2iEifo&W#< From 1e777bf7ff95cc00d265587a454996de538a2c6b Mon Sep 17 00:00:00 2001 From: "Vladmir Sharhsov(warpc)" Date: Mon, 25 Mar 2013 16:24:13 +0400 Subject: [PATCH 24/68] Add logo for Google OAuth --- public/pics/abf-logo.png | Bin 0 -> 10081 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 public/pics/abf-logo.png diff --git a/public/pics/abf-logo.png b/public/pics/abf-logo.png new file mode 100644 index 0000000000000000000000000000000000000000..a6357dd0014519e0be256363e04d88eadd6198f8 GIT binary patch literal 10081 zcmV-nC!W}eP)002t}1^@s6I8J)%00009a7bBm000&x z000&x0ZCFM@Bjb`PiaF#P*7-ZbZ>KLZ*U+IBfRsybQWXdwQbLP>6pAqfylh#{fb6;Z(vMMVS~$e@S=j*ftg6;Uhf59&ghTmgWD0l;*T zI709Y^p6lP1rIRMx#05C~cW=H_Aw*bJ-5DT&Z2n+x)QHX^p z00esgV8|mQcmRZ%02D^@S3L16t`O%c004NIvOKvYIYoh62rY33S640`D9%Y2D-rV&neh&#Q1i z007~1e$oCcFS8neI|hJl{-P!B1ZZ9hpmq0)X0i`JwE&>$+E?>%_LC6RbVIkUx0b+_+BaR3cnT7Zv!AJxW zizFb)h!jyGOOZ85F;a?DAXP{m@;!0_IfqH8(HlgRxt7s3}k3K`kFu>>-2Q$QMFfPW!La{h336o>X zu_CMttHv6zR;&ZNiS=X8v3CR#fknUxHUxJ0uoBa_M6WNWeqIg~6QE69c9o#eyhGvpiOA@W-aonk<7r1(?fC{oI5N*U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HEcAEUx=!w0QmW`*YEGBQyKJ~THv;L%2Cf_nZ9?0 zEuS`aRn}R|P_tQ3eWI*nT$dW9&8L~G=ULQmePuLIUq(2`B%jjEduQbY(sH9leBER%Hl z0}IBkTCw?lYzuFCH;h&9Wd=Z2P9KN+W{rDlSe}1gsh=^`d& Date: Mon, 25 Mar 2013 18:12:15 +0400 Subject: [PATCH 25/68] #31: add new specs for product model --- spec/models/product_spec.rb | 40 ++++++++++++++++++++++++------------- 1 file changed, 26 insertions(+), 14 deletions(-) diff --git a/spec/models/product_spec.rb b/spec/models/product_spec.rb index 96598974f..b23aee44d 100644 --- a/spec/models/product_spec.rb +++ b/spec/models/product_spec.rb @@ -2,15 +2,7 @@ require 'spec_helper' describe Product do - before(:all) do - stub_symlink_methods - Platform.delete_all - User.delete_all - Product.delete_all - init_test_root - # Need for validate_uniqueness_of check - FactoryGirl.create(:product) - end + let!(:product) { FactoryGirl.create(:product) } it { should belong_to(:platform) } it { should have_many(:product_build_lists)} @@ -27,11 +19,31 @@ describe Product do #it { should_not allow_mass_assignment_of(:platform_id) } it { should_not allow_mass_assignment_of(:product_build_lists) } - after(:all) do - Platform.delete_all - User.delete_all - Product.delete_all - clear_test_root + + context '#autostart_iso_builds' do + + Product::HUMAN_AUTOSTART_STATUSES.each do |autostart_status, human_autostart_status| + it "new product_build_lists should not be created if no products which should be autostarted #{human_autostart_status}" do + lambda { Product.autostart_iso_builds(autostart_status) }.should_not change{ ProductBuildList.count } + end + end + + context 'by autostart_status = once_a_12_hours' do + before do + product.update_attributes(:autostart_status => Product::ONCE_A_12_HOURS) + FactoryGirl.create(:product, :autostart_status => Product::ONCE_A_DAY) + end + + it 'should be created only one product_build_list' do + lambda { Product.autostart_iso_builds(Product::ONCE_A_12_HOURS) }.should change{ ProductBuildList.count }.by(1) + end + + it 'product should has product_build_list' do + product.product_build_lists.should have(1).item + end + + end + end end From 7f1990bbb3529c05e81208561503b53210961b28 Mon Sep 17 00:00:00 2001 From: Vokhmin Alexey V Date: Mon, 25 Mar 2013 18:22:19 +0400 Subject: [PATCH 26/68] #31: update specs for Product model --- spec/factories/product_build_lists.rb | 3 --- spec/factories/products.rb | 3 +++ spec/models/product_spec.rb | 7 +++++-- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/spec/factories/product_build_lists.rb b/spec/factories/product_build_lists.rb index 978851e86..4c2a12e2b 100644 --- a/spec/factories/product_build_lists.rb +++ b/spec/factories/product_build_lists.rb @@ -9,8 +9,5 @@ FactoryGirl.define do params 'ENV=i586' time_living 150 project_version 'master' - - # see: before_validation in ProductBuildList model - before(:create) { Arch.find_or_create_by_name('x86_64') } end end diff --git a/spec/factories/products.rb b/spec/factories/products.rb index bdb76aedf..9dc367097 100644 --- a/spec/factories/products.rb +++ b/spec/factories/products.rb @@ -5,5 +5,8 @@ FactoryGirl.define do association :platform, :factory => :platform association :project, :factory => :project_with_commit time_living 150 + + # see: before_validation in ProductBuildList model + before(:create) { Arch.find_or_create_by_name('x86_64') } end end diff --git a/spec/models/product_spec.rb b/spec/models/product_spec.rb index b23aee44d..6034ec74d 100644 --- a/spec/models/product_spec.rb +++ b/spec/models/product_spec.rb @@ -30,8 +30,10 @@ describe Product do context 'by autostart_status = once_a_12_hours' do before do - product.update_attributes(:autostart_status => Product::ONCE_A_12_HOURS) - FactoryGirl.create(:product, :autostart_status => Product::ONCE_A_DAY) + stub_symlink_methods + stub_redis + product.update_attributes(:autostart_status => Product::ONCE_A_12_HOURS, :main_script => 'text.sh') + FactoryGirl.create(:product, :autostart_status => Product::ONCE_A_DAY, :main_script => 'text.sh') end it 'should be created only one product_build_list' do @@ -39,6 +41,7 @@ describe Product do end it 'product should has product_build_list' do + Product.autostart_iso_builds Product::ONCE_A_12_HOURS product.product_build_lists.should have(1).item end From 9670f72ef938a9338d94065f25dde3995a634d07 Mon Sep 17 00:00:00 2001 From: Vokhmin Alexey V Date: Mon, 25 Mar 2013 19:04:05 +0400 Subject: [PATCH 27/68] #31: added specs for ProductBuildList#update action --- app/controllers/api/v1/base_controller.rb | 2 +- app/models/product_build_list.rb | 2 +- .../api/v1/product_build_lists_controller.rb | 11 ++++++----- .../platforms/product_build_lists_controller_spec.rb | 12 ++++++++++++ 4 files changed, 20 insertions(+), 7 deletions(-) diff --git a/app/controllers/api/v1/base_controller.rb b/app/controllers/api/v1/base_controller.rb index 98402c117..0d108ba31 100644 --- a/app/controllers/api/v1/base_controller.rb +++ b/app/controllers/api/v1/base_controller.rb @@ -65,7 +65,7 @@ class Api::V1::BaseController < ApplicationController def update_subject(subject) class_name = subject.class.name - if subject.update_attributes(params[class_name.downcase.to_sym] || {}) + if subject.update_attributes(params[class_name.underscore.to_sym] || {}) render_json_response subject, "#{class_name} has been updated successfully" else render_validation_error subject, "#{class_name} has not been updated" diff --git a/app/models/product_build_list.rb b/app/models/product_build_list.rb index dfa771f77..64425b0f1 100644 --- a/app/models/product_build_list.rb +++ b/app/models/product_build_list.rb @@ -38,7 +38,7 @@ class ProductBuildList < ActiveRecord::Base belongs_to :user # see: Issue #6 - before_validation lambda { self.arch_id = Arch.find_by_name('x86_64').id } + before_validation lambda { self.arch_id = Arch.find_by_name('x86_64').id }, :on => :create validates :product_id, :status, :project_id, diff --git a/spec/controllers/api/v1/product_build_lists_controller.rb b/spec/controllers/api/v1/product_build_lists_controller.rb index bc8148419..5885ef50e 100644 --- a/spec/controllers/api/v1/product_build_lists_controller.rb +++ b/spec/controllers/api/v1/product_build_lists_controller.rb @@ -64,7 +64,7 @@ shared_examples_for 'api user with admin rights' do params = {:product_id => @product_build_list.product_id, :arch_id => Arch.last.id, :commit_hash => commit_hash, :main_script => @product_build_list.main_script} @create_params = {:product_build_list =>{:time_living => 150}.merge(params)} - @update_params = {:product_build_list =>{:time_living => 250}} + @update_params = {:product_build_list =>{:time_living => 250, :not_delete => true}} end it 'should be able to perform show action' do @@ -96,14 +96,15 @@ shared_examples_for 'api user with admin rights' do lambda { put :destroy, :id => @product_build_list.id, :format => :json }.should change{ ProductBuildList.count }.by(-1) end - it "should not be able to perform update action" do - put :update, :id => @product_build_list.id, :format => :json - response.should_not be_success + it "should be able to perform update action" do + put :update, @update_params.merge(:id => @product_build_list.id), :format => :json + response.should be_success end - it "ensures that product has not been updated" do + it "ensures that only not_delete field of product build list has been updated" do put :update, @update_params.merge(:id => @product_build_list.id), :format => :json @product_build_list.reload.time_living.should == 150*60 # in seconds + @product_build_list.not_delete.should be_true end it 'ensures that return correct answer for wrong creating action' do diff --git a/spec/controllers/platforms/product_build_lists_controller_spec.rb b/spec/controllers/platforms/product_build_lists_controller_spec.rb index f7ae23a8d..081964ee8 100644 --- a/spec/controllers/platforms/product_build_lists_controller_spec.rb +++ b/spec/controllers/platforms/product_build_lists_controller_spec.rb @@ -35,6 +35,18 @@ shared_examples_for 'product build list admin' do response.should render_template(:show) end + it 'should be able to perform update action' do + put :update, valid_attributes_for_show.merge(:product_build_list => {:time_living => 100,:not_delete => true}) + response.should redirect_to(platform_product_product_build_list_path(@product.platform, @product, @pbl)) + end + + it "ensures that only not_delete field of product build list has been updated" do + put :update, valid_attributes_for_show.merge(:product_build_list => {:time_living => 100,:not_delete => true}) + time_living = @pbl.time_living + @pbl.reload.time_living.should == time_living + @pbl.not_delete.should be_true + end + it 'should be able to perform log action' do get :log, valid_attributes_for_show response.should be_success From ab93f1ae5ada93b6dec7d455e0eb21b539b97df0 Mon Sep 17 00:00:00 2001 From: Vokhmin Alexey V Date: Mon, 25 Mar 2013 19:57:14 +0400 Subject: [PATCH 28/68] #37: revert ABF logo --- public/pics/abf-logo.png | Bin 10081 -> 8787 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/public/pics/abf-logo.png b/public/pics/abf-logo.png index a6357dd0014519e0be256363e04d88eadd6198f8..dfc93268ca200b842c70629977a8432b879db362 100644 GIT binary patch delta 6126 zcmV;PSZpoiBL{Q4GJ0x0000DNk~Le0000y0000y2nGNE06P5Hafy&(1n)uWxSQ|Do`a zOMv;O00SwI+zNbu5V+}T;GH)BZv;-g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hmin Alexey V Date: Tue, 26 Mar 2013 22:17:47 +0400 Subject: [PATCH 29/68] #31: disable product_build_list:clear:outdated rake task --- config/schedule.rb | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/config/schedule.rb b/config/schedule.rb index 318eabf95..8a4d061ad 100644 --- a/config/schedule.rb +++ b/config/schedule.rb @@ -7,9 +7,10 @@ # runner "Download.parse_and_remove_nginx_log" #end -every :day, :at => '4:10 am' do - rake "product_build_list:clear:outdated", :output => 'log/product_build_list_clear.log' -end +# TODO: Uncomment when all needed product build lists will be updated. +# every :day, :at => '4:10 am' do +# rake "product_build_list:clear:outdated", :output => 'log/product_build_list_clear.log' +# end every :day, :at => '4:00 am' do rake "import:sync:all", :output => 'log/sync.log' From ca3c5d4e1c1528047455b470d82df25afac8ddc9 Mon Sep 17 00:00:00 2001 From: Vokhmin Alexey V Date: Wed, 27 Mar 2013 13:59:31 +0400 Subject: [PATCH 30/68] #54: add ARCH into failed_builds_list.txt --- app/models/mass_build.rb | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/app/models/mass_build.rb b/app/models/mass_build.rb index 14c2a84d1..a7b933603 100644 --- a/app/models/mass_build.rb +++ b/app/models/mass_build.rb @@ -55,9 +55,15 @@ class MassBuild < ActiveRecord::Base def generate_failed_builds_list report = "" - BuildList.where(:status => BuildList::BUILD_ERROR, :mass_build_id => self.id).each do |build_list| - report << "ID: #{build_list.id}; " - report << "PROJECT_NAME: #{build_list.project.name}\n" + BuildList.where( + :status => BuildList::BUILD_ERROR, + :mass_build_id => self.id + ).includes(:project, :arch).find_in_batches(:batch_size => 100) do |build_lists| + build_lists.each do |build_list| + report << "ID: #{build_list.id}; " + report << "PROJECT_NAME: #{build_list.project.name}; " + report << "ARCH: #{build_list.arch.name}\n" + end end report end From fa794d53c769d764710263ec6aeb2bf86f342048 Mon Sep 17 00:00:00 2001 From: Vokhmin Alexey V Date: Wed, 27 Mar 2013 14:38:52 +0400 Subject: [PATCH 31/68] #54: some refactoring MassBuild#generate_failed_builds_list --- app/models/mass_build.rb | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/app/models/mass_build.rb b/app/models/mass_build.rb index a7b933603..58ba4035d 100644 --- a/app/models/mass_build.rb +++ b/app/models/mass_build.rb @@ -55,14 +55,15 @@ class MassBuild < ActiveRecord::Base def generate_failed_builds_list report = "" - BuildList.where( + BuildList.select('build_lists.id, projects.name as project_name, arches.name as arch_name'). + where( :status => BuildList::BUILD_ERROR, :mass_build_id => self.id - ).includes(:project, :arch).find_in_batches(:batch_size => 100) do |build_lists| + ).joins(:project, :arch).find_in_batches(:batch_size => 100) do |build_lists| build_lists.each do |build_list| report << "ID: #{build_list.id}; " - report << "PROJECT_NAME: #{build_list.project.name}; " - report << "ARCH: #{build_list.arch.name}\n" + report << "PROJECT_NAME: #{build_list.project_name}; " + report << "ARCH: #{build_list.arch_name}\n" end end report From eeedbbc79b910c9cb68a4f99f174bc721d276772 Mon Sep 17 00:00:00 2001 From: Vokhmin Alexey V Date: Wed, 27 Mar 2013 15:38:19 +0400 Subject: [PATCH 32/68] #31: update notification about removing product_build_list --- .../product_build_lists/show.html.haml | 18 ++++++++++-------- .../locales/models/product_build_list.en.yml | 4 ++-- .../locales/models/product_build_list.ru.yml | 4 ++-- 3 files changed, 14 insertions(+), 12 deletions(-) diff --git a/app/views/platforms/product_build_lists/show.html.haml b/app/views/platforms/product_build_lists/show.html.haml index 848a2684d..02f6a3376 100644 --- a/app/views/platforms/product_build_lists/show.html.haml +++ b/app/views/platforms/product_build_lists/show.html.haml @@ -45,14 +45,16 @@ %br = submit_tag t('layout.update') .both - - unless pbl.not_delete - .flash_notify - .alert.alert-error - - if pbl.autostarted? - = t('layout.product_build_lists.will_be_exist_2_weeks') - - else - = t('layout.product_build_lists.will_be_exist_3_months') - .both +- unless pbl.not_delete + .flash_notify + .alert.alert-error + - days = pbl.autostarted? ? ProductBuildList::LIVE_TIME : ProductBuildList::MAX_LIVE_TIME + - days = (pbl.created_at.to_date - days.ago.to_date).to_i + - if days > 1 + = t('layout.product_build_lists.will_be_exist_n_days', :n => days) + - else + = t('layout.product_build_lists.will_be_removed_today') + .both = render 'results', :subject => pbl diff --git a/config/locales/models/product_build_list.en.yml b/config/locales/models/product_build_list.en.yml index 2a711bd90..dfff38f36 100644 --- a/config/locales/models/product_build_list.en.yml +++ b/config/locales/models/product_build_list.en.yml @@ -1,8 +1,8 @@ en: layout: product_build_lists: - will_be_exist_2_weeks: Product build list will be exist in two weeks - will_be_exist_3_months: Product build list will be exist in three months + will_be_exist_n_days: Product build list will be exist in %{n} days + will_be_removed_today: Product build list will be removed today logs: Logs (last 100 lines) work_env: Work environment iso_builder_folder: folder with contents of the GIT project diff --git a/config/locales/models/product_build_list.ru.yml b/config/locales/models/product_build_list.ru.yml index 00dde5ad7..ff145f323 100644 --- a/config/locales/models/product_build_list.ru.yml +++ b/config/locales/models/product_build_list.ru.yml @@ -1,8 +1,8 @@ ru: layout: product_build_lists: - will_be_exist_2_weeks: Cборочный лист продукта будет доступен в течение двух недель - will_be_exist_3_months: Cборочный лист продукта будет доступен в течение трех месяцев + will_be_exist_n_days: Cборочный лист продукта будет доступен в течение %{n} дней + will_be_removed_today: Cборочный лист продукта будет удален в течение дня logs: Логи (последнии 100 строк) work_env: Рабочее пространство iso_builder_folder: папка с содержимым GIT проекта From a100f3b3b1fd142aceb1da44b1dc268ac14595ca Mon Sep 17 00:00:00 2001 From: Vokhmin Alexey V Date: Wed, 27 Mar 2013 15:44:19 +0400 Subject: [PATCH 33/68] #31: update position of alert message --- app/views/platforms/product_build_lists/show.html.haml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/app/views/platforms/product_build_lists/show.html.haml b/app/views/platforms/product_build_lists/show.html.haml index 02f6a3376..cff945996 100644 --- a/app/views/platforms/product_build_lists/show.html.haml +++ b/app/views/platforms/product_build_lists/show.html.haml @@ -32,9 +32,7 @@ = link_to t("layout.build_lists.cancel"), cancel_platform_product_product_build_list_path(pbl.product.platform, pbl.product, pbl), :method => :put, :confirm => t("layout.confirm"), :class => 'button' .both - -- if pbl.build_started? || pbl.build_canceling? - = render 'shared/log', { :build_started => true, :get_log_path => log_platform_product_product_build_list_path(pbl.product.platform, pbl.product, pbl) } + %br - if pbl.build_completed? && can?(:update, pbl) = form_for pbl, :url => platform_product_product_build_list_path(pbl.product.platform, pbl.product, pbl) do |f| @@ -56,6 +54,9 @@ = t('layout.product_build_lists.will_be_removed_today') .both +- if pbl.build_started? || pbl.build_canceling? + = render 'shared/log', { :build_started => true, :get_log_path => log_platform_product_product_build_list_path(pbl.product.platform, pbl.product, pbl) } + = render 'results', :subject => pbl :javascript From a171be9f53dae826851ffee38f61502a0b4ab2ae Mon Sep 17 00:00:00 2001 From: Vokhmin Alexey V Date: Wed, 27 Mar 2013 16:18:24 +0400 Subject: [PATCH 34/68] #31: add project_version into product --- app/helpers/git_helper.rb | 1 + app/models/product.rb | 6 +++--- app/views/platforms/product_build_lists/new.html.haml | 2 +- app/views/platforms/products/_form.html.haml | 4 ++++ db/migrate/20130327120129_add_project_version_to_product.rb | 5 +++++ db/schema.rb | 3 ++- 6 files changed, 16 insertions(+), 5 deletions(-) create mode 100644 db/migrate/20130327120129_add_project_version_to_product.rb diff --git a/app/helpers/git_helper.rb b/app/helpers/git_helper.rb index c65d1ff37..a1782ecbd 100644 --- a/app/helpers/git_helper.rb +++ b/app/helpers/git_helper.rb @@ -68,6 +68,7 @@ module GitHelper end def versions_for_group_select(project) + return [] unless project [ ['Branches', project.repo.branches.map(&:name)], ['Tags', project.repo.tags.map(&:name)] ] end diff --git a/app/models/product.rb b/app/models/product.rb index 765ca8346..6b581b161 100644 --- a/app/models/product.rb +++ b/app/models/product.rb @@ -31,7 +31,8 @@ class Product < ActiveRecord::Base :main_script, :params, :platform_id, - :autostart_status + :autostart_status, + :project_version attr_readonly :platform_id def full_clone(attrs = {}) @@ -63,7 +64,7 @@ class Product < ActiveRecord::Base def self.autostart_iso_builds(autostart_status) Product.where(:autostart_status => autostart_status).each do |product| pbl = product.product_build_lists.new - [:params, :main_script, :project].each do |k| + [:params, :main_script, :project, :project_version].each do |k| pbl.send "#{k}=", product.send(k) end owner = product.platform.owner @@ -71,7 +72,6 @@ class Product < ActiveRecord::Base pbl.autostarted = true pbl.base_url = "http://#{product.platform.default_host}" pbl.time_living = product.time_living / 60 - pbl.project_version = product.project.default_branch pbl.save end end diff --git a/app/views/platforms/product_build_lists/new.html.haml b/app/views/platforms/product_build_lists/new.html.haml index 6f03eb78a..24743689f 100644 --- a/app/views/platforms/product_build_lists/new.html.haml +++ b/app/views/platforms/product_build_lists/new.html.haml @@ -9,7 +9,7 @@ .both .leftlist= f.label :project_version, t("activerecord.attributes.product_build_list.project_version"), :class => :label - .rightlist= f.select :project_version, versions_for_group_select(pbl.project), :selected => params[:product_build_lists].try(:fetch, :project_version) || pbl.project.default_branch + .rightlist= f.select :project_version, versions_for_group_select(pbl.project), :selected => params[:product_build_lists].try(:fetch, :project_version) || @product.project_version || pbl.project.default_branch .both = render 'platforms/products/def_fields', :f => f diff --git a/app/views/platforms/products/_form.html.haml b/app/views/platforms/products/_form.html.haml index e1759d958..ede415ad5 100644 --- a/app/views/platforms/products/_form.html.haml +++ b/app/views/platforms/products/_form.html.haml @@ -10,6 +10,10 @@ .rightlist= f.autocomplete_field :project, autocomplete_project_platform_products_path(@platform), :id_element => 'src_project_id', :name => 'src_project', :value => @product.project.try(:name_with_owner) .both +.leftlist= f.label :project_version, t("activerecord.attributes.product_build_list.project_version") +.rightlist= f.select :project_version, versions_for_group_select(@product.project), {:selected => params[:products].try(:fetch, :project_version) || @product.project_version, :include_blank => true} +.both + = render 'def_fields', :f => f .leftlist= f.label :autostart_status diff --git a/db/migrate/20130327120129_add_project_version_to_product.rb b/db/migrate/20130327120129_add_project_version_to_product.rb new file mode 100644 index 000000000..b58828f47 --- /dev/null +++ b/db/migrate/20130327120129_add_project_version_to_product.rb @@ -0,0 +1,5 @@ +class AddProjectVersionToProduct < ActiveRecord::Migration + def change + add_column :products, :project_version, :string + end +end diff --git a/db/schema.rb b/db/schema.rb index ce331079b..62a94da91 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended to check this file into your version control system. -ActiveRecord::Schema.define(:version => 20130322132919) do +ActiveRecord::Schema.define(:version => 20130327120129) do create_table "activity_feeds", :force => true do |t| t.integer "user_id", :null => false @@ -331,6 +331,7 @@ ActiveRecord::Schema.define(:version => 20130322132919) do t.string "main_script" t.integer "time_living" t.integer "autostart_status" + t.string "project_version" end create_table "project_imports", :force => true do |t| From 12ca85a513dbb184ff2f4c18f83a62d9e80eb781 Mon Sep 17 00:00:00 2001 From: Vokhmin Alexey V Date: Wed, 27 Mar 2013 16:22:31 +0400 Subject: [PATCH 35/68] #31: update notification message --- app/views/platforms/product_build_lists/show.html.haml | 2 +- config/locales/models/product_build_list.en.yml | 2 +- config/locales/models/product_build_list.ru.yml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/views/platforms/product_build_lists/show.html.haml b/app/views/platforms/product_build_lists/show.html.haml index cff945996..c27756272 100644 --- a/app/views/platforms/product_build_lists/show.html.haml +++ b/app/views/platforms/product_build_lists/show.html.haml @@ -49,7 +49,7 @@ - days = pbl.autostarted? ? ProductBuildList::LIVE_TIME : ProductBuildList::MAX_LIVE_TIME - days = (pbl.created_at.to_date - days.ago.to_date).to_i - if days > 1 - = t('layout.product_build_lists.will_be_exist_n_days', :n => days) + = t('layout.product_build_lists.will_be_removed_n_days', :n => days) - else = t('layout.product_build_lists.will_be_removed_today') .both diff --git a/config/locales/models/product_build_list.en.yml b/config/locales/models/product_build_list.en.yml index dfff38f36..e5cb0e42f 100644 --- a/config/locales/models/product_build_list.en.yml +++ b/config/locales/models/product_build_list.en.yml @@ -1,7 +1,7 @@ en: layout: product_build_lists: - will_be_exist_n_days: Product build list will be exist in %{n} days + will_be_removed_n_days: Product build list will be removed through %{n} days will_be_removed_today: Product build list will be removed today logs: Logs (last 100 lines) work_env: Work environment diff --git a/config/locales/models/product_build_list.ru.yml b/config/locales/models/product_build_list.ru.yml index ff145f323..71329702f 100644 --- a/config/locales/models/product_build_list.ru.yml +++ b/config/locales/models/product_build_list.ru.yml @@ -1,7 +1,7 @@ ru: layout: product_build_lists: - will_be_exist_n_days: Cборочный лист продукта будет доступен в течение %{n} дней + will_be_removed_n_days: Cборочный лист продукта будет удален через %{n} дней will_be_removed_today: Cборочный лист продукта будет удален в течение дня logs: Логи (последнии 100 строк) work_env: Рабочее пространство From fe836f121275215456b8a800d6207c1cc808169d Mon Sep 17 00:00:00 2001 From: Vokhmin Alexey V Date: Wed, 27 Mar 2013 16:25:25 +0400 Subject: [PATCH 36/68] #31: update notification message --- config/locales/models/product_build_list.en.yml | 2 +- config/locales/models/product_build_list.ru.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/config/locales/models/product_build_list.en.yml b/config/locales/models/product_build_list.en.yml index e5cb0e42f..79003c2a3 100644 --- a/config/locales/models/product_build_list.en.yml +++ b/config/locales/models/product_build_list.en.yml @@ -1,7 +1,7 @@ en: layout: product_build_lists: - will_be_removed_n_days: Product build list will be removed through %{n} days + will_be_removed_n_days: Product build list will be removed through %{n} d. will_be_removed_today: Product build list will be removed today logs: Logs (last 100 lines) work_env: Work environment diff --git a/config/locales/models/product_build_list.ru.yml b/config/locales/models/product_build_list.ru.yml index 71329702f..aac415f32 100644 --- a/config/locales/models/product_build_list.ru.yml +++ b/config/locales/models/product_build_list.ru.yml @@ -1,7 +1,7 @@ ru: layout: product_build_lists: - will_be_removed_n_days: Cборочный лист продукта будет удален через %{n} дней + will_be_removed_n_days: Cборочный лист продукта будет удален через %{n} д. will_be_removed_today: Cборочный лист продукта будет удален в течение дня logs: Логи (последнии 100 строк) work_env: Рабочее пространство From 79c178357e2d3e1447ea6c802c4b0e7207e2d5ba Mon Sep 17 00:00:00 2001 From: Vokhmin Alexey V Date: Wed, 27 Mar 2013 17:36:01 +0400 Subject: [PATCH 37/68] #31: UI: update #project_version field on change project --- app/assets/javascripts/extra/product.js | 14 ++++++++++++++ app/controllers/platforms/products_controller.rb | 8 +++++++- app/views/platforms/products/_form.html.haml | 7 +++++-- config/locales/models/product.en.yml | 1 + config/locales/models/product.ru.yml | 1 + 5 files changed, 28 insertions(+), 3 deletions(-) create mode 100644 app/assets/javascripts/extra/product.js diff --git a/app/assets/javascripts/extra/product.js b/app/assets/javascripts/extra/product.js new file mode 100644 index 000000000..d3b86bed0 --- /dev/null +++ b/app/assets/javascripts/extra/product.js @@ -0,0 +1,14 @@ +$(document).ready(function() { + + $('#product_project').bind('railsAutocomplete.select', function(event, data){ + var ppv = $("#product_project_version").empty().append(''); + $(data.item.project_versions).each(function(k, i) { + var optgroup = $(''); + $(i[1]).each(function(k, b) { + optgroup.append(''); + }); + ppv.append(optgroup); + }); + }); + +}); \ No newline at end of file diff --git a/app/controllers/platforms/products_controller.rb b/app/controllers/platforms/products_controller.rb index 744189384..85149d5ed 100644 --- a/app/controllers/platforms/products_controller.rb +++ b/app/controllers/platforms/products_controller.rb @@ -1,5 +1,6 @@ # -*- encoding : utf-8 -*- class Platforms::ProductsController < Platforms::BaseController + include GitHelper before_filter :authenticate_user! skip_before_filter :authenticate_user!, :only => [:index, :show] if APP_CONFIG['anonymous_access'] @@ -55,7 +56,12 @@ class Platforms::ProductsController < Platforms::BaseController search(params[:term]).search_order items.select! {|e| e.repo.branches.count > 0} render :json => items.map{ |p| - {:id => p.id, :label => p.name_with_owner, :value => p.name_with_owner} + { + :id => p.id, + :label => p.name_with_owner, + :value => p.name_with_owner, + :project_versions => versions_for_group_select(p) + } } end diff --git a/app/views/platforms/products/_form.html.haml b/app/views/platforms/products/_form.html.haml index ede415ad5..5b91f54ee 100644 --- a/app/views/platforms/products/_form.html.haml +++ b/app/views/platforms/products/_form.html.haml @@ -1,3 +1,5 @@ +- act = action_name.to_sym + .leftlist= f.label :name .rightlist= f.text_field :name, :class => 'text_field' .both @@ -7,10 +9,11 @@ .both .leftlist= f.label :project -.rightlist= f.autocomplete_field :project, autocomplete_project_platform_products_path(@platform), :id_element => 'src_project_id', :name => 'src_project', :value => @product.project.try(:name_with_owner) +.rightlist + = f.autocomplete_field :project, autocomplete_project_platform_products_path(@platform), :id_element => 'src_project_id', :name => 'src_project', :value => @product.project.try(:name_with_owner) .both -.leftlist= f.label :project_version, t("activerecord.attributes.product_build_list.project_version") +.leftlist= f.label :project_version .rightlist= f.select :project_version, versions_for_group_select(@product.project), {:selected => params[:products].try(:fetch, :project_version) || @product.project_version, :include_blank => true} .both diff --git a/config/locales/models/product.en.yml b/config/locales/models/product.en.yml index df3d3f26d..e54f0c6c0 100644 --- a/config/locales/models/product.en.yml +++ b/config/locales/models/product.en.yml @@ -32,6 +32,7 @@ en: autostart_status: Autostart name: Name description: Description + project_version: Version platform_id: Platform build_status: Build status created_at: Created diff --git a/config/locales/models/product.ru.yml b/config/locales/models/product.ru.yml index a96929744..03b82a5ef 100644 --- a/config/locales/models/product.ru.yml +++ b/config/locales/models/product.ru.yml @@ -32,6 +32,7 @@ ru: autostart_status: Автостарт name: Название description: Описание + project_version: Версия platform_id: Платформа build_status: Статус последней сборки created_at: Создан From 0207e25fb8f9db7f8c9c824978f174ef15bff6b6 Mon Sep 17 00:00:00 2001 From: Vokhmin Alexey V Date: Wed, 27 Mar 2013 17:38:34 +0400 Subject: [PATCH 38/68] #31: set not_delete to false if build not completed --- app/models/product_build_list.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/app/models/product_build_list.rb b/app/models/product_build_list.rb index 64425b0f1..ff4ec83c2 100644 --- a/app/models/product_build_list.rb +++ b/app/models/product_build_list.rb @@ -39,6 +39,7 @@ class ProductBuildList < ActiveRecord::Base # see: Issue #6 before_validation lambda { self.arch_id = Arch.find_by_name('x86_64').id }, :on => :create + before_validation lambda { self.not_delete = false unless build_completed? } validates :product_id, :status, :project_id, From baf7ceb8f00df80e3242daea7244a011c3fe05a6 Mon Sep 17 00:00:00 2001 From: Vokhmin Alexey V Date: Wed, 27 Mar 2013 18:01:54 +0400 Subject: [PATCH 39/68] #31: update specs and update before_validation for not_delete field --- app/models/product_build_list.rb | 3 ++- spec/models/product_build_list_spec.rb | 6 +++--- spec/models/product_spec.rb | 5 +++-- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/app/models/product_build_list.rb b/app/models/product_build_list.rb index ff4ec83c2..d3b6f5f0d 100644 --- a/app/models/product_build_list.rb +++ b/app/models/product_build_list.rb @@ -39,7 +39,8 @@ class ProductBuildList < ActiveRecord::Base # see: Issue #6 before_validation lambda { self.arch_id = Arch.find_by_name('x86_64').id }, :on => :create - before_validation lambda { self.not_delete = false unless build_completed? } + # field "not_delete" can be changed only if build has been completed + before_validation lambda { self.not_delete = false unless build_completed?; true } validates :product_id, :status, :project_id, diff --git a/spec/models/product_build_list_spec.rb b/spec/models/product_build_list_spec.rb index c79f25bcb..0f5967d09 100644 --- a/spec/models/product_build_list_spec.rb +++ b/spec/models/product_build_list_spec.rb @@ -2,8 +2,9 @@ require 'spec_helper' describe ProductBuildList do - before(:all) do + before do stub_symlink_methods + FactoryGirl.create(:product_build_list) end it { should belong_to(:product) } @@ -29,9 +30,8 @@ describe ProductBuildList do # see app/ability.rb # can :read, ProductBuildList#, :product => {:platform => {:visibility => 'open'}} # double nested hash don't work it 'should generate correct sql to get product build lists' do - stub_symlink_methods user = FactoryGirl.create(:user) ability = Ability.new user - ProductBuildList.accessible_by(ability).count.should == 0 + ProductBuildList.accessible_by(ability).count.should == 1 end end diff --git a/spec/models/product_spec.rb b/spec/models/product_spec.rb index 6034ec74d..da01f12b5 100644 --- a/spec/models/product_spec.rb +++ b/spec/models/product_spec.rb @@ -32,8 +32,9 @@ describe Product do before do stub_symlink_methods stub_redis - product.update_attributes(:autostart_status => Product::ONCE_A_12_HOURS, :main_script => 'text.sh') - FactoryGirl.create(:product, :autostart_status => Product::ONCE_A_DAY, :main_script => 'text.sh') + params = {:main_script => 'text.sh', :project_version => product.project.default_branch} + product.update_attributes params.merge(:autostart_status => Product::ONCE_A_12_HOURS) + FactoryGirl.create :product, params.merge(:autostart_status => Product::ONCE_A_DAY) end it 'should be created only one product_build_list' do From eef4d2756381879bf1dabef181fd13a58cf6cb1f Mon Sep 17 00:00:00 2001 From: Vokhmin Alexey V Date: Wed, 27 Mar 2013 18:07:29 +0400 Subject: [PATCH 40/68] #31: revert some changes --- app/views/platforms/products/_form.html.haml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/app/views/platforms/products/_form.html.haml b/app/views/platforms/products/_form.html.haml index 5b91f54ee..f5d28dfca 100644 --- a/app/views/platforms/products/_form.html.haml +++ b/app/views/platforms/products/_form.html.haml @@ -9,8 +9,7 @@ .both .leftlist= f.label :project -.rightlist - = f.autocomplete_field :project, autocomplete_project_platform_products_path(@platform), :id_element => 'src_project_id', :name => 'src_project', :value => @product.project.try(:name_with_owner) +.rightlist= f.autocomplete_field :project, autocomplete_project_platform_products_path(@platform), :id_element => 'src_project_id', :name => 'src_project', :value => @product.project.try(:name_with_owner) .both .leftlist= f.label :project_version From 8e234d278d07cf2fb0e603c98ecd14c85589e6cf Mon Sep 17 00:00:00 2001 From: Vokhmin Alexey V Date: Wed, 27 Mar 2013 18:08:14 +0400 Subject: [PATCH 41/68] #31: revert some changes --- app/views/platforms/products/_form.html.haml | 2 -- 1 file changed, 2 deletions(-) diff --git a/app/views/platforms/products/_form.html.haml b/app/views/platforms/products/_form.html.haml index f5d28dfca..0095616ad 100644 --- a/app/views/platforms/products/_form.html.haml +++ b/app/views/platforms/products/_form.html.haml @@ -1,5 +1,3 @@ -- act = action_name.to_sym - .leftlist= f.label :name .rightlist= f.text_field :name, :class => 'text_field' .both From 390d80a9a2d09f07628e47b1b20358259e216eb3 Mon Sep 17 00:00:00 2001 From: Vokhmin Alexey V Date: Thu, 28 Mar 2013 01:10:34 +0400 Subject: [PATCH 42/68] #52: added highlighting for line --- app/assets/javascripts/extra/highlight.js | 27 ++++++++++++++++++++ app/assets/stylesheets/design/custom.scss | 12 +++++++++ app/views/projects/git/blobs/_show.html.haml | 6 ++--- 3 files changed, 42 insertions(+), 3 deletions(-) create mode 100644 app/assets/javascripts/extra/highlight.js diff --git a/app/assets/javascripts/extra/highlight.js b/app/assets/javascripts/extra/highlight.js new file mode 100644 index 000000000..0ba09f0c6 --- /dev/null +++ b/app/assets/javascripts/extra/highlight.js @@ -0,0 +1,27 @@ +$(document).ready(function() { + + jQuery(window).bind('hashchange', function(e) { + var hash = location.hash; + if (/^#diff-/.test(hash)) { + highlightDiff(hash); + } else if (/^#L[0-9]+/.test(hash)) { + highlightShow(hash); + } + }); + + // Since the event is only triggered when the hash changes, we need to trigger + // the event now, to handle the hash the page may have loaded with. + jQuery(window).trigger('hashchange'); + +}); + + +function highlightShow(id) { + $('.highlight-line').remove(); + $(id).append('
'); +} + +function highlightDiff(id) { + $('.highlight-line').removeClass('highlight-line'); + $(id).parent().find('td.code').addClass('highlight-line'); +} \ No newline at end of file diff --git a/app/assets/stylesheets/design/custom.scss b/app/assets/stylesheets/design/custom.scss index 6e57d4df0..0702e37ce 100644 --- a/app/assets/stylesheets/design/custom.scss +++ b/app/assets/stylesheets/design/custom.scss @@ -325,6 +325,18 @@ article div.file table { background-color: #DDFFDD; } +#repo-wrapper table.diff tr td.code.highlight-line { + background-color: #FFFFCC; +} +.gutter .highlight-line { + background-color: #FFFFCC; + width: 805px; + height: 12px; + margin: -12px 0 0 50px; + opacity: 0.5; + position: absolute; +} + #repo-wrapper table.diff tr td.code.ins .idiff { background-color: #BAFBAD; } diff --git a/app/views/projects/git/blobs/_show.html.haml b/app/views/projects/git/blobs/_show.html.haml index b808cefc1..3d8ae19c0 100644 --- a/app/views/projects/git/blobs/_show.html.haml +++ b/app/views/projects/git/blobs/_show.html.haml @@ -10,6 +10,6 @@ :javascript $(document).ready(function() { - var text = $('#code').text().replace(/&/gi, '&'); - CodeMirror.runMode(text, "#{@blob.raw_mime_type.content_type}", document.getElementById("output")); - }); + CodeMirror.runMode($('#code').text().replace(/&/gi, '&'), "#{@blob.raw_mime_type.content_type}", document.getElementById("output")); + jQuery(window).trigger('hashchange'); + }); \ No newline at end of file From 7c02610a2088458860b5288f60a025eaa2237881 Mon Sep 17 00:00:00 2001 From: Vokhmin Alexey V Date: Thu, 28 Mar 2013 02:02:08 +0400 Subject: [PATCH 43/68] #52: remove unnecessary code --- app/views/projects/git/blobs/_show.html.haml | 1 - 1 file changed, 1 deletion(-) diff --git a/app/views/projects/git/blobs/_show.html.haml b/app/views/projects/git/blobs/_show.html.haml index 3d8ae19c0..b3d1f4606 100644 --- a/app/views/projects/git/blobs/_show.html.haml +++ b/app/views/projects/git/blobs/_show.html.haml @@ -11,5 +11,4 @@ :javascript $(document).ready(function() { CodeMirror.runMode($('#code').text().replace(/&/gi, '&'), "#{@blob.raw_mime_type.content_type}", document.getElementById("output")); - jQuery(window).trigger('hashchange'); }); \ No newline at end of file From 274c4d39be95be8ef4304aac6521ba3211869a78 Mon Sep 17 00:00:00 2001 From: Vokhmin Alexey V Date: Thu, 28 Mar 2013 14:21:25 +0400 Subject: [PATCH 44/68] #52: extra change JS --- app/assets/javascripts/extra/highlight.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/app/assets/javascripts/extra/highlight.js b/app/assets/javascripts/extra/highlight.js index 0ba09f0c6..99b16a469 100644 --- a/app/assets/javascripts/extra/highlight.js +++ b/app/assets/javascripts/extra/highlight.js @@ -9,9 +9,11 @@ $(document).ready(function() { } }); - // Since the event is only triggered when the hash changes, we need to trigger - // the event now, to handle the hash the page may have loaded with. - jQuery(window).trigger('hashchange'); + $(window).load(function() { + // this code will run after all other $(document).ready() scripts + // have completely finished, AND all page elements are fully loaded. + jQuery(window).trigger('hashchange'); + }); }); From 4f40327293b3a04b7b2c44532f958f92bd3bdaad Mon Sep 17 00:00:00 2001 From: Vokhmin Alexey V Date: Thu, 28 Mar 2013 15:04:07 +0400 Subject: [PATCH 45/68] #52: updated JS and rendering discussion in pull_request --- app/assets/javascripts/extra/highlight.js | 10 ++++------ app/helpers/diff_helper.rb | 17 +++++++++-------- .../projects/pull_requests/_activity.html.haml | 8 +++++--- .../_discussion_comments.html.haml | 2 +- 4 files changed, 19 insertions(+), 18 deletions(-) diff --git a/app/assets/javascripts/extra/highlight.js b/app/assets/javascripts/extra/highlight.js index 99b16a469..063ed4900 100644 --- a/app/assets/javascripts/extra/highlight.js +++ b/app/assets/javascripts/extra/highlight.js @@ -2,18 +2,16 @@ $(document).ready(function() { jQuery(window).bind('hashchange', function(e) { var hash = location.hash; - if (/^#diff-/.test(hash)) { + if (/^#(diff|discussion)-F[0-9]+(L|R)[0-9]+/.test(hash)) { highlightDiff(hash); } else if (/^#L[0-9]+/.test(hash)) { highlightShow(hash); } }); - $(window).load(function() { - // this code will run after all other $(document).ready() scripts - // have completely finished, AND all page elements are fully loaded. - jQuery(window).trigger('hashchange'); - }); + // Since the event is only triggered when the hash changes, we need to trigger + // the event now, to handle the hash the page may have loaded with. + jQuery(window).trigger('hashchange'); }); diff --git a/app/helpers/diff_helper.rb b/app/helpers/diff_helper.rb index 00c6774da..172050fe6 100644 --- a/app/helpers/diff_helper.rb +++ b/app/helpers/diff_helper.rb @@ -52,6 +52,7 @@ module DiffHelper def prepare(args) @url, @diff_counter, @in_discussion = args[:url], args[:diff_counter], args[:in_discussion] @filepath, @line_comments = args[:filepath], args[:comments] + @diff_prefix = args[:diff_prefix] || 'diff' @add_reply_id, @num_line = if @in_discussion [@line_comments[0].id, @line_comments[0].data[:line].to_i - @line_comments[0].data[:strings].lines.count.to_i-1] else @@ -74,7 +75,7 @@ module DiffHelper set_line_number " - #{td_line_link "diff-F#{@diff_counter}R#{line.new_number}", line.new_number} + #{td_line_link "#{@diff_prefix}-F#{@diff_counter}R#{line.new_number}", line.new_number} #{line_comment}
#{render_line(line)}
@@ -86,7 +87,7 @@ module DiffHelper def remline(line) set_line_number " - #{td_line_link "diff-F#{@diff_counter}L#{line.old_number}", line.old_number} + #{td_line_link "#{@diff_prefix}-F#{@diff_counter}L#{line.old_number}", line.old_number} #{line_comment} @@ -99,8 +100,8 @@ module DiffHelper def modline(line) set_line_number " - #{td_line_link "diff-F#{@diff_counter}L#{line.old_number}", line.old_number} - #{td_line_link "diff-F#{@diff_counter}R#{line.new_number}", line.new_number} + #{td_line_link "#{@diff_prefix}-F#{@diff_counter}L#{line.old_number}", line.old_number} + #{td_line_link "#{@diff_prefix}-F#{@diff_counter}R#{line.new_number}", line.new_number} #{line_comment}
#{render_line(line)}
@@ -112,8 +113,8 @@ module DiffHelper def unmodline(line) set_line_number " - #{td_line_link "diff-F#{@diff_counter}L#{line.old_number}", line.old_number} - #{td_line_link "diff-F#{@diff_counter}R#{line.new_number}", line.new_number} + #{td_line_link "#{@diff_prefix}-F#{@diff_counter}L#{line.old_number}", line.old_number} + #{td_line_link "#{@diff_prefix}-F#{@diff_counter}R#{line.new_number}", line.new_number} #{line_comment}
#{render_line(line)}
@@ -133,8 +134,8 @@ module DiffHelper def nonewlineline(line) set_line_number " - #{td_line_link "diff-F#{@diff_counter}L#{line.old_number}", line.old_number} - #{td_line_link "diff-F#{@diff_counter}R#{line.new_number}", line.new_number} + #{td_line_link "#{@diff_prefix}-F#{@diff_counter}L#{line.old_number}", line.old_number} + #{td_line_link "#{@diff_prefix}-F#{@diff_counter}R#{line.new_number}", line.new_number} #{line_comment}
#{render_line(line)}
diff --git a/app/views/projects/pull_requests/_activity.html.haml b/app/views/projects/pull_requests/_activity.html.haml index 3f868e607..cbde0e05b 100644 --- a/app/views/projects/pull_requests/_activity.html.haml +++ b/app/views/projects/pull_requests/_activity.html.haml @@ -1,5 +1,6 @@ .hr --commits_queue = [] +- commits_queue = [] +- diff_counter = 0 -merge_activity(@comments, @commits).each do |item| # -if item.is_a? Comment =render 'projects/git/commits/commits_small', :commits => commits_queue if commits_queue.present? @@ -16,8 +17,9 @@ =t '.show_outdated_diff' %span.data-expander.collapsed{:id => exp_id}   .hidden{:id => "content-#{exp_id}"} - =render 'projects/pull_requests/discussion_comments', :item => item, :add_id => nil + =render 'projects/pull_requests/discussion_comments', :item => item, :diff_counter => diff_counter -else - =render 'projects/pull_requests/discussion_comments', :item => item, :add_id => nil + =render 'projects/pull_requests/discussion_comments', :item => item, :diff_counter => diff_counter + - diff_counter += 1 =render 'projects/git/commits/commits_small', :commits => commits_queue if commits_queue.present? diff --git a/app/views/projects/pull_requests/_discussion_comments.html.haml b/app/views/projects/pull_requests/_discussion_comments.html.haml index e42f7eb69..c35d879d0 100644 --- a/app/views/projects/pull_requests/_discussion_comments.html.haml +++ b/app/views/projects/pull_requests/_discussion_comments.html.haml @@ -11,5 +11,5 @@ =t'projects.pull_requests.outdated_diff' =image_tag 'x.png' .clear - .diff_data=render_diff(comment.inline_diff, :diff_counter => 0, :comments => item[1], :filepath => comment.data[:path]) + .diff_data=render_diff(comment.inline_diff, :diff_counter => diff_counter, :comments => item[1], :filepath => comment.data[:path], :diff_prefix => 'discussion') From 05a8cec16950d12f1f3b73b3c8f928f50df6b06a Mon Sep 17 00:00:00 2001 From: Vokhmin Alexey V Date: Thu, 28 Mar 2013 15:58:26 +0400 Subject: [PATCH 46/68] #53: added Publisher into BuildList --- app/controllers/api/v1/build_lists_controller.rb | 3 ++- app/controllers/projects/build_lists_controller.rb | 1 + app/models/build_list.rb | 7 +++++++ app/views/api/v1/build_lists/show.json.jbuilder | 8 +++++++- app/views/projects/build_lists/show.html.haml | 4 ++++ config/locales/models/build_list.en.yml | 1 + config/locales/models/build_list.ru.yml | 1 + .../20130328112110_add_published_user_to_build_list.rb | 5 +++++ db/schema.rb | 3 ++- 9 files changed, 30 insertions(+), 3 deletions(-) create mode 100644 db/migrate/20130328112110_add_published_user_to_build_list.rb diff --git a/app/controllers/api/v1/build_lists_controller.rb b/app/controllers/api/v1/build_lists_controller.rb index 79d3c04b4..78817f9c5 100644 --- a/app/controllers/api/v1/build_lists_controller.rb +++ b/app/controllers/api/v1/build_lists_controller.rb @@ -33,6 +33,7 @@ class Api::V1::BuildListsController < Api::V1::BaseController end def publish + @build_list.publisher = current_user render_json :publish end @@ -47,7 +48,7 @@ class Api::V1::BuildListsController < Api::V1::BaseController private def render_json(action_name, action_method = nil) - if @build_list.try("can_#{action_name}?") && @build_list.send(action_method || action_name) + if @build_list.save && @build_list.try("can_#{action_name}?") && @build_list.send(action_method || action_name) render_json_response @build_list, t("layout.build_lists.#{action_name}_success") else render_validation_error @build_list, t("layout.build_lists.#{action_name}_fail") diff --git a/app/controllers/projects/build_lists_controller.rb b/app/controllers/projects/build_lists_controller.rb index 9df8fd43d..35199f2e0 100644 --- a/app/controllers/projects/build_lists_controller.rb +++ b/app/controllers/projects/build_lists_controller.rb @@ -173,6 +173,7 @@ class Projects::BuildListsController < Projects::BaseController end + @build_list.publisher = current_user if @build_list.save && @build_list.can_publish? && @build_list.now_publish redirect_to :back, :notice => t('layout.build_lists.publish_success') else diff --git a/app/models/build_list.rb b/app/models/build_list.rb index 3dbbad32e..7af5e6045 100644 --- a/app/models/build_list.rb +++ b/app/models/build_list.rb @@ -10,6 +10,7 @@ class BuildList < ActiveRecord::Base belongs_to :save_to_repository, :class_name => 'Repository' belongs_to :build_for_platform, :class_name => 'Platform' belongs_to :user + belongs_to :publisher, :class_name => 'User' belongs_to :advisory belongs_to :mass_build, :counter_cache => true has_many :items, :class_name => "BuildList::Item", :dependent => :destroy @@ -156,6 +157,7 @@ class BuildList < ActiveRecord::Base after_transition :on => :published, :do => [:set_version_and_tag, :actualize_packages] + after_transition :on => :publish, :do => :set_publisher after_transition :on => :cancel, :do => :cancel_job after_transition :on => [:published, :fail_publish, :build_error, :tests_failed], :do => :notify_users @@ -476,6 +478,11 @@ class BuildList < ActiveRecord::Base self.use_save_to_repository = true if save_to_platform.main? end + def set_publisher + self.publisher ||= user + save + end + def current_ability @current_ability ||= Ability.new(user) end diff --git a/app/views/api/v1/build_lists/show.json.jbuilder b/app/views/api/v1/build_lists/show.json.jbuilder index da96b0acf..a108c7f76 100644 --- a/app/views/api/v1/build_lists/show.json.jbuilder +++ b/app/views/api/v1/build_lists/show.json.jbuilder @@ -40,7 +40,13 @@ json.build_list do |json| :json => json_build_for_platform end - json.partial! 'api/v1/shared/owner', :owner => @build_list.project.owner + json.user do |json_user| + json.partial! 'api/v1/shared/member', :member => @build_list.user, :tag => json_user + end + + json.publisher do |json_publisher| + json.partial! 'api/v1/shared/member', :member => @build_list.publisher, :tag => json_publisher + end if @build_list.publisher inc_repos = Repository.includes(:platform).where(:id => @build_list.include_repos) json.include_repos inc_repos do |json_include_repos, repo| diff --git a/app/views/projects/build_lists/show.html.haml b/app/views/projects/build_lists/show.html.haml index 56abee61c..94f8bcdcb 100644 --- a/app/views/projects/build_lists/show.html.haml +++ b/app/views/projects/build_lists/show.html.haml @@ -25,6 +25,10 @@ .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 diff --git a/config/locales/models/build_list.en.yml b/config/locales/models/build_list.en.yml index 81147c210..02bed316b 100644 --- a/config/locales/models/build_list.en.yml +++ b/config/locales/models/build_list.en.yml @@ -29,6 +29,7 @@ en: auto_publish: Automated publising project_version: Version user: User + publisher: Publisher preferences: Preferences started_at: Build started at duration: Build duration in seconds diff --git a/config/locales/models/build_list.ru.yml b/config/locales/models/build_list.ru.yml index 1407b8f70..c3c93fbed 100644 --- a/config/locales/models/build_list.ru.yml +++ b/config/locales/models/build_list.ru.yml @@ -29,6 +29,7 @@ ru: auto_publish: Автоматическая публикация project_version: Версия user: Пользователь + publisher: Публикатор preferences: Настройки duration: Длительность билда в секундах mass_build_id: Массовая сборка diff --git a/db/migrate/20130328112110_add_published_user_to_build_list.rb b/db/migrate/20130328112110_add_published_user_to_build_list.rb new file mode 100644 index 000000000..b7d31b4e5 --- /dev/null +++ b/db/migrate/20130328112110_add_published_user_to_build_list.rb @@ -0,0 +1,5 @@ +class AddPublishedUserToBuildList < ActiveRecord::Migration + def change + add_column :build_lists, :publisher_id, :integer + end +end diff --git a/db/schema.rb b/db/schema.rb index 62a94da91..723c833d8 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended to check this file into your version control system. -ActiveRecord::Schema.define(:version => 20130327120129) do +ActiveRecord::Schema.define(:version => 20130328112110) do create_table "activity_feeds", :force => true do |t| t.integer "user_id", :null => false @@ -137,6 +137,7 @@ ActiveRecord::Schema.define(:version => 20130327120129) do t.boolean "auto_create_container", :default => false t.text "extra_repositories" t.text "extra_build_lists" + t.integer "publisher_id" end add_index "build_lists", ["advisory_id"], :name => "index_build_lists_on_advisory_id" From 853284ba8c051074b786e6cbda86fa50ce0300ac Mon Sep 17 00:00:00 2001 From: Vokhmin Alexey V Date: Thu, 28 Mar 2013 16:10:09 +0400 Subject: [PATCH 47/68] add z-index to #assigned-popup --- app/assets/stylesheets/design/custom.scss | 1 + 1 file changed, 1 insertion(+) diff --git a/app/assets/stylesheets/design/custom.scss b/app/assets/stylesheets/design/custom.scss index 6e57d4df0..b9144ce0c 100644 --- a/app/assets/stylesheets/design/custom.scss +++ b/app/assets/stylesheets/design/custom.scss @@ -1945,6 +1945,7 @@ article .activity .top { #assigned-popup { + z-index: 1001; position: absolute; margin: 5px 0 0 130px; display: none; From ef0f6fa45a593b8b39dbe2d151755a44211fa5ec Mon Sep 17 00:00:00 2001 From: Vokhmin Alexey V Date: Thu, 28 Mar 2013 16:47:34 +0400 Subject: [PATCH 48/68] #53: update email notifications --- app/views/user_mailer/build_list_notification.en.haml | 4 ++++ app/views/user_mailer/build_list_notification.ru.haml | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/app/views/user_mailer/build_list_notification.en.haml b/app/views/user_mailer/build_list_notification.en.haml index afd0752d6..e400f8da3 100644 --- a/app/views/user_mailer/build_list_notification.en.haml +++ b/app/views/user_mailer/build_list_notification.en.haml @@ -8,6 +8,10 @@ = @build_list.human_status for arch = "#{@build_list.arch.name}." +- if @build_list.build_published? + %p + = t('activerecord.attributes.build_list.publisher') + = link_to @build_list.publisher.try(:fullname), @build_list.publisher %p More detailed information you can get by link: = link_to "task [№ #{@build_list.bs_id ? @build_list.bs_id : t("layout.build_lists.bs_id_not_set")}]", build_list_url(@build_list) diff --git a/app/views/user_mailer/build_list_notification.ru.haml b/app/views/user_mailer/build_list_notification.ru.haml index 21401beaa..6050c546b 100644 --- a/app/views/user_mailer/build_list_notification.ru.haml +++ b/app/views/user_mailer/build_list_notification.ru.haml @@ -8,6 +8,10 @@ = @build_list.human_status для архитектуры = "#{@build_list.arch.name}." +- if @build_list.build_published? + %p + = t('activerecord.attributes.build_list.publisher') + = link_to @build_list.publisher.try(:fullname), @build_list.publisher %p Более подробную информацию можно получить по ссылке: = link_to "задание [№ #{@build_list.bs_id ? @build_list.bs_id : t("layout.build_lists.bs_id_not_set")}]", build_list_url(@build_list) From 54fcda0780350e26b635c1712af193b70a028e3f Mon Sep 17 00:00:00 2001 From: Vokhmin Alexey V Date: Thu, 28 Mar 2013 16:52:27 +0400 Subject: [PATCH 49/68] #53: updated links to publisher in email --- app/views/user_mailer/build_list_notification.en.haml | 2 +- app/views/user_mailer/build_list_notification.ru.haml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views/user_mailer/build_list_notification.en.haml b/app/views/user_mailer/build_list_notification.en.haml index e400f8da3..165e61fb8 100644 --- a/app/views/user_mailer/build_list_notification.en.haml +++ b/app/views/user_mailer/build_list_notification.en.haml @@ -11,7 +11,7 @@ - if @build_list.build_published? %p = t('activerecord.attributes.build_list.publisher') - = link_to @build_list.publisher.try(:fullname), @build_list.publisher + = link_to @build_list.publisher.try(:fullname), user_url(@build_list.publisher) %p More detailed information you can get by link: = link_to "task [№ #{@build_list.bs_id ? @build_list.bs_id : t("layout.build_lists.bs_id_not_set")}]", build_list_url(@build_list) diff --git a/app/views/user_mailer/build_list_notification.ru.haml b/app/views/user_mailer/build_list_notification.ru.haml index 6050c546b..f99a64d2b 100644 --- a/app/views/user_mailer/build_list_notification.ru.haml +++ b/app/views/user_mailer/build_list_notification.ru.haml @@ -11,7 +11,7 @@ - if @build_list.build_published? %p = t('activerecord.attributes.build_list.publisher') - = link_to @build_list.publisher.try(:fullname), @build_list.publisher + = link_to @build_list.publisher.try(:fullname), user_url(@build_list.publisher) %p Более подробную информацию можно получить по ссылке: = link_to "задание [№ #{@build_list.bs_id ? @build_list.bs_id : t("layout.build_lists.bs_id_not_set")}]", build_list_url(@build_list) From 857c27c5be9a408fdc3d4f510e89349033690e7a Mon Sep 17 00:00:00 2001 From: Vokhmin Alexey V Date: Thu, 28 Mar 2013 17:33:08 +0400 Subject: [PATCH 50/68] #53: update Activity Feed --- app/models/activity_feed_observer.rb | 16 +++++++++++++--- .../partials/_build_list_notification.haml | 6 ++++++ 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/app/models/activity_feed_observer.rb b/app/models/activity_feed_observer.rb index 7fe598a20..17450f905 100644 --- a/app/models/activity_feed_observer.rb +++ b/app/models/activity_feed_observer.rb @@ -148,9 +148,19 @@ class ActivityFeedObserver < ActiveRecord::Observer ActivityFeed.create( :user => recipient, :kind => 'build_list_notification', - :data => {:task_num => record.bs_id, :build_list_id => record.id, :status => record.status, :updated_at => record.updated_at, - :project_id => record.project_id, :project_name => record.project.name, :project_owner => record.project.owner.uname, - :user_name => record.user.name, :user_email => record.user.email, :user_id => record.user_id} + :data => { + :task_num => record.bs_id, + :build_list_id => record.id, + :status => record.status, + :updated_at => record.updated_at, + :project_id => record.project_id, + :project_name => record.project.name, + :project_owner => record.project.owner.uname, + :user_name => record.user.name, + :user_email => record.user.email, + :user_id => record.user_id, + :publisher_fullname => record.publisher.try(:fullname) + } ) end end diff --git a/app/views/activity_feeds/partials/_build_list_notification.haml b/app/views/activity_feeds/partials/_build_list_notification.haml index 9f1594004..a34797a30 100644 --- a/app/views/activity_feeds/partials/_build_list_notification.haml +++ b/app/views/activity_feeds/partials/_build_list_notification.haml @@ -14,6 +14,12 @@ - ['success', nil] - else ['failed', t("layout.build_lists.statuses.#{BuildList::HUMAN_STATUSES[status]}")] = raw t("notifications.bodies.build_status.#{message}", :error => error) + - publisher_fullname ||= nil + - if status == BuildList::BUILD_PUBLISHED && publisher_fullname + .both + %span + = t('activerecord.attributes.build_list.publisher') + = publisher_fullname .both %span.date= updated_at .both From 0419cc897ae2daaf3d612eb2fcec10e6eb3ee829 Mon Sep 17 00:00:00 2001 From: Vokhmin Alexey V Date: Thu, 28 Mar 2013 17:40:29 +0400 Subject: [PATCH 51/68] #53: fixed ActionView::Template::Error --- app/views/user_mailer/build_list_notification.en.haml | 2 +- app/views/user_mailer/build_list_notification.ru.haml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views/user_mailer/build_list_notification.en.haml b/app/views/user_mailer/build_list_notification.en.haml index 165e61fb8..982547a8b 100644 --- a/app/views/user_mailer/build_list_notification.en.haml +++ b/app/views/user_mailer/build_list_notification.en.haml @@ -8,7 +8,7 @@ = @build_list.human_status for arch = "#{@build_list.arch.name}." -- if @build_list.build_published? +- if @build_list.build_published? && @build_list.publisher %p = t('activerecord.attributes.build_list.publisher') = link_to @build_list.publisher.try(:fullname), user_url(@build_list.publisher) diff --git a/app/views/user_mailer/build_list_notification.ru.haml b/app/views/user_mailer/build_list_notification.ru.haml index f99a64d2b..4ecd9da37 100644 --- a/app/views/user_mailer/build_list_notification.ru.haml +++ b/app/views/user_mailer/build_list_notification.ru.haml @@ -8,7 +8,7 @@ = @build_list.human_status для архитектуры = "#{@build_list.arch.name}." -- if @build_list.build_published? +- if @build_list.build_published? && @build_list.publisher %p = t('activerecord.attributes.build_list.publisher') = link_to @build_list.publisher.try(:fullname), user_url(@build_list.publisher) From e7b07cdfca970b118630cc1c9f0b9e8fa366c199 Mon Sep 17 00:00:00 2001 From: Vokhmin Alexey V Date: Thu, 28 Mar 2013 17:42:26 +0400 Subject: [PATCH 52/68] #53: small refactoring --- app/views/activity_feeds/partials/_build_list_notification.haml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/activity_feeds/partials/_build_list_notification.haml b/app/views/activity_feeds/partials/_build_list_notification.haml index a34797a30..882233ec5 100644 --- a/app/views/activity_feeds/partials/_build_list_notification.haml +++ b/app/views/activity_feeds/partials/_build_list_notification.haml @@ -15,7 +15,7 @@ - else ['failed', t("layout.build_lists.statuses.#{BuildList::HUMAN_STATUSES[status]}")] = raw t("notifications.bodies.build_status.#{message}", :error => error) - publisher_fullname ||= nil - - if status == BuildList::BUILD_PUBLISHED && publisher_fullname + - if status == BuildList::BUILD_PUBLISHED && publisher_fullname.present? .both %span = t('activerecord.attributes.build_list.publisher') From 230c46539d1c75046cc71379168f807e9836b2cf Mon Sep 17 00:00:00 2001 From: Vokhmin Alexey V Date: Thu, 28 Mar 2013 18:20:46 +0400 Subject: [PATCH 53/68] #52: added highlighting for multi lines --- app/assets/javascripts/extra/highlight.js | 22 +++++++++++++++++++++- app/assets/stylesheets/design/custom.scss | 2 +- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/app/assets/javascripts/extra/highlight.js b/app/assets/javascripts/extra/highlight.js index 063ed4900..31ecf61ed 100644 --- a/app/assets/javascripts/extra/highlight.js +++ b/app/assets/javascripts/extra/highlight.js @@ -18,7 +18,27 @@ $(document).ready(function() { function highlightShow(id) { $('.highlight-line').remove(); - $(id).append('
'); + var from = to = id.substring(2); + if (/[0-9]+\-L[0-9]+$/.test(from)) { + var index = to.indexOf('-'); + to = to.substring(index + 2); + from = from.substring(0, index); + } + from = parseInt(from); + to = parseInt(to); + if (from && to) { + if (from > to) { + var x = to; to = from; from = x; + } + var el = $('#L' + from); + $(document).scrollTop( el.offset().top ); + while (el.length > 0) { + el.append('
'); + if (from == to) { return true; } + from += 1; + el = $('#L' + from); + } + } } function highlightDiff(id) { diff --git a/app/assets/stylesheets/design/custom.scss b/app/assets/stylesheets/design/custom.scss index 0702e37ce..be8ab324c 100644 --- a/app/assets/stylesheets/design/custom.scss +++ b/app/assets/stylesheets/design/custom.scss @@ -333,7 +333,7 @@ article div.file table { width: 805px; height: 12px; margin: -12px 0 0 50px; - opacity: 0.5; + opacity: 0.6; position: absolute; } From 547f0437a94745f101793ba76ee4320c1f76c7ea Mon Sep 17 00:00:00 2001 From: Vokhmin Alexey V Date: Fri, 29 Mar 2013 16:20:06 +0400 Subject: [PATCH 54/68] show full name of assigned user --- app/views/projects/issues/_search_collaborators.html.haml | 2 +- app/views/projects/issues/_user_container.html.haml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views/projects/issues/_search_collaborators.html.haml b/app/views/projects/issues/_search_collaborators.html.haml index 0d36330cd..81463a782 100644 --- a/app/views/projects/issues/_search_collaborators.html.haml +++ b/app/views/projects/issues/_search_collaborators.html.haml @@ -13,7 +13,7 @@ .container .image = image_tag(avatar_url(user, :micro), :alt => 'avatar') - %span.name= link_to(user.uname, user_path(user)) + %span.name= link_to(user.fullname, user_path(user)) %span= t('layout.issues.is_assigned') = hidden_field_tag "user-#{index}", user.id, :name => "issue[assignee_id]" .both diff --git a/app/views/projects/issues/_user_container.html.haml b/app/views/projects/issues/_user_container.html.haml index 63a37e54c..47b78037d 100644 --- a/app/views/projects/issues/_user_container.html.haml +++ b/app/views/projects/issues/_user_container.html.haml @@ -2,7 +2,7 @@ - if user .image =image_tag(avatar_url(user, :micro), :alt => 'avatar') - %span.name= link_to(user.uname, user_path(user)) + %span.name= link_to(user.fullname, user_path(user)) %span= t('layout.issues.is_assigned') - else %span= t('layout.issues.no_one_is_assigned') From 574396e03cad53519766602bb9fe6841c6f992b4 Mon Sep 17 00:00:00 2001 From: Vokhmin Alexey V Date: Fri, 29 Mar 2013 16:30:22 +0400 Subject: [PATCH 55/68] create admin user at first start of server --- db/seeds.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/db/seeds.rb b/db/seeds.rb index 25fcb79af..1a0a9c079 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -7,4 +7,7 @@ end %w(rosa_system iso_worker_1 file_store).each do |uname| user = User.new uname: uname, email: "#{uname}@rosalinux.ru", password: SecureRandom.base64 user.confirmed_at, user.role = Time.now.utc, 'system'; user.save -end \ No newline at end of file +end + +admin = User.new uname: 'admin', email: 'admin@rosalinux.ru', password: 'qwerty' +admin.confirmed_at, admin.role = Time.now.utc, 'admin'; admin.save \ No newline at end of file From 0dfb3bd00fb58764002fd375a99529aaaae15205 Mon Sep 17 00:00:00 2001 From: Vokhmin Alexey V Date: Fri, 29 Mar 2013 16:38:06 +0400 Subject: [PATCH 56/68] update uname of admin user --- db/seeds.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/db/seeds.rb b/db/seeds.rb index 1a0a9c079..3150a8b4e 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -9,5 +9,5 @@ end user.confirmed_at, user.role = Time.now.utc, 'system'; user.save end -admin = User.new uname: 'admin', email: 'admin@rosalinux.ru', password: 'qwerty' +admin = User.new uname: 'admin_user', email: 'admin_user@rosalinux.ru', password: 'qwerty' admin.confirmed_at, admin.role = Time.now.utc, 'admin'; admin.save \ No newline at end of file From fc52e673d484af390b4f5cf564ba2f0522cdd4f3 Mon Sep 17 00:00:00 2001 From: Vokhmin Alexey V Date: Fri, 29 Mar 2013 17:20:11 +0400 Subject: [PATCH 57/68] update css styles for highlight-line --- app/assets/stylesheets/design/custom.scss | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/assets/stylesheets/design/custom.scss b/app/assets/stylesheets/design/custom.scss index a8862fb48..078a44535 100644 --- a/app/assets/stylesheets/design/custom.scss +++ b/app/assets/stylesheets/design/custom.scss @@ -329,11 +329,11 @@ article div.file table { background-color: #FFFFCC; } .gutter .highlight-line { - background-color: #FFFFCC; + background-color: #FF9900; width: 805px; height: 12px; margin: -12px 0 0 50px; - opacity: 0.6; + opacity: 0.2; position: absolute; } From 1fd4ea4da71b15ed4be928708bd715645a21e813 Mon Sep 17 00:00:00 2001 From: Vokhmin Alexey V Date: Mon, 1 Apr 2013 14:52:12 +0400 Subject: [PATCH 58/68] #55: added anonymous access for mass_builds page --- .../platforms/mass_builds_controller.rb | 3 +-- app/models/ability.rb | 3 ++- app/views/platforms/base/_sidebar.html.haml | 2 +- .../platforms/mass_builds/_form.html.haml | 17 +++++++++++++++++ .../platforms/mass_builds/index.html.haml | 19 +------------------ 5 files changed, 22 insertions(+), 22 deletions(-) create mode 100644 app/views/platforms/mass_builds/_form.html.haml diff --git a/app/controllers/platforms/mass_builds_controller.rb b/app/controllers/platforms/mass_builds_controller.rb index ff90c71b2..956862630 100644 --- a/app/controllers/platforms/mass_builds_controller.rb +++ b/app/controllers/platforms/mass_builds_controller.rb @@ -1,6 +1,7 @@ #class MassBuildsController < ApplicationController class Platforms::MassBuildsController < Platforms::BaseController before_filter :authenticate_user! + skip_before_filter :authenticate_user!, :only => [:index, :get_list] if APP_CONFIG['anonymous_access'] load_and_authorize_resource :platform load_and_authorize_resource @@ -37,8 +38,6 @@ class Platforms::MassBuildsController < Platforms::BaseController end def index - authorize! :local_admin_manage, @platform - @mass_builds = MassBuild.by_platform(@platform).order('created_at DESC').paginate(:page => params[:page], :per_page => 20) @auto_publish_selected = true end diff --git a/app/models/ability.rb b/app/models/ability.rb index 6404797d2..749023f2c 100644 --- a/app/models/ability.rb +++ b/app/models/ability.rb @@ -26,6 +26,7 @@ class Ability # Platforms block can [:show, :members, :advisories], Platform, :visibility => 'open' can :platforms_for_build, Platform, :visibility => 'open', :platform_type => 'main' + can(:get_list, MassBuild) {|mass_build| mass_build.platform.main? && can?(:show, mass_build.platform) } can [:read, :projects_list, :projects], Repository, :platform => {:visibility => 'open'} can :read, Product, :platform => {:visibility => 'open'} @@ -98,7 +99,7 @@ class Ability can([:update, :destroy], Platform) {|platform| owner?(platform) } can([:local_admin_manage, :members, :add_member, :remove_member, :remove_members] , Platform) {|platform| owner?(platform) || local_admin?(platform) } - can([:get_list, :create, :publish], MassBuild) {|mass_build| (owner?(mass_build.platform) || local_admin?(mass_build.platform)) && mass_build.platform.main?} + can([:create, :publish], MassBuild) {|mass_build| (owner?(mass_build.platform) || local_admin?(mass_build.platform)) && mass_build.platform.main?} can(:cancel, MassBuild) {|mass_build| (owner?(mass_build.platform) || local_admin?(mass_build.platform)) && !mass_build.stop_build && mass_build.platform.main?} can [:read, :projects_list, :projects], Repository, :platform => {:owner_type => 'User', :owner_id => user.id} diff --git a/app/views/platforms/base/_sidebar.html.haml b/app/views/platforms/base/_sidebar.html.haml index eda999eeb..b5a857be5 100644 --- a/app/views/platforms/base/_sidebar.html.haml +++ b/app/views/platforms/base/_sidebar.html.haml @@ -13,7 +13,7 @@ - if can? :show, @platform %li{:class => (act == :index && contr == :maintainers) ? 'active' : nil} = link_to t("layout.platforms.maintainers"), platform_maintainers_path(@platform) - - if can? :edit, @platform + - if can? :show, @platform %li{:class => (contr == :mass_builds && [:index, :create].include?(act)) ? 'active' : ''} = link_to t("layout.platforms.mass_build"), platform_mass_builds_path(@platform) - if can? :read, @platform.products.build diff --git a/app/views/platforms/mass_builds/_form.html.haml b/app/views/platforms/mass_builds/_form.html.haml new file mode 100644 index 000000000..88748ed12 --- /dev/null +++ b/app/views/platforms/mass_builds/_form.html.haml @@ -0,0 +1,17 @@ += form_for :build, :url => platform_mass_builds_path(@platform), :html => { :class => 'form mass_build', :method => :post } do |f| + %section.left + =render 'repos_or_list_choice' + %br + = f.submit t("layout.projects.build_button") + %section.right + %h3= t("activerecord.attributes.build_list.arch") + - Arch.recent.each do |arch| + .lefter + = check_box_tag "arches[]", arch.id, (params[:arches]||[]).include?(arch.id.to_s), :id => "arches_#{arch.id}" + = label_tag "arches_#{arch.id}", arch.name + .both + %h3= t("activerecord.attributes.build_list.preferences") + .both.bottom_20 + = check_box_tag :auto_publish, true, @auto_publish_selected, :id => 'auto_publish' + = label_tag :auto_publish, t('activerecord.attributes.build_list.auto_publish') +.both \ No newline at end of file diff --git a/app/views/platforms/mass_builds/index.html.haml b/app/views/platforms/mass_builds/index.html.haml index a5276ea0e..d965430c2 100644 --- a/app/views/platforms/mass_builds/index.html.haml +++ b/app/views/platforms/mass_builds/index.html.haml @@ -1,24 +1,7 @@ = render 'platforms/base/submenu' = render 'platforms/base/sidebar' -= form_for :build, :url => platform_mass_builds_path(@platform), :html => { :class => 'form mass_build', :method => :post } do |f| - %section.left - =render 'repos_or_list_choice' - %br - = f.submit t("layout.projects.build_button") - %section.right - %h3= t("activerecord.attributes.build_list.arch") - - Arch.recent.each do |arch| - .lefter - = check_box_tag "arches[]", arch.id, (params[:arches]||[]).include?(arch.id.to_s), :id => "arches_#{arch.id}" - = label_tag "arches_#{arch.id}", arch.name - .both - %h3= t("activerecord.attributes.build_list.preferences") - .both.bottom_20 - = check_box_tag :auto_publish, true, @auto_publish_selected, :id => 'auto_publish' - = label_tag :auto_publish, t('activerecord.attributes.build_list.auto_publish') -%br -%br += render 'form' if can? :edit, @platform %table.tablesorter.unbordered{:cellpadding => "0", :cellspacing => "0"} %thead From 6a419f8fb90f3fdbdb17e2fc498b2bed2a842fe4 Mon Sep 17 00:00:00 2001 From: Vokhmin Alexey V Date: Mon, 1 Apr 2013 15:08:25 +0400 Subject: [PATCH 59/68] #55: update specs for mass_builds_controller --- .../platforms/mass_builds_controller_spec.rb | 51 ++++++++++++++----- 1 file changed, 39 insertions(+), 12 deletions(-) diff --git a/spec/controllers/platforms/mass_builds_controller_spec.rb b/spec/controllers/platforms/mass_builds_controller_spec.rb index b459124fd..416dd6b6c 100644 --- a/spec/controllers/platforms/mass_builds_controller_spec.rb +++ b/spec/controllers/platforms/mass_builds_controller_spec.rb @@ -42,6 +42,11 @@ shared_examples_for 'mass_build platform owner' do lambda { post :create, @create_params }.should change{ MassBuild.count }.by(1) end + it 'should be able to perform get_list action' do + get :get_list, :platform_id => @platform, :id => @mass_build, :kind => 'failed_builds_list' + response.should be_success + end + context 'for personal platform' do before(:each) do Platform.update_all(:platform_type => 'personal') @@ -57,14 +62,22 @@ shared_examples_for 'mass_build platform owner' do end shared_examples_for 'mass_build platform reader' do - [:index, :create].each do |action| - it "should not be able to perform #{ action } action" do - get action, :platform_id => @platform - response.should redirect_to(forbidden_path) - end + it 'should be able to perform index action' do + get :index, :platform_id => @platform + response.should render_template(:index) end - [:cancel, :get_list, :publish].each do |action| + it 'should be able to perform get_list action' do + get :get_list, :platform_id => @platform, :id => @mass_build, :kind => 'failed_builds_list' + response.should be_success + end + + it "should not be able to perform create action" do + get :create, :platform_id => @platform + response.should redirect_to(forbidden_path) + end + + [:cancel, :publish].each do |action| it "should not be able to perform #{ action } action" do get action, :platform_id => @platform, :id => @mass_build.id response.should redirect_to(forbidden_path) @@ -111,15 +124,29 @@ describe Platforms::MassBuildsController do end context 'for guest' do - [:index, :create].each do |action| - it "should not be able to perform #{ action } action" do - get action, :platform_id => @platform - response.should redirect_to(new_user_session_path) - end + + it 'should be able to perform index action', :anonymous_access => true do + get :index, :platform_id => @platform + response.should render_template(:index) end - it "should not be able to get failed builds list" do + it 'should be able to perform index action', :anonymous_access => false do + get :index, :platform_id => @platform + response.should redirect_to(new_user_session_path) + end + + it 'should be able to perform get_list action', :anonymous_access => true do get :get_list, :platform_id => @platform, :id => @mass_build, :kind => 'failed_builds_list' + response.should be_success + end + + it "should not be able to get failed builds list", :anonymous_access => false do + get :get_list, :platform_id => @platform, :id => @mass_build, :kind => 'failed_builds_list' + response.should redirect_to(new_user_session_path) + end + + it "should not be able to perform create action" do + get :create, :platform_id => @platform response.should redirect_to(new_user_session_path) end From 67ddfdc3186b9cac785e9462322de2b073c1d6bf Mon Sep 17 00:00:00 2001 From: Vokhmin Alexey V Date: Mon, 1 Apr 2013 15:15:46 +0400 Subject: [PATCH 60/68] #55: update messages of specs --- spec/controllers/platforms/mass_builds_controller_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/controllers/platforms/mass_builds_controller_spec.rb b/spec/controllers/platforms/mass_builds_controller_spec.rb index 416dd6b6c..e27d5b650 100644 --- a/spec/controllers/platforms/mass_builds_controller_spec.rb +++ b/spec/controllers/platforms/mass_builds_controller_spec.rb @@ -130,7 +130,7 @@ describe Platforms::MassBuildsController do response.should render_template(:index) end - it 'should be able to perform index action', :anonymous_access => false do + it 'should not be able to perform index action', :anonymous_access => false do get :index, :platform_id => @platform response.should redirect_to(new_user_session_path) end From c30808b733e0e91413af90c1818b07cdcd7459dc Mon Sep 17 00:00:00 2001 From: Vokhmin Alexey V Date: Mon, 1 Apr 2013 18:49:57 +0400 Subject: [PATCH 61/68] update password for admin_user --- db/seeds.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/db/seeds.rb b/db/seeds.rb index 3150a8b4e..3678284fc 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -9,5 +9,5 @@ end user.confirmed_at, user.role = Time.now.utc, 'system'; user.save end -admin = User.new uname: 'admin_user', email: 'admin_user@rosalinux.ru', password: 'qwerty' +admin = User.new uname: 'admin_user', email: 'admin_user@rosalinux.ru', password: 'ABFrulez!!!' admin.confirmed_at, admin.role = Time.now.utc, 'admin'; admin.save \ No newline at end of file From 7e11e16fd579fa580d652e3f844f5830642171d4 Mon Sep 17 00:00:00 2001 From: Vokhmin Alexey V Date: Mon, 1 Apr 2013 23:59:57 +0400 Subject: [PATCH 62/68] update password for admin_user --- db/seeds.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/db/seeds.rb b/db/seeds.rb index 3678284fc..606290ce3 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -9,5 +9,5 @@ end user.confirmed_at, user.role = Time.now.utc, 'system'; user.save end -admin = User.new uname: 'admin_user', email: 'admin_user@rosalinux.ru', password: 'ABFrulez!!!' +admin = User.new uname: 'admin_user', email: 'admin_user@rosalinux.ru', password: 'admin_user' admin.confirmed_at, admin.role = Time.now.utc, 'admin'; admin.save \ No newline at end of file From c9b04a6acc33b42192a45de0d3c439e9bc445543 Mon Sep 17 00:00:00 2001 From: Vokhmin Alexey V Date: Tue, 2 Apr 2013 15:04:51 +0400 Subject: [PATCH 63/68] #53: some refactoring according to discussion --- app/controllers/api/v1/build_lists_controller.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/controllers/api/v1/build_lists_controller.rb b/app/controllers/api/v1/build_lists_controller.rb index 78817f9c5..ee46406ce 100644 --- a/app/controllers/api/v1/build_lists_controller.rb +++ b/app/controllers/api/v1/build_lists_controller.rb @@ -34,6 +34,7 @@ class Api::V1::BuildListsController < Api::V1::BaseController def publish @build_list.publisher = current_user + @build_list.save render_json :publish end @@ -48,7 +49,7 @@ class Api::V1::BuildListsController < Api::V1::BaseController private def render_json(action_name, action_method = nil) - if @build_list.save && @build_list.try("can_#{action_name}?") && @build_list.send(action_method || action_name) + if @build_list.try("can_#{action_name}?") && @build_list.send(action_method || action_name) render_json_response @build_list, t("layout.build_lists.#{action_name}_success") else render_validation_error @build_list, t("layout.build_lists.#{action_name}_fail") From c5c54013f3d8803bb13fc765f138d1ea9d308187 Mon Sep 17 00:00:00 2001 From: Vokhmin Alexey V Date: Tue, 2 Apr 2013 17:54:18 +0400 Subject: [PATCH 64/68] #53: set publisher on MassBuilds#publish action --- .../platforms/mass_builds_controller.rb | 4 ++-- app/models/mass_build.rb | 14 ++++++++------ 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/app/controllers/platforms/mass_builds_controller.rb b/app/controllers/platforms/mass_builds_controller.rb index ff90c71b2..89b191ee5 100644 --- a/app/controllers/platforms/mass_builds_controller.rb +++ b/app/controllers/platforms/mass_builds_controller.rb @@ -29,9 +29,9 @@ class Platforms::MassBuildsController < Platforms::BaseController def publish if params[:status] == 'test_failed' - @mass_build.publish_test_faild_builds + @mass_build.publish_test_faild_builds current_user else - @mass_build.publish_success_builds + @mass_build.publish_success_builds current_user end redirect_to(platform_mass_builds_path(@mass_build.platform), :notice => t("flash.platform.publish_success")) end diff --git a/app/models/mass_build.rb b/app/models/mass_build.rb index 58ba4035d..01a7e0477 100644 --- a/app/models/mass_build.rb +++ b/app/models/mass_build.rb @@ -77,20 +77,22 @@ class MassBuild < ActiveRecord::Base end later :cancel_all, :queue => :clone_build - def publish_success_builds - publish BuildList::SUCCESS, BuildList::FAILED_PUBLISH + def publish_success_builds(user) + publish user, BuildList::SUCCESS, BuildList::FAILED_PUBLISH end later :publish_success_builds, :queue => :clone_build - def publish_test_faild_builds - publish BuildList::TESTS_FAILED + def publish_test_faild_builds(user) + publish user, BuildList::TESTS_FAILED end later :publish_test_faild_builds, :queue => :clone_build private - def publish(*statuses) - build_lists.where(:status => statuses).order(:id).find_in_batches(:batch_size => 50) do |bls| + def publish(user, *statuses) + builds = build_lists.where(:status => statuses) + builds.update_all(:publisher_id => user.id) + builds.order(:id).find_in_batches(:batch_size => 50) do |bls| bls.each{ |bl| bl.can_publish? && bl.now_publish } end end From 852015f0d5cb56c0e3edcaba708f66e2b89d816a Mon Sep 17 00:00:00 2001 From: Vokhmin Alexey V Date: Tue, 2 Apr 2013 18:07:42 +0400 Subject: [PATCH 65/68] #53: send email notifications from publisher --- app/mailers/user_mailer.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/mailers/user_mailer.rb b/app/mailers/user_mailer.rb index 7c4c79f0a..b79be2446 100644 --- a/app/mailers/user_mailer.rb +++ b/app/mailers/user_mailer.rb @@ -62,7 +62,7 @@ class UserMailer < ActionMailer::Base mail( :to => email_with_name(user, user.email), :subject => subject, - :from => email_with_name(build_list.user) + :from => email_with_name(build_list.publisher || build_list.user) ) do |format| format.html end From 3a6e238209e0cd4dfabefb5596688ecba2c4c06c Mon Sep 17 00:00:00 2001 From: Vokhmin Alexey V Date: Tue, 2 Apr 2013 18:20:22 +0400 Subject: [PATCH 66/68] #53: rollback some changes, update ActivityFeedObserver according to Vladimir's comments --- app/models/activity_feed_observer.rb | 15 ++++++++------- .../partials/_build_list_notification.haml | 6 ------ .../user_mailer/build_list_notification.en.haml | 4 ---- .../user_mailer/build_list_notification.ru.haml | 4 ---- 4 files changed, 8 insertions(+), 21 deletions(-) diff --git a/app/models/activity_feed_observer.rb b/app/models/activity_feed_observer.rb index 17450f905..00baeee09 100644 --- a/app/models/activity_feed_observer.rb +++ b/app/models/activity_feed_observer.rb @@ -136,15 +136,17 @@ class ActivityFeedObserver < ActiveRecord::Observer end when 'BuildList' - if [BuildList::BUILD_PUBLISHED, + if ( record.status_changed? && + [BuildList::BUILD_PUBLISHED, BuildList::SUCCESS, BuildList::BUILD_ERROR, BuildList::PROJECT_VERSION_NOT_FOUND, BuildList::FAILED_PUBLISH, BuildList::TESTS_FAILED - ].include? record.status or - (record.status == BuildList::BUILD_PENDING && record.bs_id_changed?) + ].include?(record.status) + ) or (record.status == BuildList::BUILD_PENDING && record.bs_id_changed?) record.project.admins.each do |recipient| + user = record.publisher || record.user ActivityFeed.create( :user => recipient, :kind => 'build_list_notification', @@ -156,10 +158,9 @@ class ActivityFeedObserver < ActiveRecord::Observer :project_id => record.project_id, :project_name => record.project.name, :project_owner => record.project.owner.uname, - :user_name => record.user.name, - :user_email => record.user.email, - :user_id => record.user_id, - :publisher_fullname => record.publisher.try(:fullname) + :user_name => user.name, + :user_email => user.email, + :user_id => user.id } ) end diff --git a/app/views/activity_feeds/partials/_build_list_notification.haml b/app/views/activity_feeds/partials/_build_list_notification.haml index 882233ec5..9f1594004 100644 --- a/app/views/activity_feeds/partials/_build_list_notification.haml +++ b/app/views/activity_feeds/partials/_build_list_notification.haml @@ -14,12 +14,6 @@ - ['success', nil] - else ['failed', t("layout.build_lists.statuses.#{BuildList::HUMAN_STATUSES[status]}")] = raw t("notifications.bodies.build_status.#{message}", :error => error) - - publisher_fullname ||= nil - - if status == BuildList::BUILD_PUBLISHED && publisher_fullname.present? - .both - %span - = t('activerecord.attributes.build_list.publisher') - = publisher_fullname .both %span.date= updated_at .both diff --git a/app/views/user_mailer/build_list_notification.en.haml b/app/views/user_mailer/build_list_notification.en.haml index 982547a8b..afd0752d6 100644 --- a/app/views/user_mailer/build_list_notification.en.haml +++ b/app/views/user_mailer/build_list_notification.en.haml @@ -8,10 +8,6 @@ = @build_list.human_status for arch = "#{@build_list.arch.name}." -- if @build_list.build_published? && @build_list.publisher - %p - = t('activerecord.attributes.build_list.publisher') - = link_to @build_list.publisher.try(:fullname), user_url(@build_list.publisher) %p More detailed information you can get by link: = link_to "task [№ #{@build_list.bs_id ? @build_list.bs_id : t("layout.build_lists.bs_id_not_set")}]", build_list_url(@build_list) diff --git a/app/views/user_mailer/build_list_notification.ru.haml b/app/views/user_mailer/build_list_notification.ru.haml index 4ecd9da37..21401beaa 100644 --- a/app/views/user_mailer/build_list_notification.ru.haml +++ b/app/views/user_mailer/build_list_notification.ru.haml @@ -8,10 +8,6 @@ = @build_list.human_status для архитектуры = "#{@build_list.arch.name}." -- if @build_list.build_published? && @build_list.publisher - %p - = t('activerecord.attributes.build_list.publisher') - = link_to @build_list.publisher.try(:fullname), user_url(@build_list.publisher) %p Более подробную информацию можно получить по ссылке: = link_to "задание [№ #{@build_list.bs_id ? @build_list.bs_id : t("layout.build_lists.bs_id_not_set")}]", build_list_url(@build_list) From 7be2d6f6bc7c0cb1d84ac88ed1737fade17c997f Mon Sep 17 00:00:00 2001 From: Vokhmin Alexey V Date: Tue, 2 Apr 2013 18:59:00 +0400 Subject: [PATCH 67/68] fix product_build_list_spec --- spec/models/product_build_list_spec.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/spec/models/product_build_list_spec.rb b/spec/models/product_build_list_spec.rb index 0f5967d09..e62d51cae 100644 --- a/spec/models/product_build_list_spec.rb +++ b/spec/models/product_build_list_spec.rb @@ -4,6 +4,7 @@ require 'spec_helper' describe ProductBuildList do before do stub_symlink_methods + stub_redis FactoryGirl.create(:product_build_list) end From 69ffc52bf3dbdef665997e0c063541508443d6b0 Mon Sep 17 00:00:00 2001 From: Alexander Machehin Date: Wed, 3 Apr 2013 23:52:22 +0600 Subject: [PATCH 68/68] [#76] fix 404 error --- config/routes.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/routes.rb b/config/routes.rb index 49f8fcfc5..d1fa562ed 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -137,7 +137,7 @@ Rosa::Application.routes.draw do get :members post :remove_members # fixme: change post to delete delete :remove_member - put :add_member + post :add_member post :make_clone get :advisories end