From bbb4739c9bad85cc9fadbc802dc17109ab1eb433 Mon Sep 17 00:00:00 2001 From: blinblinblin Date: Mon, 6 Mar 2017 20:57:05 -0500 Subject: [PATCH] Added Placeholder value for receiving participant when updating charges (#239) * created unit test for organization model. almost done * switching to goat branch to checkout akshay's commit * begining to modify test class for organization_alias_class. trying to merge rumby's modification on factories into my test branch * finished creating test class for organization_alias model. Everything functions properly * updated test for organization_category model. Everything functions properly * created new factory for organization_status_type. created a new test class for orgniazation_status but have been getting error message: factory not registered. Will come back to this later * fixed error! added organization_status to the factory file. test for organization_status now passed! * checking Rumby's PR. commiting before switching to goat * fixed previous file name error. Test for organization_status_type passed * finished up organization_timeline_entry test. removed duplicate schema comment in the status_type * updated organization test to include dependency testing * did some refactoring on organization_alias model and test * created test function for downtime methods * fixed syntax for org_category test. added test case for dependency * fixed minor syntax in test case for org_status and org_status_type * added test case for membership * added test case for judge, judgement, judgement_category * somehow event_type_test got updated with a new schema entry. Saving change before checking out akshay's unit tests * updated TravisCI's timezone to US Eastern time, which should match with the built in timezone indicated in application.rb * changed TRAVIS CI Setting to eastern time * trying to see if this fix for time works * travis yml syntax incorrect in the previous commit. just fixed it now. Hopefully this works * travis could not load timezone data. trying a different method * both attempts failed. reverted back to master branch version of travis configuration. Will create an issue * added redirect back to organization as a temporary solution for bug #201 * made modification to the charge param and fixed odd behavior, described in issue #202 * added placeholder value so that the receiving_participant does not seem to disappear * Update .travis.yml * Update event_type_test.rb --- app/controllers/charges_controller.rb | 6 ++++-- app/views/charges/_form.html.erb | 5 ++++- test/unit/event_type_test.rb | 3 ++- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/app/controllers/charges_controller.rb b/app/controllers/charges_controller.rb index e87c2e17..0259c3bb 100644 --- a/app/controllers/charges_controller.rb +++ b/app/controllers/charges_controller.rb @@ -59,6 +59,7 @@ def new # GET /charges/1/edit def edit + @current_receiving_participant = @charge.receiving_participant.nil? ? "" : @charge.receiving_participant.formatted_name end # POST /charges @@ -76,7 +77,7 @@ def create # PUT /charges/1.json def update @charge.is_approved = false - @charge.update(charge_params) + @charge.update_attributes(charge_params) respond_with(@charge) end @@ -96,7 +97,8 @@ def destroy def approve @charge.is_approved = !@charge.is_approved @charge.save - respond_with @charge, location: -> {charges_path} + + respond_with(@charge, location: @charge.organization) end private diff --git a/app/views/charges/_form.html.erb b/app/views/charges/_form.html.erb index 374d0e3d..2b7648d1 100644 --- a/app/views/charges/_form.html.erb +++ b/app/views/charges/_form.html.erb @@ -20,11 +20,14 @@ When adding a charge, please ensure that you add a detailed description. This al <%= f.input_field :amount, :as => :string %> <% end %> + <%= f.input :description, :as => :text, textarea: "{ font-size:16px; }" %> + <%= f.association :issuing_participant, :collection => Participant.scc %> + <%= f.input :receiving_participant do %> <%= f.input_field :receiving_participant_id, as: :hidden %> - <%= text_field_tag 'card-number-input', nil, class: 'form-control' %> + <%= text_field_tag 'card-number-input', nil, placeholder: @current_receiving_participant, class: 'form-control'%>
<% end %> diff --git a/test/unit/event_type_test.rb b/test/unit/event_type_test.rb index 7c3a828c..2d2877ab 100644 --- a/test/unit/event_type_test.rb +++ b/test/unit/event_type_test.rb @@ -9,6 +9,7 @@ # **`display`** | `boolean` | # **`id`** | `integer` | `not null, primary key` # **`name`** | `string(255)` | +# **`priority`** | `integer` | # class EventTypeTest < ActiveSupport::TestCase @@ -16,4 +17,4 @@ class EventTypeTest < ActiveSupport::TestCase should have_many(:events) -end \ No newline at end of file +end