devel cont

master
Wojciech Todryk 2012-03-26 20:22:01 +02:00
parent 0872730d8d
commit b8eddc8e48
18 changed files with 113 additions and 49 deletions

View File

@ -37,9 +37,13 @@ p.help-block
.custom_pagination
text-align: right
em.current
font-weight: bold
font-size: 16px
a,span,em
line-height: 18px
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05)
margin-bottom: 0
margin-left: 0
border: 1px solid #DDDDDD
padding: 3px
table.records
font-size: 12px

View File

@ -292,7 +292,7 @@ class MessagesOpsController < ApplicationController
@message.body = mail.decoded_and_charseted.gsub(/<\/?[^>]*>/, "")
end
@attachments = []
@operation = :reply
@operation = :reply
render 'messages/compose'
end
###################################### protected section #######################################

View File

@ -33,9 +33,9 @@ module MessagesHelper
#fs[0].size.zero? ? s = fs[1] : s << fs[0] + " <" + fs[1] + ">"
s = h(addr)
return s
when :reply
return h(addr)
end
when :reply
return addr
end
end
def body_formatter(body,op)

View File

@ -8,7 +8,7 @@ class Message < ActiveRecord::Base
#set_primary_key :uid
self.primary_key = :uid
attr_accessible :unseen, :to_addr, :size, :content_type, :folder_id, :subject, :date, :uid, :from_addr, :user_id, :msg_id, :body,:cc_addr,:bcc_addr
attr_accessible :unseen, :to_addr, :size, :content_type, :folder_id, :subject, :date, :uid, :from_addr, :user_id, :msg_id, :body, :cc_addr, :bcc_addr
attr_accessor :body
def self.addr_to_db(addr)

View File

@ -11,7 +11,9 @@ class Prefs < ActiveRecord::Base
:theme => $defaults['theme'],
:locale => $defaults['locale'],
:msgs_per_page => $defaults['msgs_per_page'],
:msg_send_type => $defaults['msg_send_type']
:msg_send_type => $defaults['msg_send_type'],
:msg_image_view_as => 'attachment',
:msg_image_thumbnail_size => '192x144'
)
end
end

View File

@ -0,0 +1,27 @@
- model = eval(object.class.model_name)
- model_string = object.class.model_name.downcase
- label.nil? ? model_label = model.human_attribute_name(attr) : model_label = t(label.to_sym)
- val = value || object.instance_eval(attr) || ""
- if object.errors[attr.to_sym].empty?
- to_class ||= ""
- rows ||= 5
.control-group
%label{:class=>"control-label",:for=>"#{attr}"}
= model_label
.controls
%textarea{:rows=>"#{rows}",:class=>"#{to_class}",:id=>"#{model_string}_#{attr}",:name=>"#{model_string}[#{attr}]"}
= val
%p{:class=>"help-block"}
= t(:example,:scope=>:common)
= example
- else
.control-group.error
%label{:class=>"control-label",:for=>"#{attr}"}
= model_label
.controls
%input{:id=>"#{model_string}_#{attr}",:name=>"#{model_string}[#{attr}]",:value=>"#{val}"}
%span{:class=>"help-inline"}
= object.errors[attr.to_sym].to_s
%p{:class=>"help-block"}
= t(:example,:scope=>:common)
= example

View File

@ -0,0 +1,5 @@
.control-group
%label{:class=>"control-label",:for=>"#{attr}"}
= model_label
.controls
%input{:id=>"#{model_string}_#{attr}",:name=>"#{model_string}[#{attr}]",:type=>"file"}

View File

@ -3,11 +3,12 @@
- label.nil? ? model_label = model.human_attribute_name(attr) : model_label = t(label.to_sym)
- val = value || object.instance_eval(attr) || ""
- if object.errors[attr.to_sym].empty?
- to_class ||= ""
.control-group
%label{:class=>"control-label",:for=>"#{attr}"}
= model_label
.controls
%input{:id=>"#{model_string}_#{attr}",:name=>"#{model_string}[#{attr}]",:value=>"#{val}"}
%input{:class=>"#{to_class}",:id=>"#{model_string}_#{attr}",:name=>"#{model_string}[#{attr}]",:value=>"#{val}"}
%p{:class=>"help-block"}
= t(:example,:scope=>:common)
= example

View File

@ -3,6 +3,6 @@
= render :partial => "common/select_for_folders",:locals => { :label=> t(:parent,:scope=>:folder), :name => "folder", :id => "parent", :collection => @folders, :choice => "", :blank => true}
= render :partial => "common/input_form_field",:locals => { :model => 'folder',:attr => 'target'}
.control-group
.form-actions
.controls
= render :partial => "common/button",:locals => { :name=>:create, :caption => t(:create,:scope=>:common), :icon =>'icon-plus icon-white'}

View File

@ -2,5 +2,5 @@
%fieldset
= render :partial => "common/select_for_folders",:locals => { :label=> t(:to_delete,:scope=>:folder), :name => "folder", :id => "delete", :collection => @folders, :choice => "", :blank => true}
.control-group
.form-actions
.controls
= render :partial => "common/button",:locals => { :name=>:delete, :caption => t(:delete,:scope=>:common), :icon =>'icon-minus icon-white'}

View File

@ -6,6 +6,6 @@
.controls
= render :partial=>"common/multiselect",:locals => {:objects => @folders, :selected_objects => @folders_shown,:style=>"",:id=>"multiselect_form",:name=>"folders_to_show[]",:value=>:id,:joiner=>"",:text=>[:parent,:delim,:name]}
.control-group
.form-actions
.controls
= render :partial => "common/button",:locals => { :name=>:show_hide, :caption => t(:show_hide,:scope=>:folder), :icon =>'icon-eye-open icon-white'}
= render :partial => "common/button",:locals => { :name=>:refresh, :caption => t(:refresh,:scope=>:folder), :icon =>'icon-refresh icon-white'}

View File

@ -5,5 +5,5 @@
= render :partial => "common/select_for_folders",:locals => { :label=> t(:folder,:scope => :folder) + " " + t(:sent_name,:scope=>:folder), :name => "folder", :id => "mailbox_sent", :collection => @folders, :choice => @folder_sent, :blank => true}
= render :partial => "common/select_for_folders",:locals => { :label=> t(:folder,:scope => :folder) + " " + t(:drafts_name,:scope=>:folder), :name => "folder", :id => "mailbox_drafts", :collection => @folders, :choice => @folder_drafts, :blank => true}
.control-group
.form-actions
.controls
= render :partial => "common/button",:locals => { :name=>:set, :caption => t(:set,:scope=>:common), :icon =>'icon-cog icon-white'}

View File

@ -0,0 +1,10 @@
%tr
%td
= check_box_tag "files[]", file_attach[:name]
%td
= file_attach[:name]
%td
= size_formatter(file_attach[:size])
%td
&nbsp;

View File

@ -6,39 +6,45 @@
= render :partial => 'common/main_navigation', :locals => { :compose => :active }
%form{:multipart => 'true',:class=>"form-horizontal",:action=>composed_path,:method=>"post"}
%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 => @user,:attr => 'login',:label => nil,:example => 'joe.doe',:value => params[:user] ? params[:user][:login] : "" }
= 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 => '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?
= hidden_field_tag 'olduid', @olduid
.control-group
.controls
%h1
%small
= t(:attachments,:scope=>:message)
- if not @attachments.size.zero?
%table{:class=>"table table-bordered"}
%tbody
- @attachments.each do |a|
= render :partial => "messages/file_attach", :locals => {:file_attach => a }
= render :partial => "common/button", :locals => {:name=>'delete_marked',
:caption=>t('delete_marked',:scope=>'compose'),
:icon=>'icon-minus icon-white'}
= render :partial => "common/file_select", :locals => { :model_label => t(:select_file,:scope=>:compose),
:model_string => "file",
:attr => "data"}
.control-group
.controls
= render :partial => "common/button", :locals => {:name=>'upload',
:caption=>t('upload',:scope=>'compose'),
:icon=>'icon-upload icon-white'}
.control-group
.controls
= render :partial => "common/button", :locals => {:name=>'sendout',
:caption=>t('sendout',:scope=>'compose'),
:icon=>'icon-envelope icon-white'}
= render :partial => "common/button", :locals => {:name=>'save',
:caption=>t('save',:scope=>'compose'),
:icon=>'icon-folder-open icon-white'}
-#
<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

@ -7,7 +7,7 @@
= render :partial => 'common/main_navigation', :locals => { :show => :active }
%form{:class=>"form-horizontal top-pix18",:action=>"#{messages_ops_multi_path}",:method=>"post"}
%form{:class=>"form-horizontal top-pix18",:action=>"#{messages_ops_single_path}",:method=>"post"}
= render :partial => 'header'
= render :partial => 'single_ops'
- if not @attachments.size.zero?

View File

@ -1,7 +1,7 @@
pl:
will_paginate:
previous_label: "&#8592; Poprzednia"
next_label: "Następna &#8594;"
previous_label: "« Poprzednia"
next_label: "Następna »"
page_gap: "&hellip;"
date:
day_names: [Niedziela, Poniedziałek, Wtorek, Środa, Czwartek, Piątek, Sobota]
@ -170,7 +170,7 @@ pl:
select_file: Wybierz plik
delete_marked: Usuń zaznaczone
upload: Wyślij plik
sendout: Wyślij
sendout: Wyślij wiadomość
save: Zapisz w katalogu roboczym
show:

View File

@ -0,0 +1,8 @@
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,7 +10,7 @@
#
# It's strongly recommended to check this file into your version control system.
ActiveRecord::Schema.define(:version => 20120303202800) do
ActiveRecord::Schema.define(:version => 20120325115720) do
create_table "contacts", :force => true do |t|
t.string "nick"
@ -72,6 +72,7 @@ ActiveRecord::Schema.define(:version => 20120303202800) do
t.datetime "date"
t.datetime "created_at"
t.datetime "updated_at"
t.string "cc_addr"
end
create_table "prefs", :force => true do |t|