- rtc_controller_name ||= controller_name - rtc_title = true if rtc_title.nil? - the_klass = instance_variable_get("@#{rtc_controller_name}").respond_to?(:klass) ? instance_variable_get("@#{rtc_controller_name}").klass : Array - the_klass_name = the_klass.name - add_form_remote = true if add_form_remote.nil? - rtc_button_new = true if rtc_button_new.nil? - export_attributes ||= nil - export_attribute_ids = [] - rtc_actions ||= nil .rtc_actions - if multiple_selection_actions.present? - multiple_selection_actions = [multiple_selection_actions].flatten - multiple_selection_actions.each do |sa| = form_tag sa[:form][:path], sa[:form][:options].merge({class: 'multiple_selection_form'}) do = submit_tag sa[:action_button][:value], sa[:action_button][:options] - if rtc_button_new.eql?(true) || rtc_button_new.eql?('true') - if rtc_controller_name != controller_name || instance_variable_get("@#{controller_name.singularize}").nil? = link_to icon('plus', 'Tambah ' + t("#{the_klass_name.tableize.singularize}").titleize).html_safe, params.merge({controller: the_klass_name.tableize, action: 'new'}), remote: add_form_remote ? true : false, class: 'btn btn-mini btn-success btn_new' if can?(:create, the_klass) - else = link_to icon('plus', 'Tambah ' + t("#{rtc_controller_name.singularize}").titleize).html_safe, params.merge({controller: rtc_controller_name, action: 'new', "#{controller_name.singularize}_id".to_sym => instance_variable_get("@#{controller_name.singularize}").id }), remote: add_form_remote ? true : false, class: 'btn btn-mini btn-success btn_new' if can?(:create, rtc_controller_name.classify.constantize) - if rtc_actions.present? - rtc_actions = [rtc_actions].flatten - rtc_actions.each do |rtc_action| = rtc_action - if export_attributes.present? = (link_to (t('xls')).html_safe, '#', class: 'btn btn-mini btn_export btn_xls') = (link_to (t('pdf')).html_safe, '#', class: 'btn btn-mini btn_export btn_pdf') .hide - new_params = Hash.new - new_params.merge! params - new_params[:controller] ||= the_klass_name.tableize - new_params[:format] = 'xls' - path = url_for(new_params) %form{"accept-charset" => "UTF-8", action: path, method: :get, class: 'simple_form form-horizontal export_form'} = hidden_field_tag 'rtc_controller_name', the_klass_name.tableize = hidden_field_tag 'pgos', true unless action_name.eql? 'index' .control-group.check_boxes.optional .check_boxes.optional.control-label = t("data") - export_attributes.each do |ea| - if ea.instance_of?(Hash) - attribute_value = ea[:value].to_s - attribute_label = ea[:label] - else - attribute_value = ea.to_s - splitter = attribute_value.split('.') - attribute_label = (splitter.last(2) - ['to_s']).join('_') - if attribute_label.split('_to_s').one? - attribute_label = attribute_label.split('_to_s').first - if attribute_label.split('_to_s_code').one? - attribute_label = attribute_label.split('_to_s_code').first - attribute_label = t(attribute_label) .controls %label.checkbox = check_box_tag 'export_attribute_ids[]', "#{attribute_label};#{attribute_value}", true = attribute_label .form-actions %button{type: 'submit', class: "btn btn btn-large btn-primary btn_submit"} = t("export")