Created
December 7, 2016 22:48
-
-
Save Willardgmoore/3717c93027f6bacf004b208b33ac2bda to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
table | |
tr | |
th Paypoint | |
th Vendor | |
- @item_groups_by_cost_code = Hash[template.item_groups.group_by{|item_group| item_group.cost_code}.sort_by{|k, v| k.number}] | |
- @item_groups_by_cost_code.each do |cost_code, item_groups| | |
tr | |
td colspan='2' style='font-size: 14px;' = "#{cost_code.number} - #{cost_code.description}" | |
- item_groups.each do |item_group| | |
tr | |
td style='text-indent: 12px;' = item_group.name | |
td | |
- project_preferred_vendor = ProjectPreferredVendor.where(project_id: project.id, template_id: template.id, budget_item_group_id: item_group.id).first | |
= simple_form_for (project_preferred_vendor || ProjectPreferredVendor.new), :format => :json, :remote => true do |f| | |
= f.input :project_id, :as => :hidden, :input_html => { :value => project.id } | |
= f.input :template_id, :as => :hidden, :input_html => { :value => template.id } | |
= f.association :budget_item_group, :as => :hidden, :input_html => { :value => item_group.id } | |
= f.association :vendor, :label => false, :input_html => { :class => 'chosen-select' } | |
br | |
coffee: | |
jQuery(document).ready -> | |
jQuery(".chosen-select").chosen | |
search_contains: true | |
placeholder_text_single: "Select a vendor" | |
jQuery(".chosen-select").on "change", (event, params) -> | |
jQuery(event.target).parents("form").submit() | |
jQuery(".new_project_preferred_vendor").on("ajax:success", (event, data, status, xhr) -> | |
form = jQuery(event.target) | |
form.attr('action', '/project_preferred_vendors/' + data.project_preferred_vendor.id + '.json') | |
form.attr('method', 'put') | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment