Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

merge huge conficts because I was using 2 git repo

  • Loading branch information...
commit 54066f135202bee55747324cbcf86f34d31a30f8 2 parents 4fa6a02 + 99de982
Sébastien Gruhier authored
View
1  Gemfile
@@ -22,7 +22,6 @@ group :test do
gem "launchy", ">= 2.0.5"
gem 'simplecov', :require => false
gem 'ffaker', '~> 1.14.0'
- gem 'mocha'
end
# case HOST_OS
# when /darwin/i
View
4 Gemfile.lock
@@ -139,11 +139,8 @@ GEM
i18n (>= 0.4.0)
mime-types (~> 1.16)
treetop (~> 1.4.8)
- metaclass (0.0.1)
method_source (0.7.1)
mime-types (1.18)
- mocha (0.11.4)
- metaclass (~> 0.0.1)
mongo (1.6.2)
bson (~> 1.6.2)
mongoid (2.4.10)
@@ -314,7 +311,6 @@ DEPENDENCIES
kaminari
launchy (>= 2.0.5)
less-rails-bootstrap
- mocha
mongoid (~> 2.4.8)
mongoid-rspec (>= 1.4.4)
mongoid_search
View
9 Guardfile
@@ -31,7 +31,6 @@ guard 'spork' do
watch('Gemfile.lock')
watch('spec/spec_helper.rb') { :rspec }
watch('test/test_helper.rb') { :test_unit }
- watch(%r{features/support/}) { :cucumber }
end
guard 'rspec', :version => 2, :cli => "--drb" do
@@ -52,13 +51,6 @@ guard 'rspec', :version => 2, :cli => "--drb" do
watch(%r{^app/views/(.+)/.*\.(erb|haml)$}) { |m| "spec/requests/#{m[1]}_spec.rb" }
end
-
-# guard 'cucumber' do
-# watch(%r{^features/.+\.feature$})
-# watch(%r{^features/support/.+$}) { 'features' }
-# watch(%r{^features/step_definitions/(.+)_steps\.rb$}) { |m| Dir[File.join("**/#{m[1]}.feature")][0] || 'features' }
-# end
-
guard 'spork', :cucumber_env => { 'RAILS_ENV' => 'test' }, :rspec_env => { 'RAILS_ENV' => 'test' } do
watch('config/application.rb')
watch('config/environment.rb')
@@ -68,5 +60,4 @@ guard 'spork', :cucumber_env => { 'RAILS_ENV' => 'test' }, :rspec_env => { 'RAIL
watch('Gemfile.lock')
watch('spec/spec_helper.rb') { :rspec }
watch('test/test_helper.rb') { :test_unit }
- watch(%r{features/support/}) { :cucumber }
end
View
1  app/assets/javascripts/condition.js.coffee
@@ -36,3 +36,4 @@ class @Condition
value += 86400 if input.hasClass('to')
value = default_value if value.length == 0
value
+
View
2  app/assets/javascripts/map.js.coffee.erb
@@ -10,7 +10,7 @@
mapquestAttrib = 'Data, imagery and map information provided by <a href="http://open.mapquest.co.uk" target="_blank">MapQuest</a>,
<a href="http://www.openstreetmap.org/" target="_blank">OpenStreetMap</a> and contributors.'
- tileLayer = new L.TileLayer(mapquestUrl, maxZoom: 18, attribution: mapquestAttrib, subdomains: subDomains)
+ tileLayer = new L.TileLayer(mapquestUrl, maxZoom: 14, attribution: mapquestAttrib, subdomains: subDomains)
map.setView(new L.LatLng(25, 0), 1).addLayer(tileLayer)
# Create maptimize controller
View
6 app/assets/stylesheets/application.css.less
@@ -27,7 +27,9 @@ h1,h2,h3,h4,h5 {font-family: 'Convergence', sans-serif;}
margin-top: 0px;
color: #888;
}
-
+select.date {
+ width: auto
+}
.centered {
text-align:center
}
@@ -55,6 +57,7 @@ h2 {
margin-top: 40px;
}
+
@media (max-width: 979px) {
#container {
margin-top: -25px;
@@ -118,6 +121,7 @@ p.text {
padding:2px 5px;
margin-bottom: 5px
}
+
/* Filters */
.datepicker {
width: 100px;
View
2  app/models/concern/searchable.rb
@@ -6,7 +6,7 @@ module Searchable
include Tire::Model::Search
include Tire::Model::Callbacks
- #index_name "#{self.to_s.tableize}_#{Rails.env}" unless Rails.env.production?
+ index_name "#{self.to_s.tableize}_#{Rails.env}" unless Rails.env.production?
end
def to_indexed_json
View
17 app/models/user.rb
@@ -1,5 +1,7 @@
class User
include Mongoid::Document
+ include Mongoid::MultiParameterAttributes
+
# Include default devise modules. Others available are:
# :token_authenticatable, :encryptable, :confirmable, :lockable, :timeoutable and :omniauthable
devise :database_authenticatable, :registerable,
@@ -75,4 +77,19 @@ def self.find_for_facebook_oauth(access_token, signed_in_resource=nil)
User.create!(:email => data.email, :password => password, :password_confirmation => password, :gender => gender, :nickname => username, :birthdate => birthday)
end
end
+
+ ## Override devise methods to remove the "current_password", I hate that behavior
+ def update_with_password(params={})
+ current_password = params.delete(:current_password)
+
+ if params[:password].blank?
+ params.delete(:password)
+ params.delete(:password_confirmation) if params[:password_confirmation].blank?
+ end
+
+ result = update_attributes(params)
+
+ clean_up_passwords
+ result
+ end
end
View
3  app/views/devise/registrations/edit.html.erb
@@ -4,11 +4,10 @@
<%= f.input :email, :required => true, :autofocus => true %>
<%= f.input :nickname, :input_html => {:autocomplete => :off} %>
- <%#= f.input :birthdate, :as => :date %>
+ <%= f.input :birthdate, :as => :date, :start_year => Date.today.year - 120, :end_year => Date.today.year %>
<%= f.input :gender, :as => :radio_buttons, :collection => {"#{t :male}" => "male", "#{t :female}" => "female"} %>
<%= f.input :password, :input_html => {:autocomplete => :off}, :hint => t('devise.registrations.leave_blank'), :required => false %>
<%= f.input :password_confirmation, :required => false , :input_html => {:autocomplete => :off} %>
- <%= f.input :current_password, :hint => t('devise.registrations.current_password_label'), :required => true , :input_html => {:autocomplete => :off}%>
<div class="control-group">
<div class="controls">
View
50 app/views/medications/_list.html.erb
@@ -1,40 +1,20 @@
-<table class="table table-striped table-bordered table-condensed">
- <tr>
- <th><%= t('simple_form.labels.medication.name') %></th>
- <th><%= t('simple_form.labels.medication.generic_name') %></th>
- <th><%= t('simple_form.labels.medication.secondary_effects') %></th>
- <th>Nb</th>
-
- <th></th>
- </tr>
-
<% @medications.each do |medication| %>
- <tr>
- <td><%= medication.name %></td>
- <td><%= medication.generic_name %></td>
- <td>
+ <div class="container well medication_list">
+ <div class="row">
+ <h3>
+ <%= medication.name %>
+ <% unless medication.generic_name.blank? %>
+ <small> - <%= medication.generic_name %></small>
+ <% end %>
+ <em>(<%= medication.prescriptions.count %>)</em>
+ </h3>
+ </div>
+ <div class="row">
+ <span class="hidden-phone"><%= t('simple_form.labels.medication.secondary_effects') %> : </span></span>
<% medication.secondary_effects_array.each do |tag| %>
<span class="label label-info"><%= tag %></span>
<% end %>
- </td>
- <td>
- <%= medication.prescriptions.count %>
- </td>
-
- <td>
- <i class="icon-eye-open"></i> <%= link_to t(:show), medication_path(medication.slug), class: :action %> -
- <% if medication.has_geo_data? %>
- <i class="icon-map-marker"></i>
- <%= link_to t(:map), map_medication_path(medication.slug), class: :action %> -
- <% end %>
- <i class="icon-plus"></i> <%= link_to t(:"medications.add_effects"), new_medication_secondary_effect_path(medication.slug), class: :action%>
-
- <% if admin_mode %>
- - <i class="icon-edit"></i> <%= link_to t(:edit), edit_medication_path(medication.slug), class: :action %>
- - <i class="icon-remove"></i> <%= link_to 'Destroy', medication_path(medication.slug), confirm: 'Are you sure?', method: :delete , class: :action %>
- <% end %>
- </td>
- </tr>
+ </div>
+ <%= render "actions", medication: medication, with_show: true %>
+ </div>
<% end %>
-</table>
-<%= paginate @medications %>
View
2  app/views/medications/elastic_search.html.erb
@@ -1,5 +1,5 @@
<h2><%= t('search.title', :for => @search) %></h2>
-<%= render 'list_new' %>
+<%= render 'list' %>
<%= render 'elastic_search_facets' %>
<br />
<%= link_to t('medications.add_title'), new_medication_path, :class=>"link" %>
View
3  app/views/medications/map.html.erb
@@ -19,6 +19,9 @@
<%= t(:from) %> <input id="from" type="date" class="datepicker from"/><br/>
<%= t(:to) %> <input id="to" type="date" class="datepicker to"/><br/>
</div>
+ <%= link_to new_medication_secondary_effect_path(@medication.slug), class: "btn btn-small btn-primary" do %>
+ <i class="icon-plus icon-white"></i> <span><%= t(:'medications.add_effects') %></span>
+ <% end %>
</div>
<div class="span8">
<div id='map'><div>
View
43 app/views/medications/show.html.erb
@@ -17,28 +17,27 @@
<% end %>
</ul>
</p>
- <% if admin? %>
- <% @prescriptions.each do |prescription| %>
- <div class="row well">
- <%= prescription.user.nickname.blank? ? t(:anonymous) : prescription.user.nickname %>
- <% prescription.secondary_effects_array.each do |tag| %>
- <span class="label label-info"><%= tag %></span>
- <% end %>
- <br/>
- <% if prescription.user_agent_info %>
- <span class="label label">
- <%= prescription.user_agent_info['platform'] %>
- </span>&nbsp;
- <% end %>
- <% if prescription.user_agent_info && prescription.user_agent_info['is_mobile'] %>
- <span class="label label-success">
- <%= t(:mobile) %>
- </span>
- <% end %>
- </div>
- <% end %>
- <br/>
- <%= paginate @prescriptions %>
+ <% @prescriptions.each do |prescription| %>
+ <div class="row well">
+ <%= prescription.user.nickname.blank? ? t(:anonymous) : prescription.user.nickname %>
+ <% prescription.secondary_effects_array.each do |tag| %>
+ <span class="label label-info"><%= tag %></span>
+ <% end %>
+ <br/>
+ <% if prescription.user_agent_info %>
+ <span class="label label">
+ <%= prescription.user_agent_info['platform'] %>
+ </span>&nbsp;
+ <% end %>
+ <% if prescription.user_agent_info && prescription.user_agent_info['is_mobile'] %>
+ <span class="label label-success">
+ <%= t(:mobile) %>
+ </span>
+ <% end %>
+ </div>
<% end %>
+ <br/>
+ <%= paginate @prescriptions %>
+
<%= render "actions", medication: @medication, with_show: false %>
</div>
View
6 config/deploy/production.rb
@@ -33,7 +33,7 @@
set :scm_verbose, true
set :use_sudo, false
-set :repository, "git@github.com:xilinus/bbphealth.git"
+set :repository, "git@github.com:BBP/BBPHealth.git"
set :branch, 'master'
set :rake, '$HOME/.rbenv/shims/rake'
@@ -70,7 +70,11 @@
namespace :bundle do
task :install do
+<<<<<<< HEAD
run "cd #{release_path}; bundle install --deployment --binstubs --shebang ruby-local-exec --without test:development:cucumber --path #{shared_path}/bundle"
+=======
+ run "cd #{release_path}; bundle install --deployment --binstubs --shebang ruby-local-exec --without test:development --path #{shared_path}/bundle"
+>>>>>>> 99de982f38953f782d0d60e4749576d2ae21b7c6
end
end
View
10 config/environments/production.rb
@@ -58,17 +58,21 @@
# Send deprecation notices to registered listeners
config.active_support.deprecation = :notify
- config.action_mailer.default_url_options = { :host => 'yourhost.com' }
# ActionMailer Config
# Setup for production - deliveries, no errors raised
config.action_mailer.delivery_method = :smtp
config.action_mailer.perform_deliveries = true
- config.action_mailer.raise_delivery_errors = false
+ config.action_mailer.raise_delivery_errors = true
config.action_mailer.default :charset => "utf-8"
config.action_mailer.default_url_options = { :host => 'bbphealth.xilinus.com' }
config.clusterer_url = "http://clusterer.xilinus.com"
config.clusterer_key = "f5591a74bd5f099d327535ad9dfdbae61eccaf38"
-
+ config.action_mailer.smtp_settings = {
+ :address => "localhost",
+ :port => 25,
+ :domain => "bbphealth.xilinus.com",
+ :openssl_verify_mode => 'none'
+ }
end
View
4 config/initializers/omniauth.rb
@@ -1,9 +1,9 @@
require "omniauth-facebook"
Rails.application.config.middleware.use OmniAuth::Builder do
if Rails.env.development?
- provider :facebook, '362807127093790', 'a3d57d6c1bd18e65c01b0e6fe2900332', :setup => true, scope: "user_birthday,user_about_me"
+ provider :facebook, '362807127093790', 'a3d57d6c1bd18e65c01b0e6fe2900332', :setup => true, scope: "email,user_birthday,user_about_me"
elsif Rails.env.production?
- provider :facebook, '334294033301652', '8606d936d9557b892a5c42c605e83aa2', :setup => true, scope: "user_birthday,user_about_me"
+ provider :facebook, '334294033301652', '8606d936d9557b892a5c42c605e83aa2', :setup => true, scope: "email,user_birthday,user_about_me"
end
end
OmniAuth.config.logger = Rails.logger
View
3  config/initializers/tire.rb
@@ -1,5 +1,6 @@
require 'tire'
+
Tire.configure do
if Rails.env.production? || Rails.env.staging?
logger STDERR, :level => 'debug'
@@ -7,4 +8,4 @@
logger 'log/elasticsearch.log', :level => 'debug'
end
url(YAML::load(File.open(Rails.root.join("./config/tire.yml")))[Rails.env]["url"])
-end
+end
View
7 config/locales/fr.yml
@@ -33,3 +33,10 @@ fr:
update: Mettre à jour
search:
title: "Résutats de recherche pour '%{for}'"
+ views:
+ pagination:
+ first: "&laquo; Début"
+ last: "Fin &raquo;"
+ previous: "&lsaquo; Précédent"
+ next: "Suivant &rsaquo;"
+ truncate: "..."
View
1  db/seeds.rb
@@ -23,7 +23,6 @@
p.save!
end
-
m = Medication.new name: "corgard", generic_name: "nadolol"
m.user = user
View
0  script/cucumber 100755 → 100644
File mode changed
View
1  spec/models/medication_spec.rb
@@ -13,7 +13,6 @@
it "should create a prescription with same secondary effects" do
medication = create(:medication, :secondary_effects => "foo,bar")
medication.prescriptions.length.should == 1
-
prescription = medication.prescriptions.first
prescription.user.should == medication.user
prescription.secondary_effects.should == medication.secondary_effects
View
1  spec/models/prescription_spec.rb
@@ -1,5 +1,4 @@
require 'spec_helper'
-
describe Prescription do
it "should create a simple prescription" do
prescription = create(:prescription)
View
2  spec/requests/search_spec.rb
@@ -12,6 +12,7 @@
@medications << create(:medication, :name => "ibuprofene", :generic_name => "ibuprofene")
@medications << create(:medication, :name => "asprin", :generic_name => "asprin")
+ Medication.tire.index.refresh
visit root_path
end
@@ -20,6 +21,7 @@
find("#search-button").click
current_path.should == elastic_search_medications_path
+
page.should have_css("h3", :text => "ibuprofene")
page.should_not have_css("h3", :text => "asprin")
end
View
2  spec/requests/users_spec.rb
@@ -86,7 +86,6 @@
it "should edit my account with valid info" do
visit edit_user_registration_path
fill_in 'user_email', :with => "foo@bar.com"
- fill_in 'user_current_password', :with => "secret"
click_button I18n.t("update")
@user.reload.email.should == "foo@bar.com"
@@ -95,6 +94,7 @@
it "should not edit my account with invalid info" do
visit edit_user_registration_path
fill_in 'user_email', :with => "foo@bar.com"
+ fill_in 'user_password', :with => "bad pass"
click_button I18n.t("update")
@user.reload.email.should_not == "foo@bar.com"
View
5 spec/support/devise.rb
@@ -9,9 +9,6 @@ def login(user = :user)
def admin_login
login(:admin)
- # before(:each) do
- # request.env['HTTP_AUTHORIZATION'] = ActionController::HttpAuthentication::Basic.encode_credentials("admin", "top_secret")
- # end
end
end
@@ -25,10 +22,10 @@ def login(user = :user)
click_button I18n.t("devise.shared.sign_in")
end
end
+
def admin_login
login(:admin)
end
-
end
RSpec.configure do |config|
Please sign in to comment.
Something went wrong with that request. Please try again.