[Trapaas: 2/2] Merge branch 'master' of ssh://git.fedorahosted.org/git/Trapaas
by Maros Zatko
commit 3220f746488c023e4288da046e5d3d83dd57b07c
Merge: 7431328 26065bd
Author: Maros Zatko <mzatko(a)redhat.com>
Date: Wed Jun 22 14:57:57 2011 +0200
Merge branch 'master' of ssh://git.fedorahosted.org/git/Trapaas
.../app/controllers/.mails_controller.rb.swn | Bin 12288 -> 0 bytes
.../app/controllers/.mails_controller.rb.swo | Bin 12288 -> 0 bytes
.../app/controllers/.mails_controller.rb.swp | Bin 12288 -> 0 bytes
.../app/views/layouts/.application.html.haml.swo | Bin 12288 -> 0 bytes
.../app/views/layouts/.application.html.haml.swp | Bin 12288 -> 0 bytes
.../list_mailer/.response_email.text.plain.erb.swp | Bin 12288 -> 0 bytes
web/trapaas/app/views/mails/.index.html.haml.swn | Bin 12288 -> 0 bytes
web/trapaas/app/views/mails/.index.html.haml.swo | Bin 12288 -> 0 bytes
web/trapaas/db/development.sqlite3 | 1 -
web/trapaas/public/stylesheets/.stylesheet.css.swn | Bin 12288 -> 0 bytes
web/trapaas/public/stylesheets/.stylesheet.css.swo | Bin 12288 -> 0 bytes
web/trapaas/public/stylesheets/.stylesheet.css.swp | Bin 12288 -> 0 bytes
12 files changed, 0 insertions(+), 1 deletions(-)
---
13 years
[Trapaas: 1/2] Added basic user management, cucumber tests, paginate & collapsed threads by default
by Maros Zatko
commit 743132866c787c26a581ab938e69b4302d8aa21d
Author: Maros Zatko <mzatko(a)redhat.com>
Date: Wed Jun 22 14:47:44 2011 +0200
Added basic user management, cucumber tests, paginate & collapsed
threads by default
web/trapaas/app/controllers/admin_controller.rb | 18 ++++++
.../app/controllers/application_controller.rb | 29 ++++++++++
web/trapaas/app/controllers/mails_controller.rb | 35 ++++++++++--
web/trapaas/app/controllers/users_controller.rb | 57 +++++++++++++++++++-
web/trapaas/app/models/user.rb | 15 +++++
web/trapaas/app/models/user_mailer.rb | 8 +++
web/trapaas/app/views/admin/_users_list.haml | 21 +++++++
web/trapaas/app/views/admin/edit_user.haml | 1 +
web/trapaas/app/views/admin/index.haml | 1 +
web/trapaas/app/views/admin/index.html.haml | 1 -
web/trapaas/app/views/admin/list.haml | 3 +
.../app/views/layouts/application.html.haml | 3 +
web/trapaas/app/views/mails/.index.html.haml.swp | Bin 12288 -> 0 bytes
web/trapaas/app/views/mails/.mail.haml.swp | Bin 12288 -> 0 bytes
web/trapaas/app/views/mails/_render_mail.haml | 16 ++++--
web/trapaas/app/views/mails/index.html.haml | 20 +------
web/trapaas/app/views/mails/mail.haml | 5 --
.../password_reset_email.text.plain.erb | 9 +++
web/trapaas/app/views/users/edit.haml | 13 +++++
web/trapaas/app/views/users/show.haml | 1 +
web/trapaas/config/cucumber.yml | 8 +++
web/trapaas/config/database.yml | 5 ++-
web/trapaas/config/environment.rb | 4 +-
web/trapaas/config/environments/cucumber.rb | 29 ++++++++++
web/trapaas/config/routes.rb | 8 ++-
.../20110319152307_create_processed_mails.rb | 2 +-
web/trapaas/public/403.html | 30 ++++++++++
web/trapaas/public/javascripts/application.js | 32 +++++++----
web/trapaas/public/stylesheets/stylesheet.css | 3 +
web/trapaas/public/stylesheets/stylesheet.sass | 2 +
web/trapaas/script/cucumber | 10 ++++
web/trapaas/vendor/plugins/haml/init.rb | 2 +-
32 files changed, 338 insertions(+), 53 deletions(-)
---
diff --git a/web/trapaas/app/controllers/admin_controller.rb b/web/trapaas/app/controllers/admin_controller.rb
index c2a9ad9..1b28ab0 100644
--- a/web/trapaas/app/controllers/admin_controller.rb
+++ b/web/trapaas/app/controllers/admin_controller.rb
@@ -1,4 +1,22 @@
class AdminController < ApplicationController
+ before_filter :user_is_admin, :only => :list
+ before_filter :logged_in
+
def index
+ if current_user.admin
+ redirect_to :action => :list
+ else
+ redirect_to :controller => :users, :action => :edit, :id => current_user.id
+ end
end
+
+ def list
+ @users = User.all
+ end
+
+ #def edit_user
+ # @user = User.find_by_id params[:id]
+ # render :partial => 'users/edit'
+ #end
+
end
diff --git a/web/trapaas/app/controllers/application_controller.rb b/web/trapaas/app/controllers/application_controller.rb
index 8a31cfa..d4be42c 100644
--- a/web/trapaas/app/controllers/application_controller.rb
+++ b/web/trapaas/app/controllers/application_controller.rb
@@ -7,6 +7,16 @@ class ApplicationController < ActionController::Base
protect_from_forgery # See ActionController::RequestForgeryProtection for details
helper_method :current_user
filter_parameter_logging :password, :password_confirmation
+ before_filter :store_location
+
+ def store_location
+ session[:return_to] = request.request_uri
+ end
+
+ def redirect_back_or_default(default)
+ redirect_to(session[:return_to] || default)
+ session[:return_to] = nil
+ end
private
@@ -14,6 +24,25 @@ class ApplicationController < ActionController::Base
current_user ||= User.find(session[:user_id]) if session[:user_id]
end
+ def user_is_admin
+ render(:file=>"#{RAILS_ROOT}/public/403.html", :layout => false, :status=>403) unless current_user && current_user.admin
+ end
+
+ def user_is_admin_or_owner(user_id)
+ user_id = user_id.to_i
+
+ unless current_user && (current_user.admin || (current_user.id == user_id))
+ #redirect_to("/403.html")
+ render(:file=>"#{RAILS_ROOT}/public/403.html", :layout => false, :status=>403)
+ return
+ end
+ logger.info "authorized"
+ end
+
+ def logged_in
+# redirect_to("/403.html")
+ render(:file=>"#{RAILS_ROOT}/public/403.html", :layout => false, :status=>403) unless current_user
+ end
# Scrub sensitive parameters from your log
# filter_parameter_logging :password
diff --git a/web/trapaas/app/controllers/mails_controller.rb b/web/trapaas/app/controllers/mails_controller.rb
index 2479f72..fbf9fd9 100644
--- a/web/trapaas/app/controllers/mails_controller.rb
+++ b/web/trapaas/app/controllers/mails_controller.rb
@@ -35,13 +35,19 @@ class MailsController < ApplicationController
m = ProcessedMails.find_by_m_id(Base64.decode64(params[:id])) if params[:id]
@tm = ListMailer.create_take_review_email(current_user, m)
ListMailer.deliver(@tm)
- flash[:notice] = "Your NAK has been sent to mailing list."
+ flash[:notice] = "Your action has been sent to mailing list."
redirect_to :action => 'index'
end
def comment
end
+ def thread
+ root = ProcessedMails.find_by_id params[:id]
+ puts params.inspect
+ render :partial => 'render_mail', :locals => {:mail => root, :unrolled => (not params[:roll])}
+ end
+
def index
#@mails = ProcessedMails.find_all_by_from_git true, :order => "date"
#@mails = @mails.reject do |m|
@@ -49,9 +55,28 @@ class MailsController < ApplicationController
#end
if params[:id]
- @root_mails = ProcessedMails.all(:conditions => {:parent_id => nil, :from_git => true, :repo => params[:id]}, :order => "date DESC")
+ @root_nmails = ProcessedMails.paginate(
+ :conditions => {
+ :parent_id => nil,
+ :from_git => true,
+ :repo => params[:id]
+ },
+ :order => "date DESC",
+ :page => params[:page],
+ :per_page => 10
+ )
+# @root_mails = ProcessedMails.all(:conditions => {:parent_id => nil, :from_git => true, :repo => params[:id]}, :order => "date DESC")
else
- @root_mails = ProcessedMails.all(:conditions => {:parent_id => nil, :from_git => true}, :order => "date DESC")
+ @root_mails = ProcessedMails.paginate(
+ :conditions => {
+ :parent_id => nil,
+ :from_git => true
+ },
+ :order => "date DESC",
+ :page => params[:page],
+ :per_page => 10
+ )
+# @root_mails = ProcessedMails.all(:conditions => {:parent_id => nil, :from_git => true}, :order => "date DESC")
end
#@thrd = {}
# @mails.map do |m|
@@ -61,8 +86,8 @@ class MailsController < ApplicationController
# gen_thread_from_mail m, 0
#end
#@th = @th.flatten
-
- @nongitmails = ProcessedMails.find_all_by_from_git false, :order => "date DESC"
+ @to_unroll = params[:unroll].to_i
+ @nongitmails = ProcessedMails.all (:conditions => {:from_git => false, :parent_id => nil}, :order => "date DESC")
@repos = ProcessedMails.find :all, :select => :repo, :group => :repo
# @nongitmails
end
diff --git a/web/trapaas/app/controllers/users_controller.rb b/web/trapaas/app/controllers/users_controller.rb
index 893f6b4..0006cb5 100644
--- a/web/trapaas/app/controllers/users_controller.rb
+++ b/web/trapaas/app/controllers/users_controller.rb
@@ -5,12 +5,15 @@ class UsersController < ApplicationController
# redirect_to '/'
# end
+ before_filter :user_is_admin, :only => [:reset_password, :logged_in]
+ before_filter :logged_in, :except => [:create, :new]
+
def validate
@user = User.find_by_validation_hash(params[:id])
@user.validation_hash = "."
@user.save
flash[:notice] = "Mail validated!"
- redirect_to new_session_path
+ redirect_to new_session_path
end
def new
@@ -26,4 +29,56 @@ class UsersController < ApplicationController
render "new"
end
end
+
+ def reset_password
+ if params[:id]
+ user = User.find_by_id params[:id]
+ user.reset_password
+ end
+
+ redirect_to "/"
+ end
+
+ def edit
+ user_is_admin_or_owner(params[:id])
+ @user = User.find_by_id(params[:id])
+ end
+
+ def show
+ user_is_admin_or_owner(params[:id])
+ @user = User.find_by_id(params[:id])
+ end
+
+ def update
+ user_is_admin_or_owner(params[:id])
+ @user = User.find(params[:id])
+
+ respond_to do |format|
+ if @user.update_attributes(params[:user])
+ format.html {
+ flash[:notice] = "Account has been updated."
+ redirect_back_or_default('/')
+ #redirect_to "/"
+ } #redirect_to(root_path, :notice => "Account has been updated.") }
+ else
+ format.html {
+ flash[:notice] = "Le fu."
+ #redirect_back_or_default('/')
+ redirect_to "/500.html"
+ }
+ end
+ end
+ end
+
+#
+# def destroy
+# end
+
+ private
+
+# def authentize
+# redirect_to("/403.html") unless current_user.admin
+# end
+
+
end
diff --git a/web/trapaas/app/models/user.rb b/web/trapaas/app/models/user.rb
index 4f48b48..f573b7a 100644
--- a/web/trapaas/app/models/user.rb
+++ b/web/trapaas/app/models/user.rb
@@ -42,4 +42,19 @@ class User < ActiveRecord::Base
self.validation_hash = Digest::SHA1.hexdigest(hash)
end
end
+
+ def reset_password
+
+
+ o = [('a'..'z'),('A'..'Z')].map{|i| i.to_a}.flatten;
+ self.password = (0..10).map{ o[rand(o.length)] }.join;
+
+ self.validation_hash = nil
+ generate_validation_hash
+
+ self.save
+ #self.encrypt_password
+
+ UserMailer.deliver_password_reset_email(self, password)
+ end
end
diff --git a/web/trapaas/app/models/user_mailer.rb b/web/trapaas/app/models/user_mailer.rb
index da5c43a..83a8924 100644
--- a/web/trapaas/app/models/user_mailer.rb
+++ b/web/trapaas/app/models/user_mailer.rb
@@ -8,4 +8,12 @@ class UserMailer < ActionMailer::Base
body :user => user, :url => "http://localhost"
end
+ def password_reset_email(user, pwd)
+ recipients user.email
+ from "dev-null(a)redhat.com"
+ subject "[TRAPAAS] Email Validation"
+ sent_on Time.now
+ body :user => user, :url => "http://localhost", :pwd => pwd
+ end
+
end
diff --git a/web/trapaas/app/views/admin/_users_list.haml b/web/trapaas/app/views/admin/_users_list.haml
new file mode 100644
index 0000000..8b37751
--- /dev/null
+++ b/web/trapaas/app/views/admin/_users_list.haml
@@ -0,0 +1,21 @@
+%table
+ %thead
+ %tr
+ %td Id
+ %td Email
+ %td Created
+ %td Updated
+ %td Admin?
+ %td Valid?
+ %tbody
+ - users.each do |user|
+ %tr
+ %td= user.id
+ %td= user.email
+ %td= user.created_at
+ %td= user.updated_at
+ %td= user.admin
+ %td= user.validated?
+ %td= link_to "reset password", :controller => "users", :action => :reset_password, :id => user.id
+ %td= link_to "Edit", edit_user_path(user) #:controller => 'users', :action => :edit, :id => user.id
+
diff --git a/web/trapaas/app/views/admin/edit_user.haml b/web/trapaas/app/views/admin/edit_user.haml
new file mode 100644
index 0000000..8b13789
--- /dev/null
+++ b/web/trapaas/app/views/admin/edit_user.haml
@@ -0,0 +1 @@
+
diff --git a/web/trapaas/app/views/admin/index.haml b/web/trapaas/app/views/admin/index.haml
new file mode 100644
index 0000000..8b13789
--- /dev/null
+++ b/web/trapaas/app/views/admin/index.haml
@@ -0,0 +1 @@
+
diff --git a/web/trapaas/app/views/admin/list.haml b/web/trapaas/app/views/admin/list.haml
new file mode 100644
index 0000000..2001a86
--- /dev/null
+++ b/web/trapaas/app/views/admin/list.haml
@@ -0,0 +1,3 @@
+List of users
+=render :partial => "users_list", :locals => {:users => @users}
+
diff --git a/web/trapaas/app/views/layouts/application.html.haml b/web/trapaas/app/views/layouts/application.html.haml
index 84c41a7..643e30f 100644
--- a/web/trapaas/app/views/layouts/application.html.haml
+++ b/web/trapaas/app/views/layouts/application.html.haml
@@ -38,6 +38,9 @@
- if current_user.admin
%div
= link_to "Administration", :controller => 'admin'
+ - elsif current_user
+ %div
+ = link_to "Account", edit_user_path(current_user)
- else
%div
= link_to "Sing up", sign_up_path
diff --git a/web/trapaas/app/views/mails/_render_mail.haml b/web/trapaas/app/views/mails/_render_mail.haml
index 2304fbd..664b8d9 100644
--- a/web/trapaas/app/views/mails/_render_mail.haml
+++ b/web/trapaas/app/views/mails/_render_mail.haml
@@ -3,9 +3,15 @@
%div{:class => "#{if mscore > 0; 'ack' elsif mscore == 0; if mail.under_review?; 'rev'; else 'unk' end; else 'nak' end} #{mail.status+'2' if mail.status != 'unk'}" }
Subject
%strong= link_to mail.subject, :controller => 'mails', :action => 'mail', :id => Base64.encode64(mail.m_id)
+ %span.show_thread
+ - if unrolled
+ = link_to "Hide thread", {:action => :index}, :class => "hide_thread", :id => mail.id
+ - else
+ = link_to "Show thread", {:action => :index, :unroll => mail.id}, :class => "show_thread", :id => mail.id
+ .clear
%div
%strong
- -#%span
+ -# %span
= mail.status
%span
- if (mail.parent and mail.parent.repo != mail.repo) or (not mail.parent)
@@ -40,6 +46,8 @@
%strong NAK
.hr
- %ul
- - mail.children(:oreder => 'date DESC').each do |m|
- %li= render :partial => 'render_mail', :locals => {:mail => m}
+
+ - if unrolled
+ %ul
+ - mail.children(:oreder => 'date DESC').each do |m|
+ %li= render :partial => 'render_mail', :locals => {:mail => m, :unrolled => unrolled}
diff --git a/web/trapaas/app/views/mails/index.html.haml b/web/trapaas/app/views/mails/index.html.haml
index 6303d39..4247142 100644
--- a/web/trapaas/app/views/mails/index.html.haml
+++ b/web/trapaas/app/views/mails/index.html.haml
@@ -10,26 +10,10 @@
#git-list.grid_15
%h2 Git traffic
%ul
+ %div= will_paginate @root_mails
- @root_mails.each do |m|
%li.root
- = render :partial => 'render_mail', :locals => {:mail => m}
--#
- #git-list.grid_15
- - @mails.each do |mail|
- %div{:class => cycle('mail-odd', 'mail-even')}
- %div{:class => "git_#{mail.from_git}"}
- %span
- = mail.status
- %span
- = mail.repo
- = mail.from
- %div
- Subject
- %strong= link_to mail.subject, :controller => 'mails', :action => 'mail', :id => Base64.encode64(mail.m_id)
- %ul
- - @thrd[mail.m_id].each do |t|
- %li{ :class => t.status }
- = link_to t.subject, :controller => 'mails', :action => 'mail', :id => Base64.encode64(t.m_id)
+ = render :partial => 'render_mail', :locals => {:mail => m, :unrolled => (m.id == @to_unroll)}
#mail-list.grid_6
%h2 General traffic
diff --git a/web/trapaas/app/views/mails/mail.haml b/web/trapaas/app/views/mails/mail.haml
index 73ef024..132c6d0 100644
--- a/web/trapaas/app/views/mails/mail.haml
+++ b/web/trapaas/app/views/mails/mail.haml
@@ -4,7 +4,6 @@
= link_to "ACK", :controller => 'mails', :action => 'ack', :id => Base64.encode64((a)m.m_id)
= link_to "NAK", :controller => 'mails', :action => 'nak', :id => Base64.encode64((a)m.m_id)
= link_to "Take Review", :controller => 'mails', :action => 'take_review', :id => Base64.encode64((a)m.m_id) if @m.from_git
- -# link_to "ACK and comment", :controller => 'mails', :action => 'comment', :id => Base64.encode64((a)m.m_id)
%div
%p
= @m.subject
@@ -32,7 +31,3 @@
%li= link_to mail.subject, :controller => 'mails', :action => 'mail', :id => Base64.encode64(mail.m_id)
#mail-content
%pre{:class => "brush: diff"}~ @m.body
- -# :javascript
- $(document).ready(function(){
- SyntaxHighlighter.all();
- });
diff --git a/web/trapaas/app/views/user_mailer/password_reset_email.text.plain.erb b/web/trapaas/app/views/user_mailer/password_reset_email.text.plain.erb
new file mode 100644
index 0000000..ad86ed3
--- /dev/null
+++ b/web/trapaas/app/views/user_mailer/password_reset_email.text.plain.erb
@@ -0,0 +1,9 @@
+You have requested passowrd reset at <%= url_for(:controller => 'mails', :action => 'index', :only_path => false, :protocol => 'http') %> and entered <%= @user.email %> as your email address.
+
+Your new password is '<%= @pwd %>'.
+
+Please copy and paste following link
+<%= url_for(:controller => "users", :action => "validate", :id => @user.validation_hash,:only_path => false, :protocol => 'http') %>
+to your address bar.
+
+Please change your password immediately after login.
diff --git a/web/trapaas/app/views/users/edit.haml b/web/trapaas/app/views/users/edit.haml
new file mode 100644
index 0000000..4fd4f53
--- /dev/null
+++ b/web/trapaas/app/views/users/edit.haml
@@ -0,0 +1,13 @@
+User settings
+- form_for(@user) do |u|
+ %p
+ = u.label "Email:"
+ = u.text_field :email
+ %p
+ = u.label "Password:"
+ = u.password_field :password
+ %p
+ = u.label "Confirm password:"
+ = u.password_field :password_confirmation
+ %p
+ = u.submit 'Save'
diff --git a/web/trapaas/app/views/users/show.haml b/web/trapaas/app/views/users/show.haml
new file mode 100644
index 0000000..50a9ccb
--- /dev/null
+++ b/web/trapaas/app/views/users/show.haml
@@ -0,0 +1 @@
+= @user.email
diff --git a/web/trapaas/config/cucumber.yml b/web/trapaas/config/cucumber.yml
new file mode 100644
index 0000000..621a14c
--- /dev/null
+++ b/web/trapaas/config/cucumber.yml
@@ -0,0 +1,8 @@
+<%
+rerun = File.file?('rerun.txt') ? IO.read('rerun.txt') : ""
+rerun_opts = rerun.to_s.strip.empty? ? "--format #{ENV['CUCUMBER_FORMAT'] || 'progress'} features" : "--format #{ENV['CUCUMBER_FORMAT'] || 'pretty'} #{rerun}"
+std_opts = "--format #{ENV['CUCUMBER_FORMAT'] || 'progress'} --strict --tags ~@wip"
+%>
+default: <%= std_opts %> features
+wip: --tags @wip:3 --wip features
+rerun: <%= rerun_opts %> --format rerun --out rerun.txt --strict --tags ~@wip
diff --git a/web/trapaas/config/database.yml b/web/trapaas/config/database.yml
index 35fee06..0ccf5e5 100644
--- a/web/trapaas/config/database.yml
+++ b/web/trapaas/config/database.yml
@@ -10,7 +10,7 @@ development:
# Warning: The database defined as "test" will be erased and
# re-generated from your development database when you run "rake".
# Do not set this db to the same as development or production.
-test:
+test: &test
adapter: postgresql
database: trapaas_test
username: trapaas
@@ -25,3 +25,6 @@ production:
password: the8Quoh
host: localhost
+
+cucumber:
+ <<: *test
\ No newline at end of file
diff --git a/web/trapaas/config/environment.rb b/web/trapaas/config/environment.rb
index 1573300..2dd59ab 100644
--- a/web/trapaas/config/environment.rb
+++ b/web/trapaas/config/environment.rb
@@ -1,7 +1,7 @@
# Be sure to restart your server when you modify this file
# Specifies gem version of Rails to use when vendor/rails is not present
-RAILS_GEM_VERSION = '2.3.8' unless defined? RAILS_GEM_VERSION
+RAILS_GEM_VERSION = '2.3.11' unless defined? RAILS_GEM_VERSION
# Bootstrap the Rails environment, frameworks, and default configuration
require File.join(File.dirname(__FILE__), 'boot')
@@ -23,6 +23,8 @@ Rails::Initializer.run do |config|
config.gem "bcrypt-ruby", :lib => "bcrypt"
config.gem "ssl_requirement"
config.gem "acts_as_tree"
+ config.gem "cucumber", :lib => false
+ config.gem "will_paginate"
#config.gem "i18n"
# Only load the plugins named here, in the order given (default is alphabetical).
diff --git a/web/trapaas/config/environments/cucumber.rb b/web/trapaas/config/environments/cucumber.rb
new file mode 100644
index 0000000..8bb2cd2
--- /dev/null
+++ b/web/trapaas/config/environments/cucumber.rb
@@ -0,0 +1,29 @@
+# Edit at your own peril - it's recommended to regenerate this file
+# in the future when you upgrade to a newer version of Cucumber.
+
+# IMPORTANT: Setting config.cache_classes to false is known to
+# break Cucumber's use_transactional_fixtures method.
+# For more information see https://rspec.lighthouseapp.com/projects/16211/tickets/165
+config.cache_classes = true
+
+# Log error messages when you accidentally call methods on nil.
+config.whiny_nils = true
+
+# Show full error reports and disable caching
+config.action_controller.consider_all_requests_local = true
+config.action_controller.perform_caching = false
+
+# Disable request forgery protection in test environment
+config.action_controller.allow_forgery_protection = false
+
+# Tell Action Mailer not to deliver emails to the real world.
+# The :test delivery method accumulates sent emails in the
+# ActionMailer::Base.deliveries array.
+config.action_mailer.delivery_method = :test
+
+config.gem 'cucumber-rails', :lib => false, :version => '>=0.3.2' unless File.directory?(File.join(Rails.root, 'vendor/plugins/cucumber-rails'))
+config.gem 'database_cleaner', :lib => false, :version => '>=0.5.0' unless File.directory?(File.join(Rails.root, 'vendor/plugins/database_cleaner'))
+config.gem 'capybara', :lib => false, :version => '>=0.3.5' unless File.directory?(File.join(Rails.root, 'vendor/plugins/capybara'))
+config.gem 'rspec', :lib => false, :version => '>=1.3.0' unless File.directory?(File.join(Rails.root, 'vendor/plugins/rspec'))
+config.gem 'rspec-rails', :lib => false, :version => '>=1.3.2' unless File.directory?(File.join(Rails.root, 'vendor/plugins/rspec-rails'))
+
diff --git a/web/trapaas/config/routes.rb b/web/trapaas/config/routes.rb
index 39284e6..a9b36de 100644
--- a/web/trapaas/config/routes.rb
+++ b/web/trapaas/config/routes.rb
@@ -31,15 +31,12 @@ ActionController::Routing::Routes.draw do |map|
# end
# You can have the root of your site routed with map.root -- just remember to delete public/index.html.
- map.root :controller => "mails"
# See how all your routes lay out with "rake routes"
# Install the default routes as the lowest priority.
# Note: These default routes make all actions in every controller accessible via GET requests. You should
# consider removing or commenting them out if you're using named routes and resources.
- map.connect ':controller/:action/:id'
- map.connect ':controller/:action/:id.:format'
map.log_out "/log_out", :controller => "sessions", :action => "destroy"
map.log_in "/log_in", :controller => "sessions", :action => 'new'
@@ -47,4 +44,9 @@ ActionController::Routing::Routes.draw do |map|
# root :to => "users#new"
map.resources :users
map.resources :sessions
+
+ map.connect ':controller/:action/:id'
+ map.connect ':controller/:action/:id.:format'
+
+ map.root :controller => "mails"
end
diff --git a/web/trapaas/db/migrate/20110319152307_create_processed_mails.rb b/web/trapaas/db/migrate/20110319152307_create_processed_mails.rb
index 5f67b78..d29582d 100644
--- a/web/trapaas/db/migrate/20110319152307_create_processed_mails.rb
+++ b/web/trapaas/db/migrate/20110319152307_create_processed_mails.rb
@@ -3,7 +3,7 @@ class CreateProcessedMails < ActiveRecord::Migration
create_table :processed_mails do |t|
t.string :m_id
t.string :in_reply_to
- t.string :subject
+ t.text :subject
t.string :repo
t.string :status
t.text :body
diff --git a/web/trapaas/public/403.html b/web/trapaas/public/403.html
new file mode 100644
index 0000000..5260044
--- /dev/null
+++ b/web/trapaas/public/403.html
@@ -0,0 +1,30 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+
+<head>
+ <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
+ <title>The change you wanted was rejected (422)</title>
+ <style type="text/css">
+ body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
+ div.dialog {
+ width: 25em;
+ padding: 0 4em;
+ margin: 4em auto 0 auto;
+ border: 1px solid #ccc;
+ border-right-color: #999;
+ border-bottom-color: #999;
+ }
+ h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
+ </style>
+</head>
+
+<body>
+ <!-- This file lives in public/422.html -->
+ <div class="dialog">
+ <h1>403</h1>
+ <p>This incident will be <a href="http://xkcd.com/838/">reported</a>.</p>
+ </div>
+</body>
+</html>
diff --git a/web/trapaas/public/javascripts/application.js b/web/trapaas/public/javascripts/application.js
index 80e918c..7f365bc 100644
--- a/web/trapaas/public/javascripts/application.js
+++ b/web/trapaas/public/javascripts/application.js
@@ -37,15 +37,26 @@ function rot(t) {
}
-$(function(){ // <<JQUERY after dom is loaded event
-// $("#main-container").hide();
-// $("#main-container").fadeIn(50);
-// blink(50);
- spd = 0;
-// rot(10);
+function bind_show_hide_thread() {
+ $('a.show_thread').click(
+ function(e) {
+ $(this).parent().parent().parent().load('/mails/thread/' + $(this).attr('id'), bind_show_hide_thread);
+ e.preventDefault();
+ $('a.show_thread').attr('href', '');
+ });
+ $('a.hide_thread').click(
+ function(e) {
+ $(this).parent().parent().parent().load('/mails/thread/' + $(this).attr('id') + '?roll=true', bind_show_hide_thread);
+ e.preventDefault();
+
+ bind_show_hide_thread();
+ });
-// $("body").mousemove(function(e) {spd = e.pageY/100 - e.pageX/100;});
+ $('a.show_thread').attr('href', '');
+ $('a.hide_thread').attr('href', '');
+}
+$(function(){
if ($("#git-list").html() != null) {
jQuery.PeriodicalUpdater('/mails/updated', {
method: 'GET',
@@ -57,10 +68,8 @@ $(function(){ // <<JQUERY after dom is loaded event
maxCalls: 0,
autoStop: 0
}, function(remoteData, success, xhr, handle) {
- // console.log(success)
if (success == 'success') {
location.reload();
- //console.log("reloading")
}
});
}
@@ -78,6 +87,5 @@ $(function(){ // <<JQUERY after dom is loaded event
}
}
-// $("#main-container").fadeIn(1000);
-// SyntaxHighlighter.all();
-})
+ bind_show_hide_thread();
+});
diff --git a/web/trapaas/public/stylesheets/stylesheet.css b/web/trapaas/public/stylesheets/stylesheet.css
index 090a9d0..fbd8759 100644
--- a/web/trapaas/public/stylesheets/stylesheet.css
+++ b/web/trapaas/public/stylesheets/stylesheet.css
@@ -1,3 +1,6 @@
+span.show_thread {
+ float: right; }
+
#repos {
-moz-border-radius: 10px;
border-radius: 10px;
diff --git a/web/trapaas/public/stylesheets/stylesheet.sass b/web/trapaas/public/stylesheets/stylesheet.sass
index 18655c2..45cc9fd 100644
--- a/web/trapaas/public/stylesheets/stylesheet.sass
+++ b/web/trapaas/public/stylesheets/stylesheet.sass
@@ -1,3 +1,5 @@
+span.show_thread
+ float: right
#repos
ul
li
diff --git a/web/trapaas/script/cucumber b/web/trapaas/script/cucumber
new file mode 100755
index 0000000..7fa5c92
--- /dev/null
+++ b/web/trapaas/script/cucumber
@@ -0,0 +1,10 @@
+#!/usr/bin/env ruby
+
+vendored_cucumber_bin = Dir["#{File.dirname(__FILE__)}/../vendor/{gems,plugins}/cucumber*/bin/cucumber"].first
+if vendored_cucumber_bin
+ load File.expand_path(vendored_cucumber_bin)
+else
+ require 'rubygems' unless ENV['NO_RUBYGEMS']
+ require 'cucumber'
+ load Cucumber::BINARY
+end
diff --git a/web/trapaas/vendor/plugins/haml/init.rb b/web/trapaas/vendor/plugins/haml/init.rb
index 3b64a9e..f8b3dab 100644
--- a/web/trapaas/vendor/plugins/haml/init.rb
+++ b/web/trapaas/vendor/plugins/haml/init.rb
@@ -13,6 +13,6 @@ rescue LoadError
end
end
-# Load Haml and Sass.
+# Load Haml.
# Haml may be undefined if we're running gems:install.
Haml.init_rails(binding) if defined?(Haml)
13 years