view cleanup

master
Wojciech Todryk 2012-03-24 18:09:31 +01:00
parent 0daf487816
commit 0872730d8d
40 changed files with 195 additions and 452 deletions

View File

@ -1,3 +1,5 @@
**NOTE** The last stable version is 0.8.6. Now I try to moved code to Rails 3.2.2 and add Boostrap from Tweeter as default theme. Not all sources that you can find in _MASTER_ branch were already moved, so some views can be broken.
## Introduction
_MailR_ is a IMAP mail client based on _Ruby on Rails_ platform.

View File

@ -31,3 +31,21 @@ table.header
text-align: right
font-weight: bold
padding-right: 10px
p.help-block
font-size: 10px
.custom_pagination
text-align: right
em.current
font-weight: bold
font-size: 16px
table.records
font-size: 12px
td
padding: 4px
iframe
width: 700px
height: 800px

View File

@ -90,12 +90,6 @@ class ApplicationController < ActionController::Base
##################################### private section ##########################################
private
def plugins_configuration
WillPaginate::ViewHelpers.pagination_options[:previous_label] = t(:previous_page,:scope=>:common)
WillPaginate::ViewHelpers.pagination_options[:next_label] = t(:next_page,:scope=>:common)
end
end

View File

@ -80,7 +80,7 @@ class UserController < ApplicationController
#@server.user_id = @user.id
#@server.save
Prefs.create_default(@user)
Server.create_defaults(@user)
Server.create_server(@user,@server.name)
flash[:success] = t(:setup_done,:scope=>:user)
redirect_to :action => 'login'
else

View File

@ -1,19 +1,25 @@
module FolderHelper
def folder_link(folder)
def folder_link(options={})
folder = options[:folder]
active = ""
if options[:active]
active = "icon-white"
end
folder.parent.empty? ? name = folder.name : name = folder.parent.gsub(/\./,'#') + "#" + folder.name
if folder.isInbox?
name_shown = t(:inbox_name,:scope => :folder)
name_shown = "<i class=\"icon-inbox #{active}\"></i>" + t(:inbox_name,:scope => :folder)
elsif folder.isSent?
name_shown = t(:sent_name,:scope => :folder)
name_shown = "<i class=\"icon-plane #{active}\"></i>" + t(:sent_name,:scope => :folder)
elsif folder.isDrafts?
name_shown = t(:drafts_name,:scope => :folder)
name_shown = "<i class=\"icon-book #{active}\"></i>" + t(:drafts_name,:scope => :folder)
elsif folder.isTrash?
name_shown = t(:trash_name,:scope => :folder)
name_shown = "<i class=\"icon-trash #{active}\"></i>" +t(:trash_name,:scope => :folder)
else
name_shown = folder.name.capitalize
name_shown = "<i class=\"icon-none\"></i>" + folder.name.capitalize
end
if folder.isTrash?

View File

@ -98,6 +98,9 @@ module MessagesHelper
html << link_to(Message.human_attribute_name(f), {:controller => 'messages',:action => 'index',:sort_field => f,:sort_dir => dir}, {:class=>"header"})
html << "</th>"
end
if @current_folder == @drafts_folder
html << "<th>&nbsp;</th>"
end
html
end

View File

@ -12,9 +12,13 @@ class Server < ActiveRecord::Base
where(:for_smtp=>true).first
end
def self.create_defaults(user)
def self.create_default(user)
create_server(user,"localhost")
end
def self.create_server(user,server)
create( :user_id=>user.id,
:name=>"localhost",
:name=>server,
:port=>$defaults['imap_port'],
:use_ssl=>false,
:use_tls=>false,
@ -22,7 +26,7 @@ class Server < ActiveRecord::Base
:for_imap=>true
)
create( :user_id=>user.id,
:name=>"localhost",
:name=>server,
:port=>$defaults['smtp_port'],
:use_ssl=>false,
:use_tls=>false,

View File

@ -1,6 +0,0 @@
- size ||= "btn-small"
- type ||= "btn-primary"
%button{:class=>"btn #{size} #{type}",:type=>"submit",:onclick=>"window.location='#{url}'"}
%i{:class=>"#{icon}"}
= t(text.to_sym, :scope => scope.to_sym)

View File

@ -1,4 +0,0 @@
.control-group
.controls
%button{:class=>"btn btn-primary",:type=>"submit"}
= text

View File

@ -1,6 +0,0 @@
- size ||= "btn-small"
- type ||= "btn-primary"
%button{:class=>"btn #{size} #{type}",:type=>"submit", :name=>"#{name}"}
%i{:class=>"#{icon_class}"}
= text

View File

@ -10,7 +10,7 @@
- @folders_shown.each do |folder|
- if folder == @current_folder
%li{:class=>"active"}
= folder_link(folder)
= folder_link(:folder=>folder,:active=>true)
- else
%li
= folder_link(folder)
= folder_link(:folder=>folder,:active=>false)

View File

@ -1,4 +0,0 @@
<p class="version">
<%= link_to (t(:version,:scope=>:common) + " " + $defaults["version"]),about_path %>
</p>

View File

@ -1,33 +0,0 @@
<% content_for :title do %>
- <%= t(:about,:scope=>:internal) %>
<% end %>
<% content_for :sidebar do %>
<%= content_for_sidebar %>
<% end %>
<div class="block">
<div class="navigation-tabs clearfix">
<%= raw single_navigation(:about,:internal) %>
</div>
<div class="content">
<h4>
<%= t(:current_version,:scope=>:internal) + ": " + $defaults["version"] %>
</h4>
<div class="md">
<%= raw BlueCloth::new(render :file => 'README.markdown').to_html %>
</div>
<div class="md">
<%= raw BlueCloth::new(render :file => 'CHANGES').to_html %>
</div>
<div class="md">
<%= raw BlueCloth::new(render :file => 'TODO').to_html %>
</div>
</div>

View File

@ -0,0 +1,52 @@
= content_for :sidebar do
= render :partial => "sidebar/sidebar"
= content_for :title do
= t(:about,:scope=>:internal)
= render :partial => 'common/main_navigation', :locals => { :about => :active }
.well{:style=>"padding: 5px 3pt;"}
%h3
= t(:current_version,:scope=>:internal) + ": " + $defaults["version"]
.well
= raw BlueCloth::new(render :file => 'README.markdown').to_html
.well
= raw BlueCloth::new(render :file => 'CHANGES.markdown').to_html
.well
= raw BlueCloth::new(render :file => 'TODO.markdown').to_html
-#
<% content_for :title do %>
- <%= t(:about,:scope=>:internal) %>
<% end %>
<% content_for :sidebar do %>
<%= content_for_sidebar %>
<% end %>
<div class="block">
<div class="navigation-tabs clearfix">
<%= raw single_navigation(:about,:internal) %>
</div>
<div class="content">
<h4>
<%= t(:current_version,:scope=>:internal) + ": " + $defaults["version"] %>
</h4>
<div class="md">
<%= raw BlueCloth::new(render :file => 'README.markdown').to_html %>
</div>
<div class="md">
<%= raw BlueCloth::new(render :file => 'CHANGES').to_html %>
</div>
<div class="md">
<%= raw BlueCloth::new(render :file => 'TODO').to_html %>
</div>
</div>

View File

@ -1,36 +0,0 @@
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>
<%= t(:mailr,:scope=>:common) %>
<%= yield :title %>
</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<%=stylesheet_link_tag current_theme_stylesheet_path('olive') %>
<%=stylesheet_link_tag current_theme_stylesheet_path('calendar_olive') %>
<%=stylesheet_link_tag current_theme_stylesheet_path('jquery-ui-dialog') %>
<%=stylesheet_link_tag current_theme_stylesheet_path('jquery-ui-custom') %>
<%=javascript_include_tag current_theme_javascript_path('jquery') %>
<%=javascript_include_tag current_theme_javascript_path('jquery-ui') %>
<%=javascript_include_tag current_theme_javascript_path('rails') %>
<%=javascript_include_tag current_theme_javascript_path('application') %>
<link rel="icon" type="image/x-icon" href="/favicon.ico"/>
</head>
<body>
<div id="container">
<div id="sidebar">
<%= yield :sidebar %>
</div>
<div id="main">
<%= render :partial=>'layouts/flash', :object => flash %>
<%= calendar_window(:title=>t(:calendar,:scope=>:common)) %>
<%= yield %>
</div>
</div>
</body>
</html>

View File

@ -1,19 +0,0 @@
<td>
<%= link_to attachment.filename_charseted, attachment_download_path(attachment.parent_id,attachment.idx) %>
</td>
<td>
<%= attachment.main_type %>/<%= attachment.sub_type %>
</td>
<td>
<%= attachment.charset %>
</td>
<td>
<%= attachment.content_transfer_encoding %>
</td>
<td>
<%= size_formatter(attachment.getSize) %>
</td>
<td>
<%= link_to image_tag(current_theme_image_path('download.png')), attachment_download_path(attachment.parent_id,attachment.idx) %>
</td>

View File

@ -1,13 +0,0 @@
<div class="attachments">
<span class="title"><%= t(:attachments,:scope=>:message) %></span>
<table class="table">
<% trclass = :even %>
<% for idx in 0..@attachments.size-1 %>
<tr class="<%= trclass.to_s %>">
<%= render :partial => 'attachment', :object => @attachments[idx] %>
</tr>
<% trclass == :even ? trclass = :odd : trclass = :even %>
<% end %>
</table>
</div>

View File

@ -1,4 +0,0 @@
<td><%= check_box_tag "files[]", file_attach[:name] %></td>
<td><%= file_attach[:name] %></td>
<td><%= size_formatter(file_attach[:size]) %></td>
<td class="last">&nbsp;</td>

View File

@ -1,16 +0,0 @@
<div class="attachments">
<span class="title"><%= t(:attachments,:scope=>:message) %></span>
<% if not @attachments.size.zero? %>
<% trclass = :even %>
<table class="table">
<% @attachments.each do |a| %>
<tr class="<%= trclass.to_s %>">
<%= render :partial => 'messages/file_attach', :object => a %>
</tr>
<% trclass == :even ? trclass = :odd : trclass = :even %>
<% end %>
</table>
<%= raw single_action('delete_marked','compose','minus.png') %>
<% end %>
</div>

View File

@ -1,9 +0,0 @@
<div class="fileselect clearfix">
<label for="upload_file"><%= t(:select_file,:scope=>:compose) %></label>:&nbsp;
<%= file_field 'file', 'data' %>
<%= raw single_action('upload','compose','up.png') %>
</div>

View File

@ -1,14 +0,0 @@
<div class="msg_header clearfix">
<%= raw show_param_view(@message,"from_addr",address_formatter(@from,:show)) %>
<%= raw show_param_view(@message,"to_addr",address_formatter(@to,:show)) %>
<% if not @cc.nil? %>
<%= raw show_param_view(@message,"cc_addr","CC jest") %>
<% end %>
<% if not @bcc.nil? %>
<%= raw show_param_view(@message,"bcc_addr","BCC jest ") %>
<% end %>
<%= raw show_param_view(@message,"subject",subject_formatter(@message,:show)) %>
<%= raw show_param_view(@message,"date",date_formatter(@date)) %>
<%= hidden_field_tag 'uids[]', @message.uid %>
<%= hidden_field_tag 'source', 'show' %>
</div>

View File

@ -1,3 +0,0 @@
<iframe frameborder="0" src="<%= html_body_path(@message.uid) %>">
</iframe>

View File

@ -0,0 +1,3 @@
%iframe{:frameborder=>"0",:src=>"#{html_body_path(@message.uid)}"}/

View File

@ -1,8 +0,0 @@
<div class="image">
<%= image_tag(attachment_download_path(image.parent_id,image.idx), :size => @current_user.prefs.msg_image_thumbnail_size, :alt=>image.filename, :title=>image.filename) %>
<div class="desc">
<span class="name"><%= link_to (image.filename,attachment_download_path(image.parent_id,image.idx)) %></span>
<span class="size"><%= size_formatter(image.getSize) %></span>
</div>
</div>

View File

@ -1,8 +0,0 @@
<div class="images">
<% for idx in 0..@images.size-1 %>
<%= render :partial => 'image', :object => @images[idx] %>
<% end %>
<div class="clear"></div>
</div>

View File

@ -9,30 +9,10 @@
= address_formatter(message.from_addr,:index)
%td
= subject_formatter(message,:index)
%td
%td{:nowrap=>"nowrap"}
= date_formatter(message.date)
%td
= size_formatter(message.size)
%td
- if @current_folder == @drafts_folder
- if @current_folder == @drafts_folder
%td
= link_to(t(:edit,:scope=>:message),edit_path(message.uid))
- else
&nbsp;
-#
<td><%= check_box_tag "uids[]", message.uid %></td>
<td><%= attachment_formatter(message) %></td>
<% if @current_folder == @sent_folder || @current_folder == @drafts_folder %>
<td nowrap="nowrap"><%= address_formatter(message.to_addr,:index) %></td>
<% else %>
<td nowrap="nowrap"><%= address_formatter(message.from_addr,:index) %></td>
<% end %>
<td nowrap="nowrap"><%= subject_formatter(message,:index) %></td>
<td nowrap="nowrap"><%= date_formatter(message.date) %></td>
</td><td nowrap="nowrap"><%= size_formatter(message.size) %></td>
<% if @current_folder == @drafts_folder %>
<td><%= link_to(t(:edit,:scope=>:message),edit_path(message.uid)) %></td>
<% else %>
<td><%= raw('&nbsp;') %></td>
<% end %>

View File

@ -8,9 +8,9 @@
\:
= @messages.total_entries
= will_paginate @messages
= will_paginate @messages, :class => "custom_pagination bottom-pix18"
%table{:class=>"table table-bordered"}
%table{:class=>"table table-bordered records"}
%thead
%tr
%th
@ -18,15 +18,12 @@
%th
%i{:class=>"icon-file"}
= raw headers_links
%th
&nbsp;
%tbody
- @messages.each do |m|
- m.unseen == true ? unseen = "unseen" : unseen = ""
%tr{:class=>"#{unseen}"}
= render :partial => 'messages/message', :locals => {:message => m}
= will_paginate @messages
= will_paginate @messages , :class => "custom_pagination bottom-pix18"

View File

@ -1,27 +0,0 @@
<div class="params">
<%= raw form_field( @message,
"to_addr",
nil,
"joe@domain.com"+', '+ t(:not_contain_at,:scope=>:compose),
address_formatter(@message.to_addr,@operation)
) %>
<%= raw form_field( @message,
"subject",
nil,
t(:subject_of_the_message,:scope=>:compose),
subject_formatter(@message.subject,@operation)
) %>
<%= raw area_field( @message,
"body",
nil,
t(:write_your_message_here,:scope=>:compose),
body_formatter(@message.body,@operation),
80,
20
) %>
</div>
<% if !@olduid.nil? %>
<%= hidden_field_tag 'olduid', @olduid %>
<% end %>
<%= raw group_action(@buttons) %>

View File

@ -1,10 +0,0 @@
<div id="search" class="ops">
<p>
<%= t(:search) %>
<%= t(:in_message_field) %>
<select name="search_field"><%= options_for_select($defaults["msg_search_fields"])%></select>
<%= t(:string) %>
<input type="text" name="search_value" value="" size='16' id='search_value'/>
<%= submit_tag(t(:search), :name=>'search')%>
</p>
</div>

View File

@ -1,10 +0,0 @@
<div class="ops clearfix">
<%= raw group_action_text(@multi1_buttons,t(:to_folder,:scope=>:folder)+ " " + simple_select_for_folders("folder","target",@folders_shown,'',true)) %>
<%= raw group_action(@multi3_buttons) %>
<div id="header_source" title="<%= t(:header_source,:scope=>:message)%>">
<pre>
<%= @plain_header %>
</pre>
</div>
</div>

View File

@ -1,23 +0,0 @@
<% content_for :sidebar do %>
<%= content_for_sidebar %>
<% end %>
<% content_for :title do %>
- <%= t(:compose,:scope=>:compose) %>
<% end %>
<div class="block">
<div class="navigation-tabs clearfix">
<%= raw main_navigation(:compose_tab) %>
</div>
<div class="content">
<h2><%= t(:new_message,:scope=>:compose) %></h2>
<div class="inner">
<%= form_tag(composed_path, :multipart => true) %>
<%= render :partial => 'messages/new' %>
<%= render :partial=> 'messages/file_attachs' %>
<%= render :partial => 'messages/file_select' %>
</form>
</div>
</div>

View File

@ -1,2 +0,0 @@
<%= raw @body -%>

View File

@ -0,0 +1,2 @@
= raw @body

View File

@ -1,33 +0,0 @@
<% content_for :sidebar do %>
<%= content_for_sidebar %>
<% end %>
<% content_for :title do %>
- <%= t(:messages,:scope=>:message) %>
<% end %>
<div class="block">
<div class="navigation-tabs clearfix">
<%= raw main_navigation(:messages_tab) %>
</div>
<div class="content">
<%= form_tag({:controller=>'messages_ops', :action=>'multi'},{:name=>'messages'})%>
<% if @current_folder.nil? %>
<h2><%= t(:no_selected,:scope=>:folder) %></h2>
<% end %>
<% if @messages.size.zero? %>
<div class="actions-bar wat-cf">
<div class="header_info"><%= t(:no_in,:scope=>:message) %></div>
</div>
<% else %>
<%= render :partial => 'multi_ops' %>
<%= render :partial => 'messages' %>
<% end %>
</form>
</div>
</div>

View File

@ -1,43 +0,0 @@
<% content_for :sidebar do %>
<%= content_for_sidebar %>
<% end %>
<% content_for :title do %>
- <%= subject_formatter(@message,:show) %>
<% end %>
<div class="block">
<div class="navigation-tabs clearfix">
<%= raw main_navigation(:show) %>
</div>
<div class="content clearfix">
<%= form_tag(messages_ops_single_path)%>
<%= render :partial => 'header' %>
<%= render :partial => 'single_ops' %>
<% if not @attachments.size.zero? %>
<%= render :partial => 'attachments' %>
<% end %>
<% if not @images.size.zero? %>
<%= render :partial => 'images' %>
<% end %>
<% if not @html_part.nil? %>
<%= render :partial => 'html_part' %>
<% else %>
<div class="render_text clearfix">
<% if @text_part.nil? %>
<p>
<%= t(:no_content,:scope => :message) %>
</p>
<% else %>
<%= raw content_text_plain_for_render(@text_part) %>
<% end %>
</div>
<% end %>
</form>
</div>
</div>

View File

@ -8,7 +8,7 @@
= render :partial => "common/input_password_form_field",:locals => { :model => 'user',:attr => 'password'}
.control-group
.controls
= render :partial => "common/button",:locals => { :name=>'login', :caption => t(:please_login,:scope=>:user), :icon =>'icon-lock icon-white'}
= render :partial => "common/button",:locals => { :name=>'login_button', :caption => t(:please_login,:scope=>:user), :icon =>'icon-lock icon-white'}
%hr/

View File

@ -12,4 +12,9 @@
= render :partial => "common/input_form_desc_field",:locals => {:object => @user,:attr => 'first_name',:label => nil,:example => 'Joe',:value => params[:user] ? params[:user][:first_name] : ""}
= render :partial => "common/input_form_desc_field",:locals => {:object => @user,:attr => 'last_name',:label => nil,:example => 'Doe',:value => params[:user] ? params[:user][:last_name] : ""}
= render :partial => "common/input_form_desc_field",:locals => {:object => @server,:attr => 'name',:label => nil,:example => 'server.domain',:value => params[:server] ? params[:server][:name] : ""}
= render :partial => "common/form_button_icon",:locals => { :text => t(:send_config,:scope=>:user), :icon_class =>'icon-ok icon-white'}
.control-group
.controls
= render :partial => "common/button",:locals => { :name=>'send',
:caption => t(:send_config,:scope=>:user),
:icon =>'icon-ok icon-white'}
%hr/

View File

@ -1,4 +1,8 @@
en:
will_paginate:
previous_label: "&#8592; Previous"
next_label: "Next &#8594;"
page_gap: "&hellip;"
activerecord:
attributes:
prefs:

View File

@ -1,4 +1,8 @@
pl:
will_paginate:
previous_label: "&#8592; Poprzednia"
next_label: "Następna &#8594;"
page_gap: "&hellip;"
date:
day_names: [Niedziela, Poniedziałek, Wtorek, Środa, Czwartek, Piątek, Sobota]
abbr_day_names: [Ni, Po, Wt, Śr, Cz, Pi, So]
@ -192,7 +196,7 @@ pl:
logout: Wyloguj
has_no_domain: Użytkownik nie ma ustawionej domeny
send_config: Wyślij
no_config: W bazie nie znaleziono żadnego użytkownika. Prawdopodobnie aplikacja nie została jeszcze skonfigurowana. Wypełnij poniższy formularz, aby dokonać podtsawowej konfiguracji.
no_config: W bazie nie znaleziono żadnego użytkownika. Prawdopodobnie aplikacja nie została jeszcze skonfigurowana. Wypełnij poniższy formularz, aby dokonać podstawowej konfiguracji.
internal:
imap_error: Błąd protokołu IMAP

View File

@ -6,19 +6,19 @@ module Mail
attr_accessor :idx,:parent_id
#def decoded_and_charseted
#begin
#if not charset.upcase == 'UTF-8'
#charset.nil? ? source_charset = $defaults["msg_unknown_charset"] : source_charset = charset
#charseted = Iconv.iconv("UTF-8",source_charset,decoded).first
#else
#charseted = decoded
#end
#rescue
#decoded
#end
def decoded_and_charseted
begin
if not charset.upcase == 'UTF-8'
charset.nil? ? source_charset = $defaults["msg_unknown_charset"] : source_charset = charset
charseted = Iconv.iconv("UTF-8",source_charset,decoded).first
else
charseted = decoded
end
rescue
decoded
end
#end
end
def isImage?
not (content_type =~ /^image/).nil?
@ -58,74 +58,74 @@ module Mail
attr_accessor :idx,:parent_id
#def isImage?
#not (content_type =~ /^image/).nil?
#end
def isImage?
not (content_type =~ /^image/).nil?
end
#def isText?
#not (content_type =~ /^text\/plain/).nil?
#end
def isText?
not (content_type =~ /^text\/plain/).nil?
end
#def isHtml?
#not (content_type =~ /^text\/html/).nil?
#end
def isHtml?
not (content_type =~ /^text\/html/).nil?
end
#def getSize
#body.raw_source.size
#end
def getSize
body.raw_source.size
end
#def decoded_and_charseted
#begin
#if not charset.upcase == 'UTF-8'
#charset.nil? ? source_charset = $defaults["msg_unknown_charset"] : source_charset = charset
#charseted = Iconv.iconv("UTF-8",source_charset,decoded).first
#else
#charseted = decoded
#end
#rescue
#decoded
#end
def decoded_and_charseted
begin
if not charset.upcase == 'UTF-8'
charset.nil? ? source_charset = $defaults["msg_unknown_charset"] : source_charset = charset
charseted = Iconv.iconv("UTF-8",source_charset,decoded).first
else
charseted = decoded
end
rescue
decoded
end
#end
end
end
#class Field
#def charseted
#begin
#if value =~ /\=\?([\w\-]+)\?/
#source_charset = $1
#if source_charset.upcase == 'UTF-8'
#return decoded
#end
#else
#source_charset = $defaults["msg_unknown_charset"]
#end
#Iconv.iconv("UTF-8",source_charset,decoded).first
#rescue
#decoded
#end
#end
#end
class Field
def charseted
begin
if value =~ /\=\?([\w\-]+)\?/
source_charset = $1
if source_charset.upcase == 'UTF-8'
return decoded
end
else
source_charset = $defaults["msg_unknown_charset"]
end
Iconv.iconv("UTF-8",source_charset,decoded).first
rescue
decoded
end
end
end
#class Address
#def charseted
#begin
#if value =~ /\=\?([\w\-]+)\?/
#source_charset = $1
#if source_charset.upcase == 'UTF-8'
#return decoded
#end
#else
#source_charset = $defaults["msg_unknown_charset"]
#end
#Iconv.iconv("UTF-8",source_charset,decoded).first
#rescue
#decoded
#end
#end
#end
class Address
def charseted
begin
if value =~ /\=\?([\w\-]+)\?/
source_charset = $1
if source_charset.upcase == 'UTF-8'
return decoded
end
else
source_charset = $defaults["msg_unknown_charset"]
end
Iconv.iconv("UTF-8",source_charset,decoded).first
rescue
decoded
end
end
end
#class Part
#def filename_charseted