mirror of
https://github.com/TracksApp/tracks.git
synced 2026-02-07 00:11:47 +01:00
fix #1101. Most strings were pushed into html attributes. The remaining are generated from the layout into an array
This commit is contained in:
parent
e528af30a6
commit
f2760ed7de
21 changed files with 147 additions and 76 deletions
|
|
@ -129,30 +129,6 @@ module ApplicationHelper
|
|||
{:id => "link_edit_#{dom_id(note)}", :class => "note_edit_settings"})
|
||||
end
|
||||
|
||||
def link_to_delete_project(project, descriptor = sanitize(project.name))
|
||||
link_to(
|
||||
descriptor,
|
||||
project_path(project, :format => 'js'),
|
||||
{:id => "delete_project_#{project.id}", :class => "delete_project_button", :title => "#{t('projects.delete_project_title')} '#{project.name}'"}
|
||||
)
|
||||
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", :title => t('contexts.delete_context_confirmation', :name => context.name)}
|
||||
)
|
||||
end
|
||||
|
||||
def link_to_delete_note(note, descriptor = sanitize(note.id.to_s))
|
||||
link_to(
|
||||
descriptor,
|
||||
note_path(note, :format => 'js'),
|
||||
{:id => "delete_note_#{note.id}", :class => "delete_note_button", :title => "delete the note '#{note.id}'"}
|
||||
)
|
||||
end
|
||||
|
||||
def link_to_project_mobile(project, accesskey, descriptor = sanitize(project.name))
|
||||
link_to( descriptor, project_path(project, :format => 'm'), {:title => "View project: #{project.name}", :accesskey => accesskey} )
|
||||
end
|
||||
|
|
@ -263,4 +239,24 @@ module ApplicationHelper
|
|||
end
|
||||
end
|
||||
|
||||
def generate_i18n_strings
|
||||
js = ""
|
||||
js << "i18n = new Array();\n"
|
||||
%w{
|
||||
shared.toggle_multi shared.toggle_multi_title
|
||||
shared.hide_form shared.hide_action_form_title
|
||||
shared.toggle_single shared.toggle_single_title
|
||||
projects.hide_form projects.hide_form_title
|
||||
projects.show_form projects.show_form_title
|
||||
contexts.hide_form contexts.hide_form_title
|
||||
contexts.show_form contexts.show_form_title
|
||||
contexts.new_context_pre contexts.new_context_post
|
||||
common.cancel common.ok
|
||||
common.ajaxError
|
||||
}.each do |s|
|
||||
js << "i18n['#{s}'] = \"#{t(s)}\";\n"
|
||||
end
|
||||
return js
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
|||
|
|
@ -9,4 +9,17 @@ module ContextsHelper
|
|||
}
|
||||
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
|
||||
|
||||
end
|
||||
|
|
|
|||
|
|
@ -6,4 +6,14 @@ module NotesHelper
|
|||
def rendered_note(note)
|
||||
sanitize(textilize_without_paragraph(note.body))
|
||||
end
|
||||
|
||||
def link_to_delete_note(note, descriptor = sanitize(note.id.to_s))
|
||||
link_to(
|
||||
descriptor,
|
||||
note_path(note, :format => 'js'),
|
||||
{:id => "delete_note_#{note.id}", :class => "delete_note_button",
|
||||
:title => t('notes.delete_note_title', :id => note.id), :x_confirm_message => t('notes.delete_note_confirm', :id => note.id)}
|
||||
)
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
|||
|
|
@ -44,5 +44,18 @@ module ProjectsHelper
|
|||
end
|
||||
html
|
||||
end
|
||||
|
||||
def link_to_delete_project(project, descriptor = sanitize(project.name))
|
||||
link_to(
|
||||
descriptor,
|
||||
project_path(project, :format => 'js'),
|
||||
{
|
||||
:id => "delete_project_#{project.id}",
|
||||
:class => "delete_project_button",
|
||||
:x_confirm_message => t('projects.delete_project_confirmation', :name => project.name),
|
||||
:title => t('projects.delete_project_title')
|
||||
}
|
||||
)
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ module RecurringTodosHelper
|
|||
def recurring_todo_remote_delete_icon
|
||||
link_to( image_tag_for_delete,
|
||||
recurring_todo_path(@recurring_todo), :id => "delete_icon_"+@recurring_todo.id.to_s,
|
||||
:class => "icon delete_icon", :title => t('todos.delete_recurring_action', :description => @recurring_todo.description))
|
||||
:class => "icon delete_icon", :title => t('todos.delete_recurring_action_title'), :x_confirm_message => t('todos.delete_recurring_action_confirm', :description => @recurring_todo.description))
|
||||
end
|
||||
|
||||
def recurring_todo_remote_star_icon
|
||||
|
|
|
|||
|
|
@ -20,7 +20,8 @@ module TodosHelper
|
|||
{:controller => 'todos', :action => 'destroy', :id => todo.id},
|
||||
:class => "icon_delete_item",
|
||||
:id => "delete_#{dom_id(todo)}",
|
||||
:title => t('todos.confirm_delete', :description => todo.description));
|
||||
:x_confirm_message => t('todos.confirm_delete', :description => todo.description),
|
||||
:title => t('todos.delete_action'));
|
||||
end
|
||||
|
||||
def remote_defer_menu_item(days, todo)
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
<div id="context_new_container">
|
||||
|
||||
<div id="toggle_context_new" class="hide_form">
|
||||
<a title="<%= t('contexts.hide_form_link_title') %>" accesskey="n">« <%= t('contexts.hide_form') %></a>
|
||||
<div id="toggle_context_link" class="hide_form">
|
||||
<a id="toggle_context_new" href="#" title="<%= t('contexts.hide_form_title') %>" accesskey="n"><%= t('contexts.hide_form') %></a>
|
||||
</div>
|
||||
|
||||
<div id="context_new" class="context_new" style="display:block">
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@
|
|||
setup_periodic_check("<%=url_for(:controller => "login", :action => "check_expiry")%>", 5*60);
|
||||
<% end -%>
|
||||
setup_periodic_check("<%=check_deferred_todos_path(:format => 'js')%>", 10*60, 'POST');
|
||||
<%= generate_i18n_strings %>
|
||||
</script>
|
||||
<link rel="shortcut icon" href="<%= url_for(:controller => 'favicon.ico') %>" />
|
||||
<%= auto_discovery_link_tag(:rss, {:controller => "todos", :action => "index", :format => 'rss', :token => "#{current_user.token}"}, {:title => t('layouts.next_actions_rss_feed')}) %>
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
<div id="project_new_project_container">
|
||||
|
||||
<div id="toggle_project_link" class="hide_form">
|
||||
<a id="toggle_project_new" href="#" title="<%= t('projects.hide_new_project_form') %>" accesskey="n">« <%= t('projects.hide_form') %></a>
|
||||
<a id="toggle_project_new" href="#" title="<%= t('projects.hide_form_title') %>" accesskey="n">« <%= t('projects.hide_form') %></a>
|
||||
</div>
|
||||
|
||||
<div id="project_new" class="project_new" style="display:block">
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ suppress_edit_button ||= false
|
|||
|
||||
<div class="buttons">
|
||||
<span class="grey"><%= project.current_state.to_s.upcase %></span>
|
||||
<%= link_to_delete_project(project, image_tag( "blank.png", :title => t('projects.delete_project'), :class=>"delete_item")) %>
|
||||
<%= 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")) %>
|
||||
</div>
|
||||
|
||||
|
|
|
|||
|
|
@ -3,10 +3,10 @@
|
|||
<div class="menu_sort"><span class="sort_separator"><%= t('common.sort.sort') %> </span>
|
||||
<div class="alpha_sort">
|
||||
<%= link_to("Alphabetically", alphabetize_projects_path(:state => state),
|
||||
:id => "#{state}_alphabetize_link", :class => "alphabetize_link", :title => t('common.sort.alphabetically_title')) %>
|
||||
:id => "#{state}_alphabetize_link", :class => "alphabetize_link", :title => t('common.sort.alphabetically_title'), :x_confirm_message => t('common.sort.alphabetically_confirm')) %>
|
||||
</div><span class="sort_separator"> | </span><div class="tasks_sort">
|
||||
<%= link_to("By number of tasks", actionize_projects_path(:state => state),
|
||||
:id => "#{state}_actionize_link", :class => "actionize_link", :title => t('common.sort.by_task_count_title')) %>
|
||||
:id => "#{state}_actionize_link", :class => "actionize_link", :title => t('common.sort.by_task_count_title'), :x_confirm_message => t('common.sort.by_task_count_title_confirm')) %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
<div id="todo_new_action_container">
|
||||
|
||||
<div id="toggle_forms" class="toggle_forms">
|
||||
<a title="<%= t('shared.hide_action_form_title') %>" accesskey="n" href="#" id="toggle_action_new">« <%= t('shared.hide_form') %></a>
|
||||
<a title="<%= t('shared.hide_action_form_title') %>" accesskey="n" href="#" id="toggle_action_new"><%= t('shared.hide_form') %></a> |
|
||||
<a title="<%= t('shared.toggle_multi_title') %>" accesskey="m" href="#" id="toggle_multi"><%= t('shared.toggle_multi') %></a>
|
||||
</div>
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue