diff --git a/app/controllers/departments_controller.rb b/app/controllers/departments_controller.rb index 7f1abcfe..7652db69 100644 --- a/app/controllers/departments_controller.rb +++ b/app/controllers/departments_controller.rb @@ -2,15 +2,15 @@ class DepartmentsController < ApplicationController def index @departments = Department.all end - + def show - @department = Department.find(params[:id]) + redirect_to department_users_path(params[:id]) end - + def new @department = Department.new end - + def create @department = Department.new(params[:department]) if @department.save @@ -20,11 +20,11 @@ def create render :action => 'new' end end - + def edit @department = Department.find(params[:id]) end - + def update @department = Department.find(params[:id]) if @department.update_attributes(params[:department]) @@ -34,7 +34,7 @@ def update render :action => 'edit' end end - + def destroy @department = Department.find(params[:id]) @department.destroy @@ -42,3 +42,4 @@ def destroy redirect_to departments_url end end + diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 2f24cc96..667020bb 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -1,5 +1,5 @@ class UsersController < ApplicationController - before_filter :load_department, :only => [:index, :new, :create] + before_filter :load_department, :only => [:index, :new, :create, :mass_add] def index @users = @department.users diff --git a/app/helpers/layout_helper.rb b/app/helpers/layout_helper.rb index 2933d4b2..aac189b1 100644 --- a/app/helpers/layout_helper.rb +++ b/app/helpers/layout_helper.rb @@ -7,17 +7,22 @@ def title(page_title, show_title = true) @content_for_title = page_title.to_s @show_title = show_title end - + def show_title? @show_title end - + def stylesheet(*args) content_for(:head) { stylesheet_link_tag(*args.map(&:to_s)) } end - + def javascript(*args) args = args.map { |arg| arg == :defaults ? arg : arg.to_s } content_for(:head) { javascript_include_tag(*args) } end + + def tab(str) + str == controller.controller_name ? "current_tab" : "tab" + end end + diff --git a/app/views/departments/show.html.erb b/app/views/departments/show.html.erb deleted file mode 100644 index 488fc7b7..00000000 --- a/app/views/departments/show.html.erb +++ /dev/null @@ -1,16 +0,0 @@ -<% title "Department" %> - -

- Name: - <%=h @department.name %> -

-

- Permission: - <%=h @department.permission_id %> -

- -

- <%= link_to "Edit", edit_department_path(@department) %> | - <%= link_to "Destroy", @department, :confirm => 'Are you sure?', :method => :delete %> | - <%= link_to "View All", departments_path %> -

diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index d5469731..944dcf3d 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -3,20 +3,30 @@ <%= h(yield(:title) || "Untitled") %> - <%= stylesheet_link_tag 'application' %> + <%= stylesheet_link_tag 'application', 'nav' %> <%= yield(:head) %> + + <%= render :file => 'layouts/nav_top' %> + <% if @current_user %> +
+

Hello <%= @current_user.name %>!

+ You are logged in as <%= @current_user.netid %> <%= link_to "[Logout]", logout_path %> +
+ <% end %> +
<%- flash.each do |name, msg| -%> <%= content_tag :div, msg, :id => "flash_#{name}" %> <%- end -%> - + <%- if show_title? -%>

<%=h yield(:title) %>

<%- end -%> - - <%= yield %> + + <%= yield(:my_content) || yield %>
+ diff --git a/app/views/layouts/nav_top.html.erb b/app/views/layouts/nav_top.html.erb new file mode 100644 index 00000000..6732a8bc --- /dev/null +++ b/app/views/layouts/nav_top.html.erb @@ -0,0 +1,8 @@ + + diff --git a/app/views/layouts/users.html.erb b/app/views/layouts/users.html.erb new file mode 100644 index 00000000..4a325e6d --- /dev/null +++ b/app/views/layouts/users.html.erb @@ -0,0 +1,18 @@ +<% content_for :my_content do %> + + +
+ <%= yield %> +
+ +
+<% end %> + +<%= render :file => 'layouts/application.html.erb' %> + diff --git a/public/stylesheets/nav.css b/public/stylesheets/nav.css new file mode 100644 index 00000000..25d6b4b0 --- /dev/null +++ b/public/stylesheets/nav.css @@ -0,0 +1,47 @@ +.no_underlined a{ + text-decoration: none; + color: whitesmoke; +} + +li.current_tab{ + background: #222; +} + +div#nav_top{ + width: 84.2%; + margin: 0 auto; +} + +div#nav_top ul{ + margin: 0 auto; +} + +div#nav_top li{ + display: inline; + padding-right: 20px; + padding-left: 20px; + width: 200px; +} + +div #nav_bar{ + width: 20%; + height: 100%; + float: left; + border: 1px solid black; + background-color: whitesmoke; + padding: 10px; + word-wrap: break-word; +} + +a{ + color: blue; +} +a:hover{ + color: orange; +} + +div #tab_content{ + float: right; + width: 70%; +} +