From ab0006dc3441ae27be5417be939a55a958c003e6 Mon Sep 17 00:00:00 2001 From: Reinier Balt Date: Sat, 22 Jun 2013 16:04:17 +0200 Subject: [PATCH] initial port of context-show view --- Gemfile | 4 +- Gemfile.lock | 19 +++++--- app/assets/stylesheets/tracks.css.scss | 36 ++++++++++++-- app/helpers/todos_helper.rb | 24 ++++----- app/views/contexts/show.html.erb | 21 +++----- app/views/layouts/application.html.erb | 6 +-- app/views/todos/_todo.html.erb | 67 +++++++------------------- app/views/todos/_todo.old.html.erb | 51 ++++++++++++++++++++ 8 files changed, 136 insertions(+), 92 deletions(-) create mode 100644 app/views/todos/_todo.old.html.erb diff --git a/Gemfile b/Gemfile index 66fc27a7..79dbf6a0 100644 --- a/Gemfile +++ b/Gemfile @@ -17,7 +17,9 @@ gem 'jquery-rails' # Twitter Bootstrap gem 'therubyracer' gem 'less-rails' -gem 'twitter-bootstrap-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' # 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 diff --git a/Gemfile.lock b/Gemfile.lock index b70ba246..55d703f6 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -5,6 +5,16 @@ GIT actionpack-xml_parser (1.0.0) actionpack (>= 4.0.0.rc1, < 4.1) +GIT + remote: git://github.com/seyhunak/twitter-bootstrap-rails.git + revision: 61c14a7a853abefcaa9e6878ade5a48a6856fb55 + specs: + twitter-bootstrap-rails (2.2.7) + actionpack (>= 3.1) + execjs + rails (>= 3.1) + railties (>= 3.1) + GEM remote: https://rubygems.org/ specs: @@ -105,7 +115,7 @@ GEM metaclass (0.0.1) mime-types (1.23) mini_portile (0.5.0) - minitest (4.7.4) + minitest (4.7.5) mocha (0.14.0) metaclass (~> 0.0.1) mousetrap-rails (0.0.10) @@ -183,11 +193,6 @@ GEM treetop (1.4.14) polyglot polyglot (>= 0.3.1) - twitter-bootstrap-rails (2.2.7) - actionpack (>= 3.1) - execjs - rails (>= 3.1) - railties (>= 3.1) tzinfo (0.3.37) uglifier (2.1.1) execjs (>= 0.3.0) @@ -235,7 +240,7 @@ DEPENDENCIES therubyracer timecop tolk - twitter-bootstrap-rails + twitter-bootstrap-rails! uglifier (>= 1.3.0) will_paginate yard diff --git a/app/assets/stylesheets/tracks.css.scss b/app/assets/stylesheets/tracks.css.scss index d95c7e58..3731643a 100644 --- a/app/assets/stylesheets/tracks.css.scss +++ b/app/assets/stylesheets/tracks.css.scss @@ -2,11 +2,7 @@ * Tracks CSS */ -footer { - text-align: center; - background-color: #000; - background-image: linear-gradient(to bottom, #FFFFFF, #F2F2F2); -} +/* Header */ .navbar-inner { border-radius: none; @@ -29,4 +25,34 @@ span.badge_count { text-shadow: none; padding: 5px 5px 5px 5px; border-radius: 2px 2px 2px 2px; +} + +/* Footer */ + +footer { + margin-top: 50px; + text-align: center; + background-color: #000; + background-image: linear-gradient(to bottom, #FFFFFF, #F2F2F2); +} + +/* Todo tags */ +span.tags { + .label { + a:hover, a:focus { + text-decoration: none; + } + a { + text-shadow: none; + color: #FFF; + font-weight: normal; + } + margin-right: 1px; + } +} + +/* Container */ + +h4 a { + color: #222; } \ No newline at end of file diff --git a/app/helpers/todos_helper.rb b/app/helpers/todos_helper.rb index be28052f..30763d77 100644 --- a/app/helpers/todos_helper.rb +++ b/app/helpers/todos_helper.rb @@ -4,7 +4,7 @@ module TodosHelper def empty_message_holder(container_name, show, title_param=nil) content_tag(:div, :id => "no_todos_in_view", :class => "container #{container_name}", :style => "display:" + (show ? "block" : "none") ) do - content_tag(:h2) { t("todos.no_actions.title", :param=>title_param) } + + content_tag(:h4) { t("todos.no_actions.title", :param=>title_param) } + content_tag(:div, :class => "message") do content_tag(:p) { t("todos.no_actions.#{container_name}", :param=>title_param) } end @@ -114,7 +114,7 @@ module TodosHelper :title => t("todos.actions.#{settings[:parent_container_type]}_#{settings[:container_name]}", :param => settings[:title_param]) }) header = settings[:link_in_header].nil? ? "" : content_tag(:div, :class=>"add_note_link"){settings[:link_in_header]} - header += content_tag(:h2) do + header += content_tag(:h4) do toggle = settings[:collapsible] ? container_toggle("toggle_#{settings[:id]}") : "" "#{toggle} #{settings[:title]} #{settings[:append_descriptor]}".html_safe end @@ -249,10 +249,10 @@ module TodosHelper def date_span(todo=@todo) if todo.completed? - content_tag(:span, {:class => :grey}) { format_date( todo.completed_at ) } + content_tag(:span, {class: "label"}) { format_date( todo.completed_at ) } elsif todo.pending? title = t('todos.depends_on')+ ": " + todo.uncompleted_predecessors.map(&:description).join(', ') - content_tag(:a, {:title => title}) { content_tag(:span, {:class => :orange}) { t('todos.pending') } } + content_tag(:a, {:title => title}) { content_tag(:span, {class: "label label-info"}) { t('todos.pending') } } elsif todo.deferred? show_date( todo.show_from ) else @@ -281,7 +281,7 @@ module TodosHelper end def tag_span (tag, mobile=false) - content_tag(:span, :class => "tag #{tag.label}") { link_to(tag.name, tag_path(tag.name, :format => mobile ? :m : nil)) } + content_tag(:span, :class => "label label-info #{tag.label}") { link_to(tag.name, tag_path(tag.name, :format => mobile ? :m : nil)) } end def tag_list(todo=@todo, mobile=false) @@ -351,7 +351,7 @@ module TodosHelper def show_date_tag(date, the_class, text) content_tag(:a, :title => format_date(date)) do - content_tag(:span, :class => the_class) { text } + content_tag(:span, :class => "label label-#{the_class.to_s}") { text } end end @@ -366,21 +366,21 @@ module TodosHelper case days # overdue or due very soon! sound the alarm! when -1000..-1 - show_date_tag(d, :red, t('todos.scheduled_overdue', :days => (days * -1).to_s)) + show_date_tag(d, :important, t('todos.scheduled_overdue', :days => (days * -1).to_s)) when 0 - show_date_tag(d, :amber, t('todos.show_today')) + show_date_tag(d, :warning, t('todos.show_today')) when 1 - show_date_tag(d, :amber, t('todos.show_tomorrow')) + show_date_tag(d, :warning, t('todos.show_tomorrow')) # due 2-7 days away when 2..7 if prefs.due_style == Preference.due_styles[:due_on] - show_date_tag(d, :orange, t('todos.show_on_date', :date => d.strftime("%A")) ) + show_date_tag(d, :important, t('todos.show_on_date', :date => d.strftime("%A")) ) else - show_date_tag(d, :orange, t('todos.show_in_days', :days => days.to_s) ) + show_date_tag(d, :important, t('todos.show_in_days', :days => days.to_s) ) end # more than a week away - relax else - show_date_tag(d, :green, t('todos.show_in_days', :days => days.to_s) ) + show_date_tag(d, :success, t('todos.show_in_days', :days => days.to_s) ) end end diff --git a/app/views/contexts/show.html.erb b/app/views/contexts/show.html.erb index fe44d124..acd791fe 100644 --- a/app/views/contexts/show.html.erb +++ b/app/views/contexts/show.html.erb @@ -4,22 +4,15 @@ done_todo_options = {:append_descriptor => suffix_completed, :suppress_context => true, :parent_container_type => 'context'} show_empty_containers = (@group_view_by == 'context') -%> -
- <%= empty_message_holder("not_done_project", @not_done_todos.empty?) %> - - <%= show_grouped_todos({:collapsible => false, :show_empty_containers => show_empty_containers, :parent_container_type => 'context'}) %> +<%= empty_message_holder("not_done_context", @not_done_todos.empty?) %> - <% if @group_view_by == 'project' -%> - <%= show_todos_without_project(@todos_without_project, {:collapsible => false, :parent_container_type => 'context', :title_param => @context.name}) -%> - <% end -%> +<%= show_grouped_todos({:collapsible => false, :show_empty_containers => show_empty_containers, :parent_container_type => 'context'}) %> - <%= show_deferred_pending_todos(@deferred_todos, @pending_todos, deferred_pending_options) %> +<% if @group_view_by == 'project' -%> + <%= show_todos_without_project(@todos_without_project, {:collapsible => false, :parent_container_type => 'context', :title_param => @context.name}) -%> +<% end -%> - <%= show_done_todos(@done, done_todo_options) unless @done.nil? %> -
+<%= show_deferred_pending_todos(@deferred_todos, @pending_todos, deferred_pending_options) %> -
- <%= render :partial => "shared/add_new_item_form" %> - <%= render :file => "sidebar/sidebar" %> -
+<%= show_done_todos(@done, done_todo_options) unless @done.nil? %> \ No newline at end of file diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 43376196..b2b2e16f 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -4,7 +4,7 @@ - <%= content_for?(:title) ? yield(:title) : "Tracksapp" %> + <%= content_for?(:title) ? yield(:title) : @page_title %> <%= csrf_meta_tags %> @@ -34,13 +34,13 @@ <%= favicon_link_tag 'favicon.ico', :rel => 'shortcut icon' %> - + <%= render partial: "shared/navbar" %>
-
+
<%= bootstrap_flash %> <%= yield %>
diff --git a/app/views/todos/_todo.html.erb b/app/views/todos/_todo.html.erb index aae9cfd2..3e4a46ab 100644 --- a/app/views/todos/_todo.html.erb +++ b/app/views/todos/_todo.html.erb @@ -1,51 +1,18 @@ <% -suppress_context ||= false -suppress_project ||= false -suppress_edit_button ||= todo.completed? -parameters = "_source_view=#{@source_view}" -parameters += "&_tag_name=#{@tag_name}" if @source_view == 'tag' -@z_index_counter = @z_index_counter - 1 # for IE z-index bug -@rec_depth=0 # to prevent stack overflow on large dependency trees, see _successor.html.erb - -# invalidate the cache every day because of staleness or -# rendering of "due in x days" that change without touching updated at of the todo -# also make different caches per source_view to handle difference in showing [C] and [P] -cache [todo, current_user.date.strftime("%Y%m%d"), @source_view, current_user.prefs.verbose_action_descriptors] do -%> -
-
- <%= remote_star_icon(todo) %> - <%= remote_toggle_checkbox(todo) %> - <%= remote_edit_button(todo) unless suppress_edit_button %> -
    -
  • <%= image_tag "downarrow.png", :class => "todo-submenu", :alt=> "" %> -
      -
    • <%= remote_delete_menu_item(todo) %>
    • - <% unless todo.completed? || todo.deferred? -%> -
    • <%= remote_defer_menu_item(1, todo) %>
    • -
    • <%= remote_defer_menu_item(2, todo) %>
    • -
    • <%= remote_defer_menu_item(3, todo) %>
    • -
    • <%= remote_defer_menu_item(7, todo) %>
    • -
    • <%= remote_promote_to_project_menu_item(todo) %>
    • - <% end -%> -
    -
  • -
- <%= grip_span(todo) %> -
- <%= date_span(todo) -%> - <%= h todo.description %> - <%= image_tag_for_recurring_todo(todo) 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 ) %> - <%= collapsed_notes_image(todo) unless todo.notes.blank? %> - <%= collapsed_successors_image(todo) if todo.has_pending_successors %> -
-
- -
-<% end %> + suppress_context ||= false + suppress_project ||= false +-%> +
+ "> + "> + + + <%= 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 ) %> + + <%= content_tag(:i, {class: "icon-play-sign"}){} if todo.has_pending_successors %> +
\ No newline at end of file diff --git a/app/views/todos/_todo.old.html.erb b/app/views/todos/_todo.old.html.erb new file mode 100644 index 00000000..aae9cfd2 --- /dev/null +++ b/app/views/todos/_todo.old.html.erb @@ -0,0 +1,51 @@ +<% +suppress_context ||= false +suppress_project ||= false +suppress_edit_button ||= todo.completed? +parameters = "_source_view=#{@source_view}" +parameters += "&_tag_name=#{@tag_name}" if @source_view == 'tag' +@z_index_counter = @z_index_counter - 1 # for IE z-index bug +@rec_depth=0 # to prevent stack overflow on large dependency trees, see _successor.html.erb + +# invalidate the cache every day because of staleness or +# rendering of "due in x days" that change without touching updated at of the todo +# also make different caches per source_view to handle difference in showing [C] and [P] +cache [todo, current_user.date.strftime("%Y%m%d"), @source_view, current_user.prefs.verbose_action_descriptors] do +%> +
+
+ <%= remote_star_icon(todo) %> + <%= remote_toggle_checkbox(todo) %> + <%= remote_edit_button(todo) unless suppress_edit_button %> +
    +
  • <%= image_tag "downarrow.png", :class => "todo-submenu", :alt=> "" %> +
      +
    • <%= remote_delete_menu_item(todo) %>
    • + <% unless todo.completed? || todo.deferred? -%> +
    • <%= remote_defer_menu_item(1, todo) %>
    • +
    • <%= remote_defer_menu_item(2, todo) %>
    • +
    • <%= remote_defer_menu_item(3, todo) %>
    • +
    • <%= remote_defer_menu_item(7, todo) %>
    • +
    • <%= remote_promote_to_project_menu_item(todo) %>
    • + <% end -%> +
    +
  • +
+ <%= grip_span(todo) %> +
+ <%= date_span(todo) -%> + <%= h todo.description %> + <%= image_tag_for_recurring_todo(todo) 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 ) %> + <%= collapsed_notes_image(todo) unless todo.notes.blank? %> + <%= collapsed_successors_image(todo) if todo.has_pending_successors %> +
+
+ +
+<% end %>