Tags & Categories
This commit is contained in:
parent
678327686f
commit
4f25ba67cb
|
@ -10,7 +10,7 @@ class Admin::AnnouncementsController < OrbitAdminController
|
|||
|
||||
def index
|
||||
@tags = @module_app.tags
|
||||
@categories = @module_app.categories
|
||||
@categories = @module_app.categories.enabled
|
||||
|
||||
@filter_fields = {
|
||||
:status=>[{:title=>"is_top",:id=>"is_top"},{:title=>"is_hot",:id=>"is_hot"},{:title=>"is_hidden",:id=>"is_hidden"}],
|
||||
|
@ -58,7 +58,7 @@ class Admin::AnnouncementsController < OrbitAdminController
|
|||
|
||||
def new
|
||||
@tags =@module_app.tags
|
||||
@categories = @module_app.categories
|
||||
@categories = @module_app.categories.enabled
|
||||
@statuses = []
|
||||
@bulletin = Bulletin.new
|
||||
end
|
||||
|
@ -73,7 +73,7 @@ class Admin::AnnouncementsController < OrbitAdminController
|
|||
|
||||
def edit
|
||||
@tags =@module_app.tags
|
||||
@categories = @module_app.categories
|
||||
@categories = @module_app.categories.enabled
|
||||
@statuses = []
|
||||
end
|
||||
|
||||
|
|
|
@ -38,11 +38,6 @@ class Bulletin
|
|||
self.update_user_id = user.id
|
||||
end
|
||||
|
||||
def self.with_status(status)
|
||||
status = [status].flatten
|
||||
self.any_of(status.map{|s| {s.to_sym=>true}})
|
||||
end
|
||||
|
||||
def self.can_display()
|
||||
self.any_of({:postdate.lt=>Time.now, :deadline.gt=>Time.now},{:postdate.lt=>Time.now, :deadline=>nil})
|
||||
end
|
||||
|
|
|
@ -36,7 +36,7 @@
|
|||
<div class="control-group">
|
||||
<label class="control-label muted"><%= t(:category) %></label>
|
||||
<div class="controls">
|
||||
<%= f.select :category_id, @categories.collect{|t| [ t.title, t.id ]} %>
|
||||
<%= select_category(f, @module_app) %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
@ -58,7 +58,6 @@
|
|||
</div>
|
||||
|
||||
<!-- Status Module -->
|
||||
<%# if show_form_status_field(@bulletin) %>
|
||||
<div class="tab-pane fade" id="status">
|
||||
|
||||
<!-- Status -->
|
||||
|
@ -82,19 +81,10 @@
|
|||
|
||||
<!-- Tag Module -->
|
||||
<div class="tab-pane fade" id="tag">
|
||||
|
||||
<!-- Tag -->
|
||||
<div class="control-group">
|
||||
<label class="control-label muted"><%= t(:tags) %></label>
|
||||
<div class="controls" data-toggle="buttons-checkbox">
|
||||
<% @tags.each do |tag| %>
|
||||
<label class="checkbox inline btn <%= 'active' if @bulletin.tags.include?(tag) %>">
|
||||
<%= check_box_tag 'bulletin[tags][]', tag.id, @bulletin.tags.include?(tag) %> <%= tag.name %>
|
||||
</label>
|
||||
<% end %>
|
||||
</div>
|
||||
<%= select_tag(f, @module_app, @bulletin) %>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<!-- Images Module -->
|
||||
|
|
|
@ -12,29 +12,33 @@ module Announcement
|
|||
side_bar do
|
||||
head_label_i18n 'announcement.announcement', icon_class: "icons-megaphone"
|
||||
available_for [:admin,:manager,:sub_manager]
|
||||
active_for_controllers ({:private=>['announcements']})
|
||||
active_for_controllers (['admin/announcements'])
|
||||
head_link_path "admin_announcements_path"
|
||||
|
||||
context_link 'announcement.all_articles',
|
||||
:link_path=>"admin_announcements_path" ,
|
||||
:priority=>1,
|
||||
:active_for_action=>{'admin/announcement'=>'index'},
|
||||
:active_for_action=>{'admin/announcements'=>'index'},
|
||||
:available_for => [:all]
|
||||
context_link 'announcement.add_new',
|
||||
:link_path=>"new_admin_announcement_path" ,
|
||||
:priority=>2,
|
||||
:active_for_action=>{'admin/announcement'=>'new'},
|
||||
:active_for_action=>{'admin/announcements'=>'new'},
|
||||
:available_for => [:sub_manager]
|
||||
# context_link 'announcement.categories',
|
||||
# :link_path=>"admin_announcement_path(get_module_app)" ,
|
||||
# :priority=>3,
|
||||
# :active_for_category => 'Announcement',
|
||||
# :available_for => [:manager]
|
||||
# context_link 'tags',
|
||||
# :link_path=>"admin_announcement_path(module_app_id: get_module_app)" ,
|
||||
# :priority=>4,
|
||||
# :active_for_tag => 'Announcement',
|
||||
# :available_for => [:manager]
|
||||
context_link 'announcement.categories',
|
||||
:link_path=>"admin_module_app_categories_path" ,
|
||||
:link_arg=>{:module_app_id=>get_module_app.id},
|
||||
:priority=>3,
|
||||
:active_for_action=>{'admin/announcements'=>'categories'},
|
||||
:active_for_category => 'Announcement',
|
||||
:available_for => [:manager]
|
||||
context_link 'tags',
|
||||
:link_path=>"admin_module_app_tags_path" ,
|
||||
:link_arg=>{:module_app_id=>get_module_app.id},
|
||||
:priority=>4,
|
||||
:active_for_action=>{'admin/announcements'=>'tags'},
|
||||
:active_for_tag => 'Announcement',
|
||||
:available_for => [:manager]
|
||||
end
|
||||
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue