Permalink
Browse files

updated styles, commented out pageless for now

  • Loading branch information...
1 parent 89571f7 commit ec6d509dca71a1adb5f82c1743c54846c7041717 @mshwery mshwery committed Oct 14, 2011
@@ -33,4 +33,4 @@ def redirect_back_or_default(default)
redirect_to(session[:return_to] || default)
session[:return_to] = nil
end
-end
+end
@@ -4,7 +4,7 @@ def create
user = User.find_by_email(params[:password][:email])
if user
PasswordMailer.password_reset(params[:password][:email], user.perishable_token).deliver
- redirect_to root_url, :notice => 'Check your email for password instructions ...'
+ redirect_to root_url, :notice => 'Check your email for password instructions.'
else
# Don't alert the requesting user to the fact that an email does or does not exist ...
redirect_to root_url
@@ -3,17 +3,23 @@ class UsersController < ApplicationController
before_filter :require_user, :only => [:edit, :update, :destroy]
def index
- displayed_user_ids = params[:selected].blank? ? [] : params[:selected].split(',')
- @number_of_users, @users = User.get_page(displayed_user_ids, params[:category])
- if request.xhr?
- render :partial => @users and return
- else
+ if params[:category]
+ @users = User.find_by_category(params[:category]).shuffle
+ else
+ @users = User.includes(:missions => :category).all.shuffle
+ end
+
+ # displayed_user_ids = params[:selected].blank? ? [] : params[:selected].split(',')
+ # @number_of_users, @users = User.get_page(displayed_user_ids, params[:category])
+ # if request.xhr?
+ # render :partial => @users and return
+ # else
respond_to do |format|
format.html
format.js
format.xml { render :xml => @users }
end
- end
+ # end
end
def new
@@ -61,4 +67,4 @@ def update
end
end
-end
+end
View
@@ -1,7 +1,7 @@
class User < ActiveRecord::Base
- cattr_reader :per_page
- @@per_page = Noladex::Application.config.page_size
+ # cattr_reader :per_page
+ # @@per_page = Noladex::Application.config.page_size
acts_as_authentic do |c|
c.login_field :email
@@ -29,20 +29,24 @@ class User < ActiveRecord::Base
accepts_nested_attributes_for :missions, :reject_if => proc {|attributes| attributes['statement'].blank? }
- class << self
+# class << self
+#
+# def get_page(user_ids_displayed, category=nil)
+# candidates = 0
+# unless category.blank?
+# candidates = select(:id).includes(:missions => :category).where(["categories.id = ?", category]).map!(&:id)
+# else
+# candidates = select(:id).map(&:id)
+# end
+# length = candidates.length
+# candidates = candidates - user_ids_displayed.map!(&:to_i)
+# page = candidates.shuffle[0..8]
+# return [length, includes(:missions => :category).where("users.id in (#{page.join(',')})").paginate(:page => 1, :per_page => Noladex::Application.config.page_size)]
+# end
+# end
- def get_page(user_ids_displayed, category=nil)
- candidates = 0
- unless category.blank?
- candidates = select(:id).includes(:missions => :category).where(["categories.id = ?", category]).map!(&:id)
- else
- candidates = select(:id).map(&:id)
- end
- length = candidates.length
- candidates = candidates - user_ids_displayed.map!(&:to_i)
- page = candidates.shuffle[0..8]
- return [length, includes(:missions => :category).where("users.id in (#{page.join(',')})").paginate(:page => 1, :per_page => Noladex::Application.config.page_size)]
- end
+ def self.find_by_category(category_id)
+ includes(:missions => :category).where(["categories.id = ?", category_id])
end
private
@@ -18,4 +18,4 @@
<div class="actions">
<%= f.submit %>
</div>
-<% end %>
+<% end %>
@@ -20,4 +20,4 @@
<br />
-<%= link_to 'New Category', new_category_path %>
+<%= link_to 'New Category', new_category_path %>
@@ -78,4 +78,4 @@
<%= javascript_include_tag "jquery.min", "jquery_ujs", "plugins", "noladex.js", "jquery.pageless.js" %>
<%= yield :javascript %>
</body>
-</html>
+</html>
@@ -1,7 +1,11 @@
<%= semantic_form_for :password, :url => password_index_path do |f| %>
- <h2>+Get a password reset email...</h2>
- <%= f.inputs :email %>
- <%= f.buttons do %>
- <%= f.submit "Send", :class => 'button' %>
- <% end %>
+ <div id="sign-in" class="clear">
+ <h2>Forgot your password?</h2>
+ <div class="field">
+ <%= f.label :email, "Email" %>
+ <%= f.text_field :email, :tabindex => '1' %>
+ </div>
+ <div class="actions right">
+ <%= f.submit "Send", :tabindex => '2', :class => 'edit-button' %>
+ </div>
<% end %>
@@ -4,4 +4,4 @@
<% else %>
<li><%= link_to "My Profile", edit_user_path(current_user) %></li>
<li><%= link_to "Sign out", logout_path %></li>
-<% end %>
+<% end %>
@@ -29,9 +29,9 @@
<div class="avatar left">
<% if @user.avatar.url and @user.created_at %>
- <%= f.label :avatar, 'Upload Photo', :style => 'background: url('+@user.avatar.url+'); text-indent: -9999px;' %>
+ <%= f.label :avatar, 'Upload Photo', :class => 'true', :style => 'background-image: url('+@user.avatar.url+');' %>
<% else %>
- <%= f.label :avatar, 'Upload Photo' %>
+ <%= f.label :avatar, 'Upload Photo', :class => 'false' %>
<% end %>
<%= f.file_field :avatar %>
<p>Maximum size of 700k. JPG, GIF, PNG.</p>
@@ -68,7 +68,11 @@
<div class="actions right">
<a href="/">Cancel</a>
- <input id="user_submit" name="commit" type="submit" value="Submit" class="add-button">
+ <% if @user.created_at %>
+ <input id="user_submit" name="commit" type="submit" value="Update" class="edit-button">
+ <% else %>
+ <input id="user_submit" name="commit" type="submit" value="Add Yourself" class="add-button">
+ <% end %>
</div>
</div>
<% end %>
@@ -1,12 +1,12 @@
-<% content_for :javascript do %>
- <% javascript_tag do %>
- opts = {
- totalPages : <%= @number_of_users % Noladex::Application.config.page_size > 0 ? (@number_of_users / Noladex::Application.config.page_size) + 1 : (@number_of_users / Noladex::Application.config.page_size) %>,
+<!-- <%# content_for :javascript do %>
+ <%# javascript_tag do %>
+ opts = {
+ totalPages : <%#= @number_of_users % Noladex::Application.config.page_size > 0 ? (@number_of_users / Noladex::Application.config.page_size) + 1 : (@number_of_users / Noladex::Application.config.page_size) %>,
url : '/users',
loaderMsg : 'Loading more noladexes',
params : {
selected : $('#selected_noladexers').val(),
- category : "<%= params[:category] %>"
+ category : "<%#= params[:category] %>"
},
scrape : function(data) {
alreadySelected = $('#selected_noladexers').val().split(',')
@@ -15,14 +15,15 @@
alreadySelected.push(newId);
});
$('#selected_noladexers').val(alreadySelected.join(','));
+ console.log(alreadySelected);
}
- }
- $('#people').pageless(opts);
- <% end %>
-<% end %>
-
-<%= semantic_form_for :selected do |f| %>
- <%= f.hidden_field :noladexers, :value => @users.map {|u| u.id}.join(',') %>
-<% end %>
-
+ }
+ // $('#people').pageless(opts);
+ <%# end %>
+<%# end %> -->
+<!--
+<%#= semantic_form_for :selected do |f| %>
+ <%#= f.hidden_field :noladexers, :value => @users.map {|u| u.id}.join(',') %>
+<%# end %>
+-->
<%= render @users %>
View
@@ -45,6 +45,6 @@ class Application < Rails::Application
config.mailer_host = "http://localhost:3000"
- config.page_size = 8
+ config.page_size = 9
end
end
View
@@ -13,59 +13,59 @@
ActiveRecord::Schema.define(:version => 20110724131800) do
create_table "categories", :force => true do |t|
- t.string "name"
- t.datetime "created_at"
- t.datetime "updated_at"
+ t.string "name"
+ t.timestamp "created_at"
+ t.timestamp "updated_at"
end
create_table "missions", :force => true do |t|
- t.string "statement"
- t.integer "user_id"
- t.integer "category_id"
- t.datetime "created_at"
- t.datetime "updated_at"
+ t.string "statement"
+ t.integer "user_id"
+ t.integer "category_id"
+ t.timestamp "created_at"
+ t.timestamp "updated_at"
end
create_table "neighborhoods", :force => true do |t|
- t.string "name"
- t.datetime "created_at"
- t.datetime "updated_at"
+ t.string "name"
+ t.timestamp "created_at"
+ t.timestamp "updated_at"
end
create_table "tags", :force => true do |t|
- t.string "name"
- t.datetime "created_at"
- t.datetime "updated_at"
+ t.string "name"
+ t.timestamp "created_at"
+ t.timestamp "updated_at"
end
create_table "users", :force => true do |t|
- t.string "name"
- t.string "email"
- t.string "url_photo"
- t.boolean "admin"
- t.datetime "created_at"
- t.datetime "updated_at"
- t.string "url1"
- t.string "url2"
- t.string "url3"
- t.string "openid_url"
- t.string "avatar_file_name"
- t.string "avatar_content_type"
- t.integer "avatar_file_size"
- t.datetime "avatar_updated_at"
- t.string "crypted_password"
- t.string "password_salt"
- t.string "persistence_token"
- t.string "single_access_token"
- t.string "perishable_token"
- t.integer "login_count"
- t.integer "failed_login_count"
- t.datetime "last_request_at"
- t.datetime "current_login_at"
- t.datetime "last_login_at"
- t.string "current_login_ip"
- t.string "last_login_ip"
- t.text "avatar_meta"
+ t.string "name"
+ t.string "email"
+ t.string "url_photo"
+ t.boolean "admin"
+ t.timestamp "created_at"
+ t.timestamp "updated_at"
+ t.string "url1"
+ t.string "url2"
+ t.string "url3"
+ t.string "openid_url"
+ t.string "avatar_file_name"
+ t.string "avatar_content_type"
+ t.integer "avatar_file_size"
+ t.timestamp "avatar_updated_at"
+ t.string "crypted_password"
+ t.string "password_salt"
+ t.string "persistence_token"
+ t.string "single_access_token"
+ t.string "perishable_token"
+ t.integer "login_count"
+ t.integer "failed_login_count"
+ t.timestamp "last_request_at"
+ t.timestamp "current_login_at"
+ t.timestamp "last_login_at"
+ t.string "current_login_ip"
+ t.string "last_login_ip"
+ t.text "avatar_meta"
end
end
Oops, something went wrong.

0 comments on commit ec6d509

Please sign in to comment.