mirror of
https://github.com/TracksApp/tracks.git
synced 2025-12-25 03:30:13 +01:00
change look of todo
This commit is contained in:
parent
b79efb3f31
commit
972210326a
10 changed files with 136 additions and 84 deletions
5
Gemfile
5
Gemfile
|
|
@ -17,9 +17,10 @@ gem 'jquery-rails'
|
|||
# Twitter Bootstrap
|
||||
gem 'therubyracer'
|
||||
gem 'less-rails'
|
||||
|
||||
# use dev version to get fontawsome 3.2.1
|
||||
#gem 'twitter-bootstrap-rails'
|
||||
gem 'twitter-bootstrap-rails', :git => 'git://github.com/seyhunak/twitter-bootstrap-rails.git'
|
||||
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
|
||||
|
|
@ -45,7 +46,7 @@ gem "rack-mini-profiler"
|
|||
gem 'bcrypt-ruby', '~> 3.0.0'
|
||||
|
||||
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
|
||||
# gem 'turbolinks'
|
||||
gem 'turbolinks'
|
||||
|
||||
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
|
||||
# gem 'jbuilder', '~> 1.2'
|
||||
|
|
|
|||
10
Gemfile.lock
10
Gemfile.lock
|
|
@ -7,7 +7,8 @@ GIT
|
|||
|
||||
GIT
|
||||
remote: git://github.com/seyhunak/twitter-bootstrap-rails.git
|
||||
revision: 61c14a7a853abefcaa9e6878ade5a48a6856fb55
|
||||
revision: dfc45d21fac4178240bc3f6ec037969b49fa54c2
|
||||
branch: master
|
||||
specs:
|
||||
twitter-bootstrap-rails (2.2.7)
|
||||
actionpack (>= 3.1)
|
||||
|
|
@ -51,7 +52,7 @@ GEM
|
|||
childprocess (>= 0.3.6)
|
||||
cucumber (>= 1.1.1)
|
||||
rspec-expectations (>= 2.7.0)
|
||||
atomic (1.1.9)
|
||||
atomic (1.1.10)
|
||||
bcrypt-ruby (3.0.1)
|
||||
builder (3.1.4)
|
||||
bullet (4.6.0)
|
||||
|
|
@ -125,7 +126,7 @@ GEM
|
|||
mini_portile (~> 0.5.0)
|
||||
polyglot (0.3.3)
|
||||
rack (1.5.2)
|
||||
rack-mini-profiler (0.1.26)
|
||||
rack-mini-profiler (0.1.27)
|
||||
rack (>= 1.1.3)
|
||||
rack-test (0.6.2)
|
||||
rack (>= 1.0)
|
||||
|
|
@ -193,6 +194,8 @@ GEM
|
|||
treetop (1.4.14)
|
||||
polyglot
|
||||
polyglot (>= 0.3.1)
|
||||
turbolinks (1.2.0)
|
||||
coffee-rails
|
||||
tzinfo (0.3.37)
|
||||
uglifier (2.1.1)
|
||||
execjs (>= 0.3.0)
|
||||
|
|
@ -240,6 +243,7 @@ DEPENDENCIES
|
|||
therubyracer
|
||||
timecop
|
||||
tolk
|
||||
turbolinks
|
||||
twitter-bootstrap-rails!
|
||||
uglifier (>= 1.3.0)
|
||||
will_paginate
|
||||
|
|
|
|||
|
|
@ -2,6 +2,16 @@
|
|||
* Tracks CSS
|
||||
*/
|
||||
|
||||
body {
|
||||
background-color: #DDD;
|
||||
}
|
||||
|
||||
div.tracks-middle {
|
||||
background-color: #FFF;
|
||||
padding: 15px;
|
||||
border-radius: 10px;
|
||||
}
|
||||
|
||||
/* Header */
|
||||
|
||||
.navbar-inner {
|
||||
|
|
@ -36,7 +46,46 @@ footer {
|
|||
background-image: linear-gradient(to bottom, #FFFFFF, #F2F2F2);
|
||||
}
|
||||
|
||||
/* Todo tags */
|
||||
/* Todo */
|
||||
div.todo-item {
|
||||
margin-top: 7px;
|
||||
margin-left: 0px;
|
||||
border: 3px solid #EEE;
|
||||
border-width: 0px 0px 1px;
|
||||
|
||||
min-height: none;
|
||||
line-height: none;
|
||||
[class*="span"] {
|
||||
min-height: 0px;
|
||||
}
|
||||
|
||||
i.icon-check-empty {
|
||||
margin-right: 10px;
|
||||
}
|
||||
i.icon-check-sign {
|
||||
margin-right: 10px;
|
||||
color: #666;
|
||||
}
|
||||
i.icon-star-empty, i.icon-play-sign, i.icon-book, i.icon-refresh {
|
||||
color: #BBB; /* light gray */
|
||||
}
|
||||
i.icon-star {
|
||||
color: #F89406; /* orange */
|
||||
}
|
||||
span.todo-description {
|
||||
margin-right: 10px;
|
||||
}
|
||||
div.todo-item-icons {
|
||||
display: block;
|
||||
margin-right: 10px;
|
||||
float:left;
|
||||
}
|
||||
div.todo-item-description-container {
|
||||
display: inline-block;
|
||||
float:left;
|
||||
}
|
||||
}
|
||||
|
||||
span.tags {
|
||||
.label {
|
||||
a:hover, a:focus {
|
||||
|
|
@ -48,11 +97,19 @@ span.tags {
|
|||
font-weight: normal;
|
||||
}
|
||||
margin-right: 1px;
|
||||
background-color: #BBB;
|
||||
}
|
||||
}
|
||||
|
||||
/* Container */
|
||||
|
||||
h4 a {
|
||||
color: #222;
|
||||
div.todos-container {
|
||||
margin-bottom: 25px;
|
||||
h4 {
|
||||
margin-bottom: 0px;
|
||||
color: #444;
|
||||
a {
|
||||
color: #444;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -16,13 +16,6 @@ module ApplicationHelper
|
|||
{:id => "group_view_by_link", :accesskey => "g", :title => t('layouts.navigation.group_view_by_title'), :x_current_group_by => @group_view_by} )
|
||||
end
|
||||
end
|
||||
|
||||
def container_toggle(id)
|
||||
link_to(
|
||||
image_tag("blank.png", :alt => t('common.collapse_expand')),
|
||||
"#",
|
||||
{:class => "container_toggle", :id => id} )
|
||||
end
|
||||
|
||||
def navigation_link(name, options = {}, html_options = nil, *parameters_for_method_reference)
|
||||
link_to name, options, html_options
|
||||
|
|
@ -39,38 +32,31 @@ module ApplicationHelper
|
|||
return "" if due.nil?
|
||||
|
||||
days = days_from_today(due)
|
||||
days_limited = days
|
||||
days_limited = -2 if days < -2
|
||||
days_limited = 2 if days > 2
|
||||
|
||||
colors = ['amber','amber','orange','orange','orange','orange','orange','orange']
|
||||
color = :red if days < 0
|
||||
color = :green if days > 7
|
||||
colors = [:warning, :warning, :warning, :info, :info, :info]
|
||||
color = :important if days < 0
|
||||
color = :default if days > 7
|
||||
color = colors[days] if color.nil?
|
||||
|
||||
|
||||
if prefs.due_style == Preference.due_styles[:due_on]
|
||||
# TODO: internationalize strftime here
|
||||
due_text = Hash.new( t('models.preference.due_on', :date => due.strftime("%A")) )
|
||||
else
|
||||
due_text = Hash.new( t('models.preference.due_in', :days => days) )
|
||||
end
|
||||
|
||||
due_text = Hash.new(t('models.preference.due_in', :days => days)).merge({
|
||||
"-2" => t('todos.next_actions_due_date.overdue_by_plural', :days => days * -1),
|
||||
"-1" => t('todos.next_actions_due_date.overdue_by', :days => days * -1),
|
||||
"0" => t('todos.next_actions_due_date.due_today'),
|
||||
"1" => t('todos.next_actions_due_date.due_tomorrow')
|
||||
})
|
||||
|
||||
return content_tag(:a, {:title => format_date(due)}) {
|
||||
content_tag(:span, {:class => color}) {
|
||||
case days
|
||||
when 0
|
||||
t('todos.next_actions_due_date.due_today')
|
||||
when 1
|
||||
t('todos.next_actions_due_date.due_tomorrow')
|
||||
when 2..7
|
||||
if prefs.due_style == Preference.due_styles[:due_on]
|
||||
# TODO: internationalize strftime here
|
||||
t('models.preference.due_on', :date => due.strftime("%A"))
|
||||
else
|
||||
t('models.preference.due_in', :days => days)
|
||||
end
|
||||
else
|
||||
# overdue or due very soon! sound the alarm!
|
||||
if days == -1
|
||||
t('todos.next_actions_due_date.overdue_by', :days => days * -1)
|
||||
elsif days < -1
|
||||
t('todos.next_actions_due_date.overdue_by_plural', :days => days * -1)
|
||||
else
|
||||
# more than a week away - relax
|
||||
t('models.preference.due_in', :days => days)
|
||||
end
|
||||
end
|
||||
}
|
||||
content_tag(:span, {:class => "badge badge-#{color}"}) { due_text[days_limited.to_s] }
|
||||
}
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -12,13 +12,8 @@ module TodosHelper
|
|||
end
|
||||
|
||||
def todos_container_empty_message(container_name, container_id, show_message)
|
||||
content_tag(:div, :id=>"#{container_id}-empty-d", :style=>"display:#{show_message ? 'block' : 'none'}") do
|
||||
content_tag(:div, :class=>"message") do
|
||||
content_tag(:p) do
|
||||
t("todos.no_actions.#{container_name}")
|
||||
end
|
||||
end
|
||||
end
|
||||
render partial: "todos/container_empty_message", locals:
|
||||
{container_id: container_id, container_name: container_name, show_message: show_message}
|
||||
end
|
||||
|
||||
def show_grouped_todos(settings = {})
|
||||
|
|
@ -93,8 +88,8 @@ module TodosHelper
|
|||
|
||||
def todos_container(settings={})
|
||||
settings.reverse_merge!({
|
||||
:id => "#{settings[:container_name]}_container",
|
||||
:class => "container #{settings[:container_name]}",
|
||||
:id => "#{settings[:container_name]}-container",
|
||||
:class => "todos-container #{settings[:container_name]}",
|
||||
})
|
||||
|
||||
if settings[:collapsible]
|
||||
|
|
@ -115,7 +110,8 @@ module TodosHelper
|
|||
})
|
||||
header = settings[:link_in_header].nil? ? "" : content_tag(:div, :class=>"add_note_link"){settings[:link_in_header]}
|
||||
header += content_tag(:h4) do
|
||||
toggle = settings[:collapsible] ? container_toggle("toggle_#{settings[:id]}") : ""
|
||||
toggle = ""
|
||||
# toggle = settings[:collapsible] ? container_toggle("toggle_#{settings[:id]}") : ""
|
||||
"#{toggle} #{settings[:title]} #{settings[:append_descriptor]}".html_safe
|
||||
end
|
||||
header.html_safe
|
||||
|
|
@ -126,10 +122,14 @@ module TodosHelper
|
|||
# do not pass :class to partial locals
|
||||
settings.delete(:class)
|
||||
|
||||
content_tag(:div, :id =>settings[:id]+"_items", :class=>"items toggle_target") do
|
||||
todos_container_empty_message(settings[:container_name], settings[:id], collection.empty?) +
|
||||
render(:partial => "todos/todo", :collection => collection, :locals => settings)
|
||||
end
|
||||
render :partial => 'todos/container_items', :locals => {
|
||||
div_id: settings[:id]+"_items",
|
||||
container_name: settings[:container_name],
|
||||
todo_id: settings[:id],
|
||||
hide_empty_message: collection.empty?,
|
||||
collection: collection,
|
||||
settings: settings
|
||||
}
|
||||
end
|
||||
|
||||
def todos_calendar_container(period, collection)
|
||||
|
|
@ -281,7 +281,7 @@ module TodosHelper
|
|||
end
|
||||
|
||||
def tag_span (tag, mobile=false)
|
||||
content_tag(:span, :class => "label label-info #{tag.label}") { link_to(tag.name, tag_path(tag.name, :format => mobile ? :m : nil)) }
|
||||
content_tag(:span, :class => "label #{tag.label}") { link_to(tag.name, tag_path(tag.name, :format => mobile ? :m : nil)) }
|
||||
end
|
||||
|
||||
def tag_list(todo=@todo, mobile=false)
|
||||
|
|
|
|||
5
app/views/todos/_container_empty_message.html.erb
Normal file
5
app/views/todos/_container_empty_message.html.erb
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
<div id="<%=container_id%>-empty-d" style="display:<%= show_message ? 'block' : 'none'%>">
|
||||
<div class="message">
|
||||
<p><%=t("todos.no_actions.#{container_name}")%></p>
|
||||
</div>
|
||||
</div>
|
||||
4
app/views/todos/_container_items.html.erb
Normal file
4
app/views/todos/_container_items.html.erb
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
<div id="<%=div_id%>" class="todo_items toggle_target">
|
||||
<%= todos_container_empty_message(container_name, todo_id, hide_empty_message) %>
|
||||
<%= render(:partial => "todos/todo", :collection => collection, :locals => settings) %>
|
||||
</div>
|
||||
|
|
@ -1,18 +1,23 @@
|
|||
<%
|
||||
suppress_context ||= false
|
||||
suppress_project ||= false
|
||||
suppress_context ||= false
|
||||
suppress_project ||= false
|
||||
-%>
|
||||
<div>
|
||||
<i class="<%= todo.starred? ? "icon-star" : "icon-star-empty"%>"></i>
|
||||
<i class="<%= todo.completed? ? "icon-check-sign" : "icon-check-empty"%>"></i>
|
||||
<i class="icon-edit"></i>
|
||||
<i class="icon-ellipsis-vertical"></i>
|
||||
<%= date_span(todo) -%>
|
||||
<%= todo.description %>
|
||||
<%= content_tag(:i, {class: "icon-refresh"}){} if todo.from_recurring_todo? %>
|
||||
<%= tag_list(todo) %>
|
||||
<%= deferred_due_date(todo) %>
|
||||
<%= project_and_context_links( todo, parent_container_type, :suppress_context => suppress_context, :suppress_project => suppress_project ) %>
|
||||
<i class="icon-file-text-alt"></i>
|
||||
<%= content_tag(:i, {class: "icon-play-sign"}){} if todo.has_pending_successors %>
|
||||
<div id="<%= dom_id(todo) %>" class="row todo-item">
|
||||
<div class="span8">
|
||||
<div class="todo-item-icons">
|
||||
<i class="<%= todo.completed? ? "icon-check-sign" : "icon-check-empty"%>"></i>
|
||||
<i class="<%= todo.starred? ? "icon-star" : "icon-star-empty"%>"></i>
|
||||
</div>
|
||||
<div class="todo-item-description-container">
|
||||
<span class="todo-description"><%= todo.description %></span>
|
||||
<%= content_tag(:i, {class: "icon-refresh"}){} if todo.from_recurring_todo? %>
|
||||
<%= deferred_due_date(todo) %>
|
||||
<%= content_tag(:i, {class: "icon-play-sign"}){} if todo.has_pending_successors %>
|
||||
<%= content_tag(:i, {class: "icon-book"}){} unless todo.notes.blank? %>
|
||||
</div>
|
||||
</div>
|
||||
<div class="span4 pull-right">
|
||||
<%= date_span(todo) -%>
|
||||
<%= tag_list(todo) %>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -8,9 +8,4 @@
|
|||
<% end -%>
|
||||
|
||||
<%= show_done_todos(@done, {:parent_container_type => @group_view_by, :collapsible => true}) unless @done.nil? %>
|
||||
</div>
|
||||
|
||||
<div id="input_box">
|
||||
<%= render :partial => "shared/add_new_item_form" %>
|
||||
<%= render :file => "sidebar/sidebar" %>
|
||||
</div>
|
||||
|
|
@ -23,9 +23,4 @@
|
|||
|
||||
<%= show_done_todos(@done, done_options) unless @done.nil? %>
|
||||
|
||||
</div>
|
||||
|
||||
<div id="input_box">
|
||||
<%= render :partial => "shared/add_new_item_form" %>
|
||||
<%= render :file => "sidebar/sidebar" %>
|
||||
</div>
|
||||
Loading…
Add table
Add a link
Reference in a new issue