* Add details popover to action.

* Hide tags and overdue date on phones
* Depend on released twitter-bootstrap-rails instead of their master tree
This commit is contained in:
Reinier Balt 2013-08-09 22:49:57 +02:00
parent f8d0ff31d4
commit 031f9fe967
13 changed files with 70 additions and 55 deletions

View file

@ -20,9 +20,9 @@ gem 'jquery-rails'
gem 'therubyracer'
gem 'less-rails'
# use dev version to get fontawsome 3.2.1
#gem 'twitter-bootstrap-rails'
gem 'twitter-bootstrap-rails', github: 'seyhunak/twitter-bootstrap-rails', branch: "master"
gem 'twitter-bootstrap-rails'
# use following for dev version to get fontawsome 3.2.1
#gem 'twitter-bootstrap-rails', github: 'seyhunak/twitter-bootstrap-rails', branch: "master"
# you may comment out the database driver you will not be using.
# This will prevent a native build of the driver. Building native drivers is not

View file

@ -1,14 +1,3 @@
GIT
remote: git://github.com/seyhunak/twitter-bootstrap-rails.git
revision: 3ebe7b161a7699e56431d546aa98034483a3bb3c
branch: master
specs:
twitter-bootstrap-rails (2.2.7)
actionpack (>= 3.1)
execjs
rails (>= 3.1)
railties (>= 3.1)
GIT
remote: https://github.com/rails/actionpack-xml_parser
revision: 246653ab3670f329176c1e77e6cd1a632466f06e
@ -20,7 +9,7 @@ GEM
remote: https://rubygems.org/
specs:
RedCloth (4.2.9)
aasm (3.0.19)
aasm (3.0.20)
actionmailer (4.0.0)
actionpack (= 4.0.0)
mail (~> 2.5.3)
@ -45,14 +34,14 @@ GEM
multi_json (~> 1.3)
thread_safe (~> 0.1)
tzinfo (~> 0.3.37)
acts_as_list (0.2.0)
acts_as_list (0.3.0)
activerecord (>= 3.0)
arel (4.0.0)
aruba (0.5.3)
childprocess (>= 0.3.6)
cucumber (>= 1.1.1)
rspec-expectations (>= 2.7.0)
atomic (1.1.10)
atomic (1.1.12)
bcrypt-ruby (3.0.1)
builder (3.1.4)
bullet (4.6.0)
@ -76,7 +65,7 @@ GEM
execjs
coffee-script-source (1.6.3)
commonjs (0.2.6)
cucumber (1.3.5)
cucumber (1.3.6)
builder (>= 2.1.2)
diff-lcs (>= 1.1.3)
gherkin (~> 2.12.0)
@ -86,7 +75,7 @@ GEM
capybara (>= 1.1.2)
cucumber (>= 1.1.8)
nokogiri (>= 1.5.0)
database_cleaner (1.0.1)
database_cleaner (1.1.1)
diff-lcs (1.2.4)
erubis (2.7.0)
execjs (1.4.0)
@ -122,14 +111,14 @@ GEM
mocha (0.14.0)
metaclass (~> 0.0.1)
mousetrap-rails (0.0.11)
multi_json (1.7.7)
multi_json (1.7.8)
multi_test (0.0.2)
mysql2 (0.3.13)
nokogiri (1.6.0)
mini_portile (~> 0.5.0)
polyglot (0.3.3)
rack (1.5.2)
rack-mini-profiler (0.1.27)
rack-mini-profiler (0.1.28)
rack (>= 1.1.3)
rack-test (0.6.2)
rack (>= 1.0)
@ -150,10 +139,10 @@ GEM
thor (>= 0.18.1, < 2.0)
rake (10.1.0)
ref (1.0.5)
rspec-expectations (2.14.0)
rspec-expectations (2.14.1)
diff-lcs (>= 1.1.3, < 2.0)
rubyzip (0.9.9)
safe_yaml (0.9.4)
safe_yaml (0.9.5)
sanitize (2.0.6)
nokogiri (>= 1.4.4)
sass (3.2.10)
@ -161,7 +150,7 @@ GEM
railties (>= 4.0.0.beta, < 5.0)
sass (>= 3.1.10)
sprockets-rails (~> 2.0.0)
selenium-webdriver (2.33.0)
selenium-webdriver (2.34.0)
childprocess (>= 0.2.5)
multi_json (~> 1.0)
rubyzip
@ -190,7 +179,7 @@ GEM
thread_safe (0.1.2)
atomic
tilt (1.4.1)
timecop (0.6.2.2)
timecop (0.6.3)
tolk (1.3.11)
safe_yaml (~> 0.8)
will_paginate
@ -199,6 +188,11 @@ GEM
polyglot (>= 0.3.1)
turbolinks (1.3.0)
coffee-rails
twitter-bootstrap-rails (2.2.8)
actionpack (>= 3.1)
execjs
rails (>= 3.1)
railties (>= 3.1)
tzinfo (0.3.37)
uglifier (2.1.2)
execjs (>= 0.3.0)
@ -250,7 +244,7 @@ DEPENDENCIES
timecop (~> 0.6.2)
tolk
turbolinks
twitter-bootstrap-rails!
twitter-bootstrap-rails
uglifier (>= 1.3.0)
will_paginate-bootstrap
yard

View file

@ -12,14 +12,18 @@
//
//= require jquery
//= require jquery_ujs
//
//= require twitter/bootstrap/bootstrap-tooltip
//= require twitter/bootstrap/bootstrap-popover
//= require twitter/bootstrap/bootstrap-modal
//= require twitter/bootstrap/bootstrap-tab
//= require twitter/bootstrap/bootstrap-button
//= require twitter/bootstrap/bootstrap-dropdown
//= require twitter/bootstrap/bootstrap-collapse
//= require twitter/bootstrap/bootstrap-transition
//
//= require mousetrap
//
// Stuff in vendor/assets
// require jquery-ui-1.10.0.custom.min
// require jquery.ui.touch-punch.min
@ -28,11 +32,11 @@
// require jquery.jeditable.mini
// require jquery.simulate.drag-sortable
// require jquery.truncator
//
//= require typeahead
//= require jquery.cookie
//= require swf_fu
//
// Stuff in app/assets
//= require tracks.js
//= require keybindings.js

View file

@ -63,4 +63,5 @@ $ ->
# Item Selection
Mousetrap.bind 'j', -> TracksApp.selectNext()
Mousetrap.bind 'k', -> TracksApp.selectPrev()
Mousetrap.bind 'n', -> TracksApp.toggleNoteOfSelectedTodo()
Mousetrap.bind 'n', -> TracksApp.toggleNoteOfSelectedTodo()
Mousetrap.bind 'i', -> TracksApp.toggleDetailsPopover()

View file

@ -26,12 +26,19 @@ TracksApp =
}
}
refresh_page: -> location.reload(true)
goto_page: (page) -> window.location.href = page
go_home_page: -> TracksApp.goto_page "<%= Rails.application.routes.url_helpers.root_path %>"
go_contexts_page: -> TracksApp.goto_page "<%= Rails.application.routes.url_helpers.contexts_path %>"
go_projects_page: -> TracksApp.goto_page "<%= Rails.application.routes.url_helpers.projects_path %>"
go_starred_page: -> TracksApp.goto_page "<%= Rails.application.routes.url_helpers.tag_path("starred") %>"
go_menu: -> $('div#tracks-goto-dialog').modal()
add_todo: -> $('div#tracks-add-action-dialog').modal()
go_project: -> TracksApp.show_item_dialog(TracksApp.dialog_data.project)
go_context: -> TracksApp.show_item_dialog(TracksApp.dialog_data.context)
go_tag: -> TracksApp.show_item_dialog(TracksApp.dialog_data.tag)
show_item_dialog: (settings) ->
dialog = $('div#tracks-go-item-dialog')
# clear input field and set attributes
@ -51,19 +58,15 @@ TracksApp =
# show the dialog
dialog.modal()
go_project: -> TracksApp.show_item_dialog(TracksApp.dialog_data.project)
go_context: -> TracksApp.show_item_dialog(TracksApp.dialog_data.context)
go_tag: -> TracksApp.show_item_dialog(TracksApp.dialog_data.tag)
go_menu: -> $('div#tracks-goto-dialog').modal()
add_todo: -> $('div#tracks-add-action-dialog').modal()
createSubmenu: (todo, itemToAddBefore) ->
template_clone = $("div.todo-sub-menu-template").clone()
itemToAddBefore.before(template_clone)
todo_menu = todo.find("div.todo-sub-menu-template")
todo_menu.removeClass("todo-sub-menu-template")
todo_menu.addClass("todo-sub-menu")
info = todo.find('a[rel="tracks-popover"]')
info.attr("data-content", todo.attr("data-info"))
info.popover()
todo_menu.removeClass("hide")
appendTodoSubMenu: (todo) ->
@ -81,9 +84,11 @@ TracksApp =
selected_item.find("span.todo-item-detail").addClass("hide")
TracksApp.noteOfTodo(selected_item).addClass("hide")
selected_item.removeClass("selected-item")
selected_item.find("div.tracks-todo-badges").addClass("hidden-phone")
TracksApp.appendTodoSubMenu(new_todo)
new_todo.find("span.todo-item-detail").removeClass("hide")
new_todo.addClass("selected-item")
new_todo.find("div.tracks-todo-badges").removeClass("hidden-phone")
selectPrevNext: (go_next) ->
current = prev = next = null
@ -125,8 +130,12 @@ TracksApp =
selected_item = $("div.todo-item.selected-item")
TracksApp.toggleNoteOfTodo(selected_item)
refresh_page: ->
location.reload(true)
toggleDetailsPopover: ->
if $("body").hasClass("projects")
selected_item = $("div.project-badges")
else
selected_item = $("div.todo-item.selected-item")
selected_item.find("a.tracks-popover-toggle").popover("toggle")
group_view_by: (state) ->
$.cookie('group_view_by', state)

View file

@ -79,9 +79,6 @@ div.todo-item {
}
span.todo-item-icons {
color: #BBB; /* light gray */
display: block;
margin-right: 5px;
float:left;
cursor: pointer;
i.icon-check-empty {
color: #333;
@ -94,10 +91,6 @@ div.todo-item {
margin-right: 10px;
cursor: pointer;
}
span.todo-item-description-container {
display: inline-block;
float:left;
}
div.todo-notes {
background-color: #EEE;
border-radius: 3px;
@ -117,6 +110,9 @@ div.todo-item {
font-style: italic;
color: #999;
}
.tracks-todo-overdue {
color: #A00;
}
}
div.selected-item {

View file

@ -278,6 +278,12 @@ class Todo < ActiveRecord::Base
return has_tag?(STARRED_TAG_NAME)
end
def overdue?
return false if due.nil?
# TODO: refactor duplication with application_helper.days_from_today
return (due.in_time_zone.to_date - UserTime.new(user).date).to_i < 0
end
def toggle_star!
self.starred= !starred?
end

View file

@ -1,6 +1,6 @@
<h3 class="project-name-container"><%= show_project_name(project) %> </h3>
<div class="project-badges">
<a class="badge" title=""
<a class="badge tracks-popover-toggle" title=""
data-placement="bottom" rel="tracks-popover" href="#"
data-original-title="<%= project.name %>" data-html="true"
data-content="<div class='project-details'><%= project_details(project) %></div>">

View file

@ -7,6 +7,7 @@
<ul>
<li><span class="badge">?</span>: Shows this help page</li>
<li><span class="badge">a</span>: add action</li>
<li><span class="badge">i</span>: show details of action or project</li>
</ul>
<p>Navigation:</p>
<ul>

View file

@ -76,7 +76,6 @@
<li><%= link_to("<i class='icon-signout'></i>".html_safe, logout_path, title: "#{t('common.logout')} (#{current_user.display_name})") %></li>
</ul>
</div>
</div>
</div>
</div>
</div>

View file

@ -3,7 +3,8 @@
suppress_project ||= false
cache [todo, current_user.date.strftime("%Y%m%d"), @source_view, current_user.prefs.verbose_action_descriptors] do
-%>
<div id="<%= dom_id(todo) %>" class="todo-item">
<div id="<%= dom_id(todo) %>" class="todo-item"
data-info="<%= render partial: "todos/todo_info", locals: {todo: todo} %>">
<div class="row">
<div class="span8">
<span class="todo-item-icons">
@ -11,7 +12,7 @@
<i class="<%= todo.starred? ? "icon-star" : "icon-star-empty"%>"></i>
</span>
<span class="todo-item-description-container">
<span class="todo-description"><%= todo.description %></span>
<span class="todo-description <%= "tracks-todo-overdue" if todo.overdue?%>"><%= todo.description %></span>
<span class="todo-description-icons">
<%= content_tag(:i, {class: "icon-refresh"}){} if todo.from_recurring_todo? -%>
<%= deferred_due_date(todo) -%>
@ -20,13 +21,13 @@
</span>
</span>
<span class="todo-item-detail hide"><br/>
<p class="small todo-project-and-context"><small>
project: <span class="todo-project-name"><%= todo.project.name.blank? ? "none" : todo.project.name %></span>
context: <span class="todo-context-name"><%= todo.context.name.blank? ? "none" : todo.context.name %></span>
<p class="todo-project-and-context"><small>
project: <span class="todo-project-name"><%= todo.project.name.blank? ? "none" : link_to(todo.project.name, todo.project) %></span><br/>
context: <span class="todo-context-name"><%= todo.context.name.blank? ? "none" : link_to(todo.context.name, todo.context) %></span>
</small></p>
</span>
</div>
<div class="span4 pull-right">
<div class="span4 pull-right hidden-phone tracks-todo-badges">
<%= date_span(todo) -%>
<%= tag_list(todo) %>
</div>

View file

@ -0,0 +1 @@
Action created at <%= format_date(todo.created_at) %> and last modified at <%= format_date(todo.updated_at) %>

View file

@ -19,5 +19,8 @@
</div>
<a class="btn btn-primary btn-mini"><i class="icon-magic"></i> Make Project</a>
<a class="btn btn-primary btn-mini tracks-popover-toggle" rel="tracks-popover" href="#"
data-placement="bottom" data-original-title="Action details" data-html="true"
data-content="template-content"><i class="icon-info-sign"></i> Details</a>
<a class="btn btn-danger btn-mini"><i class="icon-trash"></i> Delete</a>
</div>