Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Minor changes

  • Loading branch information...
commit a9403cf0c7a713025660bef25109ee957202635d 1 parent ece2d81
@ivik authored
View
8 app/assets/javascripts/transactions.js
@@ -19,7 +19,11 @@ $(document).ready(function() {
// update transaction modal footer button
$('#update_transaction_button').live('click', function() {
- document.forms[".edit_transaction"].submit();
+ $('transaction_form').submit();
+ //var f_container = document.getElementsByName('form_for_transaction');
+ //f_container.form.submit();
+
+ //document.forms[".edit_transaction"].submit();
});
// get sub_category when category changes
@@ -98,7 +102,7 @@ function get_sub_categories_ajax(category_id) {
if(sub_categories.length != 0) {
- s_container = document.getElementById('sub_category_container');
+ var s_container = document.getElementById('sub_category_container');
var s = document.createElement("select");
s.id = "sub_category_id";
View
11 app/controllers/transactions_controller.rb
@@ -1,6 +1,6 @@
class TransactionsController < ApplicationController
- before_filter :get_user_categories, only: [:new, :edit]
+ before_filter :get_user_categories, only: [:new, :edit, :create]
def get_sub_categories
#params.o
@@ -61,17 +61,16 @@ def create
#params.o
month = Month.find(params[:id])
- category = Category.find(params[:transaction][:category])
-
@transaction = Transaction.new(date: params[:transaction][:date],
month: month,
- category: category,
amount: params[:transaction][:amount],
is_expense: params[:transaction][:is_expense])
+ if params[:transaction][:category]
+ @transaction.transaction = Category.find(params[:transaction][:category])
+ end
if params[:transaction][:sub_category]
- sub_category = SubCategory.find(params[:transaction][:sub_category])
- @transaction.sub_category= sub_category
+ @transaction.sub_category = SubCategory.find(params[:transaction][:sub_category])
end
#@transaction.o
View
2  app/views/transactions/edit.html.haml
@@ -1,7 +1,7 @@
- provide(:title, "Edit transaction")
- if @display_molad == "1"
.span3.offset1
- = form_for(@transaction) do |f|
+ = form_for(@transaction, html: {:name => 'transaction_form'} ) do |f|
= render 'shared/error_messages', object: f.object
= render 'form', :f => f
-else
Please sign in to comment.
Something went wrong with that request. Please try again.