app/controllers/domains_controller.rb
# GET: list of macros to apply
# POST: apply selected macro
list of macros to apply
POST: apply selected macro
list of macros to apply POST : apply selected macro
def apply_macro
    @domain = resource
    if request.get?
      @macros = Macro.user(current_user)
      respond_to do |format|
        format.html
        format.json
        format.xml
      end
    else
      @macro = Macro.user( current_user ).find( params[:macro_id] )
      @macro.apply_to( resource )
      respond_to do |format|
        format.html {
          flash[:notice] = t(:message_domain_macro_applied)
          redirect_to resource
        }
        format.json { render :status => 202 }
        format.xml { render :status => 202 }
      end
    end
  end
def apply_macro @domain = resource if request . get? @macros = Macro . user ( current_user ) respond_to do | format | format . html format . json format . xml end else @macro = Macro . user ( current_user ) . find ( params [ :macro_id ] ) @macro . apply_to ( resource ) respond_to do | format | format . html { flash [ :notice ] = t ( :message_domain_macro_applied ) redirect_to resource } format . json { render :status => 202 } format . xml { render :status => 202 } end end end
GET: list of macros to apply
POST: apply selected macro
GET : list of macros to apply POST : apply selected macro