Skip to content
This repository has been archived by the owner on May 25, 2021. It is now read-only.

Commit

Permalink
Merge pull request #209 from YACS-RCOS/staging
Browse files Browse the repository at this point in the history
Schedule Links, New README, ESLint
  • Loading branch information
Bad-Science authored Feb 20, 2017
2 parents e6f9327 + b718118 commit 19a4985
Show file tree
Hide file tree
Showing 14 changed files with 553 additions and 123 deletions.
49 changes: 49 additions & 0 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# Contributor Code of Conduct

As contributors and maintainers of this project, and in the interest of
fostering an open and welcoming community, we pledge to respect all people who
contribute through reporting issues, posting feature requests, updating
documentation, submitting pull requests or patches, and other activities.

We are committed to making participation in this project a harassment-free
experience for everyone, regardless of level of experience, gender, gender
identity and expression, sexual orientation, disability, personal appearance,
body size, race, ethnicity, age, religion, or nationality.

Examples of unacceptable behavior by participants include:

* The use of sexualized language or imagery
* Personal attacks
* Trolling or insulting/derogatory comments
* Public or private harassment
* Publishing other's private information, such as physical or electronic
addresses, without explicit permission
* Other unethical or unprofessional conduct

Project maintainers have the right and responsibility to remove, edit, or
reject comments, commits, code, wiki edits, issues, and other contributions
that are not aligned to this Code of Conduct, or to ban temporarily or
permanently any contributor for other behaviors that they deem inappropriate,
threatening, offensive, or harmful.

By adopting this Code of Conduct, project maintainers commit themselves to
fairly and consistently applying these principles to every aspect of managing
this project. Project maintainers who do not follow or enforce the Code of
Conduct may be permanently removed from the project team.

This code of conduct applies both within project spaces and in public spaces
when an individual is representing the project or its community.

Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported by contacting a project maintainer at yacsrpi@gmail.com. All
complaints will be reviewed and investigated and will result in a response that
is deemed necessary and appropriate to the circumstances. Maintainers are
obligated to maintain confidentiality with regard to the reporter of an
incident.

This Code of Conduct is adapted from the [Contributor Covenant][homepage],
version 1.3.0, available at
[http://contributor-covenant.org/version/1/3/0/][version]

[homepage]: http://contributor-covenant.org
[version]: http://contributor-covenant.org/version/1/3/0/
37 changes: 20 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,31 +1,34 @@
# YACS - Yet Another Course Scheduler

# Status
Simple, Sane Course Scheduling.
YACS is a web-based course scheduler with an emphasis on usability.
YACS is 100% RPI home-grown and hosted. To use it, visit https://yacs.cs.rpi.edu

[![Build Status](https://img.shields.io/travis/YACS-RCOS/yacs/master.svg)](https://travis-ci.org/YACS-RCOS/yacs)
[![Coverage Status](https://img.shields.io/coveralls/YACS-RCOS/yacs.svg)](https://coveralls.io/github/YACS-RCOS/yacs?branch=master)
[![Code Climate](https://img.shields.io/codeclimate/github/YACS-RCOS/yacs.svg)](https://codeclimate.com/github/YACS-RCOS/yacs)
Visit [our blog](https://yacsblog.wordpress.com/) for more updates and information.

iOS and Android apps are in development. They can be found at Our iOS app repository can be found at https://github.com/YACS-RCOS/YACSiOS and https://github.com/YACS-RCOS/YACSAndroid respectively.

# About
## API

Simple, Sane Course Scheduling.
YACS is a web-based course scheduler with an emphasis on usability.
YACS is 100% RPI home-grown and hosted. To use it, visit https://yacs.cs.rpi.edu
YACS includes a JSON API that is public by default. This can very useful for providing a standardized way of programatically accessing the data in your school's course catalog and/or student information system if no such resource exists or is publicly accessible. The API includes course searching and filtering, as well as the scheduling feature. Documentation can be found in [the wiki](https://github.com/YACS-RCOS/yacs/wiki/API-Docs).

The old version of YACS (yacs.me) by Jeff Hui still exists but will not be updated. For the latest information and fastest experience use the [RPI site](https://yacs.cs.rpi.edu)!
## Setup

Visit [our blog](https://yacsblog.wordpress.com/) for more updates and information.
YACS uses Docker and docker-compose to make setting up a breeze! See the wiki for instructions to run the app and its dependencies [in development](https://github.com/YACS-RCOS/yacs/wiki/Setting-Up-Your-Dev-Environment) and [deploy YACS at your own school](https://github.com/YACS-RCOS/yacs/wiki/Deploying-YACS-at-Your-School).

Our iOS app repository can be found at https://github.com/JGrippo/YACSiOS
## Contributing

Our Android app repository can be found at https://github.com/YACS-RCOS/YACSAndroid
We encourage you to [create issues](https://github.com/YACS-RCOS/yacs/issues/new) and contribute to YACS! To contribute [fork the repo](https://github.com/YACS-RCOS/yacs/fork), comment on an issue, and submit a pull request to the [staging](https://github.com/YACS-RCOS/yacs/tree/staging) branch. Build checks and code reviews are required before merging. Once chanbged are verified in the staging branch, they will be merged into master and a new release will be created.

YACS provides a public JSON API. Documentation can be found on the [wiki page](https://github.com/YACS-RCOS/yacs/wiki/API).
## Code of Conduct

# Setup
YACS is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant code of conduct](http://contributor-covenant.org/).

See the wiki for instructions to [run the app locally](https://github.com/YACS-RCOS/yacs/wiki/Local-Setup) and [deploy to a server](https://github.com/YACS-RCOS/yacs/wiki/Deployment).
## License
YACS is an open source project released under the terms of the [MIT License](https://opensource.org/licenses/MIT)

# Contributing
## Status

We encourage you to [create issues](https://github.com/YACS-RCOS/yacs/issues/new) and contribute to YACS! To contribute [fork the repo](https://github.com/YACS-RCOS/yacs/fork), comment on an issue, and submit a pull request to the [staging](https://github.com/YACS-RCOS/yacs/tree/staging) branch. Please make sure the build is passing before submitting a PR.
[![Build Status](https://img.shields.io/travis/YACS-RCOS/yacs/master.svg)](https://travis-ci.org/YACS-RCOS/yacs)
[![Coverage Status](https://img.shields.io/coveralls/YACS-RCOS/yacs.svg)](https://coveralls.io/github/YACS-RCOS/yacs?branch=master)
[![Code Climate](https://img.shields.io/codeclimate/github/YACS-RCOS/yacs.svg)](https://codeclimate.com/github/YACS-RCOS/yacs)
34 changes: 21 additions & 13 deletions app/assets/javascripts/controllers/courses/controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@
* @return {undefined}
* @memberOf Yacs.views
*/
'use strict';

Yacs.views.courses = function (target, params) {
params.show_sections = params.show_periods = true;
params['show_sections'] = params['show_periods'] = true;

/**
* When a section is clicked, toggle whether it is selected.
Expand All @@ -16,22 +18,27 @@ Yacs.views.courses = function (target, params) {
*/
var bindListeners = function () {
Yacs.on('click', target.querySelectorAll('section'), function (section) {
Yacs.user.removeSelection(section.dataset.id) ||
if (! Yacs.user.removeSelection(section.dataset.id)) {
Yacs.user.addSelection(section.dataset.id);
}
});

Yacs.on('click', target.querySelectorAll('course-info'), function (courseInfo) {
var courseSelected = courseInfo.parentElement.classList.contains('selected');
var sections;
if (courseSelected) {
var sections = courseInfo.parentElement.querySelectorAll('section');
Yacs.user.removeSelections(map(sections, function (section) {
sections = courseInfo.parentElement.querySelectorAll('section');
var sectionsToRemove = sections.map(function (section) {
return section.dataset.id;
}));
} else {
var sections = courseInfo.parentElement.querySelectorAll('section:not(.closed)');
Yacs.user.addSelections(map(sections, function (section) {
});
Yacs.user.removeSelections(sectionsToRemove);
}
else {
sections = courseInfo.parentElement.querySelectorAll('section:not(.closed)');
var sectionsToAdd = sections.map(function (section) {
return section.dataset.id;
}));
});
Yacs.user.addSelections(sectionsToAdd);
}
});
};
Expand All @@ -42,16 +49,17 @@ Yacs.views.courses = function (target, params) {
*/
var updateSelected = function () {
var selected = Yacs.user.getSelections();
each(target.querySelectorAll('course'), function (course) {
target.querySelectorAll('course').forEach(function (course) {
var courseSelected = false;
var sections = course.querySelectorAll('section');
if (sections.length > 0) {
courseSelected = true;
each(sections, function (section) {
sections.forEach(function (section) {
var sectionSelected = selected.indexOf(section.dataset.id) !== -1;
section.classList.toggle('selected', sectionSelected);
if (!sectionSelected && !section.classList.contains('closed'))
if (!sectionSelected && !section.classList.contains('closed')) {
courseSelected = false;
}
});
}
course.classList.toggle('selected', courseSelected);
Expand All @@ -60,7 +68,7 @@ Yacs.views.courses = function (target, params) {

Yacs.models.courses.query(params, function (data, success) {
if (success) {
Yacs.render(target, 'courses', data)
Yacs.render(target, 'courses', data);
Yacs.observe('selection', document.querySelector('courses'), updateSelected);
bindListeners();
updateSelected();
Expand Down
32 changes: 25 additions & 7 deletions app/assets/javascripts/controllers/courses/helpers.js
Original file line number Diff line number Diff line change
@@ -1,21 +1,25 @@
'use strict';

Handlebars.registerHelper('department_code', function (id) {
return new Handlebars.SafeString(Yacs.models.departments.store.id[id].code);
});

Handlebars.registerHelper('course_credits', function (c) {
var outString = '';

// render "credit(s)" properly
if (c.min_credits != c.max_credits) {
if (c.min_credits === c.max_credits) {
outString = c.max_credits + ' credit' + (c.max_credits === 1 ? '' : 's');
}
else {
outString = c.min_credits + '-' + c.max_credits + ' credits';
} else {
outString = c.max_credits + ' credit' + (c.max_credits == 1 ? '' : 's');
}
return new Handlebars.SafeString(outString);
});

Handlebars.registerHelper('formatted_description', function (description) {
if (description === '') {
description = 'Description not available...';
return new Handlebars.SafeString('Description not available...');
}
return new Handlebars.SafeString(description);
});
Expand All @@ -41,9 +45,23 @@ Handlebars.registerHelper('time_range', function (start, end) {
return new Handlebars.SafeString([start, end].map(function (time) {
var hour = Math.floor(time / 100);
var ampm = hour >= 12 ? 'p' : 'a';
hour = hour > 12 ? hour - 12 : hour == 0 ? 12 : hour;

if (hour > 12) {
hour = hour - 12;
}
else if (hour === 0) {
hour = 12;
}

var minutes = time % 100;
minutes = minutes > 9 ? minutes : minutes == 0 ? '' : '0' + minutes;
return hour + (minutes ? ':' + minutes : '') + ampm;
if (minutes === 0) {
// don't show minutes at all
return hour + ampm;
}
else if (minutes <= 9) {
minutes = '0' + minutes;
}

return hour + ':' + minutes + ampm;
}).join('-'));
});
3 changes: 3 additions & 0 deletions app/assets/javascripts/controllers/departments/controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
* @return {undefined}
* @memberOf Yacs.views
*/

'use strict';

Yacs.views.departments = function (target) {
var data = { schools: Yacs.models.schools.store.all };
Yacs.render(target, 'departments', data);
Expand Down
7 changes: 5 additions & 2 deletions app/assets/javascripts/controllers/root/controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
* @return {undefined}
* @memberOf Yacs.views
*/
'use strict';

Yacs.views.root = function (target) {
var searchbar = document.getElementById('searchbar');

Expand All @@ -30,10 +32,11 @@ Yacs.views.root = function (target) {
Yacs.on('keydown', document, function (elem, event) {
var key = event.keyCode;
if (!(event.ctrlKey || event.metaKey)) {
if ((key >= 48 && key <= 105) || key == 32) {
if ((key >= 48 && key <= 105) || key === 32) {
// normal keys focus the searchbar
searchbar.focus();
} else if (key == 13) {
}
else if (key === 13) {
// enter searches
if (searchbar.value) {
Yacs.router.visit('/courses?search=' + searchbar.value);
Expand Down
Loading

0 comments on commit 19a4985

Please sign in to comment.