Skip to content

Commit

Permalink
Merge branch 'master' into api-2.3
Browse files Browse the repository at this point in the history
  • Loading branch information
martinciu committed Sep 11, 2012
2 parents 33abb5b + fb70eaa commit f5825ed
Show file tree
Hide file tree
Showing 18 changed files with 159 additions and 43 deletions.
3 changes: 2 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
source 'http://rubygems.org'

gem 'rails', '3.2.6'
gem 'rails', '3.2.8'

gem 'nokogiri'
gem 'mongoid', '~> 2.4.10'
Expand Down Expand Up @@ -49,6 +49,7 @@ group :development, :test do
end
# gem 'rpm_contrib'
# gem 'newrelic_rpm'
gem 'capistrano'
end

group :test do
Expand Down
75 changes: 45 additions & 30 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,35 +2,35 @@ GEM
remote: http://rubygems.org/
specs:
SystemTimer (1.2.3)
actionmailer (3.2.6)
actionpack (= 3.2.6)
actionmailer (3.2.8)
actionpack (= 3.2.8)
mail (~> 2.4.4)
actionmailer_inline_css (1.3.1)
actionmailer (>= 3.0.0)
nokogiri (>= 1.4.4)
premailer (>= 1.7.1)
actionpack (3.2.6)
activemodel (= 3.2.6)
activesupport (= 3.2.6)
actionpack (3.2.8)
activemodel (= 3.2.8)
activesupport (= 3.2.8)
builder (~> 3.0.0)
erubis (~> 2.7.0)
journey (~> 1.0.1)
journey (~> 1.0.4)
rack (~> 1.4.0)
rack-cache (~> 1.2)
rack-test (~> 0.6.1)
sprockets (~> 2.1.3)
activemodel (3.2.6)
activesupport (= 3.2.6)
activemodel (3.2.8)
activesupport (= 3.2.8)
builder (~> 3.0.0)
activerecord (3.2.6)
activemodel (= 3.2.6)
activesupport (= 3.2.6)
activerecord (3.2.8)
activemodel (= 3.2.8)
activesupport (= 3.2.8)
arel (~> 3.0.2)
tzinfo (~> 0.3.29)
activeresource (3.2.6)
activemodel (= 3.2.6)
activesupport (= 3.2.6)
activesupport (3.2.6)
activeresource (3.2.8)
activemodel (= 3.2.8)
activesupport (= 3.2.8)
activesupport (3.2.8)
i18n (~> 0.6)
multi_json (~> 1.0)
addressable (2.3.2)
Expand All @@ -39,7 +39,13 @@ GEM
bson (1.6.2)
bson_ext (1.6.2)
bson (~> 1.6.2)
builder (3.0.0)
builder (3.0.3)
capistrano (2.13.3)
highline
net-scp (>= 1.0.0)
net-sftp (>= 2.0.0)
net-ssh (>= 2.0.14)
net-ssh-gateway (>= 1.1.0)
capybara (1.1.2)
mime-types (>= 1.16)
nokogiri (>= 1.3.3)
Expand Down Expand Up @@ -86,18 +92,19 @@ GEM
libxml-ruby (~> 2.0)
has_scope (0.5.1)
hashie (1.2.0)
highline (1.6.13)
hike (1.2.1)
hoptoad_notifier (2.4.11)
activesupport
builder
htmlentities (4.3.1)
httpauth (0.1)
i18n (0.6.0)
i18n (0.6.1)
inherited_resources (1.3.1)
has_scope (~> 0.5.0)
responders (~> 0.6)
journey (1.0.4)
json (1.7.4)
json (1.7.5)
jwt (0.1.5)
multi_json (>= 1.0)
kaminari (0.13.0)
Expand Down Expand Up @@ -134,6 +141,13 @@ GEM
railties (>= 3.0.0)
multi_json (1.3.6)
multipart-post (1.1.5)
net-scp (1.0.4)
net-ssh (>= 1.99.1)
net-sftp (2.0.5)
net-ssh (>= 2.0.9)
net-ssh (2.5.2)
net-ssh-gateway (1.1.0)
net-ssh (>= 1.99.1)
nokogiri (1.5.5)
oa-core (0.3.2)
oauth2 (0.8.0)
Expand Down Expand Up @@ -181,19 +195,19 @@ GEM
rack-ssl-enforcer (0.2.4)
rack-test (0.6.1)
rack (>= 1.0)
rails (3.2.6)
actionmailer (= 3.2.6)
actionpack (= 3.2.6)
activerecord (= 3.2.6)
activeresource (= 3.2.6)
activesupport (= 3.2.6)
rails (3.2.8)
actionmailer (= 3.2.8)
actionpack (= 3.2.8)
activerecord (= 3.2.8)
activeresource (= 3.2.8)
activesupport (= 3.2.8)
bundler (~> 1.0)
railties (= 3.2.6)
railties (= 3.2.8)
rails_autolink (1.0.9)
rails (~> 3.1)
railties (3.2.6)
actionpack (= 3.2.6)
activesupport (= 3.2.6)
railties (3.2.8)
actionpack (= 3.2.8)
activesupport (= 3.2.8)
rack-ssl (~> 1.3.2)
rake (>= 0.8.7)
rdoc (~> 3.4)
Expand Down Expand Up @@ -244,7 +258,7 @@ GEM
daemons (>= 1.0.9)
eventmachine (>= 0.12.6)
rack (>= 1.0.0)
thor (0.15.4)
thor (0.16.0)
tilt (1.3.3)
treetop (1.4.10)
polyglot
Expand Down Expand Up @@ -275,6 +289,7 @@ DEPENDENCIES
actionmailer_inline_css (~> 1.3.0)
bson (= 1.6.2)
bson_ext (= 1.6.2)
capistrano
capybara
database_cleaner (~> 0.6.0)
debugger
Expand All @@ -299,7 +314,7 @@ DEPENDENCIES
oruen_redmine_client
pivotal-tracker
rack-ssl-enforcer
rails (= 3.2.6)
rails (= 3.2.8)
rails_autolink (~> 1.0.9)
ri_cal
rspec (~> 2.6)
Expand Down
24 changes: 24 additions & 0 deletions app/assets/stylesheets/errbit.css
Original file line number Diff line number Diff line change
Expand Up @@ -841,15 +841,30 @@ table.comment tbody th {
height: 20px;
line-height: 0.5em;
}
table.comment th span, table.comment th img {
vertical-align: middle;
}
table.comment th span.comment-info {
line-height: 21px;
}
table.comment img.gravatar {
margin-right: 7px;
}

table.comment tbody td {
background-color: #F9F9F9;
}
#content-comments a.destroy-comment {
color: #EE0000;
margin-right: 5px;
margin-top: 2px;
font-size: 21px;
line-height: 1;
float: right;
}
#content-comments a.destroy-comment:hover {
text-decoration: none;
color: #AA0000;
}
#content-comments #comment_submit {
margin-top: 15px;
Expand Down Expand Up @@ -878,3 +893,12 @@ table.errs tr td.message .inline_comment em.commenter {

.current.asc:after { content: ' ↑'; }
.current.desc:after { content: ' ↓'; }


table.users td {
vertical-align: middle;
}
table.users td img.gravatar {
vertical-align: middle;
margin-left: 3px;
}
14 changes: 14 additions & 0 deletions app/helpers/errs_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,19 @@ def truncated_err_message(problem)
truncate(msg, :length => 300).scan(/.{1,5}/).map { |s| h(s) }.join("​").html_safe
end
end

def gravatar_tag(email, options = {})
image_tag gravatar_url(email, options), :alt => email, :class => 'gravatar'
end

def gravatar_url(email, options = {})
default_options = {
:d => Errbit::Config.gravatar_default,
}
options.reverse_merge! default_options
params = options.extract!(:s, :d).delete_if { |k, v| v.blank? }
email_hash = Digest::MD5.hexdigest(email)
"http://www.gravatar.com/avatar/#{email_hash}?#{params.to_query}"
end
end

9 changes: 6 additions & 3 deletions app/views/errs/show.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,12 @@
%table.comment
%tr
%th
%span= link_to '✘'.html_safe, app_err_comment_path(@app, @problem, comment), :method => :delete, :data => { :confirm => "Are sure you don't need this comment?" }, :class => "destroy-comment"
= time_ago_in_words(comment.created_at, true) << " ago by "
= link_to comment.user.email, user_path(comment.user)
- if Errbit::Config.use_gravatar
= gravatar_tag comment.user.email, :s => 24
%span.comment-info
= time_ago_in_words(comment.created_at, true) << " ago by "
= link_to comment.user.email, user_path(comment.user)
%span.delete= link_to '&#10008;'.html_safe, app_err_comment_path(@app, @problem, comment), :method => :delete, :data => { :confirm => "Are sure you don't need this comment?" }, :class => "destroy-comment"
%tr
%td= comment.body.gsub("\n", "<br>").html_safe
- if Errbit::Config.allow_comments_with_issue_tracker || [email protected]_tracker_configured?
Expand Down
3 changes: 2 additions & 1 deletion app/views/layouts/application.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
= render 'shared/navigation' if current_user
= render 'shared/session'
#content-wrapper
#content-title{ :class => (yield :title_css_class).to_s }
#content-title{ :class => (yield :title_css_class).to_s, :style => (yield :title_style) }
%h1= yield :title
%span.meta= yield :meta
- if (action_bar = yield(:action_bar)).present?
Expand All @@ -33,3 +33,4 @@
#footer= "Powered by #{link_to 'Errbit', 'http://github.com/errbit/errbit', :target => '_blank'}: the open source error catcher.".html_safe
= yield :scripts

= yield :before_title
6 changes: 5 additions & 1 deletion app/views/users/index.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@
- content_for :action_bar do
%span= link_to('Add a New User', new_user_path, :class => 'add')

%table
%table.users
%thead
%tr
- if Errbit::Config.use_gravatar
%th
%th Name
- if Errbit::Config.user_has_username
%th Username
Expand All @@ -13,6 +15,8 @@
%tbody
- @users.each do |user|
%tr
- if Errbit::Config.use_gravatar
%td= gravatar_tag user.email, :s => 24
%td.nowrap= link_to user.name, user_path(user)
- if Errbit::Config.user_has_username
%td= user.username
Expand Down
6 changes: 5 additions & 1 deletion app/views/users/show.html.haml
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
- content_for :title, @user.name
- if Errbit::Config.use_gravatar
- content_for :title_style do
background: url('#{gravatar_url @user.email, :s => 86}') no-repeat;
padding-left: 106px;

- content_for :action_bar do
= render 'shared/link_github_account', :user => @user
%span= link_to('Add a New User', new_user_path, :class => 'add')
= link_to 'edit', edit_user_path(@user), :class => 'button'
= link_to 'destroy', user_path(@user), :method => :delete, :data => { :confirm => 'Seriously?' }, :class => 'button'


%table.single_user
%tr
%th Email
Expand Down
5 changes: 5 additions & 0 deletions config/config.example.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,11 @@ user_has_username: false
# but you want to leave a short comment.
allow_comments_with_issue_tracker: true

# Enable Gravatar.
use_gravatar: true
# Default Gravatar image, can be: mm, identicon, monsterid, wavatar, retro.
gravatar_default: identicon

# Setup your deploy options for capistrano.
deployment:
hosts:
Expand Down
4 changes: 4 additions & 0 deletions config/initializers/_load_config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@
Errbit::Config.confirm_resolve_err = ENV['ERRBIT_CONFIRM_RESOLVE_ERR']
Errbit::Config.user_has_username = ENV['ERRBIT_USER_HAS_USERNAME']
Errbit::Config.allow_comments_with_issue_tracker = ENV['ERRBIT_ALLOW_COMMENTS_WITH_ISSUE_TRACKER']
Errbit::Config.enforce_ssl = ENV['ERRBIT_ENFORCE_SSL']

Errbit::Config.use_gravatar = ENV['ERRBIT_USE_GRAVATAR']
Errbit::Config.gravatar_default = ENV['ERRBIT_GRAVATAR_DEFAULT']

Errbit::Config.github_authentication = ENV['GITHUB_AUTHENTICATION']
Errbit::Config.github_client_id = ENV['GITHUB_CLIENT_ID']
Expand Down
1 change: 1 addition & 0 deletions config/initializers/omniauth.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
OmniAuth.config.logger = Rails.logger
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ def self.up
errs = mongo_db.collection("errs").find({ }, :fields => ["notices"])
errs.each do |err|
next unless err['notices']

# This Err was created after the Problem->Err->Notice redesign
next if err['app_id'].nil? or err['problem_id']

e = Err.find(err['_id'])
# disable email notifications
old_notify = e.app.notify_on_errs?
Expand Down
4 changes: 2 additions & 2 deletions db/migrate/20120530005915_rename_klass_to_error_class.rb
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
class RenameKlassToErrorClass < Mongoid::Migration
def self.up
[Problem, Err, Notice].each do |model|
model.collection.update({}, {'$rename' => {'klass' => 'error_class'}}, multi: true, safe: true)
model.collection.update({}, {'$rename' => {'klass' => 'error_class'}}, :multi => true, :safe => true)
end
end

def self.down
[Problem, Err, Notice].each do |model|
model.collection.update({}, {'$rename' => {'error_class' => 'klass'}}, multi: true, safe: true)
model.collection.update({}, {'$rename' => {'error_class' => 'klass'}}, :multi => true, :safe => true)
end
end
end
4 changes: 2 additions & 2 deletions db/migrate/20120603112130_change_github_url_to_github_repo.rb
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
class ChangeGithubUrlToGithubRepo < Mongoid::Migration
def self.up
App.collection.update({}, {'$rename' => {'github_url' => 'github_repo'}}, multi: true, safe: true)
App.collection.update({}, {'$rename' => {'github_url' => 'github_repo'}}, :multi => true, :safe => true)
App.all.each do |app|
app.send :normalize_github_repo
app.save
end
end

def self.down
App.collection.update({}, {'$rename' => {'github_repo' => 'github_url'}}, multi: true, safe: true)
App.collection.update({}, {'$rename' => {'github_repo' => 'github_url'}}, :multi => true, :safe => true)
App.all.each do |app|
unless app.github_repo.include?("github.com")
app.update_attribute :github_url, "https://github.com/" << app.github_url
Expand Down
Loading

0 comments on commit f5825ed

Please sign in to comment.