Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Removed old plugins, added CAS auth, and made UI changes
- Loading branch information
Showing
32 changed files
with
356 additions
and
645 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,5 +12,6 @@ | |
// | ||
//= require jquery | ||
//= require jquery_ujs | ||
//= require bootstrap | ||
//= require turbolinks | ||
//= require_tree . |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
jQuery -> | ||
$("a[rel~=popover], .has-popover").popover() | ||
$("a[rel~=tooltip], .has-tooltip").tooltip() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,61 @@ | ||
// Place all the styles related to the categories controller here. | ||
// They will automatically be included in application.css. | ||
// You can use Sass (SCSS) here: http://sass-lang.com/ | ||
|
||
.page { | ||
margin-left: 10px; | ||
} | ||
|
||
.banner { | ||
padding-right: 100px; | ||
} | ||
|
||
.unstyled_link { | ||
a { | ||
text-decoration: none; | ||
color: black; | ||
&:hover { | ||
text-decoration: none; | ||
color: black; | ||
} | ||
} | ||
} | ||
|
||
.categories_nav { | ||
width: 300px; | ||
padding-right: 20px; | ||
float: left; | ||
.categories_list { | ||
margin-left: 10px; | ||
} | ||
} | ||
|
||
.documents_grid { | ||
width: 800px; | ||
float: right; | ||
} | ||
|
||
.upload_button_container{ | ||
|
||
.upload_button { | ||
margin-left: auto; | ||
margin-right: auto; | ||
display: block; | ||
background-color: #708EA4; | ||
border-radius: 2px; | ||
box-shadow: 2px 2px 1px #0A0A0A; | ||
text-align: center; | ||
width: 100px; | ||
height: 35px; | ||
line-height: 35px; | ||
color: white; | ||
&:hover { | ||
background-color: #29516D; | ||
text-decoration: none; | ||
color: white; | ||
} | ||
.upload_button_text { | ||
padding: 5px; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,4 +5,8 @@ def index | |
@categories = Category.roots | ||
end | ||
|
||
def show | ||
@category = Category.find params[:id] | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
class SessionsController < ApplicationController | ||
|
||
def new | ||
cas_hash = request.env["omniauth.auth"] | ||
|
||
if User.find_by_username(cas_hash[:uid]).nil? | ||
user = User.new(username: cas_hash[:uid], is_admin: 0, full_name: cas_hash[:uid]) | ||
user.save | ||
session[:user_id] = user.id | ||
redirect_to "/" | ||
else | ||
user = User.find_by_username(cas_hash[:uid]) | ||
flash[:notice] = "You have successfully logged in." | ||
session[:user_id] = user.id | ||
redirect_to "/" | ||
end | ||
end | ||
|
||
def destroy | ||
session[:user_id] = nil | ||
redirect_to "/" | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,11 @@ | ||
class UsersController < ApplicationController | ||
|
||
def index | ||
@users = User.all | ||
end | ||
|
||
def show | ||
@user = User.find params[:id] | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,50 @@ | ||
class Category < ActiveRecord::Base | ||
include ActsAsCategory | ||
# Based on contributions from @bamnet on the 3.1 branch | ||
|
||
acts_as_category :order_by => 'name', :hidden => 'private' | ||
# Build a heirarchy of categories | ||
belongs_to :parent, class_name: 'Category' | ||
has_many :children, class_name: 'Category', foreign_key: 'parent_id' | ||
|
||
validates_presence_of :name, :group_id, :user_id | ||
# Find all categories serving as a root | ||
scope :roots, -> { where(parent_id: nil) } | ||
|
||
end | ||
# Is this category a root? | ||
def is_root? | ||
parent_id.nil? | ||
end | ||
|
||
# Collect a list of parent categories | ||
# Each category the monkey stops as he climbs up the tree | ||
# Compliments of DHH http://github.com/rails/acts_as_tree | ||
def ancestors | ||
node, nodes = self, [] | ||
nodes << node = node.parent while node.parent | ||
nodes | ||
end | ||
|
||
# Collect a list of children categories | ||
# Each category the monkey could stop by as he climbs down a tree | ||
# Compliments of http://github.com/funkensturm/acts_as_category | ||
def descendants | ||
node, nodes = self, [] | ||
node.children.each { |child| | ||
# Check for circular dependenciess | ||
if !nodes.include?(child) | ||
nodes += [child] | ||
nodes += child.descendants | ||
end | ||
} unless node.children.empty? | ||
nodes | ||
end | ||
|
||
# Figure out the tree's height | ||
def depth | ||
ancestors.count | ||
end | ||
|
||
# The group of category who share a common parent | ||
def self_and_siblings | ||
parent ? parent.children : Category.roots | ||
end | ||
|
||
end |
Oops, something went wrong.