<% if project %> <% sidebar = SidebarContent.find_by_project_id(project.id) %> <% uri = URI.parse(request.url) %> <% if sidebar && ((sidebar.location == 'only_regexp' && (sidebar.url_regexp.blank? || uri.path =~ Regexp.new(sidebar.url_regexp))) || (sidebar.location == 'except_regexp' && (sidebar.url_regexp.blank? || !(uri.path =~ Regexp.new(sidebar.url_regexp))))) %> <%= sidebar_content(sidebar, project) %> <% end %> <% end %>