Skip to content

Instantly share code, notes, and snippets.

View guipdutra's full-sized avatar

Guilherme Dutra guipdutra

View GitHub Profile
class PledgeCancellation < Accounting::Model
include Accountable
extend ActiveRecord::DescriptorScope
attr_accessible :pledge_id, :date, :reason, :amount, :nature,
:leftover_pledge_cancellation, :regulatory_act_id,
:amount_annulled_processed, :amount_annulled_unprocessed
attr_readonly :descriptor_id
defmodule Mylist do
def filter([], func, f_array), do: f_array
def filter([head|tail], func, f_array // []) do
if func.(head) do
filter(tail, func, List.concat(f_array , [head]))
else
filter(tail, func, List.concat(f_array , []))
end
end
# encoding: utf-8
require 'spec_helper'
require 'model_helper'
describe BudgetAllocationCapabilityChange do
describe '#update_budget_allocation_capability' do
context "when capability has movements" do
it "returns error" do
capability = Capability.make!(:reforma, :pledges => [Pledge.make!(:empenho)])
budget = BudgetAllocationCapabilityChange.create(:budget_allocation_id => BudgetAllocation.make(:alocacao).id,
class BudgetAllocation < Accounting::Model
include Accountable
extend ActiveRecord::DescriptorScope
attr_accessible :budget_structure_id, :date, :subfunction_id,
:government_program_id, :personal,
:government_action_id, :foresight, :education,
:expense_nature_id, :kind, :debt_type,
:budget_allocation_type_id, :refinancing, :health,
class BudgetAllocationCapability < Accounting::Model
attr_accessible :amount, :capability_id
attr_modal :capability_description
belongs_to :budget_allocation
belongs_to :capability
delegate :description, :to => :capability, :allow_nil => true, :prefix => true
class BudgetAllocation < Accounting::Model
include Accountable
extend ActiveRecord::DescriptorScope
attr_accessible :budget_structure_id, :date, :subfunction_id,
:government_program_id, :personal,
:government_action_id, :foresight, :education,
:expense_nature_id, :kind, :debt_type,
:budget_allocation_type_id, :refinancing, :health,
class Capability < Accounting::Model
attr_accessible :description, :goal, :kind, :status, :year
attr_accessible :capability_destination_id, :tce_specification_capability_id
attr_readonly :entity_id
attr_modal :description, :kind, :status
has_enumeration_for :kind, :with => CapabilityKind
has_enumeration_for :status, :create_helpers => true
<%= f.input :description %>
<div class="yui3-g">
<div class="yui3-u-1-2">
<%= f.input :is_pledge, :as => :select %>
</div>
<div class="yui3-u-1-2">
<%= f.input :is_transfer, :as => :select %>
</div>
$("#pledge_main_pledge_id").on("change", function (event, main_pledge) {
if (main_pledge) {
var url = "<%= auto_fill_custom_fields_pledges_path %>",
params = {main_pledge_id: $(this).val(), edit_path: true};
$(this).parents("form").blockContent();
$.post(url, params, function(data) {
if(data.success) {
var form = $("form");
ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEArOasHyQo7+DZ6yAdJ3s0LOQ/wGamgVoHqRLeBriKhH8AHvWF1AAx/xIlvSUCiSdWocZhYDTCjh0v2c42IXZ1sn398+qLV8bDqHp5bx1yFwGzBWhRld
hPxtoQTNqsapFHEEE5j6Ffs3v21Ch/4kuRE4PdHV3IaeNrjmXjz9091XE3C4M0ZunfRBNDVWGAyxWmo3WTgrhNnLMTiW1LDS5diROMfz9CyhShD7EtU0nLTmDoR750So6VMDgzzQb/SRzjeF8MBal7
44rgiB4OSnM5DEc/bstiIwLnwb/RQSjZFZXLtqbm7v0FqInge0I0xQCsyM2MuhpxRfPLnyzHeqhGKw== [email protected]