Fix choose contact

This commit is contained in:
Emilio Blanco 2011-03-31 17:59:22 -03:00
parent d1e57475ce
commit a2bad3c81d
10 changed files with 105 additions and 100 deletions

View file

@ -272,7 +272,7 @@ class WebmailController < ApplicationController
@filter.expressions << Expression.new
@expressions = @filter.expressions
@destfolders = get_to_folders
render_action("filter")
render "filter"
end
# end of filters
@ -314,8 +314,8 @@ class WebmailController < ApplicationController
protected
def additional_scripts()
'<link rel="stylesheet" href="/stylesheets/webmail/webmail.css" type="text/css" media="screen" />'<<
'<script type="text/javascript" src="/javascripts/webmail.js"></script>'
@additional_css = ["webmail/webmail"]
@additional_js = ["webmail"]
end
private

View file

@ -25,11 +25,11 @@ module NavigationHelper
def link_import_preview() "/contacts/import_preview" end
def link_main_index() root_url end
def link_contact_import() "/contacts/import" end
def link_contact_choose() "/contacts/contact/choose" end
def link_contact_import() url_for(:controller => :contacts, :action => :import) end
def link_contact_choose() url_for(:controller => :contacts, :action => :choose) end
def link_contact_list
link_to(_('List'), :controller => "/contacts/contact", :action => "list")
link_to(t(:list), :controller => :contacts, :action => :index)
end
def link_contact_add_one
@ -37,11 +37,11 @@ module NavigationHelper
end
def link_contact_add_multiple
link_to(t(:add_multiple), :controller => "/contacts/contact", :action => "add_multiple")
link_to(t(:add_multiple), :controller => :contacts, :action => "add_multiple")
end
def link_contact_group_list
link_to(_('Groups'), :controller => "/contacts/contact_group", :action => "list")
link_to(t(:groups), :controller => :contact_group, :action => :index)
end
def link_folders

View file

@ -1,4 +1,5 @@
<h1><%= t :contacts %></h1>
<% unless @mode == "choose" %>
<div id="header">
<ul id="primary">
<li><%=link_folders%></li>
@ -6,25 +7,25 @@
<li><%=link_mail_prefs%></li>
<li><%=link_mail_filters%></li>
<li><span><%= t :contacts %></span>
<ul id="secondary">
<li><%=link_contact_add_one%></li>
<li><%=link_to t(:add_multiple), add_multiple_contacts_path %></li>
<% if ret = session["return_to"] %>
<li><%=link_to(t(:back_to_message), ret) %></li>
<% end %>
</ul>
<ul id="secondary">
<li><%=link_contact_add_one%></li>
<li><%=link_to t(:add_multiple), add_multiple_contacts_path %></li>
<% if ret = session["return_to"] %>
<li><%=link_to(t(:back_to_message), ret) %></li>
<% end %>
</ul>
</li>
</ul>
</div>
<% end -%>
<div id="tab_main">
<div id="tab_content">
<% if flash["alert"] %><ul><li><%= flash["alert"] %></li></ul><% end %>
<% if flash["alert"] %><ul><li><%= flash["alert"] %></li></ul><% end %>
<form action="<%=link_contact_choose%>?mode=<%=@mode%>" method="post">
<input type="hidden" name="mode" value="<%=@mode%>"/>
<% if @group_id and not @group_id.nil? %>
<input type="hidden" name="group_id" value="<%=@group_id%>"/>
<input type="hidden" name="group_id" value="<%=@group_id%>"/>
<% end %>
<table class="list">
<tr>
@ -40,75 +41,75 @@
<td colspan="3"><%= will_paginate @contacts %></td>
</tr>
<% if @mode == "choose" %>
<tr>
<th><%= "#{t :to}&nbsp;#{t :cc}&nbsp;#{t :bcc}" %></th>
<th><%= t :name %></th>
<th><%= t :email %></th>
</tr>
<% for contact in @contacts %>
<tr class="<%= alternator %>">
<td><input type="checkbox" name="contacts_to[<%=contact.id%>]" value="1"/>
<input type="checkbox" name="contacts_cc[<%=contact.id%>]" value="1"/>
<input type="checkbox" name="contacts_bcc[<%=contact.id%>]" value="1"/></td>
<td><%=contact.full_name%></td>
<td><%=contact.email%></td>
</tr>
<% end %>
<tr class="rowsep"><td colspan="3"><%=_('Groups')%>:</td></tr>
<% for group in @contactgroups %>
<tr class="<%= alternator %>">
<td><input type="checkbox" name="groups_to[<%=group.id%>]" value="1"/>
<input type="checkbox" name="groups_cc[<%=group.id%>]" value="1"/>
<input type="checkbox" name="groups_bcc[<%=group.id%>]" value="1"/></td>
<td><%=group.name%></td>
<td>&nbsp;</td>
</tr>
<% end %>
<tr>
<td colspan=3 class="buttonBar">
<input type="submit" value="<%= _('choose')%>">
<input type="button" value="<%= _('cancel')%>" onclick="javascript:window.close();">
</td>
</tr>
<% elsif @mode == "groups"%>
<tr>
<th></th>
<th width="200px"><%= t(:name)%></th>
<th><%= t(:email)%></th>
</tr>
<% for contact in @contacts %>
<input type="hidden" id="contacts_for_group[<%=contact.id%>]" name="contacts_for_group[<%=contact.id%>]" value="<%=@contacts_for_group[contact.id]%>" >
<tr class="<%= alternator %>">
<td><input type="checkbox" id="contacts_for_group[<%=contact.id%>]" name="contacts_for_group[<%=contact.id%>]"
value="<%=@contacts_for_group[contact.id]%>" onclick="toggleCheckbox(this)"
<%=@contacts_for_group[contact.id] == 1 ? " checked " : " " %> ></td>
<td><%=contact.full_name%></td>
<td><%=contact.email%></td>
</tr>
<% end %>
<tr>
<td colspan=2 class="buttonBar">
<input type="submit" value="<%= _('Save')%>">
<input type="button" value="<%= _('Back to groups')%>" onclick="window.location='<%=link_contact_group_list%>'">
</td>
</tr>
<tr>
<th><%= "#{t :to}&nbsp;#{t :cc}&nbsp;#{t :bcc}" %></th>
<th><%= t :name %></th>
<th><%= t :email %></th>
</tr>
<% for contact in @contacts %>
<tr class="<%= alternator %>">
<td><input type="checkbox" name="contacts_to[<%=contact.id%>]" value="1"/>
<input type="checkbox" name="contacts_cc[<%=contact.id%>]" value="1"/>
<input type="checkbox" name="contacts_bcc[<%=contact.id%>]" value="1"/></td>
<td><%=contact.full_name%></td>
<td><%=contact.email%></td>
</tr>
<% end %>
<tr class="rowsep"><td colspan="3"><%=t(:groups)%>:</td></tr>
<% for group in @contactgroups %>
<tr class="<%= alternator %>">
<td><input type="checkbox" name="groups_to[<%=group.id%>]" value="1"/>
<input type="checkbox" name="groups_cc[<%=group.id%>]" value="1"/>
<input type="checkbox" name="groups_bcc[<%=group.id%>]" value="1"/></td>
<td><%=group.name%></td>
<td>&nbsp;</td>
</tr>
<% end %>
<tr>
<td colspan=3 class="buttonBar">
<input type="submit" value="<%= t(:choose)%>">
<input type="button" value="<%= t(:cancel)%>" onclick="javascript:window.close();">
</td>
</tr>
<% elsif @mode == "groups"%>
<tr>
<th></th>
<th width="200px"><%= t(:name)%></th>
<th><%= t(:email)%></th>
</tr>
<% for contact in @contacts %>
<input type="hidden" id="contacts_for_group[<%=contact.id%>]" name="contacts_for_group[<%=contact.id%>]" value="<%=@contacts_for_group[contact.id]%>" >
<tr class="<%= alternator %>">
<td><input type="checkbox" id="contacts_for_group[<%=contact.id%>]" name="contacts_for_group[<%=contact.id%>]"
value="<%=@contacts_for_group[contact.id]%>" onclick="toggleCheckbox(this)"
<%=@contacts_for_group[contact.id] == 1 ? " checked " : " " %> ></td>
<td><%=contact.full_name%></td>
<td><%=contact.email%></td>
</tr>
<% end %>
<tr>
<td colspan=2 class="buttonBar">
<input type="submit" value="<%= t(:save)%>">
<input type="button" value="<%= t(:back_to_groups)%>" onclick="window.location='<%=link_contact_group_list%>'">
</td>
</tr>
<% else %>
<tr>
<th width="200px"><%= t(:name)%></th>
<th><%= t(:email)%></th>
<th>&nbsp;</th>
</tr>
<% for contact in @contacts %>
<tr class="<%= alternator %>">
<td><%= link_to(contact.full_name, :controller=>:contacts, :action => "edit", :id => contact.id ) %></td>
<td><%= link_to( contact.email, :controller => :webmail, :action => "compose", :params => { "mail[to]" => contact.email } ) %></td>
<td><%= link_to(t(:delete), {:controller=>:contacts, :action=>'delete', :id=>contact.id},
{:confirm=>t(:delete_contact_question, :name => contact.show_name, :email => contact.email)})%>
</td>
</tr>
<% end %>
<% end %>
</table>
</form>
</div>
</div>
<tr>
<th width="200px"><%= t(:name)%></th>
<th><%= t(:email)%></th>
<th>&nbsp;</th>
</tr>
<% for contact in @contacts %>
<tr class="<%= alternator %>">
<td><%= link_to(contact.full_name, :controller=>:contacts, :action => "edit", :id => contact.id ) %></td>
<td><%= link_to( contact.email, :controller => :webmail, :action => "compose", :params => { "mail[to]" => contact.email } ) %></td>
<td><%= link_to(t(:delete), {:controller=>:contacts, :action=>'delete', :id=>contact.id},
{:confirm=>t(:delete_contact_question, :name => contact.show_name, :email => contact.email)})%>
</td>
</tr>
<% end %>
<% end %>
</table>
</form>
</div>
</div>

View file

@ -4,9 +4,11 @@
<head>
<title><%= t :mailr %></title>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<%=stylesheet_link_tag "admin", "tabs", "mailr", "webmail" %>
<%=javascript_include_tag :defaults, "global", "webmail", [] %>
<%=(@content_for_scripts ? @content_for_scripts : @additional_scripts )%>
<% @additional_css ||= [] %>
<% @additional_js ||= [] %>
<%=stylesheet_link_tag "admin", "tabs", "mailr", @additional_css %>
<%=javascript_include_tag :defaults, "global", "webmail", @additional_js %>
<%#=(@content_for_scripts ? @content_for_scripts : @additional_scripts )%>
</head>
<body id="bodyID" onload="<%=@onload_function%>">
<div id="wholepage">

View file

@ -11,7 +11,7 @@
<ul id="secondary">
<li><%= link_compose_new %></li>
<li><a href='#' onclick="getFormField('composeMail').submit();"><%= t :send %></a></li>
<li><a href="#" onclick="chooseContacts();"><%= t :choose_address %></a></li>
<li><a href="#" onclick="chooseContacts('<%=url_for(:controller => :contacts, :action => :index) %>');"><%= t :choose_address %></a></li>
</ul>
</li>
<li><%=link_mail_prefs%></li>

View file

@ -27,7 +27,7 @@
<input type="hidden" name="page" value="<%=@page%>"/>
<a href='#' onclick='toggle_msg_operations(true);'>
<%=t :operations%><img id='img_msgops' alt='open' src='/images/list_<%=@ops_img_src%>.gif'/>
<%=t :operations%><img id='img_msgops' alt='open' src='../images/list_<%=@ops_img_src%>.gif'/>
</a>
<div id="msgops" class='<%=@ops_class%>'>

View file

@ -46,7 +46,9 @@ es-ES:
bcc: BCC
send: Enviar
choose_address: Elegir direcci&oacute;n desde contactos
choose: Elegir
compose_txt: Componer nuevo correo
groups: Grupos
attachment: Adjunto
add: Agregar
first_name: Nombre

View file

@ -1,5 +1,5 @@
function chooseContacts() {
rs('', '/contacts/contact/list?mode=choose',550,480,0);
function chooseContacts(url) {
rs('', url + '?mode=choose',550,480,0);
}
function setBulk() {

View file

Before

Width:  |  Height:  |  Size: 155 B

After

Width:  |  Height:  |  Size: 155 B

View file

@ -32,7 +32,7 @@
#folders { margin: 0 0 0 0; padding: 0; border: 1px solid #888; background: #fff; text-align: left; }
#folders ul { margin: 0; padding: 10px; }
#folders ul li { margin: 0; padding-left: 20px; list-style-type:none; font-size: 1em; background: url("/images/icon-folder-open.gif") top left no-repeat; }
#folders ul li { margin: 0; padding-left: 20px; list-style-type:none; font-size: 1em; background: url("icon-folder-open.gif") top left no-repeat; }
#folders h4 { margin: 0; padding: 5px; text-align: left; }
#messages { margin: 0 0 0 0; padding: 0; width: 100%; }