Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Hooked up the reorder action to re-render the doing now and recommend…

…ed panes

* When submitted, the reorder action will render the doing now and recommended
  panes using the new ordered data
* Moved the left panes into a partial for easy rendering.
* Added a formatted route

  #1558
  • Loading branch information...
commit 31e9193c0820ec930194d9ed2a61578a7a128bee 1 parent b813e09
@edavis10 authored
View
4 app/controllers/stuff_to_do_controller.rb
@@ -7,9 +7,11 @@ def index
def reorder
NextIssue.reorder_list(User.current, params[:issue])
+ @doing_now = NextIssue.doing_now(User.current)
+ @recommended = NextIssue.recommended(User.current)
respond_to do |format|
format.html { redirect_to :action => 'index'}
- format.js
+ format.js { render :partial => 'left_panes', :layout => false}
end
end
end
View
31 app/views/stuff_to_do/_left_panes.html.erb
@@ -0,0 +1,31 @@
+
+ <div id="doing-now-pane">
+ <h3><%= l(:stuff_to_do_what_im_doing_now) %></h3>
+
+ <ul id="doing-now">
+ <% @doing_now.each do |item| %>
+ <li class="issue" id="issue_<%= item.issue.id %>">
+ <%= link_to('#' + item.issue.id.to_s, :controller => 'issues', :action => 'show', :id => item.issue) %>
+ - <%= h(item.issue.project.name) %> -
+ <%= link_to(h(item.issue.subject), :controller => 'issues', :action => 'show', :id => item.issue) %>
+ </li>
+ <% end %>
+ </ul>
+ </div>
+
+ <h3><%= l(:stuff_to_do_what_is_recommended) %></h3>
+
+ <div id="recommended-pane">
+
+ <ul id="recommended">
+ <% @recommended.each do |item| %>
+ <li class="issue" id="issue_<%= item.issue.id %>">
+ <%= link_to('#' + item.issue.id.to_s, :controller => 'issues', :action => 'show', :id => item.issue) %>
+ - <%= h(item.issue.project.name) %> -
+ <%= link_to(h(item.issue.subject), :controller => 'issues', :action => 'show', :id => item.issue) %>
+ </li>
+ <% end %>
+ </ul>
+ </div>
+
+
View
42 app/views/stuff_to_do/index.html.erb
@@ -1,36 +1,7 @@
<h1><%= l(:stuff_to_do_title) %></h1>
<div class="splitcontentleft">
-
- <div id="doing-now-pane">
- <h3><%= l(:stuff_to_do_what_im_doing_now) %></h3>
-
- <ul id="doing-now">
- <% @doing_now.each do |item| %>
- <li class="issue" id="issue_<%= item.issue.id %>">
- <%= link_to('#' + item.issue.id.to_s, :controller => 'issues', :action => 'show', :id => item.issue) %>
- - <%= h(item.issue.project.name) %> -
- <%= link_to(h(item.issue.subject), :controller => 'issues', :action => 'show', :id => item.issue) %>
- </li>
- <% end %>
- </ul>
- </div>
-
- <h3><%= l(:stuff_to_do_what_is_recommended) %></h3>
-
- <div id="recommended-pane">
-
- <ul id="recommended">
- <% @recommended.each do |item| %>
- <li class="issue" id="issue_<%= item.issue.id %>">
- <%= link_to('#' + item.issue.id.to_s, :controller => 'issues', :action => 'show', :id => item.issue) %>
- - <%= h(item.issue.project.name) %> -
- <%= link_to(h(item.issue.subject), :controller => 'issues', :action => 'show', :id => item.issue) %>
- </li>
- <% end %>
- </ul>
- </div>
-
+ <%= render :partial => 'left_panes' %>
</div>
<div class="splitcontentright">
@@ -67,8 +38,17 @@ jQuery(document).ready(function(){
console.log(jQuery("#doing-now").sortable('serialize'));
console.log(jQuery("#recommended").sortable('serialize'));
data = jQuery("#doing-now").sortable('serialize') + '&' + jQuery("#recommended").sortable('serialize')
- jQuery.post('/stuff_to_do/reorder', data, function(response) {
+ jQuery.post('/stuff_to_do/reorder.js', data, function(response) {
+ jQuery('.splitcontentleft').html(response);
+
+ // Reattach sortables
+ jQuery("#doing-now").sortable({
+ connectWith: ["#available", "#recommended"],
+ });
+ jQuery("#recommended").sortable({
+ connectWith: ["#available", "#doing-now"],
+ })
});
}
View
1  routes.rb
@@ -0,0 +1 @@
+connect 'stuff_to_do/:action.:format', :controller => 'stuff_to_do'
Please sign in to comment.
Something went wrong with that request. Please try again.