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
 | 
			
		||||
  
 | 
			
		||||
  field :admin, :type => Boolean, :default => true
 | 
			
		||||
  field :admin, :type => Boolean, :default => false
 | 
			
		||||
  field :active_role
 | 
			
		||||
  field :user_id
 | 
			
		||||
  field :sid
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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'
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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,7 +278,6 @@
 | 
			
		|||
                    <div id="content-box">
 | 
			
		||||
                        <hr />
 | 
			
		||||
 | 
			
		||||
												<%#= f.datetime_picker :email_sentdate, :picker_type => 'separated', :label => t("announcement.email_sentdate") %>
 | 
			
		||||
										
 | 
			
		||||
						<br /> 
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -291,7 +290,7 @@
 | 
			
		|||
									<label for="field-<%= k %>"><%= v["name"] %></label>
 | 
			
		||||
									<%= hidden_field_tag 'bulletin[email_group][]', '' %>
 | 
			
		||||
									</li>
 | 
			
		||||
														<% end %>
 | 
			
		||||
								<% end if !@email_group_data.blank? %>
 | 
			
		||||
		                    </ul>
 | 
			
		||||
		                </div>
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -302,8 +301,6 @@
 | 
			
		|||
                    </div>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
                    
 | 
			
		||||
 | 
			
		||||
                </div>
 | 
			
		||||
            </div>
 | 
			
		||||
        </div>
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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">
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -25,6 +25,7 @@ zh_tw:
 | 
			
		|||
    file: 附加檔案
 | 
			
		||||
    file_description: 檔案描述
 | 
			
		||||
    file_name: 檔案名稱
 | 
			
		||||
    file_name_not_null: 名稱不得為空值
 | 
			
		||||
    frontend:
 | 
			
		||||
      bulletins: 公告前台
 | 
			
		||||
      search_result: 搜尋結果頁
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue