Skip to content

Commit

Permalink
Added auth for users controller and restricted top menu display
Browse files Browse the repository at this point in the history
  • Loading branch information
August committed Apr 25, 2012
1 parent eaf31fb commit debec94
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 46 deletions.
3 changes: 2 additions & 1 deletion app/controllers/users_controller.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@

class UsersController < ApplicationController
load_and_authorize_resource

# GET /users
# GET /users.json
def index
Expand Down
94 changes: 49 additions & 45 deletions app/views/elements/_topmenu_contents.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -18,52 +18,56 @@
</section>
<!-- End User Login Area -->

<!-- Begin Menu for CONTENT -->
<section>
<div class="TM-sectop">
<%= link_to new_content_path, :class => "btn #{ current_page?(new_content_path) ? 'selected' : '' }" do %><%= t(:add) %><% end %>
<%= link_to contents_path, :class => "btn #{ current_page?(contents_path) || current_page?(:controller => 'submissions', :action => 'index') || current_page?(:controller => 'submissions', :action => 'show') ? 'selected' : '' }" do %><%= t(:browse) %><% end %>
</div>
<div class="TM-secbot">
<h1><%= t(:content) %></h1>
</div>
</section>
<!-- End Menu for CONTENT -->

<!-- Begin Menu for SCREENS -->
<section>
<div class="TM-sectop">
<%= link_to screens_path, :class => "btn #{ controller.controller_name == 'screens' ? 'selected' : '' }" do %><%= t(:manage) %><% end %>
<%= link_to templates_path, :class => "btn #{ controller.controller_name == 'templates' ? 'selected' : '' }" do %><%= t(:templates) %><% end %>
</div>
<div class="TM-secbot">
<h1><%= t(:screens) %></h1>
</div>
</section>
<!-- End Menu for SCREENS -->
<% if user_signed_in? %>

<!-- Begin Menu for CONTENT -->
<section>
<div class="TM-sectop">
<%= link_to new_content_path, :class => "btn #{ current_page?(new_content_path) ? 'selected' : '' }" do %><%= t(:add) %><% end %>
<%= link_to contents_path, :class => "btn #{ current_page?(contents_path) || current_page?(:controller => 'submissions', :action => 'index') || current_page?(:controller => 'submissions', :action => 'show') ? 'selected' : '' }" do %><%= t(:browse) %><% end %>
</div>
<div class="TM-secbot">
<h1><%= t(:content) %></h1>
</div>
</section>
<!-- End Menu for CONTENT -->

<!-- Begin Menu for SCREENS -->
<section>
<div class="TM-sectop">
<%= link_to screens_path, :class => "btn #{ controller.controller_name == 'screens' ? 'selected' : '' }" do %><%= t(:manage) %><% end %>
<%= link_to templates_path, :class => "btn #{ controller.controller_name == 'templates' ? 'selected' : '' }" do %><%= t(:templates) %><% end %>
</div>
<div class="TM-secbot">
<h1><%= t(:screens) %></h1>
</div>
</section>
<!-- End Menu for SCREENS -->

<!-- Begin Menu for FEEDS -->
<section>
<div class="TM-sectop">
<%= link_to feeds_path, :class => "btn #{ controller.controller_name == 'feeds' ? 'selected' : '' }" do %><%= t(:manage) %><% end %>
</div>
<div class="TM-secbot">
<h1><%= t(:feeds) %></h1>
</div>
</section>
<!-- End Menu for FEEDS -->

<!-- Begin Menu for USER GROUPS -->
<section>
<div class="TM-sectop">
<%= link_to groups_path, :class => "btn #{ controller.controller_name == 'groups' ? 'selected' : '' }" do %><%= t(:groups) %><% end %>
<%= link_to users_path, :class => "btn #{ controller.controller_name == 'users' ? 'selected' : '' }" do %>Accounts<% end %>
</div>
<div class="TM-secbot">
<h1><%= t(:users) %></h1>
</div>
</section>
<!-- End Menu for USER GROUPS -->

<!-- Begin Menu for FEEDS -->
<section>
<div class="TM-sectop">
<%= link_to feeds_path, :class => "btn #{ controller.controller_name == 'feeds' ? 'selected' : '' }" do %><%= t(:manage) %><% end %>
</div>
<div class="TM-secbot">
<h1><%= t(:feeds) %></h1>
</div>
</section>
<!-- End Menu for FEEDS -->

<!-- Begin Menu for USER GROUPS -->
<section>
<div class="TM-sectop">
<%= link_to groups_path, :class => "btn #{ controller.controller_name == 'groups' ? 'selected' : '' }" do %><%= t(:groups) %><% end %>
<%= link_to users_path, :class => "btn #{ controller.controller_name == 'users' ? 'selected' : '' }" do %>Accounts<% end %>
</div>
<div class="TM-secbot">
<h1><%= t(:users) %></h1>
</div>
</section>
<!-- End Menu for USER GROUPS -->
<% end %>

<div class="clear"></div>

0 comments on commit debec94

Please sign in to comment.