fix ntue new member default non-administrator and announcement image size & file name cannot be null

This commit is contained in:
Spen 2013-10-16 15:08:33 +08:00 committed by Manson Wang
parent 9849b5c7dd
commit 048f67c6da
7 changed files with 40 additions and 21 deletions

View File

@ -7,7 +7,7 @@ class User
mount_uploader :avatar, AvatarUploader
field :admin, :type => Boolean, :default => true
field :admin, :type => Boolean, :default => false
field :active_role
field :user_id
field :sid

View File

@ -23,6 +23,9 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController
def index
email_group_data
# @bulletins = Bulletin.all
# @bulletins = Bulletin.desc("postdate desc")
get_categorys('BulletinCategory',params[:bulletin_category_id])
@ -116,6 +119,9 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController
# POST /bulletins
# POST /bulletins.xml
def create
email_group_data
@tags = get_tags
if params[:bulletin_link]
@ -221,6 +227,8 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController
def update
email_group_data
@bulletin = Bulletin.find(params[:id])
# @bulletin.image.clear if params[:bulletin][:image_del] == '1'

View File

@ -11,4 +11,14 @@ class BulletinFile
belongs_to :bulletin
validate :check_file_title
private
def check_file_title
if self.title.blank?
errors.add( :file, I18n.t("announcement.file_name_not_null"))
end
end
end

View File

@ -22,7 +22,7 @@
<img class="pull-left upload-picture" src="/assets/default-img.png" />
<% end %>
</div>
<span class="alert widgetInfo"><%= t("ad.widget_info_for_ad_image_size", :best_size=> "290px x 150px") %></span>
<span class="alert widgetInfo"><%= t("ad.widget_info_for_ad_image_size", :best_size=> "290px x 230px") %></span>
<div class="controls file-upload input-prepend">
<%= t(:browse) %>
<%= f.file_field :image, :id => "input-upload", :class => '', :onchange => "document.getElementById('fu').innerHTML = this.form.fu.value = this.value;" %>
@ -278,32 +278,29 @@
<div id="content-box">
<hr />
<%#= f.datetime_picker :email_sentdate, :picker_type => 'separated', :label => t("announcement.email_sentdate") %>
<br />
<br />
<%= f.label :email_group ,t("announcement.email_group")%>
<div class="form-inline">
<ul class="nav nav-pills">
<% @email_group_data.collect do |k,v| %>
<li class="pull-left">
<%= check_box_tag 'bulletin[email_group][]', k, (@bulletin.email_group.nil? ? false : @bulletin.email_group.include?(k)), :id => "field-#{k}" %>
<label for="field-<%= k %>"><%= v["name"] %></label>
<%= hidden_field_tag 'bulletin[email_group][]', '' %>
</li>
<% end %>
</ul>
</div>
<%= f.label :email_group ,t("announcement.email_group")%>
<div class="form-inline">
<ul class="nav nav-pills">
<% @email_group_data.collect do |k,v| %>
<li class="pull-left">
<%= check_box_tag 'bulletin[email_group][]', k, (@bulletin.email_group.nil? ? false : @bulletin.email_group.include?(k)), :id => "field-#{k}" %>
<label for="field-<%= k %>"><%= v["name"] %></label>
<%= hidden_field_tag 'bulletin[email_group][]', '' %>
</li>
<% end if !@email_group_data.blank? %>
</ul>
</div>
<%= f.label :other_mailaddress ,"#{t("announcement.other_mailaddress")}(#{t("announcement.other_mailaddress_note")})"%>
<%= f.text_area :other_mailaddress, :class=>"span12", :cols=>"25", :rows=>"10" %>
<%= f.label :other_mailaddress ,"#{t("announcement.other_mailaddress")}(#{t("announcement.other_mailaddress_note")})"%>
<%= f.text_area :other_mailaddress, :class=>"span12", :cols=>"25", :rows=>"10" %>
</div>
</div>
</div>
</div>

View File

@ -1,5 +1,7 @@
<% # encoding: utf-8 %>
<%= f.error_messages %>
<tr id="<%= "bulletin_file_#{form_bulletin_file.id}" if !form_bulletin_file.new_record? %>" class='list_item'>
<td>
<div class="control-group">

View File

@ -25,6 +25,7 @@ en:
file: Attachment
file_description: File Description
file_name: File Name
file_name_not_null: Name cannot be null
frontend:
bulletins: Announcement front-end
search_result: Search result

View File

@ -25,6 +25,7 @@ zh_tw:
file: 附加檔案
file_description: 檔案描述
file_name: 檔案名稱
file_name_not_null: 名稱不得為空值
frontend:
bulletins: 公告前台
search_result: 搜尋結果頁