diff --git a/app/helpers/todos_helper.rb b/app/helpers/todos_helper.rb index 27502a25..b5617913 100644 --- a/app/helpers/todos_helper.rb +++ b/app/helpers/todos_helper.rb @@ -139,10 +139,6 @@ module TodosHelper if tag_list.empty? then "" else "#{tag_list}" end end - def predecessor_list_text(todo=@todo) - todo.predecessors.map{|t| t.specification}.join(', ') - end - def deferred_due_date(todo=@todo) if todo.deferred? && todo.due t('todos.action_due_on', :date => format_date(todo.due)) diff --git a/app/views/todos/_edit_form.rhtml b/app/views/todos/_edit_form.rhtml index 89d71ea7..c5970c19 100644 --- a/app/views/todos/_edit_form.rhtml +++ b/app/views/todos/_edit_form.rhtml @@ -42,8 +42,17 @@ form_for(todo, :html=> { :name=>'todo', :id => dom_id(@todo, 'form'), :class => - - <%= text_field_tag 'predecessor_list', predecessor_list_text, :id => dom_id(@todo, 'predecessor_list'), :size => 30, :tabindex => 15 %> +
+ +
+ +
+ + <%= text_field_tag "predecessor_input", nil, :size => 30, :tabindex => 8 %> + <%= hidden_field_tag "predecessor_list", @todo.predecessors.map{|t| t.id.to_s}.join(', ') %> +
+
diff --git a/app/views/todos/_new_todo_form.rhtml b/app/views/todos/_new_todo_form.rhtml index ba6d3c80..8feafa26 100644 --- a/app/views/todos/_new_todo_form.rhtml +++ b/app/views/todos/_new_todo_form.rhtml @@ -34,13 +34,16 @@ <%= t.text_field("show_from", "size" => 12, "class" => "Date", "tabindex" => 7, "autocomplete" => "off") %>
- -
- +
+ +
+ +
+ + <%= text_field_tag "predecessor_input", nil, :size => 30, :tabindex => 8 %> + <%= hidden_field_tag "predecessor_list", ""%>
- <%= t('common.add')%>: <%= text_field_tag "predecessor_input", nil, :size => 30, :tabindex => 8 %> - <%= hidden_field_tag "predecessor_list", ""%> <%= source_view_tag( @source_view ) %> <%= hidden_field_tag :_tag_name, @tag_name.underscore.gsub(/\s+/,'_') if source_view_is :tag %> diff --git a/config/locales/en.yml b/config/locales/en.yml index 05fb1663..3db5c71a 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -411,6 +411,7 @@ en: no_actions_found: "No actions found" no_actions_with: "Currently there are no incomplete actions with the tag '%{tag_name}'" removed_predecessor: "Removed %{successor} as dependency from %{predecessor}." + add_another_dependency: "Add another dependency" error_removing_dependency: "There was an error removing the dependency" deferred_actions_with: "Deferred actions with the tag '%{tag_name}'" no_deferred_actions_with: "No deferred actions with the tag '%{tag_name}'" diff --git a/config/locales/nl.yml b/config/locales/nl.yml index 849f0f52..d3e82780 100644 --- a/config/locales/nl.yml +++ b/config/locales/nl.yml @@ -17,8 +17,8 @@ nl: project: Project contribute: Bijdragen ok: Ok - numbered_step: Stap %{number} website: Website + numbered_step: Stap %{number} context: Context sort: by_task_count_title: Sorteer op aantal acties @@ -30,8 +30,8 @@ nl: by_task_count: Bij aantal acties create: Maken description: Beschrijving - contexts: Contexten errors_with_fields: Er waren problemen met de volgende velden + contexts: Contexten drag_handle: SLEEP update: Bijwerken bugs: Fouten @@ -39,29 +39,6 @@ nl: ajaxError: Er is een fout opgetreden bij het ophalen van gegevens van de server email: E-mail search: Zoeken - number: - format: - separator: "," - delimiter: . - human: - storage_units: - format: "%n %u" - units: - kb: KB - tb: TB - gb: GB - byte: - one: Byte - other: Bytes - mb: MB - currency: - format: - format: "%u %n" - unit: !binary | - 4oKs - - separator: "," - delimiter: . layouts: toggle_notes: Toggle notities next_actions_rss_feed: RSS-feed van de acties @@ -100,12 +77,35 @@ nl: view: Bekijk completed_tasks_title: Afgerond export: Export - contexts_title: Contexten home: Start + contexts_title: Contexten projects_title: Projecten preferences_title: Toon mijn voorkeuren calendar: Agenda search: Zoeken in alle items + number: + format: + separator: "," + delimiter: . + human: + storage_units: + format: "%n %u" + units: + kb: KB + tb: TB + gb: GB + byte: + one: Byte + other: Bytes + mb: MB + currency: + format: + format: "%u %n" + unit: !binary | + 4oKs + + separator: "," + delimiter: . integrations: opensearch_description: Zoek in Tracks gmail_description: Gadget om Tracks toe te voegen aan Gmail als een gadget @@ -140,7 +140,7 @@ nl: description: Beschrijving todo: show_from: Tonen vanaf - predecessors: Is afhankelijk van + predecessors: Afhankelijkheden notes: Notities project: Project context: Context @@ -155,15 +155,15 @@ nl: show_hidden_contexts_in_sidebar: Toon verborgen contexten in sidebar mobile_todos_per_page: Acties per pagina (mobiel) staleness_starts: Begin van markeren openstaande actie - sms_context: Standaard context voor email verbose_action_descriptors: Context en project uitschrijven in actielijst + sms_context: Standaard context voor email title_date_format: Datum formaat in titel show_number_completed: Aantal te tonen afgeronde acties refresh: Ververs interval (in minuten) week_starts: Week start op time_zone: Tijdzone - due_style: Deadline stijl locale: Taal + due_style: Deadline stijl show_project_on_todo_done: Ga naar project pagina wanneer actie gereed is sms_email: Van email show_completed_projects_in_sidebar: Toon afgeronde projecten in sidebar @@ -177,8 +177,8 @@ nl: exclusion: is gereserveerd invalid: mag niet een komma (',') karakter bevatten odd: moet oneven zijn - empty: mag niet leeg zijn wrong_length: heeft de verkeerde lengte (moet %{count} karakters lang zijn) + empty: mag niet leeg zijn even: moet even zijn too_short: is te kort (minimum is %{count} karakters) less_than: moet kleiner zijn dan %{count} @@ -217,18 +217,18 @@ nl: top10_longrunning: Top 10 langstlopende projecten actions_dow_30days_title: Dag van de week (laatste 30 dagen) current_running_time_of_incomplete_visible_actions: Huidige looptijd van onvolledige zichtbare acties - running_time_legend: - actions: Acties - percentage: Percentage - weeks: Looptijd van een actie (weken). Klik op een balk voor meer info legend: - number_of_days: Aantal dagen geleden actions: Acties + number_of_days: Aantal dagen geleden number_of_actions: Aantal acties day_of_week: Dag van de week running_time: Looptijd van een actie (weken) percentage: Percentage months_ago: Maanden geleden + running_time_legend: + actions: Acties + percentage: Percentage + weeks: Looptijd van een actie (weken). Klik op een balk voor meer info totals_action_count: u heeft een totaal van %{count} acties totals_unique_tags: Van deze tags zijn %{count} uniek. actions_avg_completed_30days: en voltooide een gemiddelde van %{count} acties per dag. @@ -244,8 +244,8 @@ nl: totals_project_count: U heeft %{count} projecten. actions_min_max_completion_days: De max-/minimum dagen tot voltooiing is %{min}/%{max}. actions_min_completion_time: De minimale tijd tot afronding is %{time}. - no_tags_available: geen tags beschikbaar tags: Tags + no_tags_available: geen tags beschikbaar actions_day_of_week_title: Dag van de week (alle acties) more_stats_will_appear: Meer statistieken zullen hier verschijnen zodra u acties hebt toegevoegd. top5_visible_contexts_with_incomplete_actions: Top 5 zichtbare contexten met onvolledige acties @@ -305,7 +305,7 @@ nl: defer_date_after_due_date: Uitsteldatum is na de vervaldag. Gelieve vervaldag bewerken alvorens uitstedatuml aan te passen. unable_to_add_dependency: Niet in staat om de afhankelijkheid toe te voegen done: Voltooid? - star_action_with_description: markeer de actie'%{description}' met een ster + star_action_with_description: markeer de actie '%{description}' met een ster tagged_with: gelabeld met ‘%{tag_name}’ completed: Afgerond no_deferred_actions_with: Geen uitgestelde acties met de tag '%{tag_name}' @@ -318,10 +318,11 @@ nl: action_deleted_success: Actie succesvol verwijderd tags: Tags (gescheiden door komma's) new_related_todo_created: Een nieuwe actie is toegevoegd, die behoort bij deze terugkerende todo - context_changed: Context veranderd in %{name} + context_changed: Context veranderd in '%{name}' mobile_todos_page_title: Alle acties + add_another_dependency: Nog een afhankelijkheid toevoegen delete_recurring_action_title: Verwijder de terugkerende actie - removed_predecessor: "%{succesor} is verwijderd als afhankelijkheid van %{predecessor}." + removed_predecessor: "'%{successor}' is verwijderd als afhankelijkheid van '%{predecessor}'." recurring_actions_title: TRACKS::Terugkerende acties next_action_needed: U dient ten minste een actie in te vullen action_saved: Actie opgeslagen @@ -331,7 +332,7 @@ nl: added_new_context: Nieuwe context toegevoegd next_actions_description: "Filter:" list_incomplete_next_actions_with_limit: Toont de laatste %{count} onvoltooide acties - set_to_pending: "%{task} als wachtend ingesteld" + set_to_pending: "'%{task}' als wachtend ingesteld" added_new_project: Nieuw project toegevoegd next_actions_title_additions: completed: acties voltooid @@ -479,6 +480,14 @@ nl: delete_note_confirm: Weet u zeker dat u de notitie '%{id}' wilt verwijderen? errors: user_unauthorized: "401 Unauthorized: Alleen administratieve gebruikers mogen deze functie gebruiken." + time: + am: ochtend + formats: + default: "%A, %d %B %Y %H:%M:%S %z" + time: "%H:%M" + short: "%d %B %H:%M" + long: "%A, %d. %B %Y, %H:%M" + pm: middag states: hidden_plural: Verborgen completed: Afgerond @@ -488,14 +497,6 @@ nl: visible: Zichtbaar active: Actief hidden: Verborgen - time: - am: ochtend - formats: - default: "%A, %d %B %Y %H:%M:%S %z" - time: "%H:%M" - short: "%d %B %H:%M" - long: "%A, %d. %B %Y, %H:%M" - pm: middag preferences: change_identity_url: Verander uw Identity URL open_id_url: Uw OpenID URL is @@ -526,8 +527,8 @@ nl: deferred_actions_empty: Er zijn geen uitgestelde acties voor dit project project_state: Project is %{state}. show_form_title: Maak een nieuw project - notes: Notities todos_append: in dit project + notes: Notities notes_empty: Er zijn geen notities voor dit project no_projects: Momenteel zijn er geen projecten hide_form_title: Verberg nieuw project formulier @@ -549,8 +550,8 @@ nl: completed_actions: Afgeronde acties voor dit project default_context: De standaard context voor dit project is %{context} status_project_name_changed: Naam van het project werd gewijzigd - no_default_context: Dit project heeft geen standaard context active_projects: Actieve projecten + no_default_context: Dit project heeft geen standaard context state: Dit project is %{state} date: month_names: @@ -673,8 +674,8 @@ nl: user_created: Gebruiker aangemaakt. change_password_submit: Wachtwoord wijzigen account_signup: Aanmelden voor een account - manage_users: Beheren gebruikers password_updated: Wachtwoord bijgewerkt. + manage_users: Beheren gebruikers signup: Aanmelden confirm_password: Bevestig wachtwoord new_user_heading: "Registreer een nieuwe gebruiker:" @@ -797,8 +798,8 @@ nl: half_a_minute: halve minuut login: user_no_expiry: Blijf ingelogd - sign_in: Meld aan login_cas: Ga naar het CAS + sign_in: Meld aan openid_identity_url_not_found: Sorry, geen gebruiker met die identiteit URL bestaat (% {identity_url}) successful_with_session_info: "Login succesvol:" please_login: Log in om Tracks te gebruiken diff --git a/public/images/icon_delete.png b/public/images/icon_delete.png new file mode 100644 index 00000000..4d66447d Binary files /dev/null and b/public/images/icon_delete.png differ diff --git a/public/javascripts/application.js b/public/javascripts/application.js index ee38999d..66751c12 100644 --- a/public/javascripts/application.js +++ b/public/javascripts/application.js @@ -87,21 +87,37 @@ var TracksForm = { submit_with_ajax_and_block_element('form#todo-form-multi-new-action', $(this)); return false; }); + }, + enable_dependency_delete: function() { + $('a[class=icon_delete_dep]').live('click', function() { + predecessor_list = $('input[name=predecessor_list]'); + id_list = split( predecessor_list.val() ); - $('input[class=predecessor_add_button]').live('click', function(){ - var text = $('input[name=predecessor_list]').val(); - if (text.length > 0) { - $('ul#predecessor_ul').show(); - if (text.length > 35) { - text = text.substring(0,35)+"..."; + // remove from ul + $("li#pred_"+this.id).slideUp(500).remove(); + + // remove from array + new_list = new Array(); + while (id_list.length > 0) { + elem = id_list.pop(); + if (elem != this.id && elem != '' && elem != ' ') { + new_list.push ( elem ); } - var html = $('ul#predecessor_ul').html(); - var new_li = "
  • "+ text + "
  • "; - $('ul#predecessor_ul').html(html + new_li); - $('input[name=predecessor]').val(''); - $('input[name=predecessor]').focus(); } - }); + + // update id list + predecessor_list.val( new_list.join(", ") ); + + if (new_list.length == 0) { + $("label#label_for_predecessor_input").hide(); + $("ul#predecessor_ul").hide(); + } + + return false; // prevent submit/follow link + }) + }, + generate_dependency_list: function(item) { + alert("nyi"); } } @@ -184,8 +200,8 @@ var TracksPages = { /* fade flashes and alerts in automatically */ $(".alert").fadeOut(8000); - /* for edit project form and edit todo form -* TODO: refactor to separate calls from project and todo */ + // for edit project form and edit todo form + // TODO: refactor to separate calls from project and todo $('.edit-form a.negative').live('click', function(){ $(this).parents('.edit-form').fadeOut(200, function () { $(this).parents('.list').find('.project').fadeIn(500); @@ -301,6 +317,12 @@ var TodoItems = { } return confirm(i18n['contexts.new_context_pre'] + givenContextName + i18n['contexts.new_context_post']); }, + generate_predecessor: function(todo_id, todo_spec) { + var img = ""; + var anchor = "" + img + ""; + var li = "
  • "+ anchor +" "+ todo_spec + "
  • "; + return li; + }, setup_behavior: function() { /* show the notes of a todo */ $(".show_notes").live('click', function () { @@ -328,6 +350,7 @@ var TodoItems = { /* set behavior for edit icon */ $(".item-container a.edit_item").live('click', function (ev){ get_with_ajax_and_block_element(this.href, $(this).parents(".item-container")); + TracksForm.generate_dependency_list($(this).parents(".item-container")); return false; }); @@ -363,6 +386,8 @@ var TodoItems = { $.ajax(ajax_options); return false; }); + + TracksForm.enable_dependency_delete(); } } @@ -750,6 +775,13 @@ function setup_auto_refresh(interval){ }); } +function split( val ) { + return val.split( /,\s*/ ); +} +function extractLast( term ) { + return split( term ).pop(); +} + $.fn.clearForm = function() { return this.each(function() { var type = this.type, tag = this.tagName.toLowerCase(); @@ -766,6 +798,7 @@ $.fn.clearForm = function() { $.fn.clearDeps = function() { $('ul#predecessor_ul', this).hide(); + $("label#label_for_predecessor_input").hide(); $('ul#predecessor_ul', this).html(""); $('input[name=predecessor_list]').val(""); } @@ -979,16 +1012,7 @@ function enable_rich_interaction(){ selectFirst: true }); - - function split( val ) { - return val.split( /,\s*/ ); - } - function extractLast( term ) { - return split( term ).pop(); - } - - - $('input[name=predecessor_list]:not(.ac_input)') + $('input[name=predecessor_input]:not(.ac_input)') .bind( "keydown", function( event ) { // don't navigate away from the field on tab when selecting an item if ( event.keyCode === $.ui.keyCode.TAB && $( this ).data( "autocomplete" ).menu.active ) { @@ -1021,14 +1045,16 @@ function enable_rich_interaction(){ // show the html for the list of deps $('ul#predecessor_ul').show(); + $("label#label_for_predecessor_input").show(); if (todo_spec.length > 35) { // cut off string - todo_spec = todo_spec.substring(0,35)+"..."; + todo_spec = todo_spec.substring(0,40)+"..."; } // show the new dep in list var html = $('ul#predecessor_ul').html(); - var new_li = "
  • "+ todo_spec + "
  • "; + var new_li = TodoItems.generate_predecessor(todo_id, todo_spec); $('ul#predecessor_ul').html(html + new_li); $('li#pred_'+todo_id).slideDown(500); + TracksForm.enable_dependency_delete(); $('input[name=predecessor_input]').val(''); $('input[name=predecessor_input]').focus(); @@ -1036,26 +1062,6 @@ function enable_rich_interaction(){ } }); - $('input[class=pred_remove_button]').live('click', function() { - predecessor_list = $('input[name=predecessor_list]'); - id_list = split( predecessor_list.val() ); - $("li#pred_"+this.id).slideUp(500).remove(); // remove from ul - - // remove from array - new_list = new Array(); - while (id_list.length > 0) { - elem = id_list.pop(); - if (elem != this.id && elem != '' && elem != ' ') { - new_list.push ( elem ); - } - } - - // update id list - predecessor_list.val( new_list.join(", ") ); - - return false; // prevent submit - }) - /* have to bind on keypress because of limitations of live() */ $('input[name=project_name]').live('keypress', function(){ $(this).bind('blur', project_defaults); diff --git a/public/stylesheets/standard.css b/public/stylesheets/standard.css index 6508504f..6b7b9abf 100644 --- a/public/stylesheets/standard.css +++ b/public/stylesheets/standard.css @@ -2,7 +2,7 @@ /* @override http://0.0.0.0:3000/stylesheets/standard.css?1180885851 */ -body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,form,fieldset,input,textarea,p,blockquote,th,td { +div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,form,fieldset,input,textarea,p,blockquote,th,td { margin:0; padding:0; } @@ -352,10 +352,6 @@ div#input_box { float:left; } -.predecessor_add_button_box { - float:right; -} - #input_box input.pred_remove_button { width:1.3em; } @@ -364,6 +360,21 @@ div#input_box { clear:right; } +ul.predecessor_list { + color: #999; + font-size: 0.8em; + padding: 0 0 5pt 0; +} + +ul.predecessor_list li { + padding: 0 0; +} + +img.icon_delete_dep {width: 10px; background-image: url(../images/icon_delete.png); background-repeat: no-repeat; background-position: -9px 0; border: none; color:black;} +a:hover img.icon_delete_dep {width: 10px; background-image: url(../images/icon_delete.png); background-repeat: no-repeat; background-position: 0 0; border: none; color:black; background-color: black;} +a.icon_delete_dep:hover {width: 10px; background-color: black;} +a.delete_dependency_button:hover {background-color: white;} + .box { float: left; width: 20px;