Skip to content

Commit

Permalink
Merge 2.11.0
Browse files Browse the repository at this point in the history
  • Loading branch information
DerekEdwards committed Sep 18, 2020
2 parents 317739e + b2313df commit bdad33a
Show file tree
Hide file tree
Showing 7 changed files with 343 additions and 143 deletions.
2 changes: 2 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ branches:
only:
- master
- /quarter\d*/
- develop
- /2.\d*.\d*/
env:
- TEST_SUITE=rspec RAILS_VERSION=4.1.9
script:
Expand Down
8 changes: 7 additions & 1 deletion app/controllers/grants_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,13 @@ def update
format.json { head :no_content }
else
format.html { render action: 'edit' }
format.json { render json: @grant.errors, status: :unprocessable_entity }

if params[:is_xeditable]
format.json { render json: {errors: @grant.errors}, status: :ok }
else
format.json { render json: @grant.errors, status: :unprocessable_entity }
end

end
end
end
Expand Down
216 changes: 146 additions & 70 deletions app/views/funding_sources/_index_table.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -2,71 +2,147 @@
table_dom_id = SecureRandom.hex
show_actions ||= 0

#subheader-label
%h2 Programs

- if show_actions == 1
#programs_table_actions.btn-toolbar
= render :partial => "funding_sources/index_actions"

.table-responsive
%table.table.table-hover{:id => table_dom_id, :data => {:toggle => 'table',
:pagination => 'true',
:show_pagination_switch => 'false',
:page_list => "5, 10, 20, 50, 100, 200, 10000]",
:page_size => current_user.num_table_rows,
:search => 'false',
:toolbar => "#programs_table_actions",
:export_types => "['csv', 'txt', 'excel']",
:show_export => 'true',
:show_columns => 'true',
:cookie => 'true',
:cookie_id_table => "funding_sources_id",
:cookie_expire => "1y"}}

%thead
%tr
%th.center{:data => {:visible => 'false'}} Object Key
%th.center{:data => {:visible => 'false', :sortable => 'true'}} External ID
%th.center{:data => {:sortable => 'true'}} Name
%th.center{:data => {:sortable => 'true'}} Source

%th.center{:data => {:sortable => 'true'}} Type
%th.center{:data => {:sortable => 'true', :formatter => 'percentage_formatter'}} Inflation Rate

%th.center{:data => {:sortable => 'true'}} Life of $ (yrs)
%th.center{:data => {:sortable => 'true', :formatter => 'percentage_formatter'}} Pcnt Match

%th.center{:data => {:sortable => 'true'}} Valid From
%th.center{:data => {:sortable => 'true'}} Valid To

%th

%tbody
- funding_sources.each do |f|
%tr{:id => f.object_key, :class => 'action-path'}
%td.left= f.object_key
%td.left= f.external_id
=# add whitespace so always read as text and not number. JS plugin trims later
%td.left{data: {tableexport: {msonumberformat: "\\@", value: "#{f.name} "}}}
= f.name
%td.left= f.funding_source_type

%td.center= f.formula_fund.present? ? 'Formula' : (f.discretionary_fund.present? ? 'Discretionary' : 'Unknown')
%td.right= f.inflation_rate.present? ? f.inflation_rate : ''

%td.center= format_as_integer(f.life_in_years)
%td.right= f.match_required

%td.center= format_as_fiscal_year(f.fy_start)
%td.center= format_as_fiscal_year(f.fy_end)

%td.center.nowrap{:data => {:field => 'action-cell'}}
%a.transam-popover{data: {placement: 'left', toggle: 'popover', html: 'true', content: "#{f.description}<br>#{f.details}"}, title: 'Details', tabindex: '0'}
%i.fa.fa-info-circle
- if can? :update, f
= link_to edit_funding_source_path(f), :class => "button btn-xs", :title => "Edit program" do
%i.fa.fa-edit.fa-1-5x.text-success
- if (can? :destroy, f) && f.deleteable?
= link_to funding_source_path(f), :method => :delete, :data => {:confirm => "Are you sure? The action cannot be undone."} do
%i.fa.fa-trash-o.fa-fw.text-danger



= javascript_include_tag "https://kit.fontawesome.com/#{ENV['FONT_AWESOME']}.js"
.library-table
%table.elbat{:id => table_dom_id,
:use => 'true',
:data => {:use => 'true',
:table_code => 'programs',
:side => 'client',
:current_page => '0',
:current_page_size => '10',
:page_sizes => "10,20,50,100",
:search => 'client',
:export => "['csv', 'txt']",
:columns => '{"name":{"name":"Program Name","type":"drilldown-link","width":"25%"},
"1":{"name":"Source","width":"12%"},
"2":{"name":"Program Type","width":"15%"},
"3":{"name":"Inflation Rate","width":"10%"},
"4":{"name":"Life of $ (yrs)","width":"10%"},
"5":{"name":"% Match","width":"10%"},
"6":{"name":"Valid From","width":"10%"},
"7":{"name":"Valid To","width":"10%"},
"8":{"name":"Description","width":"10%"},
"9":{"name":"Details","width":"8%"},
"10":{"name":"External ID","width":"10%"},
"11":{"name":"Object Key","width":"12%"},
"12":{"name":"Actions","type":"action-column","width":"15%"}}',
:selected_columns => "name,1,2,3,4,5,6,7,12",
:cookies => "true",
:sort => 'client',
:params => "{}",
:filter => "[]",
:data_source => 'client',
:url => ''}}
- funding_sources.each_with_index do |f, index|
%div.actions
%a.transam-popover{data: {placement: 'left', toggle: 'popover', html: 'true', content: "#{f.description}<br>#{f.details}"}, title: 'Details', tabindex: '0'}
%i.fa.fa-info-circle
- if can? :update, f
= link_to edit_funding_source_path(f), :class => "button btn-xs", :title => "Edit program" do
%i.fa.fa-edit.fa-1-5x.text-success
- if (can? :destroy, f) && f.deleteable?
= link_to funding_source_path(f), :method => :delete, :data => {:confirm => "Are you sure? The action cannot be undone."} do
%i.fa.fa-trash-o.fa-fw.text-danger

:javascript
add_row('#{table_dom_id}',
{
"name": '#{h link_to f.name, funding_source_path(f) }',
"1": '#{h f.funding_source_type }',
"2": '#{h f.formula_fund.present? ? "Formula" : (f.discretionary_fund.present? ? "Discretionary" : "Unknown") }',
"3": '#{h f.inflation_rate.present? ? format_as_percentage(f.inflation_rate, 3) : "" }',
"4": '#{h format_as_integer(f.life_in_years) }',
"5": '#{h format_as_percentage(f.match_required, 3) }',
"6": '#{h format_as_fiscal_year(f.fy_start) }',
"7": '#{h format_as_fiscal_year(f.fy_end) }',
"8": '#{h f.description }',
"9": '#{h f.details }',
"10": '#{h f.external_id }',
"11": '#{h f.object_key }',
}, #{index});
// TEMP UNTIL WE DO THIS FOR REAL
// TODO: PLEASE DON'T LET THIS GO TO PRODUCTION
// HACKY HACK IS HACKY
add_aux_queue('#{table_dom_id}',()=>$(".actions").eq(#{index}).detach().appendTo($("##{table_dom_id} .action-column").eq(#{index}).find(".cell-text")));






-# .table-responsive
-# %table.table.table-hover{:id => table_dom_id, :data => {:toggle => 'table',
-# :pagination => 'true',
-# :show_pagination_switch => 'false',
-# :page_list => "5, 10, 20, 50, 100, 200, 10000]",
-# :page_size => current_user.num_table_rows,
-# :search => 'false',
-# :toolbar => "#programs_table_actions",
-# :export_types => "['csv', 'txt', 'excel']",
-# :show_export => 'true',
-# :show_columns => 'true',
-# :cookie => 'true',
-# :cookie_id_table => "funding_sources_id",
-# :cookie_expire => "1y"}}
-# %thead
-# %tr
-# %th.center{:data => {:visible => 'false'}} Object Key
-# %th.center{:data => {:visible => 'false', :sortable => 'true'}} External ID
-# %th.center{:data => {:sortable => 'true'}} Name
-# %th.center{:data => {:sortable => 'true'}} Source
-# %th.center{:data => {:sortable => 'true'}} Type
-# %th.center{:data => {:sortable => 'true', :formatter => 'percentage_formatter'}} Inflation Rate
-# %th.center{:data => {:sortable => 'true'}} Life of $ (yrs)
-# %th.center{:data => {:sortable => 'true', :formatter => 'percentage_formatter'}} Pcnt Match
-# %th.center{:data => {:sortable => 'true'}} Valid From
-# %th.center{:data => {:sortable => "content":
-# %th
-# %tbody
-# - funding_sources.each do |f|
-# %tr{:id => f.object_key, :class => 'action-path'}
-# %td.left= f.object_key
-# %td.left= f.external_id
-# =# add whitespace so always read as text and not number. JS plugin trims later
-# %td.left{data: {tableexport: {msonumberformat: "\\@", value: "#{f.name} "}}}
-# = f.name
-# %td.left= f.funding_source_type
-# %td.center= f.formula_fund.present? ? 'Formula' : (f.discretionary_fund.present? ? 'Discretionary' : 'Unknown')
-# %td.right= f.inflation_rate.present? ? f.inflation_rate : ''
-# %td.center= format_as_integer(f.life_in_years)
-# %td.right= f.match_required
-# %td.center= format_as_fiscal_year(f.fy_start)
-# %td.center= format_as_fiscal_year(f.fy_end)
-# %td.center.nowrap{:data => {:field => 'action-cell'}}
-# %a.transam-popover{data: {placement: 'left', toggle: 'popover', html: 'true', content: "#{f.description}<br>#{f.details}"}, title: 'Details', tabindex: '0'}
-# %i.fa.fa-info-circle
-# - if can? :update, f
-# = link_to edit_funding_source_path(f), :class => "button btn-xs", :title => "Edit program" do
-# %i.fa.fa-edit.fa-1-5x.text-success
-# - if (can? :destroy, f) && f.deleteable?
-# = link_to funding_source_path(f), :method => :delete, :data => {:confirm => "Are you sure? The action cannot be undone."} do
-# %i.fa.fa-trash-o.fa-fw.text-danger
= render 'shared/table_formatters'

Expand All @@ -80,12 +156,12 @@
$('.transam-tooltip').tooltip();
});

$('#' + '#{table_dom_id}').on('click', 'td', function () {
var path = "#{funding_source_path('xxx')}";
var row = $(this).parent('tr').attr('id');

if ($(this).attr('data-field') != 'action-cell') {
var url = path.replace("xxx", row);
document.location.href = url;
}
});
//$('#' + '#{table_dom_id}').on('click', 'td', function () {
// var path = "#{funding_source_path('xxx')}";
// var row = $(this).parent('tr').attr('id');
//
// if ($(this).attr('data-field') != 'action-cell') {
// var url = path.replace("xxx", row);
// document.location.href = url;
// }
//});
Loading

0 comments on commit bdad33a

Please sign in to comment.