2013-06-06 19:57:36 +01:00
|
|
|
-#
|
2013-06-04 20:59:08 +01:00
|
|
|
Variables:
|
2013-06-06 19:57:36 +01:00
|
|
|
subject
|
|
|
|
field
|
|
|
|
field_class
|
|
|
|
autocomplete_path
|
|
|
|
placeholder
|
|
|
|
default_values (optional)
|
2013-06-04 20:59:08 +01:00
|
|
|
|
2013-06-06 19:57:36 +01:00
|
|
|
- default_values ||= []
|
2013-06-04 20:59:08 +01:00
|
|
|
- subject_class = subject.class.name.underscore
|
2014-01-21 04:51:49 +00:00
|
|
|
.autocomplete-form{subject_class: subject_class, field: field, path: autocomplete_path, class: field}
|
2013-06-04 20:59:08 +01:00
|
|
|
%h3= t("activerecord.attributes.build_list.#{field}")
|
|
|
|
%span.icon-question-sign
|
2013-08-05 19:34:42 +01:00
|
|
|
- if !(params[:show] == 'inline' && params[:build_list_id].present?)
|
2014-01-21 04:51:49 +00:00
|
|
|
.dialog{title: t("activerecord.attributes.build_list.#{field}"), id: "#{field}_dialog"}
|
2013-08-05 19:34:42 +01:00
|
|
|
= render "shared/autocomplete_docs/#{field}"
|
2013-06-04 20:59:08 +01:00
|
|
|
.both
|
2014-01-21 04:51:49 +00:00
|
|
|
= 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"}
|
|
|
|
= 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'
|
2013-06-04 20:59:08 +01:00
|
|
|
|
2014-01-21 04:51:49 +00:00
|
|
|
%table.tablesorter{cellpadding: "0", cellspacing: "0"}
|
2013-06-04 20:59:08 +01:00
|
|
|
%tbody
|
2013-06-06 19:57:36 +01:00
|
|
|
- field_name = "#{subject_class}[#{field}][]"
|
2014-01-21 04:51:49 +00:00
|
|
|
- field_class.where(id: params[:build_list].try(:[], field) ).each do |extra|
|
2013-06-04 20:59:08 +01:00
|
|
|
%tr
|
|
|
|
- if extra.is_a?(BuildList)
|
|
|
|
%td= 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
|
|
|
|
- field = extra.is_a?(BuildList) ? 'extra_build_lists' : 'extra_repositories'
|
2013-06-06 19:57:36 +01:00
|
|
|
= hidden_field_tag field_name, extra.id
|
|
|
|
%span.delete
|
|
|
|
.default-values
|
2014-01-21 04:51:49 +00:00
|
|
|
- field_class.where(id: default_values).each do |extra|
|
2013-06-06 19:57:36 +01:00
|
|
|
.hidden{:label => "#{extra.platform.name}/#{extra.name}",
|
|
|
|
:path => url_for([extra.platform, extra]),
|
2014-01-21 04:51:49 +00:00
|
|
|
:name => field_name, value: extra.id}
|
2013-06-06 19:57:36 +01:00
|
|
|
|
|
|
|
|