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 DrugFinder | |
attr_accessor :user, :scope | |
def initialize(user, scope = Drug.all) | |
@user = user | |
@scope = scope | |
end | |
def drugs | |
if user.is_admin? | |
drugs_for_admin |
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 Tenon::ProfileSpecificResourcesController < Tenon::ResourcesController | |
before_filter :authorize_site | |
def index | |
params[:page] = 1 if params[:page].to_i == 0 | |
respond_to do |format| | |
format.html | |
format.json do | |
self.collection = current_profile.send(plural_name) | |
self.collection = collection.where(search_args) if params[:q] |
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
_subscribeToEvents: -> | |
PubSub.subscribe 'mailChimp:loading', (e) -> | |
@setState(loading: true) if e.submitter == this | |
PubSub.subscribe 'mailChimp:done', (e) -> | |
@setState(loading: false) if e.submitter == this | |
PubSub.subscribe 'mailChimp:success', (e) -> | |
@setState(successMsg: e.msg, errorMsg: null) if e.submitter == this |
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
.embed-container | |
- if obj.external_video_url.downcase.match('youtube') | |
%iframe.external-video{ :frameborder => 0, :allowfullscreen => true, :src => "//www.youtube.com/embed/#{youtube_video_id_from_url(obj.external_video_url)}?rel=0" } | |
- elsif obj.external_video_url.downcase.match('vimeo') | |
%iframe.external-video{ frameborder: 0, webkitallowfullscreen: true, mozallowfullscreen: true, allowfullscreen: true, src: "//player.vimeo.com/video/#{vimeo_video_id_from_url(obj.external_video_url)}?color=#{current_site.brand_color.gsub('#', '')}&title=0&byline=0&portrait=0"} | |
# The CSS | |
.embed-container { | |
position: relative; | |
padding-bottom: 56.25%; |
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
{"errors":"{\"name\":[\"can't be blank\"],\"email\":[\"can't be blank\"],\"base\":[\"You are not human (according to reCAPTCHA).\"]}"} |
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
# For more information see: http://emberjs.com/guides/routing/ | |
OH.Router.map ()-> | |
@resource 'listings', path: '/', -> | |
@route 'show', path: '/listings/:id' | |
@resource 'itinerary', path: '/itinerary/:id' | |
@resource 'realtors', path: '/realtors', -> | |
@route 'show', path: ':id' |
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
actions: | |
search: -> | |
@store | |
.find('realtor', { name: @get('name'), city: @get('city') }) | |
.then (result) => | |
@set('model', result) | |
@set('meta', result.get('meta')) |
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
actions: | |
search: -> | |
find = @store.find('realtor', { name: @get('name'), city: @get('city') }) | |
@set('model', find) |
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
OH.RealtorsIndexRoute = Ember.Route.extend | |
model: (params) -> | |
params.page ||= 1 | |
@store.find('realtor', { page: params.page }) | |
setupController: (controller) -> | |
$.get('/api/v1/realtors/cities.json').then (data) => | |
controller.set('cities', data.cities) |
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
# Model | |
OH.Itinerary = DS.Model.extend | |
uniqueKey: DS.attr('string') | |
listings: DS.hasMany('listing') | |
remove: (listing) -> | |
if confirm("Remove #{listing.get('address1')} from your itinerary?") | |
@get('listings').removeObject(listing) | |
$.ajax | |
url: "/api/v1/itinerary_listings/#{@get('uniqueKey')}.json" |