Skip to content
Browse files

Clean commit

  • Loading branch information...
0 parents commit 002e7a0bc3cc065a56adf823cf002ebd1acad47e @gertig gertig committed Oct 25, 2011
Showing with 12,686 additions and 0 deletions.
  1. +9 −0 .gitignore
  2. +48 −0 Gemfile
  3. +199 −0 Gemfile.lock
  4. +256 −0 README
  5. +7 −0 Rakefile
  6. +7 −0 app/controllers/about_controller.rb
  7. +47 −0 app/controllers/application_controller.rb
  8. +43 −0 app/controllers/authentications_controller.rb
  9. +8 −0 app/controllers/home_controller.rb
  10. +95 −0 app/controllers/invitations_controller.rb
  11. +28 −0 app/controllers/registrations_controller.rb
  12. +92 −0 app/controllers/tags_controller.rb
  13. +152 −0 app/controllers/user_controller.rb
  14. +66 −0 app/controllers/user_management_controller.rb
  15. +11 −0 app/helpers/application_helper.rb
  16. +2 −0 app/helpers/authentications_helper.rb
  17. +2 −0 app/helpers/home_helper.rb
  18. +2 −0 app/helpers/registrations_helper.rb
  19. +2 −0 app/helpers/tags_helper.rb
  20. +8 −0 app/helpers/user_helper.rb
  21. +14 −0 app/helpers/user_management_helper.rb
  22. +22 −0 app/models/ability.rb
  23. +4 −0 app/models/authentication.rb
  24. +4 −0 app/models/descriptor.rb
  25. +4 −0 app/models/tag.rb
  26. +114 −0 app/models/user.rb
  27. +80 −0 app/uploaders/image_uploader.rb
  28. +26 −0 app/views/about/index.html.erb
  29. +18 −0 app/views/authentications/index.html.erb
  30. +14 −0 app/views/devise/confirmations/new.html.erb
  31. +5 −0 app/views/devise/mailer/confirmation_instructions.html.erb
  32. +8 −0 app/views/devise/mailer/invitation_instructions.html.erb
  33. +8 −0 app/views/devise/mailer/reset_password_instructions.html.erb
  34. +7 −0 app/views/devise/mailer/unlock_instructions.html.erb
  35. +20 −0 app/views/devise/passwords/edit.html.erb
  36. +14 −0 app/views/devise/passwords/new.html.erb
  37. +21 −0 app/views/devise/sessions/new.html.erb
  38. +19 −0 app/views/devise/shared/_links.erb
  39. +14 −0 app/views/devise/unlocks/new.html.erb
  40. +19 −0 app/views/home/index.html.erb
  41. +16 −0 app/views/invitations/edit.html.erb
  42. +16 −0 app/views/invitations/new.html.erb
  43. +96 −0 app/views/layouts/application.html.erb
  44. +18 −0 app/views/layouts/application.mobile.erb
  45. +8 −0 app/views/mailer/invitation.html.erb
  46. +25 −0 app/views/registrations/edit.html.erb
  47. +24 −0 app/views/registrations/new.html.erb
  48. +21 −0 app/views/sessions/new.html.erb
  49. +21 −0 app/views/tags/_form.html.erb
  50. +6 −0 app/views/tags/edit.html.erb
  51. +21 −0 app/views/tags/index.html.erb
  52. +5 −0 app/views/tags/new.html.erb
  53. +10 −0 app/views/tags/show.html.erb
  54. +98 −0 app/views/user/_form.html.erb
  55. +10 −0 app/views/user/edit.html.erb
  56. +58 −0 app/views/user/index.html.erb
  57. +34 −0 app/views/user/index.mobile.erb
  58. +16 −0 app/views/user/new.html.erb
  59. +58 −0 app/views/user/show.html.erb
  60. +55 −0 app/views/user/show.mobile.erb
  61. +138 −0 app/views/user_management/application-old.css
  62. +60 −0 app/views/user_management/index.html.erb
  63. +6,885 −0 app/views/user_management/jquery.js
  64. +166 −0 app/views/user_management/jquery.min.js
  65. +56 −0 app/views/user_management/scaffold.css
  66. +204 −0 app/views/user_management/token-input-mac.css
  67. +113 −0 app/views/user_management/token-input.css
  68. +9 −0 config.ru
  69. +42 −0 config/application.rb
  70. +13 −0 config/boot.rb
  71. +5 −0 config/environment.rb
  72. +32 −0 config/environments/development.rb
  73. +58 −0 config/environments/production.rb
  74. +35 −0 config/environments/test.rb
  75. +7 −0 config/initializers/backtrace_silencers.rb
  76. +20 −0 config/initializers/carrierwave.rb
  77. +166 −0 config/initializers/devise.rb
  78. +10 −0 config/initializers/inflections.rb
  79. +5 −0 config/initializers/mime_types.rb
  80. +3 −0 config/initializers/omniauth.rb
  81. +7 −0 config/initializers/secret_token.rb
  82. +8 −0 config/initializers/session_store.rb
  83. +26 −0 config/initializers/setup_mail.rb
  84. +39 −0 config/locales/devise.en.yml
  85. +10 −0 config/locales/devise_invitable.en.yml
  86. +5 −0 config/locales/en.yml
  87. +86 −0 config/routes.rb
  88. +14 −0 config/s3.yml
  89. +27 −0 db/migrate/20110108211315_devise_create_users.rb
  90. +44 −0 db/migrate/20110108212628_add_fields_to_users.rb
  91. +14 −0 db/migrate/20110307015732_create_tags.rb
  92. +14 −0 db/migrate/20110307015833_create_descriptors.rb
  93. +14 −0 db/migrate/20110307030048_create_authentications.rb
  94. +24 −0 db/migrate/20110326165803_devise_invitable_add_to_users.rb
  95. +8 −0 db/migrate/20110327165759_change_and_add_to_users.rb
  96. +76 −0 db/schema.rb
  97. +22 −0 db/seeds.rb
  98. +2 −0 doc/README_FOR_APP
  99. 0 lib/tasks/.gitkeep
  100. +45 −0 public/404.html
  101. +26 −0 public/422.html
  102. +26 −0 public/500.html
  103. 0 public/favicon.ico
  104. BIN public/images/noimage.png
  105. BIN public/images/noise-bg.jpg
  106. BIN public/images/photos/1/original/ical.png
  107. BIN public/images/profile-tick.png
  108. BIN public/images/rails.png
  109. BIN public/images/techclt-logo.png
  110. +21 −0 public/javascripts/application.js
  111. +680 −0 public/javascripts/jquery.tokeninput.js
  112. +157 −0 public/javascripts/rails.js
  113. +5 −0 public/robots.txt
  114. 0 public/stylesheets/.gitkeep
  115. +646 −0 public/stylesheets/application.css
  116. +79 −0 public/stylesheets/gertig.css
  117. +3 −0 public/stylesheets/mobile.css
  118. +3 −0 public/stylesheets/style-ie.css
  119. +147 −0 public/stylesheets/token-input-facebook.css
  120. +6 −0 script/rails
  121. +9 −0 test/fixtures/authentications.yml
  122. +9 −0 test/fixtures/descriptors.yml
  123. +7 −0 test/fixtures/tags.yml
  124. +11 −0 test/fixtures/users.yml
  125. +27 −0 test/functional/authentications_controller_test.rb
  126. +9 −0 test/functional/home_controller_test.rb
  127. +8 −0 test/functional/registrations_controller_test.rb
  128. +49 −0 test/functional/tags_controller_test.rb
  129. +14 −0 test/functional/user_controller_test.rb
  130. +24 −0 test/functional/user_management_controller_test.rb
  131. +9 −0 test/performance/browsing_test.rb
  132. +13 −0 test/test_helper.rb
  133. +7 −0 test/unit/authentication_test.rb
  134. +8 −0 test/unit/descriptor_test.rb
  135. +4 −0 test/unit/helpers/home_helper_test.rb
  136. +4 −0 test/unit/helpers/registrations_helper_test.rb
  137. +4 −0 test/unit/helpers/tags_helper_test.rb
  138. +4 −0 test/unit/helpers/user_helper_test.rb
  139. +4 −0 test/unit/helpers/user_management_helper_test.rb
  140. +8 −0 test/unit/tag_test.rb
  141. +8 −0 test/unit/user_test.rb
  142. 0 vendor/plugins/.gitkeep
9 .gitignore
@@ -0,0 +1,9 @@
+config/database.yml
+**.sw[a-z]
+.bundle
+db/*.sqlite3
+log/*.log
+tmp/
+public/stylesheets/compiled/**
+**.orig
+config/initializers/app_keys.rb
48 Gemfile
@@ -0,0 +1,48 @@
+source 'http://rubygems.org'
+
+gem 'rails', '3.0.4'
+
+# Bundle edge Rails instead:
+# gem 'rails', :git => 'git://github.com/rails/rails.git'
+
+gem 'sqlite3-ruby', :require => 'sqlite3'
+
+# Use unicorn as the web server
+# gem 'unicorn'
+
+# Deploy with Capistrano
+# gem 'capistrano'
+
+# To use debugger (ruby-debug for Ruby 1.8.7+, ruby-debug19 for Ruby 1.9.2+)
+# gem 'ruby-debug'
+# gem 'ruby-debug19'
+
+# Bundle the extra gems:
+# gem 'bj'
+# gem 'nokogiri'
+# gem 'sqlite3-ruby', :require => 'sqlite3'
+# gem 'aws-s3', :require => 'aws/s3'
+
+# Bundle gems for the local environment. Make sure to
+# put test-only gems in this group so their generators
+# and rake tasks are available in development mode:
+# group :development, :test do
+# gem 'webrat'
+# end
+
+#Gertig
+gem 'devise', '~> 1.3.1' #'~> 1.2.0' #:git => 'git://github.com/plataformatec/devise.git' #,
+gem 'devise_invitable', :git => 'git://github.com/AndrewGertig/devise_invitable.git' #,'~> 0.4'
+gem 'cancan'
+gem 'paperclip'
+gem 'nifty-generators'
+gem 'mocha', :group => :test
+gem 'will_paginate', '~> 3.0.pre2'
+gem 'aws-s3'
+gem 'omniauth'
+gem 'dribble'
+gem 'rmagick'
+gem 'carrierwave', '~> 0.5.3' #, :git => 'git://github.com/jnicklas/carrierwave.git'
+gem 'fog'
+#gem 'jammit'
+#gem 'dalli'
199 Gemfile.lock
@@ -0,0 +1,199 @@
+GIT
+ remote: git://github.com/AndrewGertig/devise_invitable.git
+ revision: e0f9260ff4ef5e961753ac69819f147ee4b7de67
+ specs:
+ devise_invitable (0.4.1)
+ devise (>= 1.2.0)
+ rails (~> 3.0.0)
+
+GEM
+ remote: http://rubygems.org/
+ specs:
+ abstract (1.0.0)
+ actionmailer (3.0.4)
+ actionpack (= 3.0.4)
+ mail (~> 2.2.15)
+ actionpack (3.0.4)
+ activemodel (= 3.0.4)
+ activesupport (= 3.0.4)
+ builder (~> 2.1.2)
+ erubis (~> 2.6.6)
+ i18n (~> 0.4)
+ rack (~> 1.2.1)
+ rack-mount (~> 0.6.13)
+ rack-test (~> 0.5.7)
+ tzinfo (~> 0.3.23)
+ activemodel (3.0.4)
+ activesupport (= 3.0.4)
+ builder (~> 2.1.2)
+ i18n (~> 0.4)
+ activerecord (3.0.4)
+ activemodel (= 3.0.4)
+ activesupport (= 3.0.4)
+ arel (~> 2.0.2)
+ tzinfo (~> 0.3.23)
+ activeresource (3.0.4)
+ activemodel (= 3.0.4)
+ activesupport (= 3.0.4)
+ activesupport (3.0.4)
+ addressable (2.2.5)
+ arel (2.0.9)
+ aws-s3 (0.6.2)
+ builder
+ mime-types
+ xml-simple
+ bcrypt-ruby (2.1.4)
+ builder (2.1.2)
+ cancan (1.6.4)
+ carrierwave (0.5.3)
+ activesupport (~> 3.0)
+ devise (1.3.3)
+ bcrypt-ruby (~> 2.1.2)
+ orm_adapter (~> 0.0.3)
+ warden (~> 1.0.3)
+ dribble (0.1.3)
+ em-http-request (= 0.2.10)
+ yajl-ruby (= 0.7.7)
+ em-http-request (0.2.10)
+ addressable (>= 2.0.0)
+ eventmachine (>= 0.12.9)
+ erubis (2.6.6)
+ abstract (>= 1.0.0)
+ eventmachine (0.12.10)
+ excon (0.6.2)
+ faraday (0.6.1)
+ addressable (~> 2.2.4)
+ multipart-post (~> 1.1.0)
+ rack (>= 1.1.0, < 2)
+ fog (0.7.2)
+ builder
+ excon (>= 0.6.1)
+ formatador (>= 0.1.3)
+ json
+ mime-types
+ net-ssh (>= 2.1.3)
+ nokogiri (>= 1.4.4)
+ ruby-hmac
+ formatador (0.1.3)
+ i18n (0.5.0)
+ json (1.5.1)
+ mail (2.2.17)
+ activesupport (>= 2.3.6)
+ i18n (>= 0.4.0)
+ mime-types (~> 1.16)
+ treetop (~> 1.4.8)
+ mime-types (1.16)
+ mocha (0.9.12)
+ multi_json (0.0.5)
+ multipart-post (1.1.0)
+ net-ldap (0.1.1)
+ net-ssh (2.1.4)
+ nifty-generators (0.4.6)
+ nokogiri (1.4.4)
+ oa-basic (0.2.2)
+ multi_json (~> 0.0.2)
+ nokogiri (~> 1.4.2)
+ oa-core (= 0.2.2)
+ rest-client (~> 1.6.0)
+ oa-core (0.2.2)
+ rack (~> 1.1)
+ oa-enterprise (0.2.2)
+ net-ldap (~> 0.1.1)
+ nokogiri (~> 1.4.2)
+ oa-core (= 0.2.2)
+ pyu-ruby-sasl (~> 0.0.3.1)
+ rubyntlm (~> 0.1.1)
+ oa-more (0.2.2)
+ multi_json (~> 0.0.2)
+ oa-core (= 0.2.2)
+ rest-client (~> 1.6.0)
+ oa-oauth (0.2.2)
+ faraday (~> 0.6.1)
+ multi_json (~> 0.0.2)
+ nokogiri (~> 1.4.2)
+ oa-core (= 0.2.2)
+ oauth (~> 0.4.0)
+ oauth2 (~> 0.3.0)
+ oa-openid (0.2.2)
+ oa-core (= 0.2.2)
+ rack-openid (~> 1.2.0)
+ ruby-openid-apps-discovery
+ oauth (0.4.4)
+ oauth2 (0.3.0)
+ faraday (~> 0.6.0)
+ multi_json (~> 0.0.4)
+ omniauth (0.2.2)
+ oa-basic (= 0.2.2)
+ oa-core (= 0.2.2)
+ oa-enterprise (= 0.2.2)
+ oa-more (= 0.2.2)
+ oa-oauth (= 0.2.2)
+ oa-openid (= 0.2.2)
+ orm_adapter (0.0.4)
+ paperclip (2.3.8)
+ activerecord
+ activesupport
+ polyglot (0.3.1)
+ pyu-ruby-sasl (0.0.3.2)
+ rack (1.2.2)
+ rack-mount (0.6.14)
+ rack (>= 1.0.0)
+ rack-openid (1.2.0)
+ rack (>= 1.1.0)
+ ruby-openid (>= 2.1.8)
+ rack-test (0.5.7)
+ rack (>= 1.0)
+ rails (3.0.4)
+ actionmailer (= 3.0.4)
+ actionpack (= 3.0.4)
+ activerecord (= 3.0.4)
+ activeresource (= 3.0.4)
+ activesupport (= 3.0.4)
+ bundler (~> 1.0)
+ railties (= 3.0.4)
+ railties (3.0.4)
+ actionpack (= 3.0.4)
+ activesupport (= 3.0.4)
+ rake (>= 0.8.7)
+ thor (~> 0.14.4)
+ rake (0.8.7)
+ rest-client (1.6.1)
+ mime-types (>= 1.16)
+ rmagick (2.13.1)
+ ruby-hmac (0.4.0)
+ ruby-openid (2.1.8)
+ ruby-openid-apps-discovery (1.2.0)
+ ruby-openid (>= 2.1.7)
+ rubyntlm (0.1.1)
+ sqlite3 (1.3.3)
+ sqlite3-ruby (1.3.3)
+ sqlite3 (>= 1.3.3)
+ thor (0.14.6)
+ treetop (1.4.9)
+ polyglot (>= 0.3.1)
+ tzinfo (0.3.26)
+ warden (1.0.3)
+ rack (>= 1.0.0)
+ will_paginate (3.0.pre2)
+ xml-simple (1.0.15)
+ yajl-ruby (0.7.7)
+
+PLATFORMS
+ ruby
+
+DEPENDENCIES
+ aws-s3
+ cancan
+ carrierwave (~> 0.5.3)
+ devise (~> 1.3.1)
+ devise_invitable!
+ dribble
+ fog
+ mocha
+ nifty-generators
+ omniauth
+ paperclip
+ rails (= 3.0.4)
+ rmagick
+ sqlite3-ruby
+ will_paginate (~> 3.0.pre2)
256 README
@@ -0,0 +1,256 @@
+== Welcome to Rails
+
+Rails is a web-application framework that includes everything needed to create
+database-backed web applications according to the Model-View-Control pattern.
+
+This pattern splits the view (also called the presentation) into "dumb"
+templates that are primarily responsible for inserting pre-built data in between
+HTML tags. The model contains the "smart" domain objects (such as Account,
+Product, Person, Post) that holds all the business logic and knows how to
+persist themselves to a database. The controller handles the incoming requests
+(such as Save New Account, Update Product, Show Post) by manipulating the model
+and directing data to the view.
+
+In Rails, the model is handled by what's called an object-relational mapping
+layer entitled Active Record. This layer allows you to present the data from
+database rows as objects and embellish these data objects with business logic
+methods. You can read more about Active Record in
+link:files/vendor/rails/activerecord/README.html.
+
+The controller and view are handled by the Action Pack, which handles both
+layers by its two parts: Action View and Action Controller. These two layers
+are bundled in a single package due to their heavy interdependence. This is
+unlike the relationship between the Active Record and Action Pack that is much
+more separate. Each of these packages can be used independently outside of
+Rails. You can read more about Action Pack in
+link:files/vendor/rails/actionpack/README.html.
+
+
+== Getting Started
+
+1. At the command prompt, create a new Rails application:
+ <tt>rails new myapp</tt> (where <tt>myapp</tt> is the application name)
+
+2. Change directory to <tt>myapp</tt> and start the web server:
+ <tt>cd myapp; rails server</tt> (run with --help for options)
+
+3. Go to http://localhost:3000/ and you'll see:
+ "Welcome aboard: You're riding Ruby on Rails!"
+
+4. Follow the guidelines to start developing your application. You can find
+the following resources handy:
+
+* The Getting Started Guide: http://guides.rubyonrails.org/getting_started.html
+* Ruby on Rails Tutorial Book: http://www.railstutorial.org/
+
+
+== Debugging Rails
+
+Sometimes your application goes wrong. Fortunately there are a lot of tools that
+will help you debug it and get it back on the rails.
+
+First area to check is the application log files. Have "tail -f" commands
+running on the server.log and development.log. Rails will automatically display
+debugging and runtime information to these files. Debugging info will also be
+shown in the browser on requests from 127.0.0.1.
+
+You can also log your own messages directly into the log file from your code
+using the Ruby logger class from inside your controllers. Example:
+
+ class WeblogController < ActionController::Base
+ def destroy
+ @weblog = Weblog.find(params[:id])
+ @weblog.destroy
+ logger.info("#{Time.now} Destroyed Weblog ID ##{@weblog.id}!")
+ end
+ end
+
+The result will be a message in your log file along the lines of:
+
+ Mon Oct 08 14:22:29 +1000 2007 Destroyed Weblog ID #1!
+
+More information on how to use the logger is at http://www.ruby-doc.org/core/
+
+Also, Ruby documentation can be found at http://www.ruby-lang.org/. There are
+several books available online as well:
+
+* Programming Ruby: http://www.ruby-doc.org/docs/ProgrammingRuby/ (Pickaxe)
+* Learn to Program: http://pine.fm/LearnToProgram/ (a beginners guide)
+
+These two books will bring you up to speed on the Ruby language and also on
+programming in general.
+
+
+== Debugger
+
+Debugger support is available through the debugger command when you start your
+Mongrel or WEBrick server with --debugger. This means that you can break out of
+execution at any point in the code, investigate and change the model, and then,
+resume execution! You need to install ruby-debug to run the server in debugging
+mode. With gems, use <tt>sudo gem install ruby-debug</tt>. Example:
+
+ class WeblogController < ActionController::Base
+ def index
+ @posts = Post.find(:all)
+ debugger
+ end
+ end
+
+So the controller will accept the action, run the first line, then present you
+with a IRB prompt in the server window. Here you can do things like:
+
+ >> @posts.inspect
+ => "[#<Post:0x14a6be8
+ @attributes={"title"=>nil, "body"=>nil, "id"=>"1"}>,
+ #<Post:0x14a6620
+ @attributes={"title"=>"Rails", "body"=>"Only ten..", "id"=>"2"}>]"
+ >> @posts.first.title = "hello from a debugger"
+ => "hello from a debugger"
+
+...and even better, you can examine how your runtime objects actually work:
+
+ >> f = @posts.first
+ => #<Post:0x13630c4 @attributes={"title"=>nil, "body"=>nil, "id"=>"1"}>
+ >> f.
+ Display all 152 possibilities? (y or n)
+
+Finally, when you're ready to resume execution, you can enter "cont".
+
+
+== Console
+
+The console is a Ruby shell, which allows you to interact with your
+application's domain model. Here you'll have all parts of the application
+configured, just like it is when the application is running. You can inspect
+domain models, change values, and save to the database. Starting the script
+without arguments will launch it in the development environment.
+
+To start the console, run <tt>rails console</tt> from the application
+directory.
+
+Options:
+
+* Passing the <tt>-s, --sandbox</tt> argument will rollback any modifications
+ made to the database.
+* Passing an environment name as an argument will load the corresponding
+ environment. Example: <tt>rails console production</tt>.
+
+To reload your controllers and models after launching the console run
+<tt>reload!</tt>
+
+More information about irb can be found at:
+link:http://www.rubycentral.com/pickaxe/irb.html
+
+
+== dbconsole
+
+You can go to the command line of your database directly through <tt>rails
+dbconsole</tt>. You would be connected to the database with the credentials
+defined in database.yml. Starting the script without arguments will connect you
+to the development database. Passing an argument will connect you to a different
+database, like <tt>rails dbconsole production</tt>. Currently works for MySQL,
+PostgreSQL and SQLite 3.
+
+== Description of Contents
+
+The default directory structure of a generated Ruby on Rails application:
+
+ |-- app
+ | |-- controllers
+ | |-- helpers
+ | |-- mailers
+ | |-- models
+ | `-- views
+ | `-- layouts
+ |-- config
+ | |-- environments
+ | |-- initializers
+ | `-- locales
+ |-- db
+ |-- doc
+ |-- lib
+ | `-- tasks
+ |-- log
+ |-- public
+ | |-- images
+ | |-- javascripts
+ | `-- stylesheets
+ |-- script
+ |-- test
+ | |-- fixtures
+ | |-- functional
+ | |-- integration
+ | |-- performance
+ | `-- unit
+ |-- tmp
+ | |-- cache
+ | |-- pids
+ | |-- sessions
+ | `-- sockets
+ `-- vendor
+ `-- plugins
+
+app
+ Holds all the code that's specific to this particular application.
+
+app/controllers
+ Holds controllers that should be named like weblogs_controller.rb for
+ automated URL mapping. All controllers should descend from
+ ApplicationController which itself descends from ActionController::Base.
+
+app/models
+ Holds models that should be named like post.rb. Models descend from
+ ActiveRecord::Base by default.
+
+app/views
+ Holds the template files for the view that should be named like
+ weblogs/index.html.erb for the WeblogsController#index action. All views use
+ eRuby syntax by default.
+
+app/views/layouts
+ Holds the template files for layouts to be used with views. This models the
+ common header/footer method of wrapping views. In your views, define a layout
+ using the <tt>layout :default</tt> and create a file named default.html.erb.
+ Inside default.html.erb, call <% yield %> to render the view using this
+ layout.
+
+app/helpers
+ Holds view helpers that should be named like weblogs_helper.rb. These are
+ generated for you automatically when using generators for controllers.
+ Helpers can be used to wrap functionality for your views into methods.
+
+config
+ Configuration files for the Rails environment, the routing map, the database,
+ and other dependencies.
+
+db
+ Contains the database schema in schema.rb. db/migrate contains all the
+ sequence of Migrations for your schema.
+
+doc
+ This directory is where your application documentation will be stored when
+ generated using <tt>rake doc:app</tt>
+
+lib
+ Application specific libraries. Basically, any kind of custom code that
+ doesn't belong under controllers, models, or helpers. This directory is in
+ the load path.
+
+public
+ The directory available for the web server. Contains subdirectories for
+ images, stylesheets, and javascripts. Also contains the dispatchers and the
+ default HTML files. This should be set as the DOCUMENT_ROOT of your web
+ server.
+
+script
+ Helper scripts for automation and generation.
+
+test
+ Unit and functional tests along with fixtures. When using the rails generate
+ command, template test files will be generated for you and placed in this
+ directory.
+
+vendor
+ External libraries that the application depends on. Also includes the plugins
+ subdirectory. If the app has frozen rails, those gems also go here, under
+ vendor/rails/. This directory is in the load path.
7 Rakefile
@@ -0,0 +1,7 @@
+# Add your own tasks in files placed in lib/tasks ending in .rake,
+# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
+
+require File.expand_path('../config/application', __FILE__)
+require 'rake'
+
+Techclt::Application.load_tasks
7 app/controllers/about_controller.rb
@@ -0,0 +1,7 @@
+class AboutController < ApplicationController
+
+ def index
+
+ end
+
+end
47 app/controllers/application_controller.rb
@@ -0,0 +1,47 @@
+class ApplicationController < ActionController::Base
+ protect_from_forgery
+ before_filter :adjust_format_for_mobilesafari
+
+ rescue_from CanCan::AccessDenied do |exception|
+ flash[:error] = "Access Denied"
+ redirect_to root_url
+ end
+
+ #Devise, This redirects the User to their profile page after logging in.
+ def after_sign_in_path_for(resource_or_scope)
+ if resource_or_scope.is_a?(User)
+ #user_path(resource_or_scope) #super
+ #current_user_edit_path
+ edit_user_path(current_user)
+ else
+ #flash[:notice] = "Successful! Want to invite someone else?"
+ new_user_invitation_path
+ end
+ end
+
+ private
+
+ def is_mobile?
+ #request.env["HTTP_USER_AGENT"] && request.env["HTTP_USER_AGENT"][/(iPhone|iPod)/]
+ end
+
+ def adjust_format_for_mobilesafari
+
+ #if request.env["HTTP_USER_AGENT"] && request.env["HTTP_USER_AGENT"][/(iPad|Android)/]
+ #puts "TechCLT Mobile YOOOOOOWWW"
+
+ if is_mobile?
+ request.format = :mobile
+ end
+
+ # if Rails.env.production? && request.env["HTTP_USER_AGENT"] && request.env["HTTP_USER_AGENT"][/(iPad)/]
+ # request.format = :ipad
+ # elsif request.env["HTTP_USER_AGENT"] && request.env["HTTP_USER_AGENT"][/(iPhone|iPod)/]
+ # request.format = :iphone
+ # if request.env["HTTP_USER_AGENT"] && request.env["HTTP_USER_AGENT"][/(Mobile\/.+Safari)/]
+ # request.format = :mobile
+ # end
+ end
+
+
+end
43 app/controllers/authentications_controller.rb
@@ -0,0 +1,43 @@
+class AuthenticationsController < ApplicationController
+ #This was generated with Ryanb's nifty-generators
+ # rails g nifty:scaffold authentication user_id:integer provider:string uid:string index create destroy
+
+ def index
+ @authentications = current_user.authentications if current_user #Authentication.all
+ end
+
+ def create
+ omniauthhash = request.env["omniauth.auth"]
+ authentication = Authentication.find_by_provider_and_uid(omniauthhash['provider'], omniauthhash['uid'])
+
+ if authentication
+ puts "Thinks it was a success"
+ flash[:notice] = "Signed in successfully."
+ sign_in_and_redirect(:user, authentication.user) #Omniauth method
+ elsif current_user
+ puts "Current User"
+ current_user.authentications.create!(:provider => omniauthhash['provider'], :uid => omniauthhash['uid'])
+ flash[:notice] = "Authentication successful."
+ redirect_to current_user_path
+ else
+ puts "New User"
+ user = User.new
+ user.apply_omniauth(omniauthhash) #Found in the user model
+ if user.save
+ flash[:notice] = "Signed in successfully."
+ sign_in_and_redirect(:user, user) #Omniauth method
+ else
+ session[:omniauthhash] = omniauthhash.except('extra') #This saves the hash to a session cookie without the 'extra' piece of the API return
+ redirect_to new_user_registration_url
+ end
+ end
+
+ end
+
+ def destroy
+ @authentication = current_user.authentications.find(params[:id]) #Authentication.find(params[:id])
+ @authentication.destroy
+ flash[:notice] = "Successfully destroyed authentication."
+ redirect_to authentications_url
+ end
+end
8 app/controllers/home_controller.rb
@@ -0,0 +1,8 @@
+class HomeController < ApplicationController
+
+ def index
+ @users = User.paginate :per_page => 4, :page => params[:page], # :conditions => ['id = ?', "#{}"],
+ :order => 'id DESC'
+ end
+
+end
95 app/controllers/invitations_controller.rb
@@ -0,0 +1,95 @@
+class InvitationsController < Devise::InvitationsController
+
+ include Devise::Controllers::InternalHelpers
+
+ before_filter :authenticate_inviter!, :only => [:new, :create]
+ #before_filter :has_invitations_left?, :only => [:create]
+ # before_filter :require_no_authentication, :only => [:edit, :update]
+ # helper_method :after_sign_in_path_for
+
+ # GET /resource/invitation/new
+ def new
+ #puts "INVITATIONS NEW"
+
+ #resource.role = params[resource_name][:role] if resource.errors.empty?
+ super
+ #flash[:notice] = "Successful! Want to invite someone else?"
+ #params[:user][:role] = "user"
+
+ #build_resource
+ #render_with_scope :new
+ end
+
+ # POST /resource/invitation
+ def create
+ puts "INVITATIONS CREATE"
+ puts resource_class
+
+ params[resource_name][:role] = "notadmin" #This is what sets the role
+ #current_user.decrement!(:invitation_limit)
+
+ super #this needs to be last to correctly set the user role.
+
+ #puts resource_class.invitation_limit.present?
+
+ # self.resource = resource_class.invite!(params[resource_name]) #, current_inviter)
+ #
+ # if resource.errors.empty?
+ # if resource_class.invitation_limit.present? && current_inviter
+ # puts "Invitations Left ="
+ # puts resource_class.invitation_limit
+ # current_inviter.invitation_limit ||= resource_class.invitation_limit
+ # current_inviter.decrement!(:invitation_limit)
+ # end
+ # set_flash_message :notice, :send_instructions, :email => self.resource.email
+ # redirect_to after_sign_in_path_for(resource_name)
+ # else
+ # render_with_scope :new
+ # end
+ end
+
+ # GET /resource/invitation/accept?invitation_token=abcdef
+ def edit
+ #puts "INVITATIONS EDIT"
+ super
+ resource.role = "notadmin" if resource.errors.empty?
+
+ # if params[:invitation_token] && self.resource = resource_class.first(:conditions => { :invitation_token => params[:invitation_token] })
+ # resource.role = "notadmin" if resource.errors.empty?
+ # render_with_scope :edit
+ # else
+ # set_flash_message(:alert, :invitation_token_invalid)
+ # redirect_to after_sign_out_path_for(resource_name)
+ # end
+ end
+
+ # PUT /resource/invitation
+ def update
+ #puts "INVITATIONS UPDATE"
+ super
+ resource.role = params[resource_name][:role] if resource.errors.empty?
+ puts "Done UPDATE"
+ # self.resource = resource_class.accept_invitation!(params[resource_name])
+ #
+ # if resource.errors.empty?
+ # set_flash_message :notice, :updated
+ # sign_in_and_redirect(resource_name, resource)
+ # else
+ # render_with_scope :edit
+ # end
+ end
+
+ protected
+ def current_inviter
+ @current_inviter ||= authenticate_inviter!
+ end
+
+ def has_invitations_left?
+ unless current_inviter.nil? || current_inviter.has_invitations_left?
+ build_resource
+ set_flash_message :alert, :no_invitations_remaining
+ render_with_scope :new
+ end
+ end
+
+end
28 app/controllers/registrations_controller.rb
@@ -0,0 +1,28 @@
+class RegistrationsController < Devise::RegistrationsController
+ #before_filter :authenticate_user! #Devise tip, this will make sure a user is signed in before they are allowed to access it
+ #authorize_resource :class => false #CanCan tip, use ":class => false" when a controller is not backed by a method
+
+ def new
+ super
+ end
+
+ def create
+ #params.key?(:user) == true
+
+ #This is a security measure to ensure that someone does not try to force their role to be "admin" at registration
+ if params[:user].key?(:role) == true
+ redirect_to root_url
+ end
+
+ params[:user][:role] = "notadmin"
+
+ super
+ # add custom create logic here
+ end
+
+ def update
+ super
+ end
+
+
+end
92 app/controllers/tags_controller.rb
@@ -0,0 +1,92 @@
+class TagsController < ApplicationController
+ load_and_authorize_resource
+
+ # GET /tags
+ # GET /tags.xml
+ def index
+ search_term = params[:q]
+ puts "Search Term"
+ puts search_term
+ if search_term != nil
+ @tags = Tag.where("name like ? OR name like ?", "%#{search_term.capitalize}%", "%#{search_term.upcase}%")
+ else
+ @tags = Tag.order("name ASC")
+ end
+
+ respond_to do |format|
+ format.html # index.html.erb
+ format.json { render :json => @tags.map(&:attributes) }
+ end
+ end
+
+ # GET /tags/1
+ # GET /tags/1.xml
+ def show
+ @tag = Tag.find(params[:id])
+
+ respond_to do |format|
+ format.html # show.html.erb
+ format.xml { render :xml => @tag }
+ end
+ end
+
+ # GET /tags/new
+ # GET /tags/new.xml
+ def new
+ @tag = Tag.new
+
+ respond_to do |format|
+ format.html # new.html.erb
+ format.xml { render :xml => @tag }
+ end
+ end
+
+ # GET /tags/1/edit
+ def edit
+ @tag = Tag.find(params[:id])
+ end
+
+ # POST /tags
+ # POST /tags.xml
+ def create
+ @tag = Tag.new(params[:tag])
+
+ respond_to do |format|
+ if @tag.save
+ format.html { redirect_to(@tag, :notice => 'Tag was successfully created.') }
+ format.xml { render :xml => @tag, :status => :created, :location => @tag }
+ else
+ format.html { render :action => "new" }
+ format.xml { render :xml => @tag.errors, :status => :unprocessable_entity }
+ end
+ end
+ end
+
+ # PUT /tags/1
+ # PUT /tags/1.xml
+ def update
+ @tag = Tag.find(params[:id])
+
+ respond_to do |format|
+ if @tag.update_attributes(params[:tag])
+ format.html { redirect_to(@tag, :notice => 'Tag was successfully updated.') }
+ format.xml { head :ok }
+ else
+ format.html { render :action => "edit" }
+ format.xml { render :xml => @tag.errors, :status => :unprocessable_entity }
+ end
+ end
+ end
+
+ # DELETE /tags/1
+ # DELETE /tags/1.xml
+ def destroy
+ @tag = Tag.find(params[:id])
+ @tag.destroy
+
+ respond_to do |format|
+ format.html { redirect_to(tags_url) }
+ format.xml { head :ok }
+ end
+ end
+end
152 app/controllers/user_controller.rb
@@ -0,0 +1,152 @@
+class UserController < ApplicationController
+ load_and_authorize_resource #, :except[:index, :show]
+
+ def index
+ #@users = User.all #.excludes(:id => current_user.id)
+
+ #response.headers['Cache-Control'] = 'public, max-age=300'
+
+ if is_mobile?
+ #@users = User.all(:conditions => ['visible = ? AND id = ?', true, 1], :order => 'id DESC')
+ @users = User.all(:conditions => ['visible = ?', true], :order => 'id DESC')
+ else
+ @users = User.paginate :per_page => 6, :page => params[:page], :conditions => ['visible = ?', true], # :conditions => ['id = ?', "#{}"],
+ :order => 'id DESC' #'random()' #
+ end
+
+ respond_to do |format|
+ format.html # show.html.erb
+ format.json { render :json => @users }
+ end
+
+ end
+
+ def new
+ @user = User.new
+ @user.new_user = true #virtual attribute
+ end
+
+ def show
+ @user = User.find(params[:id])
+
+ respond_to do |format|
+ format.html # show.html.erb
+ end
+ end
+
+ def create
+
+ @user = User.new(params[:user])
+ # puts "User has an image"
+ # puts @user.image?
+
+ if @user.save
+
+ if @user.first_name? && @user.last_name? && @user.image? && @user.bio? && @user.tags.count != 0 && !@user.visible?
+ @user.update_attribute(:visible, true)
+ flash[:notice] = "Successfully created User."
+ redirect_to :controller => 'user', :action => 'show'
+ else
+ flash[:notice] = "Your profile is not visible until you update your Name, Tags, Bio, and Photo."
+ render :action => 'edit'
+ end
+ else
+ render :action => 'new'
+ end
+ end
+
+ def edit
+ @user = User.find(params[:id])
+ end
+
+ def update
+ @user = User.find(params[:id])
+
+ # puts "User has an image"
+ # puts @user.image?
+
+ @user.updating_password = true if !params[:user][:password].blank? #Conditional Validation for updating a password
+ params[:user].delete(:password) if params[:user][:password].blank?
+ params[:user].delete(:password_confirmation) if params[:user][:password].blank? and params[:user][:password_confirmation].blank?
+
+ #Remove http if someone puts it in.
+ txt='http://www.stuff.com'
+
+ #http = '(https?://)'
+ if !params[:user][:website].blank?
+ temp_website = params[:user][:website]
+ params[:user][:website] = temp_website.gsub(/http[s]?:\/\//,"")
+ puts params[:user][:website]
+ end
+
+ if !params[:user][:company_website].blank?
+ temp_website = params[:user][:company_website]
+ params[:user][:company_website] = temp_website.gsub(/http[s]?:\/\//,"")
+ puts params[:user][:company_website]
+ end
+
+ # re1='(http)' # Word 1
+ # re2='(:)' # Any Single Character 1
+ # re3='(\\/)' # Any Single Character 2
+ # re4='(\\/)' # Any Single Character 3
+
+ #re=(re1+re2+re3+re4)
+ # m=Regexp.new(http,Regexp::IGNORECASE);
+ # if m.match(txt)
+ # word1=m.match(txt)[1];
+ # c1=m.match(txt)[2];
+ # c2=m.match(txt)[3];
+ # c3=m.match(txt)[4];
+ # puts "("<<word1<<")"<<"("<<c1<<")"<<"("<<c2<<")"<<"("<<c3<<")"<< "\n"
+ # end
+
+
+ if @user.update_attributes(params[:user])
+
+ if params[:user].key?(:visible) && params[:user][:visible] == "0"
+ flash[:notice] = "Profile is not visible."
+ render :action => 'edit'
+ elsif @user.first_name? && @user.last_name? && @user.image? && @user.bio? && @user.tags.count != 0 && !@user.visible?
+ @user.update_attribute(:visible, true)
+ flash[:notice] = "Successfully updated User."
+ redirect_to :controller => 'user', :action => 'show'
+ else
+ flash[:notice] = "Your profile is not visible until you update your Name, Tags, Bio, and Photo."
+ render :action => 'edit'
+ end
+
+ else
+ render :action => 'edit'
+ end
+ end
+
+ def destroy
+ #OMNIAUTH @authentications = Authentication.delete_all(:user_id => params[:id]) #Gertig, also destroy all Authentication records with this user_id.
+ #puts "Authentication Destroy"
+ #to_id(params[:id])
+ # seo_id = params[:id]
+ # puts "Chompage"
+ # #puts seo_id.match(/[^0-9]/)[0]
+ #
+ # re1='(\\d+)' # Integer Number 1
+ #
+ # re=(re1)
+ # m=Regexp.new(re,Regexp::IGNORECASE);
+ # if m.match(seo_id)
+ # int1=m.match(seo_id)[1];
+ # puts int1
+ # end
+
+
+ #puts seo_id.chomp!('-')
+
+ @user = User.find(params[:id])
+ if @user.destroy
+ #puts "User Destroy"
+ flash[:notice] = "Successfully deleted User."
+ redirect_to :controller => 'user_management', :action => 'index' # root_path
+ end
+ end
+
+
+end
66 app/controllers/user_management_controller.rb
@@ -0,0 +1,66 @@
+class UserManagementController < ApplicationController
+ #CANCAN
+ authorize_resource :class => false #CanCan tip, use ":class => false" when a controller is not backed by a method
+
+ def index
+ #@user = User.all #was @users
+
+ @visible_users = User.where('visible = ?', true).order('id DESC')
+ @hidden_users = User.where('visible = ?', false).order('id DESC')
+
+ #@invited_user =
+
+ #OMNIAUTH @authentications = Authentication.all
+
+ respond_to do |format|
+ format.html # index.html.erb
+ end
+ end
+
+ # POST /users
+ # POST /users.xml
+ def create
+ @user = User.new(params[:user])
+ #OMNIAUTH @authentications = Authentication.find(:all, :order => 'user_id') #Gertig
+
+ respond_to do |format|
+ if @user.save
+ format.html { redirect_to(@user, :notice => 'user was successfully created.') }
+ format.xml { render :xml => @user, :status => :created, :location => @user }
+ else
+ format.html { render :action => "new" }
+ format.xml { render :xml => @user.errors, :status => :unprocessable_entity }
+ end
+ end
+ end
+
+ # PUT /users/1
+ # PUT /users/1.xml
+ def update
+ @user = User.find(params[:id])
+ #OMNIAUTH @authentications = Authentication.find(:all, :order => 'name') #Gertig
+
+ respond_to do |format|
+ if @user.update_attributes(params[:user])
+ format.html { redirect_to(@user, :notice => 'user was successfully updated.') }
+ format.xml { head :ok }
+ else
+ format.html { render :action => "edit" }
+ format.xml { render :xml => @user.errors, :status => :unprocessable_entity }
+ end
+ end
+ end
+
+ # DELETE /users/1
+ # DELETE /users/1.xml
+ def destroy
+ @user = User.find(params[:id])
+ @user.destroy
+
+ respond_to do |format|
+ format.html { redirect_to(users_url) }
+ format.xml { head :ok }
+ end
+ end
+
+end
11 app/helpers/application_helper.rb
@@ -0,0 +1,11 @@
+module ApplicationHelper
+
+ def javascript(*files)
+ content_for(:head) { javascript_include_tag(*files)}
+ end
+
+ def title(page_title)
+ content_for(:title) { page_title }
+ end
+
+end
2 app/helpers/authentications_helper.rb
@@ -0,0 +1,2 @@
+module AuthenticationsHelper
+end
2 app/helpers/home_helper.rb
@@ -0,0 +1,2 @@
+module HomeHelper
+end
2 app/helpers/registrations_helper.rb
@@ -0,0 +1,2 @@
+module RegistrationsHelper
+end
2 app/helpers/tags_helper.rb
@@ -0,0 +1,2 @@
+module TagsHelper
+end
8 app/helpers/user_helper.rb
@@ -0,0 +1,8 @@
+module UserHelper
+
+ def to_id(seo_id)
+ id = seo_id.chomp("-")
+ puts id
+ end
+
+end
14 app/helpers/user_management_helper.rb
@@ -0,0 +1,14 @@
+module UserManagementHelper
+
+ def was_invited_by(user_id)
+
+ if User.exists?(:id => user_id)
+ invited_by = User.find(user_id).full_name
+ return invited_by
+ else
+ return "Inviter Removed"
+ end
+
+ end
+
+end
22 app/models/ability.rb
@@ -0,0 +1,22 @@
+class Ability
+ include CanCan::Ability
+
+ def initialize(user)
+ user ||= User.new # guest user
+
+ if user.role == "admin" # || user.role == "dj"
+ can :manage, :all
+ elsif user.role == "notadmin"
+ can :read, User
+ can :read, Tag
+ can :manage, Descriptor
+ can [:edit, :update], User do |u|
+ u.try(:id) == user.id #This ensures that a user with role not "admin" can only edit their own profile
+ end
+ else
+ can :read, User #Guest users can see the index and show pages of all controllers
+ end
+
+ end
+
+end
4 app/models/authentication.rb
@@ -0,0 +1,4 @@
+class Authentication < ActiveRecord::Base
+ belongs_to :user
+ #attr_accessible :user_id, :provider, :uid
+end
4 app/models/descriptor.rb
@@ -0,0 +1,4 @@
+class Descriptor < ActiveRecord::Base
+ belongs_to :user
+ belongs_to :tag
+end
4 app/models/tag.rb
@@ -0,0 +1,4 @@
+class Tag < ActiveRecord::Base
+ has_many :descriptors, :dependent => :destroy
+ has_many :users, :through => :descriptors
+end
114 app/models/user.rb
@@ -0,0 +1,114 @@
+class User < ActiveRecord::Base
+
+ has_many :descriptors, :dependent => :destroy
+ has_many :tags, :through => :descriptors
+
+ has_many :authentications
+
+
+ # Include default devise modules. Others available are:
+ # :token_authenticatable, :confirmable, :lockable and :timeoutable, # :registerable,
+ devise :database_authenticatable,
+ :recoverable, :rememberable, :trackable, :validatable,
+ :invitable #, :invite_for => 0 #0 is default and mean s invitation does not expire, 2.weeks #devise_invitable
+
+ # Setup accessible (or protected) attributes for your model
+ attr_accessible :email, :password, :password_confirmation, :remember_me,
+ :last_name, :first_name, :role, :company, :company_website, :website, :twitter, :show_email, :visible, :title, :bio,
+ :github, :dribble, :linkedin, :forrst, :stackoverflow,
+ :photo, :photo_file_name, :photo_content_type, :photo_file_size, :photo_updated_at,
+ :image, :tag_tokens, :tag_ids, :invitation_limit
+
+ #Validations
+ validates_presence_of :password, :if => :should_validate_password?
+ attr_accessor :updating_password, :new_user #Conditional Validation
+
+
+ #Many to Many
+ after_save :update_tags #update_tags is a method below
+
+ #Will_Paginate
+ cattr_reader :per_page
+ @@per_page = 6
+
+ #CarrierWave
+ mount_uploader :image, ImageUploader #, :mount_on => :photo_file_name
+
+ # #Paperclip method :large => "600x600>"
+ # has_attached_file :photo, :styles => { :small => "150x150>", :medium => "300x300>", :large => "500x500>" }, # :styles Needs ImageMagick
+ # :storage => :s3,
+ # :s3_credentials => "#{RAILS_ROOT}/config/s3.yml",
+ # :path => "/:style/:basename.:extension"
+ # #:url => "/images/photos/:id/:style/:basename.:extension",
+ # #:path => ":rails_root/public/images/photos/:id/:style/:basename.:extension"
+ #
+ # #default :url => "/:attachment/:id/:style/:basename.:extension",
+ # #default :path => ":rails_root/public/:attachment/:id/:style/:basename.:extension"
+
+
+ #SEO override of to_param for URLS
+ def to_param
+ "#{id}-#{full_name.gsub(/[^a-z0-9]+/i, '-')}"
+ end
+
+
+ #Creates Single reference for Full Name
+ def full_name
+ if first_name == nil || first_name == ""
+ "#{email}"
+ else
+ "#{first_name} #{last_name}"
+ end
+ end
+
+ #Conditional Validation (Episode 41)
+ def should_validate_password?
+ updating_password || new_user
+ #self.role != 'admin'
+ #current_user.role == 'player'
+ end
+
+
+ ##TAGS
+ attr_reader :tag_tokens #Getter method
+ attr_accessor :tag_ids #Many to Many
+
+ #Setter method to parse tag ids
+ def tag_tokens=(ids)
+ self.tag_ids = ids.split(",")
+ end
+
+ #after_save callback to handle tag_ids
+ def update_tags
+ unless tag_ids.nil?
+ self.descriptors.each do |m|
+ m.destroy unless tag_ids.include?(m.tag_id.to_s)
+ tag_ids.delete(m.tag_id.to_s)
+ end
+ tag_ids.each do |g|
+ self.descriptors.create(:tag_id => g) unless g.blank?
+ end
+ reload
+ self.tag_ids = nil
+ end
+ end
+
+
+ ##ROLES
+
+ SUPERROLES = %w[admin notadmin]
+
+ ###This is to account for uppercase in emails, especially because Heroku and PostgreSQL are case sensitive and SQLite is not
+ before_save do
+ self.email.downcase! if self.email
+ end
+
+ def self.find_for_authentication(conditions)
+ conditions[:email].downcase!
+ super(conditions)
+ end
+ ## END uppercase in emails fix
+
+
+
+end
80 app/uploaders/image_uploader.rb
@@ -0,0 +1,80 @@
+# encoding: utf-8
+
+class ImageUploader < CarrierWave::Uploader::Base
+
+ # Include RMagick or ImageScience support:
+ include CarrierWave::RMagick
+ # include CarrierWave::ImageScience
+
+ #include CarrierWave::Compatibility::Paperclip
+
+ # Choose what kind of storage to use for this uploader:
+ # storage :file
+ storage :fog
+
+ # Override the directory where uploaded files will be stored.
+ # This is a sensible default for uploaders that are meant to be mounted:
+ def store_dir
+ #"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}"
+ #'public/my/upload/directory'
+ #"carrierwave/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}"
+ end
+
+ # Provide a default URL as a default if there hasn't been a file uploaded:
+ def default_url
+ # "/images/fallback/" + [version_name, "default.png"].compact.join('_')
+ "/images/noimage.png"
+ end
+
+ # Process files as they are uploaded:
+ # process :scale => [200, 300]
+ #
+ # def scale(width, height)
+ # # do something
+ # end
+
+ # process :do_stuff => 10.0
+ #
+ # def do_stuff(blur_factor)
+ # manipulate! do |img|
+ # img = img.sepiatone
+ # img = img.auto_orient
+ # img = img.radial_blur(blur_factor)
+ # end
+ # end
+
+ # Create different versions of your uploaded files:
+ version :small do
+ process :resize_to_fit => [150, 300]
+ process :croppy => [::Magick::CenterGravity, 100, 100]
+ #process :scale => [100, 100]
+ end
+
+ version :medium do
+ process :resize_to_fit => [300, 600]
+ process :croppy => [::Magick::CenterGravity, 300, 200]
+ end
+
+ version :large do
+ process :resize_to_fit => [500, 1_000]
+ process :croppy => [::Magick::CenterGravity, 500, 330]
+ end
+
+ def croppy(g, w, h)
+ manipulate! do |img|
+ img = img.crop(g, w, h)
+ end
+ end
+
+ # Add a white list of extensions which are allowed to be uploaded.
+ # For images you might use something like this:
+ def extension_white_list
+ %w(jpg jpeg gif png)
+ end
+
+ # Override the filename of the uploaded files:
+ # def filename
+ # "something.jpg" if original_filename
+ # end
+
+end
26 app/views/about/index.html.erb
@@ -0,0 +1,26 @@
+<%= title "About" %>
+
+<div class="about_us 1">
+
+ <p>TechCLT was created by and for Charlotte's tech and startup community. Many people ask the question "Why aren't there more people like me in Charlotte?" TechCLT wants to answer that by providing a connection point for the silos and individuals that make up our community.</p>
+
+ <p>There are many groups in Charlotte that are doing amazing things within the tech/startup community and techCLT wants to point you to who those people are. Look them up. Connect with them on what they're doing. Let's build our future together.</p>
+
+ <p><span id="name">- <%= link_to "Andrew Gertig", user_path(1) %></span></p>
+
+</div>
+
+<div class="thanks">
+ <h3>Kudos</h3>
+ <p>Thanks to <%= link_to "Joshua Mauldin", user_path(3) %> for doing the design work on the site.</p>
+
+</div>
+
+
+
+<div class="thanks">
+ <h3>How do I join?</h3>
+ <p>To join the site you will need to receive an invite from someone who is already a member. <!-- If you don't know anyone on the site then shoot me an email or find me on twitter at <%#= link_to "@gertig", "http://twitter.com/gertig" %>. --></p>
+
+</div>
+
18 app/views/authentications/index.html.erb
@@ -0,0 +1,18 @@
+<% title "Authentications" %>
+
+<table>
+ <tr>
+ <th>User</th>
+ <th>Provider</th>
+ <th>Uid</th>
+ </tr>
+ <% for authentication in @authentications %>
+ <tr>
+ <td><%= authentication.user_id %></td>
+ <td><%= authentication.provider %></td>
+ <td><%= authentication.uid %></td>
+ <td><%= link_to "Destroy", authentication, :confirm => 'Are you sure?', :method => :delete %></td>
+ </tr>
+ <% end %>
+</table>
+
14 app/views/devise/confirmations/new.html.erb
@@ -0,0 +1,14 @@
+<div class="action_box">
+<h2>Resend confirmation instructions</h2>
+
+<%= form_for(resource, :as => resource_name, :url => confirmation_path(resource_name), :html => { :method => :post }) do |f| %>
+ <%= devise_error_messages! %>
+
+ <p><%= f.label :email %><br />
+ <%= f.text_field :email %></p>
+
+ <p><%= f.submit "Resend confirmation instructions", :class => "green_button" %></p>
+<% end %>
+
+<%= render :partial => "devise/shared/links" %>
+</div>
5 app/views/devise/mailer/confirmation_instructions.html.erb
@@ -0,0 +1,5 @@
+<p>Welcome <%= @resource.email %>!</p>
+
+<p>You can confirm your account through the link below:</p>
+
+<p><%= link_to 'Confirm my account', confirmation_url(@resource, :confirmation_token => @resource.confirmation_token) %></p>
8 app/views/devise/mailer/invitation_instructions.html.erb
@@ -0,0 +1,8 @@
+<p>Hello <%= @resource.email %>!</p>
+
+<p><%= User.find(@resource.invited_by_id).full_name %> has invited you to join the Charlotte tech community at <%= link_to "techCLT.com", root_url %>, you can accept through the link below.</p>
+
+<p><%= link_to 'Accept invitation', accept_invitation_url(@resource, :invitation_token => @resource.invitation_token) %></p>
+
+<p>If you don't want to accept the invitation, please ignore this email.<br />
+Your account won't be created until you access the link above and set your password.</p>
8 app/views/devise/mailer/reset_password_instructions.html.erb
@@ -0,0 +1,8 @@
+<p>Hello <%= @resource.email %>!</p>
+
+<p>You have requested a link to change your password, and you can do this through the link below.</p>
+
+<p><%= link_to 'Change my password', edit_password_url(@resource, :reset_password_token => @resource.reset_password_token) %></p>
+
+<p>If you didn't request this, please ignore this email.</p>
+<p>Your password won't change until you access the link above and create a new one.</p>
7 app/views/devise/mailer/unlock_instructions.html.erb
@@ -0,0 +1,7 @@
+<p>Hello <%= @resource.email %>!</p>
+
+<p>Your account has been locked due to an excessive amount of unsuccessful sign in attempts.</p>
+
+<p>Click the link below to unlock your account:</p>
+
+<p><%= link_to 'Unlock my account', unlock_url(@resource, :unlock_token => @resource.unlock_token) %></p>
20 app/views/devise/passwords/edit.html.erb
@@ -0,0 +1,20 @@
+<div class="action_box">
+
+<h2>Change your password</h2>
+
+<%= form_for(resource, :as => resource_name, :url => password_path(resource_name), :html => { :method => :put }) do |f| %>
+ <%= devise_error_messages! %>
+ <%= f.hidden_field :reset_password_token %>
+
+ <p><%= f.label :password %><br />
+ <%= f.password_field :password %></p>
+
+ <p><%= f.label :password_confirmation %><br />
+ <%= f.password_field :password_confirmation %></p>
+
+ <p><%= f.submit "Change my password", :class => "green_button" %></p>
+<% end %>
+
+<%= render :partial => "devise/shared/links" %>
+
+</div>
14 app/views/devise/passwords/new.html.erb
@@ -0,0 +1,14 @@
+<div class="action_box">
+<h2>Forgot your password?</h2>
+
+<%= form_for(resource, :as => resource_name, :url => password_path(resource_name), :html => { :method => :post }) do |f| %>
+ <%= devise_error_messages! %>
+
+ <p><%= f.label :email %><br />
+ <%= f.text_field :email %></p>
+
+ <p><%= f.submit "Send Instructions", :class => "green_button" %></p>
+<% end %>
+
+<%= render :partial => "devise/shared/links" %>
+</div>
21 app/views/devise/sessions/new.html.erb
@@ -0,0 +1,21 @@
+<div id="sign_in" class="action_box">
+ <% title "Sign In" %>
+
+ <h2>Sign In</h2>
+ <%= form_for(resource, :as => resource_name, :url => session_path(resource_name)) do |f| %>
+
+ <p><%= f.label :email %><br />
+ <%= f.text_field :email %></p>
+
+ <p><%= f.label :password %><br />
+ <%= f.password_field :password %></p>
+
+ <% if devise_mapping.rememberable? -%>
+ <p><%= f.check_box :remember_me %> <%= f.label :remember_me %></p>
+ <% end -%>
+
+ <p><%= f.submit "Sign in", :class => "green_button" %></p>
+ <% end %>
+
+ <%= render :partial => "devise/shared/links" %>
+</div>
19 app/views/devise/shared/_links.erb
@@ -0,0 +1,19 @@
+<%- if controller_name != 'sessions' %>
+ <%= link_to "Sign in", new_session_path(resource_name) %><br />
+<% end -%>
+
+<%- if devise_mapping.registerable? && controller_name != 'registrations' %>
+ <%= link_to "Sign up", new_registration_path(resource_name) %><br />
+<% end -%>
+
+<%- if devise_mapping.recoverable? && controller_name != 'passwords' %>
+ <%= link_to "Forgot your password?", new_password_path(resource_name) %><br />
+<% end -%>
+
+<%- if devise_mapping.confirmable? && controller_name != 'confirmations' %>
+ <%= link_to "Didn't receive confirmation instructions?", new_confirmation_path(resource_name) %><br />
+<% end -%>
+
+<%- if devise_mapping.lockable? && resource_class.unlock_strategy_enabled?(:email) && controller_name != 'unlocks' %>
+ <%= link_to "Didn't receive unlock instructions?", new_unlock_path(resource_name) %><br />
+<% end -%>
14 app/views/devise/unlocks/new.html.erb
@@ -0,0 +1,14 @@
+<div class="action_box">
+<h2>Resend unlock instructions</h2>
+
+<%= form_for(resource, :as => resource_name, :url => unlock_path(resource_name), :html => { :method => :post }) do |f| %>
+ <%= devise_error_messages! %>
+
+ <p><%= f.label :email %><br />
+ <%= f.text_field :email %></p>
+
+ <p><%= f.submit "Resend unlock instructions", :class => "green_button" %></p>
+<% end %>
+
+<%= render :partial => "devise/shared/links" %>
+</div>
19 app/views/home/index.html.erb
@@ -0,0 +1,19 @@
+<%= title "Home" %>
+
+<div id="temporary-content-div">
+ <% @users.each do |user| %>
+
+ <div class="profile_short">
+ <h3><%#= link_to user.full_name, user %>
+ <%= link_to user.full_name, :controller=>'user',:action=>'show',:id => @user %>
+ </h3>
+ <%= link_to image_tag(user.photo.url(:medium), :class => "small_profile"), user %>
+ <p><%= user.bio %></p>
+ </div>
+
+ <% end %>
+</div>
+
+<div class="pagination">
+ <%= will_paginate @users %>
+</div>
16 app/views/invitations/edit.html.erb
@@ -0,0 +1,16 @@
+<div id="accept_invitation" class="action_box">
+ <h2>Set your password</h2>
+
+ <%= form_for resource, :as => resource_name, :url => invitation_path(resource_name), :html => { :method => :put } do |f| %>
+ <%= devise_error_messages! %>
+ <%= f.hidden_field :invitation_token %>
+
+ <p><%= f.label :password %><br />
+ <%= f.password_field :password %></p>
+
+ <p><%= f.label :password_confirmation %><br />
+ <%= f.password_field :password_confirmation %></p>
+
+ <p><%= f.submit "Save", :class => "green_button" %></p>
+ <% end %>
+</div>
16 app/views/invitations/new.html.erb
@@ -0,0 +1,16 @@
+<div id="send_invitation" class="action_box">
+ <h2>Invites Remaining: <%= current_user.invitation_limit %></h2>
+
+ <!-- <p>Invitations are temporarily disabled while we work on an image uploading issue. Thanks!</p> -->
+
+ <%= form_for resource, :as => resource_name, :url => invitation_path(resource_name) do |f| %>
+ <%= devise_error_messages! %>
+
+ <p><%= f.label :email %> <%= f.text_field :email %></p>
+
+ <p><%= f.submit "Send", :class => "green_button" %></p>
+ <% end %>
+
+
+ <%#= link_to "Home", after_sign_in_path_for(resource_name) %><br />
+</div>
96 app/views/layouts/application.html.erb
@@ -0,0 +1,96 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <title><%= yield(:title) || "Untitled" %></title>
+
+ <%= stylesheet_link_tag 'application' %>
+ <%= stylesheet_link_tag 'gertig', 'token-input-facebook' %>
+ <!--[if gte IE 7]><%= stylesheet_link_tag 'style-ie' %><![endif]-->
+
+ <%#= javascript_include_tag 'jquery.min' %>
+ <!-- <script src="http://code.jquery.com/jquery-1.5.min.js"></script> -->
+ <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js"></script>
+ <%= javascript_include_tag 'rails' %>
+ <%= javascript_include_tag 'jquery.tokeninput' %>
+
+ <link rel="stylesheet" href="http://code.jquery.com/mobile/1.0a3/jquery.mobile-1.0a3.min.css">
+ <!-- <script src="http://code.jquery.com/mobile/1.0a3/jquery.mobile-1.0a3.min.js"></script> -->
+ <%#= yield(:head) %>
+ <%= javascript_include_tag 'application' %>
+
+ <script type="text/javascript">
+
+ var _gaq = _gaq || [];
+ _gaq.push(['_setAccount', 'UA-22555226-1']);
+ _gaq.push(['_trackPageview']);
+
+ (function() {
+ var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
+ ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
+ var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
+ })();
+
+ </script>
+
+ <script type="text/javascript" src="http://use.typekit.com/mto8xkr.js"></script>
+ <script type="text/javascript">try{Typekit.load();}catch(e){}</script>
+
+
+ <%= csrf_meta_tag %>
+</head>
+<body>
+ <%# FLASH NOTIFICATIONS %>
+ <% flash.each do |name, msg| %>
+ <%= content_tag :div, msg, :id => "flash_#{name}", :class => "flashy" %>
+ <% end %>
+ <div id="container">
+
+ <div id="header">
+ <div id="header-content">
+ <div id="logo">
+
+ <%= link_to image_tag("/images/techclt-logo.png", :alt => "techCLT Logo"), root_url %>
+
+ </div>
+
+ <div id="user_nav_and_navbar" class="clearfix">
+ <!-- <div id="user_nav">
+ <%# if user_signed_in? %>
+ <%#= link_to current_user.full_name, {:controller => 'user', :action => 'edit', :id => current_user } %> |
+ <%#= link_to "Invitations: #{current_user.invitation_limit}", new_user_invitation_path %> |
+ <%#= link_to "Logout", destroy_user_session_path %>
+ <%# else %>
+ <%#= link_to "Login", new_user_session_path %>
+ <%# end %>
+ </div> -->
+
+ <div id='navbar'>
+ <ul>
+ <li><%= link_to "About", {:controller => 'about', :action => 'index'} %></li>
+ <% if can? :manage, :all %>
+ <li><%= link_to 'Users', {:controller => 'user_management', :action => 'index'} %></li>
+ <li><%= link_to 'Tags', {:controller => 'tags', :action => 'index'}, :target => '_blank' %></li>
+ <% end %>
+ <% if user_signed_in? %>
+ <li><%= link_to "Profile", {:controller => 'user', :action => 'edit', :id => current_user } %></li>
+ <li><%= link_to "Invites", new_user_invitation_path %></li> <%# : #{current_user.invitation_limit} %>
+ <li><%= link_to "Logout", destroy_user_session_path %></li>
+ <% else %>
+ <li><%= link_to "Login", new_user_session_path %></li>
+ <% end %>
+ </ul>
+ </div> <!-- End 'navbar' -->
+
+ </div> <!-- End 'user_nav_and_navbar' -->
+ </div> <!-- End 'header-content' -->
+ </div> <!-- End 'header' -->
+
+
+ <div id="content">
+
+ <%= yield %>
+ </div> <!-- End 'content' -->
+
+ </div> <!-- End 'container' -->
+</body>
+</html>
18 app/views/layouts/application.mobile.erb
@@ -0,0 +1,18 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <title><%= yield(:title) || "Untitled" %></title>
+
+ <%= stylesheet_link_tag 'mobile' %>
+ <link rel="stylesheet" href="http://code.jquery.com/mobile/1.0a3/jquery.mobile-1.0a3.min.css" />
+ <script src="http://code.jquery.com/jquery-1.5.min.js"></script>
+ <script src="http://code.jquery.com/mobile/1.0a3/jquery.mobile-1.0a3.min.js"></script>
+
+ <%= csrf_meta_tag %>
+</head>
+<body>
+ <div data-role="page">
+ <%= yield %>
+ </div> <!-- End 'content' -->
+</body>
+</html>
8 app/views/mailer/invitation.html.erb
@@ -0,0 +1,8 @@
+<p>Hello <%= @resource.email %>!</p>
+
+<p><%= User.find(@resource.invited_by_id).full_name %> has invited you to join the Charlotte tech community at <%= link_to "techCLT.com", root_url %>, you can accept through the link below.</p>
+
+<p><%= link_to 'Accept invitation', accept_invitation_url(@resource, :invitation_token => @resource.invitation_token) %></p>
+
+<p>If you don't want to accept the invitation, please ignore this email.<br />
+Your account won't be created until you access the link above and set your password.</p>
25 app/views/registrations/edit.html.erb
@@ -0,0 +1,25 @@
+<h2>Edit <%= resource_name.to_s.humanize %></h2>
+
+<%= form_for(resource, :as => resource_name, :url => registration_path(resource_name), :html => { :method => :put }) do |f| %>
+ <%= devise_error_messages! %>
+
+ <p><%= f.label :email %><br />
+ <%= f.text_field :email %></p>
+
+ <p><%= f.label :password %> <i>(leave blank if you don't want to change it)</i><br />
+ <%= f.password_field :password %></p>
+
+ <p><%= f.label :password_confirmation %><br />
+ <%= f.password_field :password_confirmation %></p>
+
+ <p><%= f.label :current_password %> <i>(we need your current password to confirm your changes)</i><br />
+ <%= f.password_field :current_password %></p>
+
+ <p><%= f.submit "Update", :class => "button" %></p>
+<% end %>
+
+<h3>Cancel my account</h3>
+
+<p>Unhappy? <%= link_to "Cancel my account", registration_path(resource_name), :confirm => "Are you sure?", :method => :delete %>.</p>
+
+<%= link_to "Back", :back %>
24 app/views/registrations/new.html.erb
@@ -0,0 +1,24 @@
+<h2>Sign up</h2>
+
+<%= form_for(resource, :as => resource_name, :url => registration_path(resource_name)) do |f| %>
+ <%= devise_error_messages! %>
+
+ <p><%= f.label :first_name %><br />
+ <%= f.text_field :first_name %></p>
+
+ <p><%= f.label :last_name %><br />
+ <%= f.text_field :last_name %></p>
+
+ <p><%= f.label :email %><br />
+ <%= f.text_field :email %></p>
+
+ <p><%= f.label :password %><br />
+ <%= f.password_field :password %></p>
+
+ <p><%= f.label :password_confirmation %><br />
+ <%= f.password_field :password_confirmation %></p>
+
+ <p><%= f.submit "Sign up", :class => "button" %></p>
+<% end %>
+
+<%= render :partial => "devise/shared/links" %>
21 app/views/sessions/new.html.erb
@@ -0,0 +1,21 @@
+<div id="sign_in" class="action_box">
+ <% title "Sign In" %>
+
+ <h2>Sign In</h2>
+ <%= form_for(resource, :as => resource_name, :url => session_path(resource_name)) do |f| %>
+
+ <p><%= f.label :email %><br />
+ <%= f.text_field :email %></p>
+
+ <p><%= f.label :password %><br />
+ <%= f.password_field :password %></p>
+
+ <% if devise_mapping.rememberable? -%>
+ <p><%= f.check_box :remember_me %> <%= f.label :remember_me %></p>
+ <% end -%>
+
+ <p><%= f.submit "Sign in", :class => "green_button" %></p>
+ <% end %>
+
+ <%= render :partial => "devise/shared/links" %>
+</div>
21 app/views/tags/_form.html.erb
@@ -0,0 +1,21 @@
+<%= form_for(@tag) do |f| %>
+ <% if @tag.errors.any? %>
+ <div id="error_explanation">
+ <h2><%= pluralize(@tag.errors.count, "error") %> prohibited this tag from being saved:</h2>
+
+ <ul>
+ <% @tag.errors.full_messages.each do |msg| %>
+ <li><%= msg %></li>
+ <% end %>
+ </ul>
+ </div>
+ <% end %>
+
+ <div class="field">
+ <%= f.label :name %><br />
+ <%= f.text_field :name %>
+ </div>
+ <div class="actions">
+ <%= f.submit %>
+ </div>
+<% end %>
6 app/views/tags/edit.html.erb
@@ -0,0 +1,6 @@
+<h1>Editing tag</h1>
+
+<%= render 'form' %>
+
+<%= link_to 'Show', @tag %> |
+<%= link_to 'Back', tags_path %>
21 app/views/tags/index.html.erb
@@ -0,0 +1,21 @@
+<h1>Available Tags</h1>
+
+<table>
+
+<% @tags.each do |tag| %>
+ <tr>
+ <td><%= tag.name %></td>
+ <% if can? :manage, Tag %>
+ <td><%= link_to 'Show', tag %></td>
+ <td><%= link_to 'Edit', edit_tag_path(tag) %></td>
+ <td><%= link_to 'Destroy', tag, :confirm => 'Are you sure?', :method => :delete %></td>
+ <% end %>
+ </tr>
+<% end %>
+</table>
+
+<br />
+
+<% if can? :manage, Tag %>
+<%= link_to 'New Tag', new_tag_path, :class => "button" %>
+<% end %>
5 app/views/tags/new.html.erb
@@ -0,0 +1,5 @@
+<h1>New tag</h1>
+
+<%= render 'form' %>
+
+<%= link_to 'Back', tags_path %>
10 app/views/tags/show.html.erb
@@ -0,0 +1,10 @@
+<p id="notice"><%= notice %></p>
+
+<p>
+ <b>Name:</b>
+ <%= @tag.name %>
+</p>
+
+
+<%= link_to 'Edit', edit_tag_path(@tag) %> |
+<%= link_to 'Back', tags_path %>
98 app/views/user/_form.html.erb
@@ -0,0 +1,98 @@
+<div class="span-24 last">
+<p><%= link_to "Invite someone to techCLT", new_user_invitation_path %> (<%= @user.invitation_limit %> invites)</p>
+<br/>
+</div>
+
+<div id="profile_fields">
+ <p><%= f.label :first_name, :class => "profile_label" %>
+ <%= f.text_field :first_name %></p>
+
+ <p><%= f.label :last_name, :class => "profile_label" %>
+ <%= f.text_field :last_name %></p>
+
+ <% if can? :manage, :all %>
+ <p><%= f.label :invitation_limit, :class => "profile_label" %>
+ <%= f.text_field :invitation_limit %></p>
+ <% end %>
+
+ <p><%= f.label :title, :class => "profile_label" %>
+ <%= f.text_field :title %></p>
+
+ <p>Tags are displayed beneath your profile photo. <%= link_to "Available Tags", tags_path, :target => '_blank' %>.</p>
+ <div id="tags_input">
+ <p><%= f.label :tag_tokens, "Tags", :class => "profile_label" %></p>
+ <div id="tokens"><%= f.text_field :tag_tokens, "data-pre" => @user.tags.map(&:attributes).to_json %></div>
+ </div>
+
+ <p><%= f.label :twitter, "Twitter Handle", :class => "profile_label" %>
+ <%= f.text_field :twitter %></p>
+
+ <p><%= f.label :website, "Website (http://)", :class => "profile_label" %>
+ <%= f.text_field :website %></p>
+
+ <p><%= f.label :company, :class => "profile_label" %>
+ <%= f.text_field :company %></p>
+
+ <p><%= f.label :company_website, "Company site (http://)", :class => "profile_label" %>
+ <%= f.text_field :company_website %></p>
+
+ <p><%= f.label :email, "Email", :class => "profile_label" %>
+ <%= f.text_field :email %></p>
+
+
+ <p id="check_box"><%= f.check_box :show_email %><%= f.label :show_email, "Show Email in Profile?", :class => "check_box_label" %></p>
+
+ <p><%= link_to("Change Password", "#", :id => "change_password_link") %></p>
+
+ <div id="change_password" class="hidden">
+ <p><%= f.label :password, :class => "profile_label" %>
+ <%= f.password_field :password %></p>
+
+ <p><%= f.label :password_confirmation, "Confirmation", :class => "profile_label" %>
+ <%= f.password_field :password_confirmation %></p>
+ </div>
+
+ <% if can? :manage, @users %>
+ <p><%= f.label :role, :class => "profile_label" %>
+ <%= f.collection_select :role, User::SUPERROLES, :to_s, :humanize, {:include_blank => true} %></p>
+ <p><%= f.label :visible, :class => "profile_label" %>
+ <%= f.check_box :visible %></p>
+ <% end %>
+
+ <p><%= f.submit "Save" , :class =>