Permalink
Browse files

Localizing site for different technologies. Updating design elements

  • Loading branch information...
jcnetdev committed Aug 30, 2008
1 parent 0143762 commit 1c619ea838a194341fba78aa2593c8c431b4994e
Showing with 877 additions and 558 deletions.
  1. +4 −0 app/controllers/application.rb
  2. +0 −2 app/controllers/comps_controller.rb
  3. +19 −0 app/controllers/pages_controller.rb
  4. +53 −22 app/controllers/projects_controller.rb
  5. +17 −5 app/controllers/users_controller.rb
  6. +26 −2 app/helpers/application_helper.rb
  7. +21 −0 app/helpers/projects_helper.rb
  8. +6 −1 app/helpers/tabs_helper.rb
  9. +3 −0 app/models/comment.rb
  10. +11 −1 app/models/project.rb
  11. +26 −0 app/models/tell_friend.rb
  12. +14 −2 app/models/user.rb
  13. +15 −6 app/models/user_mailer.rb
  14. +3 −2 app/views/activities/_activity.html.haml
  15. +1 −1 app/views/bookmarks/_bookmark_list.html.haml
  16. +4 −1 app/views/comments/_comments.html.haml
  17. +2 −1 app/views/comments/_form.html.haml
  18. +0 −70 app/views/comps/detail.html.erb
  19. +0 −105 app/views/comps/form.html.erb
  20. +0 −3 app/views/comps/index.html.haml
  21. +0 −124 app/views/comps/list.html.erb
  22. +2 −1 app/views/hosted_instances/_form.html.haml
  23. +3 −5 app/views/layouts/_about_us.html.haml
  24. +11 −14 app/views/layouts/_footer.html.haml
  25. +5 −2 app/views/layouts/_header.html.haml
  26. +5 −0 app/views/layouts/_social_media.html.erb
  27. +4 −3 app/views/layouts/application.html.haml
  28. +11 −0 app/views/pages/_tell_friend_form.html.haml
  29. +34 −0 app/views/pages/_tell_friend_preview.html.haml
  30. +38 −21 app/views/pages/about.html.haml
  31. +1 −1 app/views/projects/_project.html.haml
  32. +1 −1 app/views/projects/index.atom.builder
  33. +2 −3 app/views/projects/index.html.haml
  34. +1 −0 app/views/projects/parts/_about_project.html.haml
  35. +5 −2 app/views/projects/parts/_grid.html.haml
  36. +4 −1 app/views/projects/parts/_list.html.haml
  37. +15 −6 app/views/projects/parts/_tabs.html.haml
  38. +2 −1 app/views/projects/show.html.haml
  39. +13 −0 app/views/projects/upcoming.atom.builder
  40. +9 −7 app/views/sessions/_login_panel.html.haml
  41. +2 −0 app/views/sessions/new.html.haml
  42. +11 −0 app/views/user_mailer/tell_friend.erb
  43. +2 −0 app/views/users/new.html.haml
  44. +22 −1 app/views/users/show.html.haml
  45. +7 −5 app/views/versions/_form.html.haml
  46. +16 −4 config/app_config.yml
  47. +44 −12 config/deploy.rb
  48. +4 −0 config/routes.rb
  49. +9 −0 db/migrate/20080826081134_add_requirements_to_project.rb
  50. +11 −0 db/migrate/20080826114524_add_user_fields.rb
  51. +37 −30 db/schema.rb
  52. BIN doc/Gallery.rtfd/1__#$!@%!#__Pasted Graphic.pict
  53. BIN doc/Gallery.rtfd/Pasted Graphic 1.pict
  54. BIN doc/Gallery.rtfd/Pasted Graphic 10.pict
  55. BIN doc/Gallery.rtfd/Pasted Graphic 11.pict
  56. BIN doc/Gallery.rtfd/Pasted Graphic 12.pict
  57. BIN doc/Gallery.rtfd/Pasted Graphic 13.pict
  58. BIN doc/Gallery.rtfd/Pasted Graphic 14.pict
  59. BIN doc/Gallery.rtfd/Pasted Graphic 15.pict
  60. BIN doc/Gallery.rtfd/Pasted Graphic 16.pict
  61. BIN doc/Gallery.rtfd/Pasted Graphic 17.pict
  62. BIN doc/Gallery.rtfd/Pasted Graphic 18.pict
  63. BIN doc/Gallery.rtfd/Pasted Graphic 19.pict
  64. BIN doc/Gallery.rtfd/Pasted Graphic 2.pict
  65. BIN doc/Gallery.rtfd/Pasted Graphic 3.pict
  66. BIN doc/Gallery.rtfd/Pasted Graphic 4.pict
  67. BIN doc/Gallery.rtfd/Pasted Graphic 5.pict
  68. BIN doc/Gallery.rtfd/Pasted Graphic 6.pict
  69. BIN doc/Gallery.rtfd/Pasted Graphic 7.pict
  70. BIN doc/Gallery.rtfd/Pasted Graphic 8.pict
  71. BIN doc/Gallery.rtfd/Pasted Graphic 9.pict
  72. BIN doc/Gallery.rtfd/Pasted Graphic.pict
  73. +48 −0 doc/Gallery.rtfd/TXT.rtf
  74. BIN doc/Slogan.psd
  75. BIN doc/logo.psd
  76. BIN doc/search_box.psd
  77. BIN doc/top.psd
  78. BIN public/images/right-box/bg.png
  79. BIN public/images/right-box/end_bg.png
  80. BIN public/images/right-box/top.png
  81. BIN public/images/right-box/top_about.png
  82. BIN public/images/right-box/top_add.png
  83. BIN public/images/right_tab_bg.gif
  84. BIN public/images/right_tab_bg.png
  85. BIN public/images/slogan.png
  86. BIN public/images/tab-blank-bg.png
  87. BIN public/images/tab-bottom.png
  88. BIN public/images/tab-half-highlighted.png
  89. BIN public/images/tab-half.png
  90. BIN public/images/tab-third-highlighted.png
  91. BIN public/images/tab-third.png
  92. BIN public/images/template/search_box_bg.png
  93. +1 −1 public/javascripts/common/shortcuts.js
  94. +1 −0 public/javascripts/components/project_grid.js
  95. +2 −2 public/javascripts/jquery.ext/jquery.onPage.js
  96. +42 −0 public/stylesheets/sass/v2/components/about.sass
  97. +1 −1 public/stylesheets/sass/v2/components/app_item.sass
  98. +7 −0 public/stylesheets/sass/v2/components/details.sass
  99. +2 −1 public/stylesheets/sass/v2/components/project.sass
  100. +5 −0 public/stylesheets/sass/v2/components/project_grid.sass
  101. +3 −3 public/stylesheets/sass/v2/forms/app_form.sass
  102. +2 −2 public/stylesheets/sass/v2/paging.sass
  103. +10 −1 public/stylesheets/sass/v2/panels/project-list.sass
  104. +23 −6 public/stylesheets/sass/v2/parts/footer.sass
  105. +16 −4 public/stylesheets/sass/v2/parts/header.sass
  106. +4 −3 public/stylesheets/sass/v2/styles.sass
  107. +9 −1 public/stylesheets/sass/v2/tabs.sass
  108. +29 −5 public/stylesheets/v2/paging.css
  109. +114 −41 public/stylesheets/v2/styles.css
  110. 0 script/{merge_javascript_css → merge_assets}
  111. +0 −8 test/functional/blog_controller_test.rb
  112. +0 −8 test/functional/pages_controller_test.rb
  113. +2 −2 vendor/plugins/exception_notification/lib/exception_notifiable.rb
  114. +0 −1 vendor/plugins/use_db
@@ -27,4 +27,8 @@ def check_spam(val)
return false
end
end
+
+ def helpers
+ self.class.helpers
+ end
end
@@ -1,2 +0,0 @@
-class CompsController < ApplicationController
-end
@@ -1,6 +1,20 @@
class PagesController < ApplicationController
def about
+ if request.post?
+ @tell_friend = TellFriend.new(params[:tell_friend])
+ @tell_friend.valid?
+ if button_pressed?(:send)
+ if @tell_friend.send_msg(current_or_anon_user)
+ flash[:success] = "Sent Message. Thanks for helping to promote #{AppConfig.site_name}!"
+ redirect_to about_url
+ end
+ elsif button_pressed?(:preview)
+ @preview = true
+ end
+ else
+ @tell_friend = TellFriend.new(:from => current_or_anon_user.email)
+ end
end
def blog
@@ -11,4 +25,9 @@ def blog
redirect_to root_url
end
end
+
+ protected
+ def button_pressed?(id)
+ !params[id].blank?
+ end
end
@@ -1,32 +1,39 @@
class ProjectsController < ApplicationController
def index
- @projects = find_projects
+ build_gallery(gallery_projects)
@upcoming = Project.upcoming
- @my_projects = current_or_anon_user.projects
-
- @latest_activities = Activity.latest
-
- @top_downloaded = Project.top_downloaded
- @top_bookmarked = Project.top_bookmarked
-
- if AppConfig.enable_throttler and throttled?
- @tags = []
- else
- @tags = Project.tag_counts(:conditions => Project.in_gallery_conditions, :order => "name")
- end
-
- if params[:ajax]
- render :partial => "projects/parts/grid", :locals => {:projects => @projects}, :layout => false
- else
- render
+ respond_to do |format|
+ format.html do
+ if params[:ajax]
+ render :partial => "projects/parts/grid", :locals => {:projects => @projects}, :layout => false
+ else
+ render
+ end
+ end
+ format.atom
+ end
+ end
+
+ def upcoming
+ build_gallery(upcoming_projects)
+ respond_to do |format|
+ format.html do
+ @grid_title = "Upcoming Projects"
+ @grid_rss = formatted_upcoming_projects_url(:atom)
+
+ @hide_upcoming = true
+ if params[:ajax]
+ render :partial => "projects/parts/grid", :locals => {:projects => @projects}, :layout => false
+ else
+ render :action => "index"
+ end
+ end
+ format.atom
end
-
- session[:page] = params[:page]
end
def feed
@projects = Project.latest
-
respond_to do |format|
format.atom do
render :action => "index.atom.builder"
@@ -226,6 +233,26 @@ def previous
end
protected
+ def build_gallery(projects)
+ @projects = projects
+ @my_projects = current_or_anon_user.projects
+
+ @latest_activities = Activity.latest
+
+ @top_downloaded = Project.top_downloaded
+ @top_bookmarked = Project.top_bookmarked
+
+ if throttled?
+ @tags = []
+ else
+ @tags = Project.tag_counts(:conditions => Project.in_gallery_conditions, :order => "name")
+ end
+
+ if params[:q].blank? and params[:tag].blank?
+ session[:page] = params[:page]
+ end
+ end
+
# retrieves the current project from params[:id]
def get_project
@current_project ||= Project.find(params[:id])
@@ -237,7 +264,7 @@ def get_tag
end
# find the projects to display based on the querystring
- def find_projects
+ def gallery_projects
# try to find an associated tag
@tag = get_tag
@search_term = params[:q].strip unless params[:q].blank?
@@ -249,7 +276,11 @@ def find_projects
else
@projects = Project.paginate(:conditions => Project.in_gallery_conditions, :order => "promoted_at DESC", :page => params[:page], :per_page => AppConfig.projects_per_page)
end
+ end
+ # list the upcoming projects
+ def upcoming_projects
+ @projects = Project.paginate(:conditions => Project.upcoming_conditions, :order => "updated_at DESC", :page => params[:page], :per_page => AppConfig.projects_per_page)
end
# verify that the current user owns a project
@@ -35,13 +35,20 @@ def create
def show
@user = find_user
- @bookmarked_projects = @user.projects
+ @bookmarked_projects = @user.projects.paginate(:page => params[:page], :per_page => AppConfig.bookmarks_per_page)
@submitted_projects = @user.submitted
@activities = @user.activities.all(:limit => 101, :order => "created_at DESC")
@rated_projects = @user.rated_projects
respond_to do |format|
- format.html
+ format.html do
+ @grid_title = helpers.pluralize(@user.projects.count, "Bookmarked Project")
+ if params[:ajax]
+ render :partial => "projects/parts/grid", :locals => {:projects => @bookmarked_projects}, :layout => false
+ else
+ render
+ end
+ end
format.js do
render :partial => "users/parts/about_user", :locals => {:user => @user}, :layout => false
end
@@ -154,7 +161,7 @@ def purge
def forgot_password
if request.post?
User.forgot_password(params[:email])
- flash[:notice] = "An email has been sent to you that will allow you to reset your password. If you have any problems email us at opensourcerails@gmail.com"
+ flash[:notice] = "An email has been sent to you that will allow you to reset your password. If you have any problems email us at #{AppConfig.admin_email_address}"
end
redirect_to new_session_url
end
@@ -165,7 +172,7 @@ def reset_password
# find user from auth code
@user = User.find_by_forgot_password_hash(params[:auth])
unless @user
- flash[:error] = "Reset Password URL was invalid. It may have expired. Please email us at opensourcerails@gmail.com if you are still unable to log in."
+ flash[:error] = "Reset Password URL was invalid. It may have expired. Please email us at #{AppConfig.admin_email_address} if you are still unable to log in."
redirect_to new_session_url
return
end
@@ -189,7 +196,12 @@ def reset_password
protected
def find_user
- @user = User.find(params[:id])
+ if(params[:id].to_s.include? "anon_")
+ user_id = params[:id].gsub("anon_","").to_i
+ @user = User.find_by_id(user_id)
+ else
+ @user = User.find_by_login(params[:id])
+ end
end
# verify that the current user can edit this profile
@@ -114,7 +114,7 @@ def current_year
def paging(page_data, style = :sabros)
return unless page_data.class == WillPaginate::Collection
- will_paginate(page_data, :class => "pagination #{style}", :inner_window => 3)
+ will_paginate(page_data, :class => "pagination #{style}", :outer_window => 1, :inner_window => 1)
end
def error_messages_for(name, options = {})
@@ -132,12 +132,36 @@ def default(val, default = "")
def name_display(user)
if current_or_anon_user == user
return "Your"
- elsif user
+ elsif !user.name.blank?
return "#{user.name}'s"
+ elsif !user.login.blank?
+ return "#{user.login}'s"
+ else
+ return "User's"
end
end
def paging?(list)
list.is_a? WillPaginate::Collection
end
+
+ def hide_login_panel?
+ @hide_login_panel
+ end
+
+ def hide_login_panel
+ @hide_login_panel = true
+ end
+
+ def projects_rss
+ AppConfig.rss_url || formatted_projects_url(:atom)
+ end
+
+ def upcoming_rss
+ AppConfig.upcoming_rss_url || formatted_upcoming_projects_url(:atom)
+ end
+
+ def activity_rss
+ AppConfig.upcoming_activity_url || formatted_activity_projects_url(:atom)
+ end
end
@@ -1,5 +1,13 @@
module ProjectsHelper
+ def gallery_url
+ if session[:page].blank?
+ root_url
+ else
+ root_url :page => session[:page]
+ end
+ end
+
def activity_display(activity, options = {})
partial "activities/activity", options.merge(:activity => activity)
end
@@ -121,6 +129,19 @@ def approve_button(project)
end
end
+ # Display an approve button for a project (if permissions allow)
+ def delete_button(project)
+ if admin?
+ haml_tag :div, :class => "actions text-center" do
+ puts br
+ puts link_to("Delete Project",
+ project_url(@project),
+ :method => :delete,
+ :confirm => "This delete this project and all related information. There is no UNDO. Continue?")
+ end
+ end
+ end
+
def deploy_now(project)
content_tag(:div, :class => "deploy-now") do
@@ -33,12 +33,17 @@ def tabs(options={}, &block)
# Give the tab a name and unique id
def tab(name, tab_id , options={}, &block)
# append an element to our nav_html
- @__tabs_navhtml << content_tag(:li, link_to(name, "##{tab_id}", :title => name))
+ @__tabs_navhtml << content_tag(:li, link_to(name, "##{tab_id}", :title => name), :class => options[:tab_class])
# build our tab
haml_tag :div, options.merge(:id => tab_id) do
puts capture_haml(&block)
puts content_tag(:div, "", :style => "clear: both")
end
end
+
+ def blank_tab
+ @__tabs_navhtml << content_tag(:li, "&nbsp;", :class => "blank")
+ return ""
+ end
end
View
@@ -5,6 +5,9 @@ class Comment < ActiveRecord::Base
validates_presence_of :author_name, :author_email
validates_as_email_address :author_email, :allow_blank => true
+
+ belongs_to :user, :class_name => "User", :foreign_key => "owner_id"
+
def self.initialize_from_user(user)
comment = Comment.new
if user.is_a? User
View
@@ -12,10 +12,11 @@ class Project < ActiveRecord::Base
has_many :instructions, :order => "updated_at DESC", :dependent => :delete_all
has_many :bookmarks, :dependent => :destroy
+ has_many :activities, :order => "updated_at DESC", :dependent => :delete_all
validates_uniqueness_of :title, :on => :create, :message => "must be unique"
- attr_accessible :title, :description, :author_name, :author_contact,
+ attr_accessible :title, :description, :author_name, :author_contact, :requirements,
:homepage_url, :source_url, :license, :short_description, :tag_list
# checkbox used to auto assign author from current_user
@@ -102,6 +103,10 @@ def self.upcoming(limit = 25)
find(:all, :conditions => {:in_gallery => false, :is_submitted => true}, :limit => limit, :order => "last_changed DESC")
end
+ def self.gallery(limit = 25)
+ find(:all, :conditions => {:in_gallery => true, :is_submitted => true}, :limit => limit, :order => "last_changed DESC")
+ end
+
# Search projects with a given search string
def self.search(search_term, options = {})
@@ -134,6 +139,11 @@ def self.in_gallery_conditions
{:in_gallery => true, :is_submitted => true}
end
+ # I'll convert this to named_scope when Rails 2.1 comes out
+ def self.upcoming_conditions
+ {:in_gallery => false, :is_submitted => true}
+ end
+
# Top Downloaded
def self.top_downloaded(limit = 5)
find(:all, :limit => limit, :conditions => {:is_submitted => true}, :order => "downloads DESC")
View
@@ -0,0 +1,26 @@
+class TellFriend < ActiveRecord::BaseWithoutTable
+ column :to, :string
+ column :from, :string
+ column :subject, :string
+ column :message, :text
+
+ validates_as_email_address :to, :from
+
+ attr_accessor :error_message
+
+ def send_msg(user)
+ if self.valid?
+ UserMailer.deliver_tell_friend(user, self)
+
+ # incremement
+ user.tell_friend_count += 1
+ user.tell_friend_last_sent = Time.now
+ user.save
+
+ return true
+ else
+ return false
+ end
+ end
+
+end
Oops, something went wrong.

0 comments on commit 1c619ea

Please sign in to comment.