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
App.Project = DS.Model.extend( | |
title: DS.attr("string", defaultValue: 'Please enter a title') | |
created_at: DS.attr('date') | |
updated_at: DS.attr('date') | |
status: DS.attr('string') | |
cover_image_url: DS.attr('string', defaultValue: '') | |
cover_image_thumb_url: DS.attr('string', defaultValue: '') | |
cover_image_show_url: DS.attr('string', defaultValue: '') | |
owner: DS.belongsTo('App.User') | |
description: DS.attr('string') |
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 ProjectSerializer < ActiveModel::Serializer | |
attributes :id, :title, :status, :owner, :description, :created_at, :updated_at, :cover_image_url, :cover_image_thumb_url, :cover_image_show_url | |
def cover_image_thumb_url | |
object.cover_image.url(:thumb) | |
end | |
def cover_image_show_url | |
object.cover_image.url(:show) | |
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
def self.index(params) | |
projects = scoped | |
projects = projects.order "#{params[:order_field]} #{params[:order_direction]}" if params[:order_field] && params[:order_direction] | |
projects = projects.limit params[:limit] if params[:limit] | |
projects | |
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 Api::ProjectsController < Api::ApiController | |
respond_to :json, :xml | |
def create | |
@project = Project.new params[:project] | |
if @project.save | |
return @project | |
else | |
return [ @project,:status => :unprocessable_entity ] | |
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
Select outcomes, inverted_outcomes, sum(outcomes,inverted_outcomes) as goals_met | |
FROM | |
(SELECT Count(outcome_records) FROM "visits" | |
INNER JOIN progress_reports ON progress_reports.visit_id = visits.id | |
INNER JOIN outcome_records ON progress_reports.id = outcome_records.progress_report_id | |
INNER JOIN outcome_goals ON outcome_records.goal_id = outcome_goals.id | |
WHERE ends_on IS NOT NULL | |
AND outcome_records.integer_value IS NOT null | |
AND progress_reports.final is true | |
AND outcome_goals.inverted is false |
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
context "The article is an ebsco article" do | |
before(:each) do | |
@ea = Factory(:ebsco_article, :teaser => '<p>\r\n\t </p>\r\n<p>teaser text</p>', :text => '<p>\r\n\t </p>\r\n<p>body text</p>') | |
end | |
it "should not call p clean on the teaser" do | |
@ea.teaser.should == '<p>\r\n\t </p>\r\n<p>teaser text</p>' | |
end | |
it "should not call p clean on the text" do |
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
FactoryGirl.define do | |
factory :resource do | |
title 'Resrouce Test' | |
author_name 'George Costanza' | |
author_bio 'Once upon some time...' | |
text 'Donec gravida posuere arcu. Nulla facilisi. Phasellus imperdiet. Vestibulum at metus. Integer euismod. Nullam placerat rhoncus sapien. Ut euismod. Praesent libero. Morbi pellentesque libero sit amet ante. Maecenas tellus. Maecenas erat. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas.' | |
published_at Date.today | |
user | |
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
startup_message off | |
#caption always '%{= kG}[ %{G}%H %{g}][%= %{=kw}%?%-Lw%?%{r}(%{W}%n*%f%t%?(%u)%?%{r})%{w}%?%+Lw%?%?%= %{g}][%{B}%D %Y-%m-%d %{W}%c %{g}]' | |
altscreen on | |
vbell off | |
termcapinfo xterm ti@:te@ | |
#shell -$SHELL | |
escape ^Jj | |
defscrollback 5000 | |
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
<table width="600"> | |
<tbody> | |
<tr> | |
<td style="padding:15px;"> | |
<%= @user.first_name %>, | |
<p>A request to reset your Pearlpoint.org password has been made.</p> | |
<p>If you did not make this request, please ignore this email.</p> |
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
def chart_health_tracker_data(health_tracker_entry_list, header, method, days_back = 7) | |
start_day = Date.today - days_back + 1 | |
day_labels = [] | |
exercise_points = [] | |
calorie_points = [] | |
weight_points = [] | |
table = [header] | |
#iterate through the days and store points | |
start_day.step(start_day + days_back - 1, 1) {|day| | |
result = 0 |