Skip to content

Instantly share code, notes, and snippets.

@gabebw
Created July 15, 2011 18:36
Show Gist options
  • Save gabebw/1085248 to your computer and use it in GitHub Desktop.
Save gabebw/1085248 to your computer and use it in GitHub Desktop.
commit e72463f0c2fc2799a89595e4de5f8e26e918c187
Author: Gabe Berke-Williams <gabe@thoughtbot.com>
Commit: Gabe Berke-Williams <gabe@thoughtbot.com>
When creating a task, select the current user, and ensure it's first.
Selenium (i.e Firefox) might have selected the options where the selected
attribute was an empty string, or Iora.users might not have had current_user
first. This fixes both problems.
diff --git a/app/views/tasks/form.jst b/app/views/tasks/form.jst
index c7da29e..1f92946 100644
--- a/app/views/tasks/form.jst
+++ b/app/views/tasks/form.jst
@@ -10,8 +10,9 @@
<li class="select" id="task_user_input">
<label for="task_user_id">Assign to</label>
<select id="task_user_id" name="user_id">
- <% Iora.users.each(function(user) { %>
- <option value="<%= user.id %>" selected="<%= user.id === Iora.current_user.id ? 'selected' : '' %>"><%= user.fullName() %></option>
+ <option value="<%= Iora.current_user.id %>" selected="selected"><%= Iora.current_user.fullName() %></option>
+ <% _.each(Iora.users.select(function(user){ return user.id !== Iora.current_user.id; }), function(user) { %>
+ <option value="<%= user.id %>"><%= user.fullName() %></option>
<% }); %>
</select>
</li>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment