Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix creation of internal rss widget #4577

Merged
merged 2 commits into from
Sep 3, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 2 additions & 6 deletions app/controllers/report_controller/widgets.rb
Original file line number Diff line number Diff line change
Expand Up @@ -435,11 +435,7 @@ def widget_set_form_vars
@edit[:new][:pivot].options = @edit[:new][:fields].dup
@edit[:new][:row_count] = @widget.row_count
elsif @sb[:wtype] == "rf"
@edit[:rss_feeds] = {}
rss_feeds = RssFeed.all
rss_feeds.each do |rf|
@edit[:rss_feeds][rf.title] = rf.id
end
@edit[:rss_feeds] = RssFeed.pluck(:title, :id).sort.to_h
@edit[:new][:feed_type] = @widget.options && @widget.options[:url] ? "external" : "internal"
if @widget.options && @widget.options[:url]
self.class::RSS_FEEDS.each do |r|
Expand All @@ -450,7 +446,7 @@ def widget_set_form_vars
@edit[:new][:txt_url] = @widget.options[:url] if @edit[:new][:url].blank?
end
@edit[:new][:row_count] = @widget.row_count
@edit[:new][:rss_feed_id] = @widget.resource_id if @widget.resource_id && @widget.resource_type == "RssFeed"
@edit[:new][:rss_feed_id] = @widget.resource_type == "RssFeed" ? @widget.resource_id : @edit[:rss_feeds].first.second
end
@edit[:current] = copy_hash(@edit[:new])
end
Expand Down
2 changes: 1 addition & 1 deletion app/views/report/_widget_form_rss.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
= _('Internal RSS Feed')
.col-md-8
= select_tag("rss_feed",
options_for_select(@edit[:rss_feeds].sort, @edit[:new][:rss_feed_id]),
options_for_select(@edit[:rss_feeds], @edit[:new][:rss_feed_id]),
:disabled => @edit[:read_only],
:class => "selectpicker")
:javascript
Expand Down