Sha256: 0271b64989599dcd772719f6709f7d2d0f871a60653d8a3879e25f1b73f71e78

Contents?: true

Size: 1.32 KB

Versions: 22

Compression:

Stored size: 1.32 KB

Contents

class Kaui::BundleTagsController < Kaui::EngineController

  def show
    bundle_id = params[:id]
    if bundle_id.present?
      begin
        tags = Kaui::KillbillHelper::get_tags_for_bundle(bundle_id, options_for_klient)
      rescue => e
        flash.now[:error] = "Error while retrieving tags information: #{as_string(e)}"
      end
    else
      flash.now[:error] = "No account id given"
    end
  end

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

      @bundle = Kaui::KillbillHelper::get_bundle(@bundle_id, options_for_klient)
      @tags = Kaui::KillbillHelper::get_tags_for_bundle(@bundle_id, options_for_klient)
    rescue => e
      flash.now[:error] = "Error while retrieving tags information: #{as_string(e)}"
    end
  end

  def update
    begin
      bundle = Kaui::KillbillHelper::get_bundle(params[:bundle_id], options_for_klient)
      tags = params[:tags]

      Kaui::KillbillHelper::set_tags_for_bundle(bundle.bundle_id, tags, current_user, params[:reason], params[:comment], options_for_klient)
      redirect_to Kaui.bundle_home_path.call(bundle.bundle_id)
    rescue => e
      flash.now[:error] = "Error while updating tags: #{as_string(e)}"
    end
  end
end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
kaui-0.6.6 app/controllers/kaui/bundle_tags_controller.rb
kaui-0.6.5 app/controllers/kaui/bundle_tags_controller.rb
kaui-0.6.4 app/controllers/kaui/bundle_tags_controller.rb
kaui-0.6.3 app/controllers/kaui/bundle_tags_controller.rb
kaui-0.6.2 app/controllers/kaui/bundle_tags_controller.rb
kaui-0.6.1 app/controllers/kaui/bundle_tags_controller.rb
kaui-0.6.0 app/controllers/kaui/bundle_tags_controller.rb
kaui-0.5.3 app/controllers/kaui/bundle_tags_controller.rb
kaui-0.5.2 app/controllers/kaui/bundle_tags_controller.rb
kaui-0.5.1 app/controllers/kaui/bundle_tags_controller.rb
kaui-0.5.0 app/controllers/kaui/bundle_tags_controller.rb
kaui-0.4.9 app/controllers/kaui/bundle_tags_controller.rb
kaui-0.4.8 app/controllers/kaui/bundle_tags_controller.rb
kaui-0.4.7 app/controllers/kaui/bundle_tags_controller.rb
kaui-0.4.6 app/controllers/kaui/bundle_tags_controller.rb
kaui-0.4.5 app/controllers/kaui/bundle_tags_controller.rb
kaui-0.4.4 app/controllers/kaui/bundle_tags_controller.rb
kaui-0.4.3 app/controllers/kaui/bundle_tags_controller.rb
kaui-0.4.2 app/controllers/kaui/bundle_tags_controller.rb
kaui-0.4.1 app/controllers/kaui/bundle_tags_controller.rb