fix ntue new member default non-administrator and announcement image size & file name cannot be null
This commit is contained in:
		
							parent
							
								
									9849b5c7dd
								
							
						
					
					
						commit
						048f67c6da
					
				| 
						 | 
					@ -7,7 +7,7 @@ class User
 | 
				
			||||||
  
 | 
					  
 | 
				
			||||||
  mount_uploader :avatar, AvatarUploader
 | 
					  mount_uploader :avatar, AvatarUploader
 | 
				
			||||||
  
 | 
					  
 | 
				
			||||||
  field :admin, :type => Boolean, :default => true
 | 
					  field :admin, :type => Boolean, :default => false
 | 
				
			||||||
  field :active_role
 | 
					  field :active_role
 | 
				
			||||||
  field :user_id
 | 
					  field :user_id
 | 
				
			||||||
  field :sid
 | 
					  field :sid
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -23,6 +23,9 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  def index
 | 
					  def index
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    email_group_data
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    # @bulletins = Bulletin.all
 | 
					    # @bulletins = Bulletin.all
 | 
				
			||||||
    # @bulletins = Bulletin.desc("postdate desc")
 | 
					    # @bulletins = Bulletin.desc("postdate desc")
 | 
				
			||||||
    get_categorys('BulletinCategory',params[:bulletin_category_id])
 | 
					    get_categorys('BulletinCategory',params[:bulletin_category_id])
 | 
				
			||||||
| 
						 | 
					@ -116,6 +119,9 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController
 | 
				
			||||||
  # POST /bulletins
 | 
					  # POST /bulletins
 | 
				
			||||||
  # POST /bulletins.xml
 | 
					  # POST /bulletins.xml
 | 
				
			||||||
  def create
 | 
					  def create
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    email_group_data
 | 
				
			||||||
 | 
					    
 | 
				
			||||||
    @tags = get_tags
 | 
					    @tags = get_tags
 | 
				
			||||||
    if params[:bulletin_link]
 | 
					    if params[:bulletin_link]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -221,6 +227,8 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  def update
 | 
					  def update
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    email_group_data
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      @bulletin = Bulletin.find(params[:id])
 | 
					      @bulletin = Bulletin.find(params[:id])
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      # @bulletin.image.clear if params[:bulletin][:image_del] == '1'
 | 
					      # @bulletin.image.clear if params[:bulletin][:image_del] == '1'
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -11,4 +11,14 @@ class BulletinFile
 | 
				
			||||||
  
 | 
					  
 | 
				
			||||||
  belongs_to :bulletin
 | 
					  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
 | 
					end
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -22,7 +22,7 @@
 | 
				
			||||||
              	<img class="pull-left upload-picture" src="/assets/default-img.png" />
 | 
					              	<img class="pull-left upload-picture" src="/assets/default-img.png" />
 | 
				
			||||||
              <% end %>
 | 
					              <% end %>
 | 
				
			||||||
          </div>
 | 
					          </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">
 | 
										<div class="controls file-upload input-prepend">
 | 
				
			||||||
						<%= t(:browse) %>
 | 
											<%= t(:browse) %>
 | 
				
			||||||
						<%= f.file_field :image, :id => "input-upload", :class => '', :onchange => "document.getElementById('fu').innerHTML = this.form.fu.value = this.value;" %>
 | 
											<%= 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">
 | 
					                    <div id="content-box">
 | 
				
			||||||
                        <hr />
 | 
					                        <hr />
 | 
				
			||||||
 | 
					
 | 
				
			||||||
												<%#= f.datetime_picker :email_sentdate, :picker_type => 'separated', :label => t("announcement.email_sentdate") %>
 | 
					 | 
				
			||||||
										
 | 
															
 | 
				
			||||||
												<br /> 
 | 
											<br /> 
 | 
				
			||||||
 | 
					
 | 
				
			||||||
				                <%= f.label :email_group ,t("announcement.email_group")%>
 | 
							                <%= f.label :email_group ,t("announcement.email_group")%>
 | 
				
			||||||
				                <div class="form-inline">
 | 
							                <div class="form-inline">
 | 
				
			||||||
				                    <ul class="nav nav-pills">
 | 
							                    <ul class="nav nav-pills">
 | 
				
			||||||
														<% @email_group_data.collect do |k,v| %>
 | 
													<% @email_group_data.collect do |k,v| %>
 | 
				
			||||||
															<li class="pull-left">
 | 
														<li class="pull-left">
 | 
				
			||||||
															<%= check_box_tag 'bulletin[email_group][]', k, (@bulletin.email_group.nil? ?  false : @bulletin.email_group.include?(k)), :id => "field-#{k}" %>
 | 
														<%= 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>
 | 
														<label for="field-<%= k %>"><%= v["name"] %></label>
 | 
				
			||||||
															<%= hidden_field_tag 'bulletin[email_group][]', '' %>
 | 
														<%= hidden_field_tag 'bulletin[email_group][]', '' %>
 | 
				
			||||||
															</li>
 | 
														</li>
 | 
				
			||||||
														<% end %>
 | 
													<% end if !@email_group_data.blank? %>
 | 
				
			||||||
				                    </ul>
 | 
							                    </ul>
 | 
				
			||||||
				                </div>
 | 
							                </div>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
										    <%= f.label :other_mailaddress ,"#{t("announcement.other_mailaddress")}(#{t("announcement.other_mailaddress_note")})"%>
 | 
										    <%= 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.text_area :other_mailaddress, :class=>"span12", :cols=>"25", :rows=>"10" %>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                    </div>
 | 
					                    </div>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                    
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                </div>
 | 
					                </div>
 | 
				
			||||||
            </div>
 | 
					            </div>
 | 
				
			||||||
        </div>
 | 
					        </div>
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,5 +1,7 @@
 | 
				
			||||||
<% # encoding: utf-8 %>
 | 
					<% # encoding: utf-8 %>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					<%= f.error_messages %>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
<tr id="<%= "bulletin_file_#{form_bulletin_file.id}" if !form_bulletin_file.new_record? %>" class='list_item'>
 | 
					<tr id="<%= "bulletin_file_#{form_bulletin_file.id}" if !form_bulletin_file.new_record? %>" class='list_item'>
 | 
				
			||||||
  <td>
 | 
					  <td>
 | 
				
			||||||
    <div class="control-group">
 | 
					    <div class="control-group">
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -25,6 +25,7 @@ en:
 | 
				
			||||||
    file: Attachment
 | 
					    file: Attachment
 | 
				
			||||||
    file_description: File Description
 | 
					    file_description: File Description
 | 
				
			||||||
    file_name: File Name
 | 
					    file_name: File Name
 | 
				
			||||||
 | 
					    file_name_not_null: Name cannot be null
 | 
				
			||||||
    frontend:
 | 
					    frontend:
 | 
				
			||||||
      bulletins: Announcement front-end
 | 
					      bulletins: Announcement front-end
 | 
				
			||||||
      search_result: Search result
 | 
					      search_result: Search result
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -25,6 +25,7 @@ zh_tw:
 | 
				
			||||||
    file: 附加檔案
 | 
					    file: 附加檔案
 | 
				
			||||||
    file_description: 檔案描述
 | 
					    file_description: 檔案描述
 | 
				
			||||||
    file_name: 檔案名稱
 | 
					    file_name: 檔案名稱
 | 
				
			||||||
 | 
					    file_name_not_null: 名稱不得為空值
 | 
				
			||||||
    frontend:
 | 
					    frontend:
 | 
				
			||||||
      bulletins: 公告前台
 | 
					      bulletins: 公告前台
 | 
				
			||||||
      search_result: 搜尋結果頁
 | 
					      search_result: 搜尋結果頁
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue