How is the public path changing

0 views
Skip to first unread message

Philip Blen

unread,
Mar 5, 2010, 11:04:49 AM3/5/10
to ZiYa Plugin
What is changing the public path for the chart scroll objects from

/charts/sliders/black.swf

to

/blee/charts/sliders/black.swf?

You can see after /blee/load_line_4_chart is requested, the path to
public changes.
This required the chart objects to be copied and placed in a
directory /public/blee/chart.

These are the objects being requested in order:

http://localhost:3000/blee/load_lines
http://localhost:3000/charts/charts.swf
http://localhost:3000/blee/line_2_chart
http://localhost:3000/charts/charts_library/lnno.swf
http://localhost:3000/charts/charts.swf?library_path=/charts/charts_library&xml_source=http%3A%2F%2Flocalhost%3A3000%2Fblee%2Fload_line_4_chart&chart_id=line_4
http://localhost:3000/blee/load_line_4_chart
http://localhost:3000/charts/charts_library/lnno.swf
http://localhost:3000/blee/charts/sliders/black.swf
http://localhost:3000/blee/charts/sliders/black.swf
http://localhost:3000/blee/charts/sliders/preview_handle_1.swf
http://localhost:3000/blee/charts/sliders/preview_handle_2.swf

The example on ziya.liquidrail did not change the public path.

http://ziya.liquidrail.com/charts/sliders/preview_handle_2.swf

The images and scroll appear correctly in the browser, however I can
not figure out what changed the public path?

Also, how was the controller able to route the request?
I hard coded the routes for 4 paths and removed the default routes and
yet rails can retrieve /blee/charts/sliders just fine?

I appreciate any help in understanding what is happening.

Thanks
Philip

routes.rb

ActionController::Routing::Routes.draw do |map|

# Install the default routes as the lowest priority.
# Note: These default routes make all actions in every controller
accessible via GET requests. You should
# consider removing or commenting them out if you're using named
routes and resources.
map.load_charts '/blee/load_charts', :controller => 'blee', :action
=> 'load_charts'
map.load_lines '/blee/load_lines', :controller => 'blee', :action =>
'load_lines'
map.line_2_chart '/blee/line_2_chart', :controller =>
'blee', :action => 'line_2_chart'
map.load_line_4_chart '/blee/load_line_4_chart', :controller =>
'blee', :action => 'load_line_4_chart'

end


ziya.rb

# Pull in the ZiYa gem framework
gem "derailed-ziya", "= 2.1.5"
require 'ziya'

# Initializes the ZiYa Framework
Ziya.initialize(
:logger => RAILS_DEFAULT_LOGGER,
:themes_dir => File.join( File.dirname(__FILE__), %w[.. ..
public charts themes]) )

The request is http://localhost:3000/blee/load_lines


blee_controller.rb


class BleeController < ApplicationController
# Load ZiYa necessary helpers
helper Ziya::HtmlHelpers::Charts
helper Ziya::YamlHelpers::Charts


def load_lines
render :partial => "line"
end

def line_2_chart
chart = Ziya::Charts::Line.new
chart.add(:axis_category_text, %w[2006 2007 2008] )
chart.add(:series, "Dogs", [10,20,30] )
chart.add(:series, "Cats", [5,15,25] )
chart.add :composites, { :line_4 => { :url =>
load_line_4_chart_url } }
respond_to do |fmt|
fmt.xml { render :xml => chart.to_xml }
end
end

def load_line_4_chart
chart = Ziya::Charts::Line.new(nil,"line_4")
chart.add :theme, "blee"
respond_to do |fmt|
fmt.xml { render :xml => chart.to_xml }
end

end
end

Reply all
Reply to author
Forward
0 new messages