Sha256: a4bc1323eb6174a36d652a13619696e750f5f226858b10262934278c7daed475

Contents?: true

Size: 947 Bytes

Versions: 2

Compression:

Stored size: 947 Bytes

Contents

class Kaui::AccountTagsController < ApplicationController

  def show
    account_id = params[:id]

    if account_id.present?
      tags = Kaui::KillbillHelper::get_tags_for_account(account_id)
    else
      flash[:error] = "No account id given"
    end
  end

  def edit
    @account_id = params[:account_id]
    @available_tags = Kaui::KillbillHelper::get_tag_definitions.sort {|tag_a, tag_b| tag_a.name.downcase <=> tag_b.name.downcase }

    @account = Kaui::KillbillHelper::get_account(@account_id)
    @tags = Kaui::KillbillHelper::get_tags_for_account(@account.account_id)
  end

  def update
    account = Kaui::KillbillHelper::get_account(params[:account_id])
    tags = params[:tags]

    if account.account_id.present?
      Kaui::KillbillHelper::set_tags_for_account(account.account_id, tags)
      redirect_to Kaui.account_home_path.call(account.external_key)
    else
      flash[:error] = "No account id given"
    end
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
kaui-0.0.2 app/controllers/kaui/account_tags_controller.rb
kaui-0.0.1 app/controllers/kaui/account_tags_controller.rb