mirror of
https://github.com/chenasraf/snpr.git
synced 2026-05-17 17:38:07 +00:00
Fixes bug with unreplaceable avatar. Removes obsolete rake tasks. Removes solr from serverscript. Slightly refactors edit page.
This commit is contained in:
@@ -191,7 +191,7 @@ GEM
|
||||
mime-types (2.6.2)
|
||||
mimemagic (0.3.0)
|
||||
mini_portile (0.6.2)
|
||||
minitest (5.8.1)
|
||||
minitest (5.8.2)
|
||||
mocha (1.1.0)
|
||||
metaclass (~> 0.0.1)
|
||||
multi_json (1.11.2)
|
||||
@@ -451,6 +451,3 @@ DEPENDENCIES
|
||||
webmock
|
||||
whenever
|
||||
will_paginate
|
||||
|
||||
BUNDLED WITH
|
||||
1.10.6
|
||||
|
||||
@@ -262,6 +262,17 @@ class UsersController < ApplicationController
|
||||
:email,
|
||||
:password,
|
||||
:password_confirmation,
|
||||
:avatar,
|
||||
:delete_avatar,
|
||||
:sex,
|
||||
:yearofbirth,
|
||||
:description,
|
||||
:homepages_attributes,
|
||||
:message_on_newsletter,
|
||||
:message_on_message,
|
||||
:message_on_new_phenotype,
|
||||
:message_on_phenotype_comment_reply,
|
||||
:message_on_snp_comment_reply,
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -2,14 +2,14 @@ class User < ActiveRecord::Base
|
||||
include PgSearchCommon
|
||||
|
||||
has_attached_file :avatar,
|
||||
styles: { medium: "300x300>", thumb: "100x100>#", head: "32x32#" },
|
||||
styles: { medium: "300x300>", thumb: "100x100>", head: "32x32#" },
|
||||
default_url: 'standard_:style.png'
|
||||
|
||||
before_validation :clear_avatar
|
||||
|
||||
validates_attachment_size :avatar, less_than: 1.megabyte
|
||||
validates_attachment_content_type :avatar,
|
||||
content_type: ['image/jpeg', 'image/png', 'image/gif']
|
||||
content_type: /\Aimage\/.*\Z/
|
||||
# call on authlogic
|
||||
acts_as_authentic do |c|
|
||||
# replace SHA512 by bcrypt
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<% # helper thing so we don't have to put up fields into every page %>
|
||||
<%= nested_form_for(@user, :remote => true, :url => user_path, :html => { :class => "form-stacked",:multipart => true } ) do |f| %>
|
||||
<%= render 'shared/error_messages', :target => @user %>
|
||||
<%= nested_form_for(@user, url: user_path, html: { multipart: true, class: "horizontal" }) do |f| %>
|
||||
|
||||
<%= render 'shared/error_messages', target: @user %>
|
||||
<div id="post_errors" style="display:none"></div>
|
||||
<div id="tab-container">
|
||||
<ul class="nav nav-tabs">
|
||||
@@ -14,37 +14,34 @@
|
||||
<div id="general">
|
||||
<div class="well">
|
||||
<h2>General Information</h2>
|
||||
<%= image_tag @user.avatar.url(:thumb) %>
|
||||
<%if @user.avatar_file_name != nil%>
|
||||
<%= f.label(:delete_avatar, 'Delete current avatar') %><%= f.check_box(:delete_avatar) %>
|
||||
<%end%>
|
||||
<div class="clearfix">
|
||||
<%= f.label :avatar, "Upload new avatar"%>
|
||||
<%=f.file_field :avatar%>
|
||||
</div>
|
||||
|
||||
<div class="clearfix">
|
||||
<%= f.label :name %>
|
||||
<%= f.label :name, "Your username" %>
|
||||
<%= f.text_field :name %>
|
||||
</div>
|
||||
|
||||
<%= f.label :avatar, "Your current avatar" %>
|
||||
<%= image_tag @user.avatar.url(:thumb) %>
|
||||
<% if @user.avatar_file_name != nil %>
|
||||
<div class="checkbox">
|
||||
<%= f.check_box(:delete_avatar) %> Delete current avatar?
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<%= f.label :avatar, "Upload new avatar"%>
|
||||
<%= f.file_field :avatar %>
|
||||
|
||||
|
||||
<h5><%=link_to "Change eMail/Password",{ :controller => "users", :action => "changepassword",:id => @user.id }%></h5>
|
||||
<h5><%= link_to "Change eMail/Password", {controller: "users", action: "changepassword", id: @user.id} %></h5>
|
||||
|
||||
<% if current_user.genotypes.length >= 1%><%= link_to "Add another genotyping!", :controller => "genotypes", :action => "new"%><% end %>
|
||||
<% if current_user.genotypes.length >= 1%><%= link_to "Add another genotyping!", controller: "genotypes", action: "new"%><% end %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="phenotypes">
|
||||
<div class="well">
|
||||
<h2>Your Phenotypes</h2>
|
||||
<div class="clearfix">
|
||||
<%= f.label :sex, "Chromosomal Sex"%>
|
||||
<%= f.select :sex, options_for_select(["XX", "XY", "other", "rather not say"], :selected => @user.sex) %>
|
||||
</div>
|
||||
<div class="clearfix">
|
||||
<%= f.select :sex, options_for_select(["XX", "XY", "other", "rather not say"], selected: @user.sex) %>
|
||||
<%= f.label :yearofbirth, "Year of Birth"%>
|
||||
<%= f.select :yearofbirth, options_for_select(((1900..2011).to_a << "rather not say").reverse, :selected => @user.yearofbirth) %>
|
||||
</div>
|
||||
<%= f.select :yearofbirth, options_for_select(((1900..2015).to_a << "rather not say").reverse, selected: @user.yearofbirth) %>
|
||||
<h2>Additional phenotypes</h2>
|
||||
<%= f.fields_for :user_phenotypes do |p| %>
|
||||
<% @phenotype = Phenotype.find_by_id(p.object.phenotype_id) %>
|
||||
@@ -62,22 +59,18 @@
|
||||
</div>
|
||||
<%end %>
|
||||
|
||||
<%= link_to "Add a new phenotype", :controller => "phenotypes", :action => "new" %>
|
||||
<%= link_to "Add a new phenotype", controller: "phenotypes", action: "new" %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="details">
|
||||
<div class="well">
|
||||
<h2>Details</h2>
|
||||
<div class="clearfix">
|
||||
<p>Add or edit a description of yourself:<br/><%= f.text_area :description, :size => "1x10" %></p>
|
||||
</div>
|
||||
<p>Add or edit a description of yourself:<br/><%= f.text_area :description, size: "1x10" %></p>
|
||||
<p>Please provide at least one homepage (or Twitter, Blog etc.) </p>
|
||||
<%= f.fields_for :homepages do |h| %>
|
||||
<div class="clearfix">
|
||||
Description <%= h.text_field :description %>
|
||||
URL <%= h.url_field :url %><%= h.link_to_remove "Remove"%>
|
||||
</div>
|
||||
<% end %>
|
||||
<%= f.link_to_add "Add a page", :homepages %>
|
||||
</div>
|
||||
@@ -121,6 +114,6 @@
|
||||
</div>
|
||||
|
||||
<div class="actions">
|
||||
<%= f.submit "Update Information", :class => "btn btn-primary", :id => "update_user" %>
|
||||
<%= f.submit "Update Information", class: "btn btn-primary", id: "update_user" %>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
<legend>Edit your details</legend>
|
||||
<br/>
|
||||
<%= render 'edit' %>
|
||||
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
namespace :snpedia do
|
||||
desc "kick out those nasty extra-crap things"
|
||||
task :clean => :environment do
|
||||
SnpediaPaper.all.each do |paper|
|
||||
if paper.summary.index("}}") != nil
|
||||
puts "OLD"
|
||||
puts paper.summary
|
||||
paper.update_attributes(:summary => paper.summary[0...paper.summary.index("}}")-1])
|
||||
puts "NEW"
|
||||
puts paper.summary
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -1,15 +0,0 @@
|
||||
# delete broken snps of user
|
||||
|
||||
namespace :snps do
|
||||
desc "delete broken snps"
|
||||
task :delete => :environment do
|
||||
Snp.where("id >= 1941594 and id <= 1956090").find_each do |s|
|
||||
s.user_snps.each do |us|
|
||||
puts "delete user-snp: " + us.snp_name
|
||||
UserSnp.delete(us)
|
||||
end
|
||||
puts "delete snp: " + s.name
|
||||
Snp.delete(s)
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -1,5 +1,4 @@
|
||||
#/bin/bash
|
||||
screen -X -S Server quit
|
||||
screen -X -S Solr quit
|
||||
killall -9 redis-server
|
||||
screen -X -S Sidekiq quit
|
||||
|
||||
Reference in New Issue
Block a user