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
<%= form_for @syllabus, :html => { :class => "form-horizontal" } do |f| %> | |
<% if @syllabus.errors.any? %> | |
<div id="error_explanation"> | |
<h2><%= pluralize(@syllabus.errors.count, "error") %> prohibited this syllabus from being saved:</h2> | |
<ul> | |
<% @syllabus.errors.full_messages.each do |msg| %> | |
<li><%= msg %></li> | |
<% end %> | |
</ul> |
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
<%= form_tag(import_missions_path, :method => :post, :id => "import-js", :remote => true ) do |f| %> | |
<ul> | |
<% current_user.folders.find_by_order(1).missions.each do |mission| %> | |
<li> <%= check_box_tag "mission_ids[]", mission.id %> | |
<%= mission.id.to_s + ". " + mission.title %> </li> | |
<% end %> | |
</ul> | |
<%= submit_tag "Import ", :class => 'btn btn-primary' %> | |
<% 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
class Track < ActiveRecord::Base | |
acts_as_taggable | |
include PgSearch | |
pg_search_scope :search_by_title, :against => :title #:using => [:tsearch => {:prefix => true}], #:trigram, :dmetaphone] | |
pg_search_scope :search_by_weight, | |
:against => { | |
:title => 'B', | |
:description => 'C' |
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
class ApplicationController < ActionController::Base | |
protect_from_forgery | |
#session['user_return_to'] = request.url | |
def after_sign_in_path_for(resource) | |
sign_in_url = "http://localhost:3000/users/sign_in" || "http://onvard.com/users/sign_in" || | |
"http://www.onvard.com/users/sign_in" #url_for(:action => 'new', :controller => 'sessions', :only_path => false, :protocol => 'http') | |
if (request.referer == sign_in_url) |
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
class MissionsController < ApplicationController | |
# GET /missions | |
# GET /missions.json | |
before_filter :store_location | |
before_filter :authenticate_user!, :except => [:show, :index] | |
def vote_for_mission | |
@mission = Mission.find(params[:id]) | |
@originalpage = session[:page_a] |
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
class ApplicationController < ActionController::Base | |
protect_from_forgery | |
#session['user_return_to'] = request.url | |
def after_sign_in_path_for(resource) | |
sign_in_url = "http://localhost:3000/users/sign_in" || "http://onvard.com/users/sign_in" || | |
"http://www.onvard.com/users/sign_in" #url_for(:action => 'new', :controller => 'sessions', :only_path => false, :protocol => 'http') | |
if (request.referer == sign_in_url) |
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
<body> | |
<%= render 'layouts/header' %> | |
<div class="background"> | |
<% if current_page?(root_url) %> | |
<%= yield :index %> | |
<!-- PROBLEM: if i include the show_track, then other pages dont work --> | |
<% elsif current_page?(@track) %> | |
<%= yield :show_track %> | |
<% else %> |
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
view/layouts/tracks.html.erb | |
//according to the Layout Assignment on http://api.rubyonrails.org/classes/AbstractController/Layouts.html, I created a new layout file with the same name as the controller | |
<!DOCTYPE html> | |
<html> | |
<head> | |
<title><%= content_for?(:title) ? yield(:title) : "Onvard" %></title> | |
<!-- [if lt IE9]> | |
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js" |
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
# GET /tracks/new | |
# GET /tracks/new.json | |
def new | |
@track = Track.new | |
@missions = @track.missions.build | |
respond_to do |format| | |
format.html # new.html.erb |
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
module Ratis | |
class Area | |
attr_accessor :area, :description | |
def self.all | |
response = Request.get 'Getareas' | |
return [] unless response.success? |
OlderNewer