<%= content = parameters.default ajax_attrs, attributes = attributes.partition_hash(HoboRapidHelper::AJAX_ATTRS) unless ajax_attrs.blank? add_data_rapid!(attributes, "a", :ajax_attrs => ajax_attrs) end if query_params if query_params==true || query_params.blank? query_params = query_parameters_filtered else query_params = query_parameters_filtered(:only => comma_split(query_params)) end params = query_params.merge(params || HashWithIndifferentAccess.new) end if href || attributes[:name] # Regular link href += "?" + params.map { |n, v| "#{n}=#{v}" }.join('&') if !params.blank? element(:a, attributes.update(:href => href), content) else target = to || this if target.nil? Dryml.last_if = false nil_view elsif action == "new" # Link to a new object form new_record = target.new new_record.set_creator(current_user) href = object_url(target, "new", params._?.merge(:subsite => subsite)) if href && (force || can_create?(new_record)) new_class_name = if target.respond_to?(:proxy_reflection) target.proxy_association.reflection.klass.name else target.name end add_classes!(attributes, "new-#{new_class_name.underscore}-link") content = "New #{new_class_name.titleize}" if content.blank? Dryml.last_if = true element(:a, attributes.update(:href => href), content) else Dryml.last_if = false "" end else # Link to an existing object content = name if content.blank? href = object_url(target, action, (params || {}).merge(:subsite => subsite)) unless (action.nil? && target.try.new_record?) if href.nil? # This target is registered with Hobo::Routes as not linkable content else css_class = target.try.origin_attribute || target.class.name.underscore.dasherize add_classes!(attributes, "#{css_class}-link") href.sub!(/\?|$/, ".#{format}\\0") unless format.blank? # Set default link text if none given element(:a, attributes.update(:href => href), content) end end end %>