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