This commit is contained in:
Manson Wang 2014-02-11 14:18:10 +08:00
parent 112958ac18
commit bf815b168a
4 changed files with 30 additions and 0 deletions

View File

@ -65,6 +65,7 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController
# GET /bulletins/1/edit
def edit
@bulletin = Bulletin.find(params[:id])
@users = @bulletin.get_users
@tags = get_tags
is_authorized_sub_manager = @bulletin.category.auth_sub_manager.authorized_user_ids rescue nil

View File

@ -24,10 +24,13 @@ class Bulletin
field :create_user_id
field :update_user_id, :class_name => "User"
field :user_ids
field :view_count, :type => Integer, :default => 0
field :public, :type => Boolean, :default => true
field :rss_link
mount_uploader :image, ImageUploader
@ -149,6 +152,9 @@ class Bulletin
preview_object
end
def get_users
User.find(self.user_ids) rescue []
end
protected

View File

@ -64,6 +64,14 @@
<%= f.datetime_picker :deadline, :no_label => true %>
</div>
</div>
<!-- Promoter -->
<div class="control-group">
<label class="control-label muted"><%= t(:promoter) %></label>
<div class="controls">
<%= render partial: 'admin/member_selects/selection_box', locals: {field: 'bulletin[user_ids][]', users: @users} %>
</div>
</div>
</div>

View File

@ -36,6 +36,21 @@
</div>
</div>
<% end %>
<% unless @bulletin.rss_link.blank? %>
<div>
<%= link_to t('ntu.rss_origin'), @bulletin.rss_link %>
</div>
<% end %>
</div>
<% unless @bulletin.user_ids.blank? %>
<div class="promoter">
<div>
<%= render partial: 'admin/member_selects/promoter_front', locals: {users: @bulletin.get_users} %>
</div>
</div>
<% end %>
<%= share_links(@bulletin, 'announcement') %>