master
Wojciech Todryk 2012-03-30 19:31:23 +02:00
parent b8eddc8e48
commit 77c8d3e7d7
54 changed files with 614 additions and 209 deletions

0
.gitignore vendored Normal file → Executable file
View File

View File

@ -44,3 +44,4 @@ gem "calendar_view"
gem 'bluecloth'
gem 'sass'
gem 'haml'
#gem 'twitter_bootstrap_form_for'

2
Gemfile.lock Executable file → Normal file
View File

@ -31,7 +31,7 @@ GEM
arel (3.0.2)
bluecloth (2.2.0)
builder (3.0.0)
calendar_view (0.0.6)
calendar_view (0.0.7)
rails (>= 3.0.0)
coffee-rails (3.2.2)
coffee-script (>= 2.2.0)

View File

@ -6,34 +6,10 @@ class ContactsController < ApplicationController
before_filter :get_contacts, :only => [:index]
before_filter :prepare_ops_buttons, :prepare_export_import_buttons,:only => [:index]
#theme :theme_resolver
def index
end
def ops
if params["create_new"]
redirect_to(new_contact_path)
return
end
if !params["cids"]
flash[:warning] = t(:no_selected,:scope=>:contact)
else
if params["delete_selected"]
params["cids"].each do |id|
@current_user.contacts.find_by_id(id).destroy
end
elsif params["compose_to_selected"]
redirect_to :controller=>'messages',:action=>'compose',:cids=>params["cids"]
return
end
end
redirect_to(contacts_path)
end
#problem http://binary10ve.blogspot.com/2011/05/migrating-to-rails-3-got-stuck-with.html
#def destroy
# @current_user.contacts.find(params[:id]).destroy
@ -50,6 +26,21 @@ class ContactsController < ApplicationController
end
def create
if params["compose_to_selected"]
if params["items_ids"]
redirect_to compose_path(:cids => params["items_ids"])
return
end
end
if params["delete_selected"]
if params["items_ids"]
params["items_ids"].each do |id|
@current_user.contacts.find_by_id(id).destroy
end
end
redirect_to(contacts_path)
return
end
@contact = @current_user.contacts.build(params[:contact])
if @contact.valid?
@contact.save
@ -69,10 +60,17 @@ class ContactsController < ApplicationController
end
end
def external
def import_export
if params["export"]
redirect_to :action => 'export'
return
contacts = @current_user.contacts
s = ""
contacts.each do |c|
s += c.export + "\r\n"
end
headers['Content-type'] = "text/csv"
headers['Content-Disposition'] = %(attachment; filename="contacts.csv")
render :text => s
return
elsif params["import"]
begin
raise t(:no_file_chosen,:scope=>:common) if not params[:upload]
@ -82,8 +80,8 @@ class ContactsController < ApplicationController
tmp_file.flush
tmp_file.rewind
tmp_file.readlines.each do |line|
next if line =~ /^#/
Contact.import(@current_user,line)
next if line =~ /^#/
Contact.import(@current_user,line)
end
rescue ActiveRecord::RecordInvalid => e
flash[:error] = {:title => e.to_s,:info => e.record.inspect + e.record.errors.inspect}
@ -96,34 +94,10 @@ class ContactsController < ApplicationController
redirect_to :action => 'index'
end
def export
contacts = @current_user.contacts
s = ""
contacts.each do |c|
s += c.export + "\r\n"
end
headers['Content-type'] = "text/csv"
headers['Content-Disposition'] = %(attachment; filename="contacts.csv")
render :text => s
end
####################################### protected section ################################
protected
def prepare_ops_buttons
@buttons = []
@buttons << {:text => 'compose_to_selected',:scope=> 'contact', :image => 'email.png'}
@buttons << {:text => 'create_new',:scope=> 'contact', :image => 'plus.png'}
@buttons << {:text => 'delete_selected',:scope=>'contact',:image => 'minus.png'}
end
def prepare_export_import_buttons
@ei_buttons = []
@ei_buttons << {:text => 'import',:scope=>'contact',:image => 'right.png'}
@ei_buttons << {:text => 'export',:scope=>'contact',:image => 'left.png'}
end
####################################### private section ##################################
private

View File

@ -6,39 +6,10 @@ class LinksController < ApplicationController
before_filter :get_links, :only => [:index]
before_filter :prepare_ops_buttons, :only => [:index]
#, :prepare_export_import_buttons,:only => [:index]
#theme :theme_resolver
def index
end
def ops
if params["create_new"]
redirect_to(new_link_path)
return
end
if !params["ids"]
flash[:warning] = t(:no_selected,:scope=>:link)
else
if params["delete_selected"]
params["ids"].each do |id|
@current_user.links.find_by_id(id).destroy
end
end
end
redirect_to(links_path)
end
#problem http://binary10ve.blogspot.com/2011/05/migrating-to-rails-3-got-stuck-with.html
#def destroy
# @current_user.contacts.find(params[:id]).destroy
# redirect_to(contacts_path)
#end
def new
@link = Link.new
end
@ -49,6 +20,15 @@ class LinksController < ApplicationController
end
def create
if params["delete_selected"]
if params["items_ids"]
params["items_ids"].each do |id|
@current_user.links.find_by_id(id).destroy
end
end
redirect_to(links_path)
return
end
@link = @current_user.links.build(params[:link])
if @link.valid?
@link.save
@ -68,10 +48,17 @@ class LinksController < ApplicationController
end
end
def external
def import_export
if params["export"]
redirect_to :action => 'export'
return
links = @current_user.links
s = ""
links.each do |l|
s += l.export + "\r\n"
end
headers['Content-type'] = "text/csv"
headers['Content-Disposition'] = %(attachment; filename="links.csv")
render :text => s
return
elsif params["import"]
begin
raise t(:no_file_chosen,:scope=>:common) if not params[:upload]
@ -81,47 +68,24 @@ class LinksController < ApplicationController
tmp_file.flush
tmp_file.rewind
tmp_file.readlines.each do |line|
next if line =~ /^#/
Contact.import(@current_user,line)
next if line =~ /^#/
Link.import(@current_user,line)
end
rescue ActiveRecord::RecordInvalid => e
flash[:error] = {:title => e.to_s,:info => e.record.inspect + e.record.errors.inspect}
rescue Exception => e
flash[:error] = e.to_s
else
flash[:success] = t(:were_imported,:scope=>:contact)
flash[:success] = t(:were_imported,:scope=>:link)
end
end
redirect_to :action => 'index'
end
def export
contacts = @current_user.contacts
s = ""
contacts.each do |c|
s += c.export + "\r\n"
end
headers['Content-type'] = "text/csv"
headers['Content-Disposition'] = %(attachment; filename="contacts.csv")
render :text => s
end
####################################### protected section ################################
protected
def prepare_ops_buttons
@buttons = []
@buttons << {:text => 'create_new',:scope=> 'link', :image => 'plus.png'}
@buttons << {:text => 'delete_selected',:scope=>'link',:image => 'minus.png'}
end
def prepare_export_import_buttons
@ei_buttons = []
@ei_buttons << {:text => 'import',:scope=>'link',:image => 'right.png'}
@ei_buttons << {:text => 'export',:scope=>'link',:image => 'left.png'}
end
####################################### private section ##################################
private

View File

@ -103,8 +103,8 @@ class MessagesController < ApplicationController
#@to = mail.To.addrs.presence
@from = @message.from_addr
@to = @message.to_addr
@cc = mail.Cc.presence
@bcc = mail.Bcc.presence
@cc = mail.cc
@bcc = mail.bcc
#@subject = mail.Subject
@date = mail.date.presence

View File

@ -25,7 +25,7 @@ class MessagesOpsController < ApplicationController
############################################### single #####################################
def single
if params[:reply]
if params[:reply] or params[:reply_all]
reply
return
elsif params[:trash]
@ -281,11 +281,19 @@ class MessagesOpsController < ApplicationController
def reply
old_message = @current_user.messages.where('folder_id = ? and uid = ?',@current_folder,params[:uids].first).first
@message = Message.new
@message.to_addr = old_message.from_addr
@message.subject = old_message.subject
#@message.to_addr = old_message.from_addr
#@message.to_addr = old_message.from.first
#@message.subject = old_message.subject
imap_message = @mailbox.fetch_body(old_message.uid)
mail = Mail.new(imap_message)
@message.to_addr = mail.from.first
@message.subject = mail.subject
if params[:reply_all]
@message.cc_addr = mail.cc.join('; ')
end
if mail.multipart?
@message.body = mail.text_part.nil? ? "" : mail.text_part.decoded_and_charseted.gsub(/<\/?[^>]*>/, "")
else
@ -295,6 +303,7 @@ class MessagesOpsController < ApplicationController
@operation = :reply
render 'messages/compose'
end
###################################### protected section #######################################
protected
@ -315,6 +324,7 @@ class MessagesOpsController < ApplicationController
@mail.from = @current_user.full_id
#TODO check if email address is valid if not get address from contacts
@mail.to = params[:message][:to_addr]
@mail.cc = params[:message][:cc_addr]
@mail.body = params[:message][:body]
@attachments = Dir.glob(File.join($defaults["msg_upload_dir"],@current_user.username + "*"))
@attachments.each do |a|

View File

@ -327,8 +327,8 @@ module ApplicationHelper
#s
#end
#def boolean_answer(answer)
#answer == true ? t(:true_answer,:scope=>:common) : t(:false_answer,:scope=>:common)
#end
def boolean_answer(answer)
answer == true ? t(:true_answer,:scope=>:common) : t(:false_answer,:scope=>:common)
end
end

View File

@ -16,11 +16,12 @@ module MessagesHelper
def address_formatter(addr,op)
s = ""
return s if addr.nil?
return t(:no_address,:scope=>:message) if addr.empty?
length = $defaults["msg_address_length"].to_i
case op
when :index
logger.custom('addr',addr)
fs = addr.gsub(/\"/,"").split(/</)
fs[0].size.zero? ? s = fs[1] : s = fs[0]
s.length >= length ? s = s[0,length]+"..." : s
@ -42,13 +43,20 @@ module MessagesHelper
case op
when :reply
s = "\n\n\n"
body.gsub(/^\s+/,"").split(/\n/).each do |line|
s += ">" + line + "\n"
body.split(/\n/).each do |line|
s += '>' + line.strip + "\n"
end
s
when :edit
return body
end
when :plain
safe_body = h(body)
s = ""
safe_body.split(/\n/).each do |line|
s += line.gsub(/^\s+/,"") + "<br/>"
end
s.html_safe
end
end
def subject_formatter(message,op)

View File

@ -1,12 +1,11 @@
class Contact < ActiveRecord::Base
validates_length_of :nick, :within => 5..15
validates_length_of :first_name,:last_name, :within => 3..20
validates_length_of :name, :within => 3..20
validates_length_of :email, :within => 5..50
validates_format_of :email, :with => /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\Z/i
validates_length_of :info, :maximum => 100
validate :check_unique_nick, :on => :create
default_scope :order => 'nick ASC'
validate :check_unique_name, :on => :create
default_scope :order => 'name ASC'
belongs_to :user
@ -22,21 +21,15 @@ class Contact < ActiveRecord::Base
Contact.paginate :page => page , :per_page => $defaults["contacts_per_page"], :conditions=> ['user_id = ?', user.id],:order => order
end
def full_name
first_name + ' ' + last_name
end
def check_unique_nick
if !Contact.where('upper(nick) = ? and user_id = ?',nick.upcase,user_id).size.zero?
errors.add(:nick, :not_unique)
def check_unique_name
if !Contact.where('upper(name) = ? and user_id = ?',name.upcase,user_id).size.zero?
errors.add(:name, :not_unique)
end
end
def export
fields = []
fields << nick.presence || ""
fields << first_name || ""
fields << last_name || ""
fields << name || ""
fields << email || ""
fields << info || ""
fields.join(';')
@ -44,11 +37,9 @@ class Contact < ActiveRecord::Base
def self.import(user,line)
fields = line.split(/;/)
contact = user.contacts.build( :nick => fields[0].strip,
:first_name => fields[1].strip,
:last_name => fields[2].strip,
:email => fields[3].strip,
:info => fields[4].strip)
contact = user.contacts.build( :name => fields[0].strip,
:email => fields[1].strip,
:info => fields[2].strip)
contact.save!
end
end

View File

@ -1,5 +1,4 @@
class Link < ActiveRecord::Base
validates_length_of :name, :within => 5..30
validates_length_of :url, :within => 5..150
validates_length_of :info, :maximum => 50
belongs_to :user
@ -16,4 +15,19 @@ class Link < ActiveRecord::Base
Link.paginate :page => page , :per_page => $defaults["links_per_page"], :conditions=> ['user_id = ?', user.id],:order => order
end
def export
fields = []
fields << url || ""
fields << info || ""
fields.join(';')
end
def self.import(user,line)
fields = line.split(/;/)
contact = user.links.build( :url => fields[0].strip,
:info => fields[1].strip)
contact.save!
end
end

View File

@ -0,0 +1,8 @@
- size ||= "btn-small"
- type ||= "btn-primary"
- icon ||= ""
%a{:class=>"btn #{size} #{type}",:href=>"#{href}"}
- if !icon.empty?
%i{:class=>"#{icon}"}
= caption

View File

@ -0,0 +1,12 @@
%form{:enctype=>"multipart/form-data", :class=>"form-horizontal top-pix18",:action=>"#{im_ex_path}",:method=>"post"}
= render :partial => "common/file_select", :locals => { :model_label => "#{im_ex_label}",
:model_string => "upload",
:attr => "datafile"}
%p
= render :partial => "common/button", :locals => {:name=>'import',
:caption=>t('import',:scope=>'contact'),
:icon=>'icon-upload icon-white'}
- if !im_ex_size.zero?
= render :partial => "common/button", :locals => {:name=>'export',
:caption=>t('export',:scope=>'contact'),
:icon=>'icon-download icon-white'}

View File

@ -0,0 +1 @@
= calendar_window(:title=>t(:calendar,:scope=>:common))

View File

@ -7,16 +7,15 @@
%ul{:class=>"nav nav-pills"}
%li{:class=>"#{messages}"}
%a{:href=>messages_path}
= t(:messages,:scope=>:message)
= link_to( t(:messages,:scope=>:message), messages_path )
%li{:class=>"#{compose}"}
= link_to( t(:compose,:scope=>:compose), compose_path )
%li{:class=>"#{folders}"}
= link_to( t(:folders,:scope=>:folder), folders_path )
%li{:class=>"#{contacts}"}
= link_to( t(:contacts,:scope=>:contact), contacts_path )
%li{:class=>"#{prefs}"}
= link_to( t(:prefs,:scope=>:prefs), prefs_look_path )
%li{:class=>"#{links}"}
= link_to( t(:links,:scope=>:link), links_path )
%li{:class=>"#{prefs}"}
= link_to( t(:prefs,:scope=>:prefs), prefs_look_path )

View File

@ -0,0 +1,11 @@
- look ||= ""
- identity ||= ""
- servers ||= ""
%ul{:class=>"nav nav-pills"}
%li{:class=>"#{look}"}
= link_to( t(:look,:scope=>:prefs), prefs_look_path )
%li{:class=>"#{identity}"}
= link_to( t(:identity,:scope=>:prefs), prefs_identity_path )
%li{:class=>"#{servers}"}
= link_to( t(:servers,:scope=>:prefs), prefs_servers_path )

View File

@ -0,0 +1,22 @@
- model = eval(object.class.model_name)
- model_string = object.class.model_name.downcase
- model_label = model.human_attribute_name(attr)
- translation_scope ||= false
.control-group
%label{:class=>"control-label",:for=>"#{attr}"}
= model_label
.controls
- if translation_scope
- t = []
- choices.each do |c|
- t << [t(c.to_sym,:scope=>translation_scope),c.to_s]
= select(model_string, attr, options_for_select(t,choice), {:include_blank => blank})
- else
= select(model_string, attr, options_for_select(choices,choice), {:include_blank => blank})
-# select(model.downcase, attr, options_for_select(choices,choice), {:include_blank => blank})

View File

@ -0,0 +1,18 @@
= render :partial => "common/input_form_desc_field",:locals => {:object => @contact,
:attr => 'name',
:label => nil,
:example => 'Joe Doe',
:value => @contact.name,
:to_class=>"span6" }
= render :partial => "common/input_form_desc_field",:locals => {:object => @contact,
:attr => 'email',
:label => nil,
:example => 'joe.doe@domain.com',
:value => @contact.email,
:to_class=>"span6" }
= render :partial => "common/input_form_desc_field",:locals => {:object => @contact,
:attr => 'info',
:label => nil,
:example => t(:some_add_info,:scope=>:common),
:value => @contact.info,
:to_class=>"span6" }

View File

@ -0,0 +1,11 @@
%tr
%td
= check_box_tag "items_ids[]", contact.id
\/
= link_to "<i class=\"icon-edit\"></i>".html_safe,edit_contact_path(contact)
%td{:nowrap=>"nowrap"}
= link_to contact.name,compose_contact_path(contact.id)
%td{:nowrap=>"nowrap"}
= link_to contact.email, compose_contact_path(contact.id)
%td{:nowrap=>"nowrap"}
= contact.info

View File

@ -0,0 +1,13 @@
= will_paginate @contacts
%table{:class=>"table table-bordered records"}
%thead
%tr
%th
%input{:id=>"toggleall",:type=>"checkbox",:name=>"allbox"}
= raw contacts_table_header
%tbody
- @contacts.each do |c|
= render :partial => 'contact', :locals => {:contact => c}
= will_paginate @contacts

View File

@ -0,0 +1,20 @@
= content_for :sidebar do
= render :partial => "sidebar/sidebar"
= content_for :title do
\-
= t(:contacts,:scope=>:contact)
= render :partial => 'common/main_navigation', :locals => { :contacts => :active }
.well{:style=>"padding: 5px 3pt;"}
%h3
= t(:modifying,:scope=>:contact)
%form{:class=>"form-horizontal",:action=>url_for(@contact),:method=>"post"}
%input{:name=>"_method",:type=>"hidden",:value=>"put"}
%fieldset
= render :partial => "attrs"
.control-group
.controls
= render :partial => "common/button",:locals => { :name=>:save, :caption => t(:save,:scope=>:common), :icon =>'icon-cog icon-white'}

View File

@ -6,3 +6,33 @@
= t(:contacts,:scope=>:contact)
= render :partial => 'common/main_navigation', :locals => { :contacts => :active }
%form{:class=>"form-horizontal top-pix18",:action=>url_for(@contact),:method=>"post"}
- if @contacts.size.zero?
.alert
= t(:no_entries,:scope=>:contact)
%p{:class=>"bottom-pix18"}
= render :partial => "common/anchor", :locals => {:caption=>t('create_new',:scope=>'contact'),
:icon=>'icon-plus icon-white',
:href=>new_contact_path}
- else
.well{:style=>"padding: 5px 3pt;"}
%h5
= t(:total_entries,:scope=>:contact)
\:
= @contacts.total_entries
%p{:class=>"bottom-pix18"}
= render :partial => "common/anchor", :locals => {:caption=>t('create_new',:scope=>'contact'),
:icon=>'icon-plus icon-white',
:href=>new_contact_path}
= render :partial => "common/button", :locals => {:name=>'delete_selected',
:caption=>t('delete_selected',:scope=>'contact'),
:icon=>'icon-minus icon-white'}
= render :partial => "common/button", :locals => {:name=>'compose_to_selected',
:caption=>t('compose_to_selected',:scope=>'contact'),
:icon=>'icon-envelope icon-white'}
= render :partial => 'list'
= render :partial => 'common/import_export',:locals=>{:im_ex_path => contacts_import_export_path,
:im_ex_label => t(:select_file,:scope=>:compose),
:im_ex_size => @contacts.total_entries }

View File

@ -0,0 +1,19 @@
= content_for :sidebar do
= render :partial => "sidebar/sidebar"
= content_for :title do
\-
= t(:contacts,:scope=>:contact)
= render :partial => 'common/main_navigation', :locals => { :contacts => :active }
.well{:style=>"padding: 5px 3pt;"}
%h3
= t(:creating_new,:scope=>:contact)
%form{:class=>"form-horizontal",:action=>url_for(@contact),:method=>"post"}
%fieldset
= render :partial => "attrs"
.control-group
.controls
= render :partial => "common/button",:locals => { :name=>:save, :caption => t(:save,:scope=>:common), :icon =>'icon-cog icon-white'}

View File

@ -2,6 +2,7 @@
= render :partial => "sidebar/sidebar"
= content_for :title do
\-
= t(:about,:scope=>:internal)
= render :partial => 'common/main_navigation', :locals => { :about => :active }

View File

@ -22,6 +22,7 @@
- elsif flash[:success]
.alert.alert-success
= flash[:success]
= render :partial => "common/main_header"
= yield
%hr/
.row

View File

@ -0,0 +1,12 @@
= render :partial => "common/input_form_desc_field",:locals => {:object => @link,
:attr => 'url',
:label => nil,
:example => 'www.example.com',
:value => @link.url,
:to_class=>"span6" }
= render :partial => "common/input_form_desc_field",:locals => {:object => @link,
:attr => 'info',
:label => nil,
:example => t(:some_add_info,:scope=>:common),
:value => @link.info,
:to_class=>"span6" }

View File

@ -0,0 +1,9 @@
%tr
%td
= check_box_tag "items_ids[]", link.id
\/
= link_to "<i class=\"icon-edit\"></i>".html_safe,edit_link_path(link)
%td{:nowrap=>"nowrap"}
= link_to link.url,"http://"+link.url
%td{:nowrap=>"nowrap"}
= link.info

13
app/views/links/_list.html.haml Executable file
View File

@ -0,0 +1,13 @@
= will_paginate @links , :class => "custom_pagination bottom-pix18"
%table{:class=>"table table-bordered records"}
%thead
%tr
%th
%input{:id=>"toggleall",:type=>"checkbox",:name=>"allbox"}
= raw links_table_header
%tbody
- @links.each do |l|
= render :partial => 'link', :locals => {:link => l}
= will_paginate @links , :class => "custom_pagination bottom-pix18"

20
app/views/links/edit.html.haml Executable file
View File

@ -0,0 +1,20 @@
= content_for :sidebar do
= render :partial => "sidebar/sidebar"
= content_for :title do
\-
= t(:links,:scope=>:link)
= render :partial => 'common/main_navigation', :locals => { :links => :active }
.well{:style=>"padding: 5px 3pt;"}
%h3
= t(:modifying,:scope=>:link)
%form{:class=>"form-horizontal",:action=>url_for(@link),:method=>"post"}
%input{:name=>"_method",:type=>"hidden",:value=>"put"}
%fieldset
= render :partial => "attrs"
.control-group
.controls
= render :partial => "common/button",:locals => { :name=>:save, :caption => t(:save,:scope=>:common), :icon =>'icon-cog icon-white'}

View File

@ -6,3 +6,28 @@
= t(:links,:scope=>:link)
= render :partial => 'common/main_navigation', :locals => { :links => :active }
%form{:class=>"form-horizontal top-pix18",:action=>url_for(@link),:method=>"post"}
- if @links.size.zero?
.alert
= t(:no_entries,:scope=>:link)
%p{:class=>"bottom-pix18"}
= render :partial => "common/anchor", :locals => {:caption=>t('create_new',:scope=>'link'),
:icon=>'icon-plus icon-white',
:href=>new_link_path}
- else
.well{:style=>"padding: 5px 3pt;"}
%h5
= t(:total_entries,:scope=>:link)
\:
= @links.total_entries
%p{:class=>"bottom-pix18"}
= render :partial => "common/anchor", :locals => {:caption=>t('create_new',:scope=>'link'),
:icon=>'icon-plus icon-white',
:href=>new_link_path}
= render :partial => "common/button", :locals => {:name=>'delete_selected',
:caption=>t('delete_selected',:scope=>'link'),
:icon=>'icon-minus icon-white'}
= render :partial => 'list'

19
app/views/links/new.html.haml Executable file
View File

@ -0,0 +1,19 @@
= content_for :sidebar do
= render :partial => "sidebar/sidebar"
= content_for :title do
\-
= t(:links,:scope=>:link)
= render :partial => 'common/main_navigation', :locals => { :links => :active }
.well{:style=>"padding: 5px 3pt;"}
%h3
= t(:create_new,:scope=>:link)
%form{:class=>"form-horizontal",:action=>url_for(@link),:method=>"post"}
%fieldset
= render :partial => "attrs"
.control-group
.controls
= render :partial => "common/button",:locals => { :name=>:save, :caption => t(:save,:scope=>:common), :icon =>'icon-cog icon-white'}

View File

@ -15,13 +15,13 @@
%td{:class=>"field_name"}
= humanize_attr(@message,'cc_addr') + ':'
%td
"CC jest"
= @cc.join('; ')
- if not @bcc.nil?
%tr
%td{:class=>"field_name"}
= humanize_attr(@message,'bcc_addr') + ':'
%td
"BCC jest"
= @bcc.join('; ')
%tr
%td{:class=>"field_name"}
= humanize_attr(@message,'subject') + ':'

View File

@ -0,0 +1,22 @@
%li{:class=>"span3"}
.thumbnail
%a{:href=>"#"}
%img{:alt=>image.filename,:src=>attachment_download_path(image.parent_id,image.idx),:size => @current_user.prefs.msg_image_thumbnail_size,:title=>image.filename}
.caption
%h5
= link_to "<i class=\"icon-download-alt\"></i>".html_safe, attachment_download_path(image.parent_id,image.idx)
= image.filename
%small
= size_formatter(image.getSize)
-#
<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>
= link_to "<i class=\"icon-download-alt\"></i>".html_safe, "#"

View File

@ -0,0 +1,3 @@
%ul{:class=>"thumbnails"}
- for idx in 0..@images.size-1
= render :partial => 'image', :locals => { :image => @images[idx] }

View File

@ -1,12 +1,3 @@
.well{:style=>"padding: 5px 3pt;"}
%h3
= t(:current,:scope=>:folder)
\:
= pretty_folder_name(@current_folder)
%h5
= t(:total,:scope=>:message)
\:
= @messages.total_entries
= will_paginate @messages, :class => "custom_pagination bottom-pix18"

View File

@ -8,7 +8,8 @@
= t(:to_folder,:scope=>:folder) + " "
= raw simple_select_for_folders("folder","target",@folders_shown,'',true)
%p
%p{:class=>"bottom-pix18"}
= render :partial => "common/button", :locals => {:name=>'trash',
:caption=>t('trash',:scope=>'message'),
:icon=>'icon-trash icon-white'}

View File

@ -9,7 +9,7 @@
= t(:to_folder,:scope=>:folder) + " "
= raw simple_select_for_folders("folder","target",@folders_shown,'',true)
%p
%p{:class=>"bottom-pix18"}
= render :partial => "common/button", :locals => {:name=>'show_header',
:caption=>t('show_header',:scope=>'show'),
:icon=>'icon-zoom-in icon-white'}
@ -19,6 +19,9 @@
= render :partial => "common/button", :locals => {:name=>'reply',
:caption=>t('reply',:scope=>'show'),
:icon=>'icon-arrow-left icon-white'}
= render :partial => "common/button", :locals => {:name=>'reply_all',
:caption=>t('reply_all',:scope=>'show'),
:icon=>'icon-backward icon-white'}
= render :partial => "common/button", :locals => {:name=>'forward',
:caption=>t('forward',:scope=>'show'),
:icon=>'icon-arrow-right icon-white'}

View File

@ -2,17 +2,15 @@
= render :partial => "sidebar/sidebar"
= content_for :title do
\-
= t(:compose,:scope=>:compose)
= render :partial => 'common/main_navigation', :locals => { :compose => :active }
%form{:enctype=>"multipart/form-data",:class=>"form-horizontal",:action=>composed_path,:method=>"post"}
.well{:style=>"padding: 5px 3pt;"}
%h3
= t(:new_message,:scope=>:compose)
%fieldset
= render :partial => "common/input_form_desc_field",:locals => {:object => @message,:attr => 'to_addr',:label => nil,:example => 'joe@domain.com',:value => address_formatter(@message.to_addr,@operation),:to_class=>"span6" }
= render :partial => "common/input_form_desc_field",:locals => {:object => @message,:attr => 'cc_addr',:label => nil,:example => 'joe@domain.com',:value => "",:to_class=>"span6" }
= render :partial => "common/input_form_desc_field",:locals => {:object => @message,:attr => 'cc_addr',:label => nil,:example => 'joe@domain.com',:value => address_formatter(@message.cc_addr,@operation),:to_class=>"span6" }
= render :partial => "common/input_form_desc_field",:locals => {:object => @message,:attr => 'subject',:label => nil,:example => t(:subject_of_the_message,:scope=>:compose),:value => subject_formatter(@message.subject,@operation),:to_class=>"span6" }
= render :partial => "common/area_form_desc_field",:locals => {:object => @message,:attr => 'body',:label => nil,:example => t(:write_your_message_here,:scope=>:compose),:value => body_formatter(@message.body,@operation),:to_class=>"span6",:rows=>20 }
- if !@olduid.nil?

View File

@ -7,11 +7,21 @@
= render :partial => 'common/main_navigation', :locals => { :messages => :active }
.well{:style=>"padding: 5px 3pt;"}
%h3
= t(:current,:scope=>:folder)
\:
= pretty_folder_name(@current_folder)
%h5
= t(:total,:scope=>:message)
\:
= @messages.total_entries
%form{:class=>"form-horizontal top-pix18",:action=>"#{messages_ops_multi_path}",:method=>"post"}
- if @current_folder.nil?
.alert
= t(:no_selected,:scope=>:folder)
- if @messages.size.zero?
.alert
= t(:no_in,:scope=>:message)

View File

@ -13,7 +13,7 @@
- if not @attachments.size.zero?
= render :partial => 'attachments'
- if not @images.size.zero?
render :partial => 'images'
= render :partial => 'images'
- if not @html_part.nil?
= render :partial => 'html_part'
- else
@ -21,8 +21,8 @@
.alert
= t(:no_content,:scope => :message)
- else
%pre
= @text_part
.well
= body_formatter(@text_part,:plain)

View File

@ -0,0 +1,17 @@
%tr
%td
= check_box_tag "cids[]", server.id
%td{:nowrap=>"nowrap"}
= server.name
%td{:nowrap=>"nowrap"}
= server.port
%td{:nowrap=>"nowrap"}
= boolean_answer(server.use_ssl)
%td{:nowrap=>"nowrap"}
= boolean_answer(server.use_tls)
%td{:nowrap=>"nowrap"}
= boolean_answer(server.for_imap)
%td{:nowrap=>"nowrap"}
= boolean_answer(server.for_smtp)
%td{:nowrap=>"nowrap"}
= server.auth

View File

@ -0,0 +1,30 @@
= content_for :sidebar do
= render :partial => "sidebar/sidebar"
= content_for :title do
\-
= t(:identity,:scope=>:prefs)
= render :partial => 'common/main_navigation', :locals => { :prefs => :active }
= render :partial => 'common/prefs_navigation', :locals => { :identity => :active }
%form{:class=>"form-horizontal",:action=>prefs_update_identity_path,:method=>"post"}
%fieldset
= render :partial => "common/input_form_desc_field",:locals => {:object => @current_user,
:attr => 'first_name',
:label => nil,
:example => 'Joe',
:value => @current_user.first_name }
= render :partial => "common/input_form_desc_field",:locals => {:object => @current_user,
:attr => 'last_name',
:label => nil,
:example => 'Doe',
:value => @current_user.last_name }
= render :partial => "common/input_form_desc_field",:locals => {:object => @current_user,
:attr => 'domain',
:label => nil,
:example => 'domain.com',
:value => @current_user.domain }
.control-group
.controls
= render :partial => "common/button",:locals => { :name=>:save, :caption => t(:save,:scope=>:common), :icon =>'icon-cog icon-white'}

View File

@ -6,3 +6,58 @@
= t(:look,:scope=>:prefs)
= render :partial => 'common/main_navigation', :locals => { :prefs => :active }
= render :partial => 'common/prefs_navigation', :locals => { :look => :active }
%form{:class=>"form-horizontal",:action=>prefs_update_look_path,:method=>"post"}
%fieldset
= render :partial => "common/select",:locals => {:object => @prefs,
:attr => 'msgs_per_page',
:choices => $defaults["msgs_per_page_table"],
:choice => @prefs.msgs_per_page,
:blank => false }
= render :partial => "common/select",:locals => {:object => @prefs,
:attr => 'theme',
:choices => $defaults["themes"],
:choice => $defaults["themes"],
:blank => false }
= render :partial => "common/select",:locals => {:object => @prefs,
:attr => 'locale',
:choices => $defaults["locales"],
:choice => @prefs.locale,
:blank => false }
= render :partial => "common/select",:locals => {:object => @prefs,
:attr => 'msg_send_type',
:choices => $defaults["msg_send_type"],
:choice => @prefs.msg_send_type,
:blank => false }
= render :partial => "common/select",:locals => {:object => @prefs,
:attr => 'msg_image_thumbnail_size',
:choices => $defaults["msg_image_thumbnail_size"],
:choice => @prefs.msg_image_thumbnail_size,
:blank => false,
}
= render :partial => "common/select",:locals => {:object => @prefs,
:attr => 'msg_image_view_as',
:choices => $defaults["msg_image_view_as"],
:choice => @prefs.msg_image_view_as,
:blank => false,
:translation_scope => :prefs}
.control-group
.controls
= render :partial => "common/button",:locals => { :name=>:save, :caption => t(:save,:scope=>:common), :icon =>'icon-cog icon-white'}
-#
<div class="params">
<%= raw select_field_table(@prefs, "msgs_per_page", $defaults["msgs_per_page_table"],@prefs.msgs_per_page,false) %>
<%= raw select_field_table(@prefs, "theme", $defaults["themes"],$defaults["themes"],false) %>
<%= raw select_field_table(@prefs, "locale", $defaults["locales"],@prefs.locale,false) %>
<%= raw select_field_table(@prefs, "msg_send_type", $defaults["msg_send_type"],@prefs.msg_send_type,false) %>
</div>
<%= raw single_action('save','common','save.png') %>
<div class="params">
<%= raw select_field_table_t(@prefs, "msg_image_view_as", $defaults["msg_image_view_as"],@prefs.msg_image_view_as,false) %>
<%= raw select_field_table(@prefs, "msg_image_thumbnail_size", $defaults["msg_image_thumbnail_size"],@prefs.msg_image_thumbnail_size,false) %>
</div>

View File

@ -0,0 +1,18 @@
= content_for :sidebar do
= render :partial => "sidebar/sidebar"
= content_for :title do
\-
= t(:servers,:scope=>:prefs)
= render :partial => 'common/main_navigation', :locals => { :prefs => :active }
= render :partial => 'common/prefs_navigation', :locals => { :servers => :active }
%table{:class=>"table table-bordered records"}
%thead
%tr
%th
= raw servers_table_header
%tbody
- @servers.each do |s|
= render :partial => 'prefs/server', :locals => { :server => s }

View File

@ -0,0 +1,3 @@
= calendar_square(:month_delta=>-1)
= calendar_square()
= calendar_square(:month_delta=>1)

View File

@ -2,13 +2,14 @@
\-
= t(:login,:scope=>:user)
%form{:class=>"form-horizontal top-pix18",:action=>"#{url_for(:controller => 'user', :action => 'authenticate')}",:method=>"post"}
%form{:class=>"form-horizontal top-pix18",:action=>user_authenticate_path,:method=>"post"}
%fieldset
= render :partial => "common/input_form_field",:locals => { :model => 'user',:attr => 'login'}
= render :partial => "common/input_password_form_field",:locals => { :model => 'user',:attr => 'password'}
.control-group
.controls
= render :partial => "common/button",:locals => { :name=>'login_button', :caption => t(:please_login,:scope=>:user), :icon =>'icon-lock icon-white'}
.controls
= render :partial => "common/button",:locals => { :name=>'login_button', :caption => t(:please_login,:scope=>:user), :icon =>'icon-lock icon-white'}
%hr/

View File

@ -9,7 +9,7 @@ Mailr::Application.configure do
config.action_controller.perform_caching = true
# Disable Rails's static asset server (Apache or nginx will already do this)
config.serve_static_assets = false
config.serve_static_assets = true
# Compress JavaScripts and CSS
config.assets.compress = true

View File

@ -1,7 +1,7 @@
en:
will_paginate:
previous_label: "&#8592; Previous"
next_label: "Next &#8594;"
previous_label: "« Previous"
next_label: "Next »"
page_gap: "&hellip;"
activerecord:
attributes:
@ -44,6 +44,10 @@ en:
to_delete_empty: No folder to delete
can_not_delete: Can not delete folder
was_deleted: Folder was deleted
inbox_name: Inbox
sent_name: Sent
trash_name: Trash
drafts_name: Drafts
message:
messages: Messages
@ -65,3 +69,31 @@ en:
show_hide: Show/Hide
mailr: Mailr
save: Save
common:
false_answer: No
true_answer: Yes
file_format_error: File format error
no_tmp_dir: No temporary directory
must_be_unique: must be unique
some_add_info: some additional info
example: "example:"
create: Create
delete: Delete
mailr: MailR
save: Save
copy: Copy
move: Move
to: to
previous_page: Previous
next_page: Next
bytes: B
kbytes: kB
mbytes: MB
no_data: No data
download: Download
view: Show
version: Version
set: Set
no_file_chosen: No file was chosen
calendar: Calendar

View File

@ -25,9 +25,9 @@ pl:
link: Sznurek
attributes:
link:
name: Nazwa
url: Adres
info: Informacje
goto: Idź do
contact:
nick: Pseudonim
first_name: Imię
@ -93,6 +93,10 @@ pl:
no_entries: Brak sznurków
total_entries: Liczba sznurków
delete_selected: Usuń wybrane
modifying: Modyfikacja sznurka
was_created: Sznurek został utworzony
were_imported: Sznurki zostały zaimportowane
goto: Idź do
prefs:
prefs: Ustawienia
@ -157,6 +161,7 @@ pl:
copy: Skopiuj
trash: Usuń zaznaczone
no_date: Brak daty
no_address: Brak adresu
compose:
compose: Nowa wiadomość
@ -175,6 +180,7 @@ pl:
show:
reply: Odpowiedz
reply_all: Odpowiedz wszystkim
show_header: Pokaż nagłówek
delete: Usuń
reply_string: "Odp: "

View File

@ -9,22 +9,19 @@ Mailr::Application.routes.draw do
match "prefs/identity" => "prefs#identity", :as => :prefs_identity
match "prefs/servers" => "prefs#servers", :as => :prefs_servers
namespace :contacts do
post "ops"
get "export"
end
match "/external" => "contacts#external", :as => :contacts_external
resources :contacts
namespace :links do
namespace :contacts do
post "import_export"
post "ops"
get "export"
end
#match "/external" => "contacts#external", :as => :contacts_external
resources :links
namespace :links do
post "import_export"
#post "ops"
end
namespace :folders do
post "create"
@ -63,6 +60,8 @@ Mailr::Application.routes.draw do
match "/messages/html_body/:id" => 'messages#html_body' , :as => :html_body
match "/messages/attachment/:id/:idx" => 'messages#attachment', :as => :attachment_download
match "/user/autheniticate" => 'user#authenticate', :as => :user_authenticate
match "/user/setup/:login" => 'user#setup'
namespace :user do
get "logout"
post "authenticate"
@ -71,7 +70,8 @@ Mailr::Application.routes.draw do
get "setup"
get "unknown"
end
match "/user/setup/:login" => 'user#setup'
#themes_for_rails

View File

@ -1,10 +1,8 @@
class CreateAllTables < ActiveRecord::Migration
def up
create_table "contacts", :force => true do |t|
t.string "nick"
t.string "name"
t.string "email"
t.string "first_name"
t.string "last_name"
t.string "info"
t.integer "user_id"
t.datetime "created_at"
@ -44,6 +42,8 @@ class CreateAllTables < ActiveRecord::Migration
t.string "msg_id"
t.string "from_addr"
t.string "to_addr"
t.string "cc_addr"
t.string "bcc_addr"
t.string "subject"
t.string "content_type"
t.integer "uid"
@ -91,7 +91,6 @@ class CreateAllTables < ActiveRecord::Migration
create_table :links, :force => true do |t|
t.integer :user_id
t.integer :lgroup_id
t.string :name
t.string :url
t.string :info
end

View File

@ -1,8 +0,0 @@
class AddCcAddrToMessages < ActiveRecord::Migration
def up
add_column :messages,:cc_addr,:string
end
def down
remove_column :messages,:cc_addr
end
end

View File

@ -10,13 +10,11 @@
#
# It's strongly recommended to check this file into your version control system.
ActiveRecord::Schema.define(:version => 20120325115720) do
ActiveRecord::Schema.define(:version => 20120303202800) do
create_table "contacts", :force => true do |t|
t.string "nick"
t.string "name"
t.string "email"
t.string "first_name"
t.string "last_name"
t.string "info"
t.integer "user_id"
t.datetime "created_at"
@ -53,7 +51,6 @@ ActiveRecord::Schema.define(:version => 20120325115720) do
create_table "links", :force => true do |t|
t.integer "user_id"
t.integer "lgroup_id"
t.string "name"
t.string "url"
t.string "info"
end
@ -64,6 +61,8 @@ ActiveRecord::Schema.define(:version => 20120325115720) do
t.string "msg_id"
t.string "from_addr"
t.string "to_addr"
t.string "cc_addr"
t.string "bcc_addr"
t.string "subject"
t.string "content_type"
t.integer "uid"
@ -72,7 +71,6 @@ ActiveRecord::Schema.define(:version => 20120325115720) do
t.datetime "date"
t.datetime "created_at"
t.datetime "updated_at"
t.string "cc_addr"
end
create_table "prefs", :force => true do |t|

View File

@ -1,4 +1,4 @@
namespace :db do
namespace :mailr do
desc "Removes all users data from db"
task :remove_all_data => :environment do