mirror of
https://github.com/TracksApp/tracks.git
synced 2025-12-20 09:10:12 +01:00
change feed page to dynamically select feed for project/context
when you have a long list of projects and/or contexts, the page got really crowded
This commit is contained in:
parent
c3fa86fc36
commit
e3f444575d
5 changed files with 85 additions and 22 deletions
|
|
@ -5,14 +5,28 @@ class FeedlistController < ApplicationController
|
||||||
def index
|
def index
|
||||||
@page_title = 'TRACKS::Feeds'
|
@page_title = 'TRACKS::Feeds'
|
||||||
init_data_for_sidebar unless mobile?
|
init_data_for_sidebar unless mobile?
|
||||||
|
|
||||||
|
@active_projects = @projects.select{ |p| p.active? }
|
||||||
|
@hidden_projects = @projects.select{ |p| p.hidden? }
|
||||||
|
@completed_projects = @projects.select{ |p| p.completed? }
|
||||||
|
|
||||||
|
@active_contexts = @contexts.select{ |c| !c.hidden? }
|
||||||
|
@hidden_contexts = @contexts.select{ |c| c.hidden? }
|
||||||
|
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.html { render :layout => 'standard' }
|
format.html { render :layout => 'standard' }
|
||||||
format.m {
|
format.m { render :action => 'mobile_index' }
|
||||||
# @projects = @projects || current_user.projects.find(:all, :include => [:default_context ])
|
|
||||||
# @contexts = @contexts || current_user.contexts
|
|
||||||
render :action => 'mobile_index'
|
|
||||||
}
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def get_feeds_for_context
|
||||||
|
context = current_user.contexts.find params[:context_id]
|
||||||
|
render :partial => 'feed_for_context', :locals => { :context => context }
|
||||||
|
end
|
||||||
|
|
||||||
|
def get_feeds_for_project
|
||||||
|
project = current_user.projects.find params[:project_id]
|
||||||
|
render :partial => 'feed_for_project', :locals => { :project => project }
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
||||||
6
app/views/feedlist/_feed_for_context.html.erb
Normal file
6
app/views/feedlist/_feed_for_context.html.erb
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
<li>
|
||||||
|
<%= rss_formatted_link({ :controller=> 'todos', :action => 'index', :context_id => context.to_param }) %>
|
||||||
|
<%= text_formatted_link({ :controller=> 'todos', :action => 'index', :context_id => context.to_param }) %>
|
||||||
|
<%= ical_formatted_link({ :controller=> 'todos', :action => 'index', :context_id => context.to_param }) %>
|
||||||
|
<strong><%=h context.name %></strong>
|
||||||
|
</li>
|
||||||
6
app/views/feedlist/_feed_for_project.html.erb
Normal file
6
app/views/feedlist/_feed_for_project.html.erb
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
<li>
|
||||||
|
<%= rss_formatted_link({ :controller=> 'todos', :action => 'index', :project_id => project.to_param }) %>
|
||||||
|
<%= text_formatted_link({ :controller=> 'todos', :action => 'index', :project_id => project.to_param }) %>
|
||||||
|
<%= ical_formatted_link({ :controller=> 'todos', :action => 'index', :project_id => project.to_param }) %>
|
||||||
|
<strong><%=h project.name %></strong>
|
||||||
|
</li>
|
||||||
|
|
@ -60,26 +60,49 @@
|
||||||
</li>
|
</li>
|
||||||
<li><h4>Feeds for incomplete actions in a specific context:</h4>
|
<li><h4>Feeds for incomplete actions in a specific context:</h4>
|
||||||
<ul>
|
<ul>
|
||||||
<% for context in @contexts %>
|
<li>Step 1 - Choose the context you want a feed of:
|
||||||
<li>
|
<select name="feed-contexts" id="feed-contexts">
|
||||||
<%= rss_formatted_link({ :controller=> 'todos', :action => 'index', :context_id => context.to_param }) %>
|
<%= options_from_collection_for_select(@active_contexts, "id", "name", @active_contexts.first.id) -%>
|
||||||
<%= text_formatted_link({ :controller=> 'todos', :action => 'index', :context_id => context.to_param }) %>
|
<%= options_from_collection_for_select(@hidden_contexts, "id", "name") -%>
|
||||||
<%= ical_formatted_link({ :controller=> 'todos', :action => 'index', :context_id => context.to_param }) %>
|
</select>
|
||||||
Next actions in <strong><%=h context.name %></strong>
|
<%= observe_field "feed-contexts", :update => "feeds-for-context",
|
||||||
|
:with => 'context_id',
|
||||||
|
:url => { :controller => "feedlist", :action => "get_feeds_for_context" },
|
||||||
|
:before => "$('feeds-for-context').startWaiting()",
|
||||||
|
:complete => "$('feeds-for-context').stopWaiting()"
|
||||||
|
-%>
|
||||||
|
</li>
|
||||||
|
<li>Step 2 - Select the feed for this context
|
||||||
|
<div id="feedicons-context">
|
||||||
|
<div id="feeds-for-context">
|
||||||
|
<%= render :partial => 'feed_for_context', :locals => { :context => @active_contexts.first } %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</li>
|
</li>
|
||||||
<% end %>
|
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
<li><h4>Feeds for incomplete actions in a specific project:</h4>
|
<li><h4>Feeds for incomplete actions in a specific project:</h4>
|
||||||
<ul>
|
<ul>
|
||||||
<% for project in @projects %>
|
<li>Step 1 - Choose the project you want a feed of:
|
||||||
<li>
|
<select name="feed-projects" id="feed-projects">
|
||||||
<%= rss_formatted_link({ :controller=> 'todos', :action => 'index', :project_id => project.to_param }) %>
|
<%= options_from_collection_for_select(@active_projects, "id", "name", @active_projects.first.id) -%>
|
||||||
<%= text_formatted_link({ :controller=> 'todos', :action => 'index', :project_id => project.to_param }) %>
|
<%= options_from_collection_for_select(@hidden_projects, "id", "name") -%>
|
||||||
<%= ical_formatted_link({ :controller=> 'todos', :action => 'index', :project_id => project.to_param }) %>
|
<%= options_from_collection_for_select(@completed_projects, "id", "name") -%>
|
||||||
Next actions for <strong><%=h project.name %></strong>
|
</select>
|
||||||
|
<%= observe_field "feed-projects", :update => "feeds-for-project",
|
||||||
|
:with => 'project_id',
|
||||||
|
:url => { :controller => "feedlist", :action => "get_feeds_for_project" },
|
||||||
|
:before => "$('feeds-for-project').startWaiting()",
|
||||||
|
:complete => "$('feeds-for-project').stopWaiting()"
|
||||||
|
-%>
|
||||||
|
</li>
|
||||||
|
<li>Step 2 - Select the feed for this project
|
||||||
|
<div id="feedicons-project">
|
||||||
|
<div id="feeds-for-project">
|
||||||
|
<%= render :partial => 'feed_for_project', :locals => { :project => @active_projects.first } %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</li>
|
</li>
|
||||||
<% end %>
|
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
@ -89,3 +112,11 @@
|
||||||
<div id="input_box">
|
<div id="input_box">
|
||||||
<%= render "sidebar/sidebar" %>
|
<%= render "sidebar/sidebar" %>
|
||||||
</div><!-- End of input box -->
|
</div><!-- End of input box -->
|
||||||
|
|
||||||
|
<script type="text/javascript">
|
||||||
|
window.onload=function(){
|
||||||
|
Nifty("div#feedicons-project","normal");
|
||||||
|
Nifty("div#feedicons-context","normal");
|
||||||
|
Nifty("div#feedlegend","normal");
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
|
||||||
|
|
@ -845,6 +845,13 @@ input, select, textarea {
|
||||||
margin: 0px 0px 5px 0px;
|
margin: 0px 0px 5px 0px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#feedicons-project, #feedicons-context {
|
||||||
|
background-color: #D2D3D6;
|
||||||
|
margin: 0px 0px 0px 60px;
|
||||||
|
padding: 0px 0px 0px 5px;
|
||||||
|
width: 70%;
|
||||||
|
}
|
||||||
|
|
||||||
.feed {
|
.feed {
|
||||||
font-family: verdana, sans-serif;
|
font-family: verdana, sans-serif;
|
||||||
font-size: 10px;
|
font-size: 10px;
|
||||||
|
|
@ -948,7 +955,6 @@ ul#prefs {list-style-type: disc; margin-left: 15px;}
|
||||||
}
|
}
|
||||||
#feedlegend {
|
#feedlegend {
|
||||||
padding: 2px;
|
padding: 2px;
|
||||||
border: 1px solid #CCC;
|
|
||||||
background-color: #D2D3D6;
|
background-color: #D2D3D6;
|
||||||
color: #666;
|
color: #666;
|
||||||
padding: 5px 20px;
|
padding: 5px 20px;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue