diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 21d6d868..39c591e4 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -120,18 +120,6 @@ module ApplicationHelper link_to( descriptor, project, :title => "View project: #{project.name}" ) end - def link_to_edit_project (project, descriptor = sanitize(project.name)) - link_to(descriptor, - url_for({:controller => 'projects', :action => 'edit', :id => project.id}), - {:id => "link_edit_#{dom_id(project)}", :class => "project_edit_settings icon"}) - end - - def link_to_edit_context (context, descriptor = sanitize(context.name)) - link_to(descriptor, - url_for({:controller => 'contexts', :action => 'edit', :id => context.id}), - {:id => "link_edit_#{dom_id(context)}", :class => "context_edit_settings"}) - end - def link_to_edit_note (note, descriptor = sanitize(note.id.to_s)) link_to(descriptor, url_for({:controller => 'notes', :action => 'edit', :id => note.id}), diff --git a/app/helpers/contexts_helper.rb b/app/helpers/contexts_helper.rb index 1b512689..10d9d9e8 100644 --- a/app/helpers/contexts_helper.rb +++ b/app/helpers/contexts_helper.rb @@ -1,30 +1,38 @@ module ContextsHelper + + def get_listing_sortable_options + { + :tag => 'div', + :handle => 'handle', + :complete => visual_effect(:highlight, 'list-contexts'), + :url => order_contexts_path + } + end + + def link_to_delete_context(context, descriptor = sanitize(context.name)) + link_to(descriptor, + context_path(context, :format => 'js'), + { + :id => "delete_context_#{context.id}", + :class => "delete_context_button icon", + :x_confirm_message => t('contexts.delete_context_confirmation', :name => context.name), + :title => t('contexts.delete_context_title') + }) + end -def get_listing_sortable_options - { - :tag => 'div', - :handle => 'handle', - :complete => visual_effect(:highlight, 'list-contexts'), - :url => order_contexts_path - } -end + def link_to_edit_context (context, descriptor = sanitize(context.name)) + link_to(descriptor, + url_for({:controller => 'contexts', :action => 'edit', :id => context.id}), + { + :id => "link_edit_#{dom_id(context)}", + :class => "context_edit_settings icon" + }) + end -def link_to_delete_context(context, descriptor = sanitize(context.name)) - link_to( - descriptor, - context_path(context, :format => 'js'), - { - :id => "delete_context_#{context.id}", - :class => "delete_context_button", - :x_confirm_message => t('contexts.delete_context_confirmation', :name => context.name), - :title => t('contexts.delete_context_title') - } - ) -end - -def summary(context, undone_todo_count) - content_tag(:p, "#{undone_todo_count}. Context is #{context.hidden? ? 'Hidden' : 'Active'}.") -end + + def summary(context, undone_todo_count) + content_tag(:p, "#{undone_todo_count}. Context is #{context.hidden? ? 'Hidden' : 'Active'}.") + end end diff --git a/app/helpers/projects_helper.rb b/app/helpers/projects_helper.rb index ddab5ba2..758c9c2f 100644 --- a/app/helpers/projects_helper.rb +++ b/app/helpers/projects_helper.rb @@ -58,6 +58,15 @@ module ProjectsHelper ) end + def link_to_edit_project (project, descriptor = sanitize(project.name)) + link_to(descriptor, + url_for({:controller => 'projects', :action => 'edit', :id => project.id}), + { + :id => "link_edit_#{dom_id(project)}", + :class => "project_edit_settings icon" + }) + end + def summary(project) project_description = '' project_description += sanitize(markdown( project.description )) unless project.description.blank? diff --git a/app/views/contexts/_context_listing.rhtml b/app/views/contexts/_context_listing.rhtml index b98a0f51..b865bcca 100644 --- a/app/views/contexts/_context_listing.rhtml +++ b/app/views/contexts/_context_listing.rhtml @@ -1,29 +1,17 @@ -<% context = context_listing +<% +context = context_listing suppress_drag_handle ||= false suppress_edit_button ||= false +suppress_delete_button ||= false %>
" class="list"> -
- <% unless suppress_drag_handle -%> -
- <%= t('common.drag_handle') %> -
- <% end -%> -
+
+ <%= suppress_delete_button ? "" : link_to_delete_context(context, image_tag( "blank.png", :title => t('contexts.delete_context'), :class=>"delete_item")) -%> + <%= suppress_edit_button ? "" : link_to_edit_context(context, image_tag( "blank.png", :title => t('contexts.edit_context'), :class=>"edit_item")) -%> + <%= suppress_drag_handle ? "" : image_tag('grip.png', :width => '7', :height => '16', :border => '0', :title => t('common.drag_handle'), :class => 'grip')-%> +
<%= link_to_context( context ) %> <%= " (" + count_undone_todos_phrase(context,"actions") + ")" %>
- -
- <% if context.hide? %> - <%= t('states.hidden') %> - <% else %> - <%= t('states.visible') %> - <% end %> - - <%= link_to_delete_context(context, image_tag( "blank.png", :title => t('contexts.delete_context'), :class=>"delete_item")) %> - <%= suppress_edit_button ? "" : link_to_edit_context(context, image_tag( "blank.png", :title => t('contexts.edit_context'), :class=>"edit_item")) %> - -
diff --git a/app/views/contexts/_context_state_group.rhtml b/app/views/contexts/_context_state_group.rhtml index d2971eb3..3437a5f8 100644 --- a/app/views/contexts/_context_state_group.rhtml +++ b/app/views/contexts/_context_state_group.rhtml @@ -3,9 +3,11 @@ <%= context_state_group.length %> <%= t("states."+ state +"_plural")%> <%= t('common.contexts') %> +

<%= t('contexts.no_contexts_' + state) %>

+
<%= render :partial => 'context_listing', :collection => context_state_group %>
diff --git a/app/views/projects/_project_listing.rhtml b/app/views/projects/_project_listing.rhtml index 22b1e37c..66c8088a 100644 --- a/app/views/projects/_project_listing.rhtml +++ b/app/views/projects/_project_listing.rhtml @@ -8,9 +8,7 @@ suppress_delete_button ||= false
<%= suppress_delete_button ? "" : link_to_delete_project(project, image_tag( "blank.png", :title => t('projects.delete_project_title'), :class=>"delete_item")) %> <%= suppress_edit_button ? "" : link_to_edit_project(project, image_tag( "blank.png", :title => t('projects.edit_project_title'), :class=>"edit_item")) %> - <%= image_tag('grip.png', - :width => '7', :height => '16', :border => '0', - :title => t('common.drag_handle'), :class => 'grip') unless suppress_drag_handle -%> + <%= suppress_drag_handle ? "" : image_tag('grip.png', :width => '7', :height => '16', :border => '0', :title => t('common.drag_handle'), :class => 'grip') -%>
<%= link_to_project( project ) %> diff --git a/features/step_definitions/context_list_steps.rb b/features/step_definitions/context_list_steps.rb index 721653a7..0679ebb6 100644 --- a/features/step_definitions/context_list_steps.rb +++ b/features/step_definitions/context_list_steps.rb @@ -44,7 +44,7 @@ When /^I drag context "([^"]*)" above context "([^"]*)"$/ do |context_drag, cont drag_index = context_list_find_index(context_drag) drop_index = context_list_find_index(context_drop) - page.execute_script "$('#{sortable_css}').simulateDragSortable({move: #{drop_index-drag_index}, handle: '.handle'});" + page.execute_script "$('#{sortable_css}').simulateDragSortable({move: #{drop_index-drag_index}, handle: '.grip'});" end Then /^context "([^"]*)" should be above context "([^"]*)"$/ do |context_high, context_low| diff --git a/public/javascripts/application.js b/public/javascripts/application.js index 7471df03..364c1e28 100644 --- a/public/javascripts/application.js +++ b/public/javascripts/application.js @@ -891,7 +891,7 @@ var ContextListPage = { /* make the two state lists of context sortable */ $(['active', 'hidden']).each(function() { $("#list-contexts-"+this).sortable({ - handle: '.handle', + handle: '.grip', update: update_order }) }); diff --git a/public/stylesheets/standard.css b/public/stylesheets/standard.css index edb76935..2dd69060 100644 --- a/public/stylesheets/standard.css +++ b/public/stylesheets/standard.css @@ -430,12 +430,12 @@ input.item-checkbox { vertical-align: middle; } -.rec_description, .description, .project_description { +.rec_description, .description, .project_description, .context_description { margin-left: 80px; position:relative; } -.project_description { +.project_description, .context_description { margin-left: 50px; } @@ -861,6 +861,7 @@ form { padding: 10px; margin: 0px; } + .inline-form { border: none; padding: 3px;