[#369] new build list page without js & last builds table

This commit is contained in:
Alexander Machehin 2014-06-06 14:01:13 +06:00
parent ad49f62ce8
commit 737d8c99f3
11 changed files with 169 additions and 120 deletions

View File

@ -37,7 +37,8 @@ $mini-avatar-height: 30px;
}
}
.nav a, .pagination a, .carousel a, .panel-title a {
.nav a, .pagination a, .carousel a, .panel-title a, i.fa-question-circle[data-toggle='modal'],
span.fa.fa-times {
cursor: pointer;
}
@ -99,6 +100,11 @@ table tbody {
}
}
table.table-borderless > tbody > tr > td,
table.table-borderless > thead > tr > th {
border: 0;
}
.build-list {
.panel-heading {
.build-list-status {
@ -118,10 +124,6 @@ table tbody {
padding-bottom: 5px;
}
.table-borderless td,
.table-borderless th {
border: 0;
}
.advisory_preview {
td {
padding-top: 0;

View File

@ -1,5 +1,5 @@
class Projects::BuildListsController < Projects::BaseController
layout 'bootstrap', only: [:index, :show]
layout 'bootstrap', only: [:index, :show, :new]
include FileStoreHelper
NESTED_ACTIONS = [:index, :new, :create]

View File

@ -88,8 +88,8 @@ module GitHelper
def versions_for_group_select(project)
return [] unless project
[ ['Branches', project.repo.branches.map(&:name)],
['Tags', project.repo.tags.map(&:name)] ]
[ [I18n.t('layout.git.repositories.branches'), project.repo.branches.map(&:name)],
[I18n.t('layout.git.repositories.tags'), project.repo.tags.map(&:name)] ]
end
def split_commits_by_date(commits)

View File

@ -1,18 +1,37 @@
- content_for :submenu do
- act = action_name.to_sym; contr = controller_name.to_sym; treeish = @project.default_head(params[:treeish])
.left
.table-sort-left=image_tag visibility_icon(@project.visibility)
.table-sort-right=@project.name
%nav
%ul
%li= link_to t("project_menu.code"), tree_path(@project, treeish), class: (act.in?([:show, :edit, :branches, :tags]) && contr.in?([:trees, :blobs]) || contr == :commits ? 'active' : nil)
%nav.navbar.navbar-default{ role: 'navigation' }
.container-fluid
/ Brand and toggle get grouped for better mobile display
.navbar-header
%button.navbar-toggle{ 'data-target' => '#submenu-navbar-collapse', 'data-toggle' => 'collapse', type: 'button' }
%span.sr-only Toggle navigation
%span.icon-bar
%span.icon-bar
%span.icon-bar
= link_to project_path(@project), class: 'navbar-brand' do
= fa_visibility_icon @project
= @project.name_with_owner
/ Collect the nav links, forms, and other content for toggling
#submenu-navbar-collapse.collapse.navbar-collapse
%ul.nav.navbar-nav.left-border
%li{ class: ('active' if act.in?([:show, :edit, :branches, :tags]) && contr.in?([:trees, :blobs]) || contr == :commits) }
= link_to t('project_menu.code'), tree_path(@project, treeish)
- if @project.is_package and can?(:read, @project => BuildList)
%li= link_to t("project_menu.builds"), project_build_lists_path(@project), class: (contr == :build_lists ? 'active' : nil)
%li{ class: ('active' if contr == :build_lists) }
= link_to t('project_menu.builds'), project_build_lists_path(@project)
- if @project.has_issues
%li= link_to t("project_menu.tracker", count: @opened_issues_count), project_issues_path(@project), class: (contr == :issues ? 'active' : nil)
%li=link_to t("project_menu.pull_requests", count: @opened_pull_requests_count), project_pull_requests_path(@project), class: (contr == :pull_requests ? 'active' : nil)
%li{ class: ('active' if contr == :issues) }
= link_to t('project_menu.tracker', count: @opened_issues_count), project_issues_path(@project)
%li{ class: ('active' if contr == :pull_requests) }
=link_to t('project_menu.pull_requests', count: @opened_pull_requests_count), project_pull_requests_path(@project)
- if @project.has_wiki
%li= link_to t("project_menu.wiki"), project_wiki_index_path(@project), class: (contr == :wiki ? 'active' : nil)
%li=# link_to t("project_menu.readme"), "#" #pending
%li{ class: ('active' if contr == :wiki) }
= link_to t('project_menu.wiki'), project_wiki_index_path(@project)
%li=# link_to t('project_menu.readme'), '#' #pending
- if can? :update, @project
%li= link_to t("project_menu.settings"), edit_project_path(@project), class: (act == :edit && contr == :projects ? 'active' : nil)
%li{ class: ('active' if act == :edit && contr == :projects) }
= link_to t('project_menu.settings'), edit_project_path(@project)
/ /.navbar-collapse
/ /.container-fluid

View File

@ -1,9 +1,10 @@
- Repository.custom_sort(platform.repositories).each do |repo|
.both
- if params[:build_list].try(:[], :include_repos).present?
- checked = (params[:build_list].try(:[], :include_repos).map(&:to_s) || []).include?(repo.id.to_s)
- else checked = false
.checkbox
%label
= check_box_tag 'build_list[include_repos][]', repo.id, checked,
disabled: ((params[:build_list].try(:[], :build_for_platform_id).to_i != platform.id) && @build_list.build_for_platform.try(:main?)),
id: "include_repos_#{repo.id}", rep_name: repo.name
= label_tag "include_repos_#{repo.id}", repo.name
= repo.name

View File

@ -1,9 +1,12 @@
.all
%h3= t 'layout.build_lists.last_build_lists'
%h4= t 'layout.relations.filters'
.both
= check_box_tag :owner_filter_build_lists, true, (params[:owner_filter] || 'true') == 'true'
= label_tag t('layout.build_lists.only_my_build_lists')
.checkbox
%label
= check_box_tag :owner_filter_build_lists, true, (params[:owner_filter] || 'true') == 'true',
class: 'form-control'
= t 'layout.build_lists.only_my_build_lists'
.both
= check_box_tag :status_filter_build_lists, true, (params[:status_filter] || 'true') == 'true'
= label_tag t('layout.build_lists.failed_build_lists')

View File

@ -1,26 +1,29 @@
= form_for [@project, @build_list], html: { class: :form, method: :post } do |f|
%section.left
%h3= t("activerecord.attributes.build_list.build_for_platform")
= form_for [@project, @build_list], html: { class: 'form', method: :post } do |f|
.row
.col-md-4.col-md-offset-2
%h3= t 'activerecord.attributes.build_list.build_for_platform'
.all_platforms
- availables_main_platforms.each do |pl|
.both
%div{id: "build_for_pl_#{pl.id}", class: 'build_for_pl'}= pl.name
.offset25= render 'include_repos', platform: pl
%section.right
%h3= t('activerecord.attributes.build_list.save_to_repository')
.clearfix
%h4{id: "build_for_pl_#{pl.id}", class: 'build_for_pl'}= pl.name
= render 'include_repos', platform: pl
.col-md-5
%h3= t 'activerecord.attributes.build_list.save_to_repository'
- selected = params[:build_list].try(:[], :save_to_repository_id) ? {selected: params[:build_list][:save_to_repository_id]} : {}
.lineForm= f.select :save_to_repository_id, save_to_repositories(project), selected
%h3= t("activerecord.attributes.build_list.project_version")
.lineForm= f.select :project_version, versions_for_group_select(project), selected: params[:build_list].try(:[], :project_version) || project.default_branch
%h3= t("activerecord.attributes.build_list.arch")
= f.select :save_to_repository_id, save_to_repositories(project), selected, class: 'form-control'
%h3= t 'activerecord.attributes.build_list.project_version'
= f.select :project_version, versions_for_group_select(project), {selected: params[:build_list].try(:[], :project_version) || project.default_branch}, class: 'form-control'
%h3= t 'activerecord.attributes.build_list.arch'
- Arch.recent.each do |arch|
.both
- checked = (params[:arches]||[]).include?(arch.id.to_s) || (params[:arches].blank? && controller.action_name == 'new' && Arch::DEFAULT.include?(arch.name))
.checkbox
%label{ for: "arches_#{arch.id}" }
= check_box_tag "arches[]", arch.id, checked, id: "arches_#{arch.id}"
= label_tag "arches_#{arch.id}", arch.name
%h3= t('activerecord.attributes.build_list.update_type')
= arch.name
%h3= t 'activerecord.attributes.build_list.update_type'
- selected = params[:build_list].try(:[], :update_type) ? {selected: params[:build_list][:update_type]} : {}
.lineForm= f.select :update_type, BuildList::UPDATE_TYPES, selected
= f.select :update_type, BuildList::UPDATE_TYPES, selected, class: 'form-control'
= render 'shared/autocomplete_form',
field: :extra_repositories,
@ -36,30 +39,33 @@
subject: build_list,
autocomplete_path: autocomplete_extra_build_list_autocompletes_path
%h3= t('activerecord.attributes.build_list.extra_params.label')
%h3= t 'activerecord.attributes.build_list.extra_params.label'
- BuildList::EXTRA_PARAMS.each do |field|
- text = params[:build_list].try(:[], :extra_params).try(:[], field)
= text_field_tag "build_list[extra_params][#{field}]", text, placeholder: t("activerecord.attributes.build_list.extra_params.#{field}"), class: 'full-size'
.both
.form-group
= text_field_tag "build_list[extra_params][#{field}]", text,
placeholder: t("activerecord.attributes.build_list.extra_params.#{field}"), class: 'form-control'
%h3= t("activerecord.attributes.build_list.preferences")
%h3= t 'activerecord.attributes.build_list.preferences'
.row
= f.label :auto_publish_status, class: 'col-xs-6'
= f.label :external_nodes, class: 'col-xs-6'
.clearfix
- selected = params[:build_list].try(:[], :auto_publish_status) ? {selected: params[:build_list][:auto_publish_status]} : {}
= f.select :auto_publish_status, auto_publish_statuses, selected
= f.label :auto_publish_status
.col-xs-6
= f.select :auto_publish_status, auto_publish_statuses, selected, class: 'form-control'
.col-xs-6
- selected = params[:build_list].try(:[], :external_nodes) ? {selected: params[:build_list][:external_nodes]} : {}
= f.select :external_nodes, external_nodes, selected.merge(include_blank: true), class: 'form-control'
- %i(auto_create_container include_testing_subrepository use_cached_chroot use_extra_tests).each do |kind|
.both
.checkbox
%label{ for: kind }
- checked = params[:build_list].try(:[], kind)
- checked = @build_list.send(kind) if checked.nil?
= f.check_box kind, checked: checked
= f.label kind
.both
- selected = params[:build_list].try(:[], :external_nodes) ? {selected: params[:build_list][:external_nodes]} : {}
= f.select :external_nodes, external_nodes, selected.merge(include_blank: true)
= f.label :external_nodes
.both
= BuildList.human_attribute_name kind
%br
= hidden_field_tag :from_build_list_id, params[:build_list_id] if params[:build_list_id].present?
= f.submit t('layout.projects.build_button'), data: {'disable-with' => t('layout.processing')}
.both
= f.submit t('layout.projects.build_button'), data: {'disable-with' => t('layout.processing')},
class: 'btn btn-primary'

View File

@ -1,4 +1,5 @@
-set_meta_tags title: [title_object(@project), t('layout.build_lists.new_header')]
.container
#new_form= render 'new_form', project: @project, build_list: @build_list
%br
= render 'last_build_lists', project: @project

View File

@ -9,32 +9,47 @@
- default_values ||= []
- subject_class = subject.class.name.underscore
.modal.fade{ id: "#{field}_dialog", tabindex: '-1', role: 'dialog', 'aria-labelledby' => "myModalLabel",
'aria-hidden' => 'true'}
.modal-dialog
.modal-content
.modal-header
%button{ type: 'button', class: 'close', 'data-dismiss' => 'modal', 'aria-hidden' => 'true' } &times;
%h4.modal-title= t "activerecord.attributes.build_list.#{field}"
.modal-body= render "shared/autocomplete_docs/#{field}"
.modal-footer
%button.btn.btn-default{ type: 'button', 'data-dismiss' => 'modal' }= t 'close'
.autocomplete-form{subject_class: subject_class, field: field, path: autocomplete_path, class: field}
%h3= t("activerecord.attributes.build_list.#{field}")
%span.icon-question-sign
- if !(params[:show] == 'inline' && params[:build_list_id].present?)
.dialog{title: t("activerecord.attributes.build_list.#{field}"), id: "#{field}_dialog"}
= render "shared/autocomplete_docs/#{field}"
.both
= autocomplete_field_tag field, nil, "#{autocomplete_path}?#{{platform_id: subject.save_to_platform.try(:id)}.to_param}", placeholder: placeholder, class: 'autocomplete', update_elements: {id: "##{field}_field", path: "##{field}_field_path", label: "##{field}_field_label"}
%h3
= t "activerecord.attributes.build_list.#{field}"
%i.fa.fa-question-circle{ 'data-toggle' => 'modal', 'data-target' => "##{field}_dialog" }
.row
= hidden_field_tag field, nil, id: "#{field}_field"
= hidden_field_tag field, nil, id: "#{field}_field_path"
= hidden_field_tag field, nil, id: "#{field}_field_label"
= submit_tag t('layout.add'), class: 'button add'
.col-xs-6
.form-group
= autocomplete_field_tag field, nil,
"#{autocomplete_path}?#{{platform_id: subject.save_to_platform.try(:id)}.to_param}",
placeholder: placeholder, class: 'autocomplete form-control',
update_elements: { id: "##{field}_field", path: "##{field}_field_path", label: "##{field}_field_label" }
.col-xs-2= submit_tag t('layout.add'), class: 'btn btn-default add'
%table.tablesorter{cellpadding: "0", cellspacing: "0"}
%table.table.table-bordered
%tbody
- field_name = "#{subject_class}[#{field}][]"
- field_class.where(id: params[:build_list].try(:[], field) ).each do |extra|
%tr
%td
- if extra.is_a?(BuildList)
%td= link_to "#{extra.id} (#{extra.project.name} - #{extra.arch.name})", extra
= link_to "#{extra.id} (#{extra.project.name} - #{extra.arch.name})", extra
- else
%td= link_to "#{extra.platform.name}/#{extra.name}", [extra.platform, extra]
%td.actions
= link_to "#{extra.platform.name}/#{extra.name}", [extra.platform, extra]
- field = extra.is_a?(BuildList) ? 'extra_build_lists' : 'extra_repositories'
= hidden_field_tag field_name, extra.id
%span.delete &nbsp;
.actions.pull-right
%span.fa.fa-times.fa-lg.delete.text-danger
.default-values
- field_class.where(id: default_values).each do |extra|
.hidden{:label => "#{extra.platform.name}/#{extra.name}",

View File

@ -196,3 +196,4 @@ en:
reset: Reset
_on: 'On'
until: Until
close: Close

View File

@ -196,3 +196,4 @@ ru:
reset: Сброс
_on: с
until: по
close: Закрыть