Skip to content
This repository has been archived by the owner on Apr 14, 2018. It is now read-only.

Commit

Permalink
Merge branch 'show-and-hide' into docket-interface
Browse files Browse the repository at this point in the history
Conflicts:
	app/assets/stylesheets/application.css.scss
	app/views/docket/index.html.erb

It works.

Signed-off-by: Kristofer Rye <[email protected]>
  • Loading branch information
rye committed Jan 7, 2014
2 parents 1c96663 + 4ed7c95 commit 3c0a573
Show file tree
Hide file tree
Showing 32 changed files with 334 additions and 105 deletions.
3 changes: 2 additions & 1 deletion app/assets/javascripts/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
//= require jquery_ujs
//= require jquery.turbolinks
//= require bootstrap
//= require docket-toggle
//= require typeahead

var ready;
Expand All @@ -38,7 +39,7 @@ $(document).ready(ready);
$(document).ready(function () {

/*
* Clamped-width.
* Clamped-width.
* Usage:
* <div data-clampedwidth=".myParent">This long content will force clamped width</div>
*
Expand Down
3 changes: 3 additions & 0 deletions app/assets/javascripts/configuration.js.coffee
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Place all the behaviors and hooks related to the matching controller here.
# All this logic will automatically be available in application.js.
# You can use CoffeeScript in this file: http://coffeescript.org/
40 changes: 40 additions & 0 deletions app/assets/javascripts/docket-toggle.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
function docket_collapse_toggle(day_tag)
{
var panel = document.getElementById("docket-collapsing-day-panel-" + day_tag);
var icon = panel.getElementsByClassName("docket-collapsing-indicator-image")[0];
var body = panel.getElementsByClassName("docket-collapsing-div-data")[0];

var collapsed = panel.getAttribute("docket-is-collapsed") == "true" ? true : false;
var icon_future_class_name = collapsed ? "glyphicon-chevron-up" : "glyphicon-chevron-down";

var icon_classes = icon.className.split(" ");
var new_icon_classes = [];

icon_classes.map(function(cls)
{
var match = cls.match(/glyphicon-chevron-(up|down)/g);

/* Stop errors */
if(match == null || match == undefined) {
new_icon_classes.push(cls);

return;
}

if(match.length > 0) {
new_icon_classes.push(icon_future_class_name);

return;
}
});

icon.className = new_icon_classes.join(" ");

if(collapsed) {
panel.setAttribute("docket-is-collapsed", "false");
body.style.display = "inherit";
} else {
panel.setAttribute("docket-is-collapsed", "true");
body.style.display = "none";
}
}
135 changes: 79 additions & 56 deletions app/assets/stylesheets/application.css.scss
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,37 @@
*= require_tree .
*/

/* prefix mixins */
@mixin browser-extensions($property, $values...) {
-webkit-#{$property}: $values;
-moz-#{$property}: $values;
#{$property}: $values;
}

@mixin background-gradient($from, $to) {
background-image: -moz-linear-gradient(top, $from, $to);
background-image: -webkit-gradient(linear, 0 0, 0 100%, from($from), to($to));
background-image: -webkit-linear-gradient(top, $from, $to);
background-image: -o-linear-gradient(top, $from, $to);
background-image: linear-gradient(to bottom, $from, $to);
background-repeat: repeat-x;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#{ie-hex-str($from)}', endColorstr='#{ie-hex-str($to)}', GradientType=0)

}

body {
padding: 40px;
padding-top: 70px;
}

.page-header {
margin-top: 0px;
}

.twitter-typeahead .tt-query,
.twitter-typeahead .tt-hint {
margin-bottom: 0;
.twitter-typeahead {
.tt-query, .tt-hint {
margin-bottom: 0;
}
}

.tt-dropdown-menu {
Expand All @@ -31,69 +55,56 @@ body {
border: 1px solid rgba(0,0,0,.2);
*border-right-width: 2px;
*border-bottom-width: 2px;
-webkit-border-radius: 6px;
-moz-border-radius: 6px;
border-radius: 6px;
-webkit-box-shadow: 0 5px 10px rgba(0,0,0,.2);
-moz-box-shadow: 0 5px 10px rgba(0,0,0,.2);
box-shadow: 0 5px 10px rgba(0,0,0,.2);
-webkit-background-clip: padding-box;
-moz-background-clip: padding;
background-clip: padding-box;
@include browser-extensions(border-radius, 6px);
@include browser-extensions(box-shadow, 0, 5px, 10px, rgba(0,0,0,.2));
@include browser-extensions(background-clip, padding-box);
}

.tt-suggestion {
display: block;
padding: 3px 20px;
}

.tt-suggestion.tt-is-under-cursor {
color: #fff;
background-color: #0081c2;
background-image: -moz-linear-gradient(top, #0088cc, #0077b3);
background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#0088cc), to(#0077b3));
background-image: -webkit-linear-gradient(top, #0088cc, #0077b3);
background-image: -o-linear-gradient(top, #0088cc, #0077b3);
background-image: linear-gradient(to bottom, #0088cc, #0077b3);
background-repeat: repeat-x;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff0088cc', endColorstr='#ff0077b3', GradientType=0)
}

.tt-suggestion.tt-is-under-cursor a {
color: #fff;
}

.tt-suggestion p {
margin: 0;
}
p {
margin: 0;
}

.twitter-typeahead .tt-hint
{
display: block;
height: 34px;
padding: 6px 12px;
font-size: 14px;
line-height: 1.428571429;
border: 1px solid transparent;
border-radius:4px;
}
&.tt-is-under-cursor {
color: #fff;
background-color: #0081c2;
@include background-gradient(#0088cc, #0077b3);

.twitter-typeahead .hint-small
{
height: 30px;
padding: 5px 10px;
font-size: 12px;
border-radius: 3px;
line-height: 1.5;
a {
color: #fff;
}
}
}

.twitter-typeahead .hint-large
{
height: 45px;
padding: 10px 16px;
font-size: 18px;
border-radius: 6px;
line-height: 1.33;
.twitter-typeahead {
.tt-hint {
display: block;
height: 34px;
padding: 6px 12px;
font-size: 14px;
line-height: 1.428571429;
border: 1px solid transparent;
border-radius:4px;
}

.hint-small {
height: 30px;
padding: 5px 10px;
font-size: 12px;
border-radius: 3px;
line-height: 1.5;
}

.hint-large {
height: 45px;
padding: 10px 16px;
font-size: 18px;
border-radius: 6px;
line-height: 1.33;
}
}

.form-control {
Expand Down Expand Up @@ -122,3 +133,15 @@ body {
box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(102, 175, 233, 0.6);
}

.navbar-inverse {
background-color: #303030;
border-color: #101010;

a, p, li {
color: #a0a0a0;
}

a :hover {
color: #f0f0f0;
}
}
3 changes: 3 additions & 0 deletions app/assets/stylesheets/configuration.css.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// Place all the styles related to the configuration controller here.
// They will automatically be included in application.css.
// You can use Sass (SCSS) here: http://sass-lang.com/
12 changes: 10 additions & 2 deletions app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,20 @@ class ApplicationController < ActionController::Base

def current_user
if session["current_user_id"]
User.find session["current_user_id"]
begin
user_find = User.find session["current_user_id"]
rescue Exception => e
puts "Exception occurred (#{e.message})"

nil
end

user_find
else
nil
end
end

hide_action :current_user

def admin?
Expand All @@ -39,5 +48,4 @@ def check_for_user_if_not_session_controller
method = "#{resource}_params"
params[resource] &&= send(method) if respond_to?(method, true)
end

end
6 changes: 3 additions & 3 deletions app/controllers/classrooms_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ class ClassroomsController < ApplicationController
# GET /classrooms.json
def index
@classrooms = Classroom.all.sort do |a, b|
if a.period == b.period
a.course.name <=> b.course.name
else
if a.course.name == b.course.name
a.period <=> b.period
else
a.course.name <=> b.course.name
end
end
end
Expand Down
10 changes: 10 additions & 0 deletions app/controllers/configuration_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
class ConfigurationController < ApplicationController
def show
end

def edit
end

def update
end
end
4 changes: 1 addition & 3 deletions app/controllers/docket_controller.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
class DocketController < ApplicationController
include ApplicationHelper

skip_authorization_check

def index
Expand Down Expand Up @@ -55,7 +53,7 @@ def index
end

@other_things = (@other_assignments + @other_exams + @other_events).sort do |thing1, thing2|
relevant_date(thing1) <=> relevant_date(thing2)
view_context.relevant_date(thing1) <=> view_context.relevant_date(thing2)
end
end
end
15 changes: 14 additions & 1 deletion app/helpers/application_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,22 @@ def relevant_date(thing)

def current_user
if session["current_user_id"]
User.find session["current_user_id"]
begin
user_find = User.find session["current_user_id"]
rescue Exception => e
puts "Exception occurred (#{e.message})"

nil
end

user_find
else
nil
end
end

def generate_glyphicon(spclass = "", glyphicon_name)
content_tag(:span, :class => "#{spclass} glyphicon glyphicon-#{glyphicon_name}") do
end
end
end
2 changes: 2 additions & 0 deletions app/helpers/configuration_helper.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
module ConfigurationHelper
end
3 changes: 3 additions & 0 deletions app/models/configuration.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
class Configuration < ActiveRecord::Base
has_one :user
end
2 changes: 2 additions & 0 deletions app/models/user.rb
Original file line number Diff line number Diff line change
Expand Up @@ -59,4 +59,6 @@ def classes_with_exams_on(day)
has_many :classrooms, :through => :memberships
has_many :attendances
has_many :events, :through => :attendances

has_one :configuration
end
2 changes: 1 addition & 1 deletion app/views/classrooms/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,4 @@
</tbody>
</table>

<%= link_to 'New Classroom', new_classroom_path, class: "btn btn-primary" %>
<%= link_to 'New Class', new_classroom_path, class: "btn btn-success" %>
2 changes: 2 additions & 0 deletions app/views/configuration/edit.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<h1>Configuration#edit</h1>
<p>Find me in app/views/configuration/edit.html.erb</p>
2 changes: 2 additions & 0 deletions app/views/configuration/show.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<h1>Configuration#show</h1>
<p>Find me in app/views/configuration/show.html.erb</p>
2 changes: 2 additions & 0 deletions app/views/configuration/update.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<h1>Configuration#update</h1>
<p>Find me in app/views/configuration/update.html.erb</p>
2 changes: 1 addition & 1 deletion app/views/courses/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,4 @@
</tbody>
</table>

<%= link_to 'New Course', new_course_path, class: "btn btn-primary" %>
<%= link_to 'New Course', new_course_path, class: "btn btn-success" %>
Loading

0 comments on commit 3c0a573

Please sign in to comment.