show error message on chart if channel not found

This commit is contained in:
Lee Lawlor 2014-10-02 13:59:11 -04:00
parent 4f05d39cfb
commit 0260e5209a
4 changed files with 9 additions and 4 deletions

View File

@ -5,7 +5,7 @@ class FeedController < ApplicationController
def index def index
feed_factory = FeedFactory.new(params) feed_factory = FeedFactory.new(params)
channel = Channel.find(params[:channel_id]) channel = feed_factory.channel
api_key = ApiKey.find_by_api_key(get_apikey) api_key = ApiKey.find_by_api_key(get_apikey)
@success = channel_permission?(channel, api_key) @success = channel_permission?(channel, api_key)

View File

@ -18,7 +18,7 @@ class FeedFactory < ApplicationController
end end
# attributes that can be read # attributes that can be read
attr_reader :feeds, :daily_feeds, :limit, :use_daily_feed, :feed_select_options, :cache_feeds attr_reader :feeds, :daily_feeds, :limit, :use_daily_feed, :feed_select_options, :cache_feeds, :channel
# calculate the limit that should be used # calculate the limit that should be used
def calculate_limit def calculate_limit

View File

@ -185,7 +185,12 @@
// draw the chart // draw the chart
var dynamicChart = new Highcharts.Chart(chartOptions); var dynamicChart = new Highcharts.Chart(chartOptions);
}); // end getJSON ajax call // end getJSON success
})
// chained to getjson, on error
.error(function() {
$('#chart-container').html('Invalid Channel.');
});
}); // end document.ready }); // end document.ready

File diff suppressed because one or more lines are too long