Skip to content

Commit

Permalink
[webui] Allow user to generate RSS feed tokens
Browse files Browse the repository at this point in the history
  • Loading branch information
Moises Deniz Aleman authored and hennevogel committed Jun 29, 2017
1 parent 3d50a84 commit b6d7f70
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 3 deletions.
20 changes: 20 additions & 0 deletions src/api/app/controllers/webui/users/rss_tokens_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
module Webui
module Users
class RssTokensController < WebuiController
before_action :require_login

def create
token = User.current.rss_token
if token
flash[:success] = "Successfully re-generated your RSS feed url"
token.regenerate_string
token.save
else
flash[:success] = "Successfully generated your RSS feed url"
User.current.create_rss_token
end
redirect_back(fallback_location: user_notifications_path)
end
end
end
end
6 changes: 3 additions & 3 deletions src/api/app/views/webui/user/show.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@
%br/
= link_to(sprited_text('email', 'Change your notifications'), user_notifications_path)
%br/
/ notifications link
= link_to(sprited_text('feeds', 'RSS for notifications'), user_rss_notifications_path(format: 'rss'), { title: 'RSS Feed for Notifications' })
%br/
- if @displayed_user.rss_token
= link_to(sprited_text('feeds', 'RSS for notifications'), user_rss_notifications_path(token: @displayed_user.rss_token.string, format: 'rss'), { title: 'RSS Feed for Notifications' })
%br/

.grid_12.omega.box.box-shadow
#involved
Expand Down
14 changes: 14 additions & 0 deletions src/api/app/views/webui/users/subscriptions/index.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,17 @@
= render partial: 'webui/subscriptions/subscriptions_form'
%p= submit_tag 'Update'
%br/
%br/
%h3 RSS Feed
= form_tag(user_rss_token_path, id: 'generate_rss_token_form', method: :post) do
%p
- if @user.rss_token
For accessing to your RSS feed of notifications use the following url
= link_to(user_rss_notifications_url(token: @user.rss_token.string, format: 'rss'), user_rss_notifications_url(token: @user.rss_token.string, format: 'rss'), target: '_blank')
%br/
%br/
Whenever you need to re-create the feed url just do it here
- else
No feed url exists already for your notifications
%p= submit_tag 'Generate Url'
4 changes: 4 additions & 0 deletions src/api/config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,10 @@ def self.public_or_about_path?(request)
get 'users/(:user)/requests' => :index, as: 'user_requests'
end

controller 'webui/users/rss_tokens' do
post 'users/rss_tokens' => :create, as: 'user_rss_token'
end

controller 'webui/groups' do
get 'groups' => :index
get 'group/show/:title' => :show, constraints: {:title => /[^\/]*/}, as: 'group_show'
Expand Down

0 comments on commit b6d7f70

Please sign in to comment.