Closed khelal closed 12 years ago
What browser?
Anyway, if there are some bug probably is in browser accept header or rails intrepeting it. You can test it with a sample app, without active_scaffold, add an action with respond_to block for html and js and add a link with :remote => true
Happens in at least Chrome (15.0.874.106) and Firefox (6.0.2).
Can you reproduce it in a sample app without active_scaffold? It's working here with Chrome 15 Also, try to reproduce it in a empty application with active_scaffold, with no customization
Ok I will try but might take some time. We are using AS as the way to display backend info in a pretty big app and all the other links work well (both inside the actual app and in sidebar of the admin pages).
Does links working use AJAX too?
Nope. they're all regular links.
Then it isn't relevant, your activescaffold broken links are remote links which use AJAX
fair enough. So how can we troubleshoot this?
Karim HELAL General Manager @ monaqasat.com http://www.monaqasat.com *
* The leading eTendering solution for the MENA region.
m: +971.50.641.7143 | t: +971.2.635.5775 | f: +971.2.635.5776 twitter: @monaqasat http://www.twitter.com/monaqasat | facebook: monaqasat http://www.facebook.com/monaqasat
On Wed, Nov 9, 2011 at 3:01 PM, Sergio Cambra < reply@reply.github.com>wrote:
Then it isn't relevant, your activescaffold broken links are remote links which use AJAX
Reply to this email directly or view it on GitHub:
https://github.com/activescaffold/active_scaffold/issues/83#issuecomment-2679961
Have you set config.show.link.page = true? Because you should get something like this: Rendered /opt/ruby-enterprise/lib/ruby/gems/1.8/gems/active_scaffold-3.1.6/frontends/default/views/_show_columns.html.erb (48.5ms) Rendered /opt/ruby-enterprise/lib/ruby/gems/1.8/gems/active_scaffold-3.1.6/frontends/default/views/_show.html.erb (51.9ms) Rendered /opt/ruby-enterprise/lib/ruby/gems/1.8/gems/active_scaffold-3.1.6/frontends/default/views/_messages.html.erb (0.3ms) Rendered /opt/ruby-enterprise/lib/ruby/gems/1.8/gems/active_scaffold-3.1.6/frontends/default/views/_list_inline_adapter.html.erb (2.3ms)
Rendering of _list_inline_adapter and _show partial. But you get rendering of show view with layout. Also, have you overrided some methods in your controller?
Here's my entire controller for the Companies view:
class Admin::CompaniesController < Admin::AdminController
before_filter :authenticate_admin_user!
active_scaffold :company do |config|
config.actions.exclude :create, :search
config.actions.add :field_search
config.field_search.columns = [:license_number, :name, :email]
config.field_search.human_conditions = true
config.list.always_show_search = true
config.show.link.inline = false
config.update.link.inline = false
config.list.sorting = { :name => :asc }
config.columns[:license_number].set_link "show", :inline => false
config.columns[:name].set_link "show", :inline => false
config.columns[:license_number].label = "License"
# Configuration for List
config.list.columns = [:id, :license_number, :name, :phone, :email, :membership]
end
def show
@company = Company.find(params[:id])
end
def edit
@company = Company.find(params[:id])
end
def update
@company = Company.find(params[:id])
respond_to do |format|
if @company.update_attributes(params[:company])
flash[:notice] = "Company <b>#{@company.name}</b> was successfully updated."
format.html { redirect_to edit_admin_company_path(@company.id) }
else
format.html { render :action => "edit" }
end
end
end
def approve
@company = Company.find(params[:id])
if @company.approve!
flash[:notice] = "Company '#{@company.name}' has been approved!"
else
flash[:error] = "Company '#{@company.name}' could not be approved!"
end
redirect_to :back
end
def start_review
@company = Company.find(params[:id])
# FIXME: RR: Fire email to the company users about this.
if @company.start_review!
flash[:notice] = "Company '#{@company.name}' is now under review."
else
flash[:error] = "Company '#{@company.name}' could not start being reviewed due to an error. Please try again."
end
redirect_to :back
end
def reject
@company = Company.find(params[:id])
# FIXME: RR: Fire email to the company users about this.
if @company.reject!
flash[:notice] = "Company '#{@company.name}' has been rejected."
else
flash[:error] = "Company '#{@company.name}' could not be rejected. Please try again."
end
redirect_to :back
end
protected
def beginning_of_chain
case params[:v]
when 'new'
active_scaffold_config.label = "Newly Registered Companies"
super.with_state(:registered)
when 'new_ok'
active_scaffold_config.label = "Newly Registered Companies with Full Documentation"
super.with_state(:registered).stamp_file_size_not_null.license_file_size_not_null.logo_file_size_not_null
when 'new_nok'
active_scaffold_config.label = "Newly Registered Companies with Missing Documentation"
super.with_state(:registered).stamp_file_size_or_license_file_size_or_logo_file_size_null
when 'approved'
active_scaffold_config.label = "Approved Companies"
super.with_state(:approved)
when 'expired'
active_scaffold_config.label = 'Expired Companies'
super.with_state(:expired)
when "expiring"
active_scaffold_config.label = 'Companies Expiring within 7 Days'
super.with_state(:approved).expires_at_greater_than(Time.now).expires_at_less_than(Time.now + 1.week)
when "lic_expired"
active_scaffold_config.label = 'Companies with an Expired Trade License'
super.with_state(:approved).license_expires_at_less_than(Time.now)
when "lic_expiring"
active_scaffold_config.label = 'Companies with an Expiring Trade License within 7 Days'
super.with_state(:approved).license_expires_at_greater_than(Time.now).license_expires_at_less_than(Time.now + 1.week)
when "trained"
active_scaffold_config.label = 'Trained Companies'
super.with_state(:approved).where("trained_at IS NOT NULL")
when "untrained"
active_scaffold_config.label = 'Un-Trained Companies'
super.with_state(:approved).where("trained_at IS NULL")
else
active_scaffold_config.label = 'All Companies'
super
end
end
end
Try changing :inline => false with page => true (and inline = false with page = true of course)
Yes! That worked!
Just found out that the same problem exists on the search functionality. After entering a search term and clicking on the Search button, nothing happens. After refreshing the page, the right results are displayed.
Hello, we are running the latest AS off master on a Rails 3.1.1 application and having a problem with the links.
Here's a screenshot of the actual table:
The problem is that clicking on any links (show, clicking on the reference, company or name) actually launches the query, but the result is not show (the page does not refresh). Here is the rails log:
Any ideas?