A modal view for approval user

This commit is contained in:
Matthew K. Fu JuYuan 2012-04-25 17:08:51 +08:00
parent b8e54bf0c1
commit 8785418ec1
11 changed files with 61 additions and 71 deletions

View File

@ -4,7 +4,7 @@
$(document).ready(function() { $(document).ready(function() {
$("a.preview_trigger").click(function(){ $("a.preview_trigger").click(function(){
$(this).after("<span id='show_preview'></span>"); $("#main-wrap").after("<span id='show_preview'></span>");
$.ajax({ $.ajax({
type: 'PUT', type: 'PUT',
url:$(this).attr("href"), url:$(this).attr("href"),

View File

@ -28,6 +28,10 @@ class Panel::Announcement::BackEnd::ApprovalsController < OrbitBackendControlle
def update_setting def update_setting
end end
def user_list
@bulletin_category = BulletinCategory.find params[:category_id]
end
# def index # def index
# get_categorys(params[:bulletin_category_id]) # get_categorys(params[:bulletin_category_id])
# #

View File

@ -1,15 +0,0 @@
<h1><%= bulletin_category.key %></h1>
<table>
<tr>
<th><%= t('bulletin.status') %></th>
<th><%= t('bulletin.category') %></th>
<th><%= t('bulletin.title') %></th>
<th><%= t('bulletin.postdate') %></th>
<th><%= t('bulletin.deadline') %></th>
<th><%= t('bulletin.action') %></th>
</tr>
<% bulletin_category.bulletins.each do |post| %>
<%= render :partial => 'panel/announcement/back_end/bulletins/bulletins', :locals => {:post => post,:approval_allow=>true} %>
<% end %>
</table>

View File

@ -0,0 +1,44 @@
<% if bulletin_category -%>
<div class="modal hide fade in" id="bulletin_category-<%=bulletin_category.id%>">
<div class="modal-header">
<a class="close" data-dismiss="modal">×</a>
<h3><%= t("announcement.bulletin.approval_user_list") %></h3>
</div>
<div class="modal-body">
<div class="clear">
<% bulletin_category.object_auths.where(title: 'fact_check').first.auth_users.each do |user| %>
<div class="checkbox clear checked">
<div class='member-avatar'>
<% if user.avatar? %>
<%= image_tag(user.avatar.thumb.url,:class => "member-img") %>
<% else %>
<%= image_tag "person.png",:class => "member-img" %>
<% end %>
</div>
<%= label_tag "lab-user-#{user.id}", (user.name rescue ''),:class=>"member-name",:id=>nil -%>
</div>
<% end -%>
<divl>
</div>
<div class="modal-footer">
<a href="#" class="btn" data-dismiss="modal"><%= t("modal.close") %></a>
</div>
<div>
<script type="text/javascript" src="/static/kernel.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$("#bulletin_category-<%=bulletin_category.id%>").on("show", function () {
});
$(".modal").on("hidden", function () {
$("#show_preview").remove();
});
});
</script>
</div>
</div>
<% end -%>

View File

@ -1,50 +0,0 @@
<%= render 'panel/announcement/back_end/bulletins/filter' %>
<table id="bulettin_sort_list" class="table main-list">
<%= render 'panel/announcement/back_end/bulletins/bulletins' %>
</table>
<div class="form-actions">
<%= link_to content_tag(:i, nil, :class => 'icon-plus icon-white') + t('admin.add'), new_panel_announcement_back_end_bulletin_path, :class => 'btn btn-primary' %>
</div>
<!--
<% content_for :secondary do %>
<%#= render :partial => '/panel/announcement/back_end/announcement_secondary' %>
<% end -%>
<%= flash_messages %>
<br />
<br />
<br />
<br />
<br />
<fieldset><legend><%= t('bulletin.search') %></legend>
<%= form_for :bulletin, :action => 'search', :method => 'get', :url => panel_announcement_back_end_bulletins_path do |f| %>
<%#= f.select :bulletin_category_id, @bulletin_categorys.collect {|t| [ t.i18n_variable[I18n.locale], t.id ] },{ :include_blank => t('bulletin.select') }%>
Category <%#= select_tag "category_id", options_for_select(@bulletin_categorys.collect{|t| [t.i18n_variable[I18n.locale], t.id]}), :prompt => t('bulletin.select') %>
KeyWord <%#= text_field_tag :search, params[:search], :id => 'search_field' %>
<%= submit_tag "Search", :name => nil %>
<% end %>
</fieldset>
<br />
<br />
<h1><%= t('bulletin.list_announcement') %></h1>
<div id="check_block">
<h1>Check Please</h1>
<%#= render :partial => "list_table", :collection => @bulletin_categorys_check,:as => :bulletin_category%>
</div>
<br />
-->

View File

@ -4,19 +4,23 @@
<% content_for :page_specific_javascript do %> <% content_for :page_specific_javascript do %>
<%= javascript_include_tag "inc/permission-checkbox" %> <%= javascript_include_tag "inc/permission-checkbox" %>
<%= javascript_include_tag "inc/search" %> <%= javascript_include_tag "inc/search" %>
<%= javascript_include_tag "inc/modal-preview" %>
<% end %> <% end %>
<%#= label_tag :fact_check_setting, t("announcement.bulletin.fact_check_setting") %> <%#= label_tag :fact_check_setting, t("announcement.bulletin.fact_check_setting") %>
<%= form_tag('', :remote => true) %> <%= form_tag('', :remote => true) %>
<div class="subnav"> <div class="subnav clear">
<ul class="nav nav-pills filter"> <ul class="nav nav-pills filter pull-left">
<li class="accordion-group"> <li class="accordion-group">
<div class="form-search" style="margin: 5px 10px;"> <div class="form-search" style="margin: 5px 10px;">
<%= label_tag :category, t("announcement.bulletin.category") %> <%= label_tag :category, t("announcement.bulletin.category") %>
<%= select_tag "category_id", options_from_collection_for_select(@bulletin_categorys, "id", "key") %> <%= select_tag "category_id", options_from_collection_for_select(@bulletin_categorys, "id", "key") %>
<%= search_field_tag 'user_filter' %> <%= search_field_tag 'user_filter' %>
</div> </div>
</li> </li>
</ul> </ul>
<%= link_to t("announcement.bulletin.approval_user_list"), panel_announcement_back_end_approval_user_list_path , :class=>'preview_trigger btn btn-success pull-right'%>
</div> </div>
<%#= label_tag :role, t("admin.roles") %> <%#= label_tag :role, t("admin.roles") %>
<div class="clear"> <div class="clear">

View File

@ -0,0 +1,2 @@
$('#show_preview').html("<%= escape_javascript(render(:partial => 'modal_list',:locals => {:bulletin_category => @bulletin_category})) %>");
var start_modal_with_id = "bulletin_category-<%=@bulletin_category.id%>"

View File

@ -77,7 +77,7 @@ en:
approval_pending: 'Pending' approval_pending: 'Pending'
approval_pass: 'Pass' approval_pass: 'Pass'
approval_setting_window_title: 'Unit' approval_setting_window_title: 'Unit'
approval_user_list: 'Approval Users'
# admin: # admin:
# action: Action # action: Action
# add_language: Add language # add_language: Add language

View File

@ -59,7 +59,7 @@ zh_tw:
approval_pass: '通過' approval_pass: '通過'
approval_not_pass_reason: '不通過原因' approval_not_pass_reason: '不通過原因'
approval_setting_window_title: '單位' approval_setting_window_title: '單位'
approval_user_list: '審核者'
bulletin: bulletin:
last_modified: 最後修改於 last_modified: 最後修改於
tags: 標籤 tags: 標籤

View File

@ -3,7 +3,8 @@ Rails.application.routes.draw do
namespace :announcement do namespace :announcement do
namespace :back_end do namespace :back_end do
match 'public' => "announcements#public",:as => :public match 'public' => "announcements#public",:as => :public
match 'approval_setting' => "approvals#setting" ,:as => :approval_setting match 'approval_setting' => "approvals#setting" ,:as => :approval_setting,:via => :get
match 'approval_setting' => "approvals#user_list" ,:as => :approval_user_list,:via => :put
match 'update_setting' => "approvals#update_setting" ,:as => :approval_update_setting match 'update_setting' => "approvals#update_setting" ,:as => :approval_update_setting
resources :bulletins do resources :bulletins do