diff --git a/app/assets/javascripts/.DS_Store b/app/assets/javascripts/.DS_Store
index 51582ef8..9134f2a5 100644
Binary files a/app/assets/javascripts/.DS_Store and b/app/assets/javascripts/.DS_Store differ
diff --git a/app/assets/javascripts/inc/search.js b/app/assets/javascripts/inc/search.js
deleted file mode 100644
index 70507fc6..00000000
--- a/app/assets/javascripts/inc/search.js
+++ /dev/null
@@ -1,34 +0,0 @@
-// JavaScript Document
-
-// can copy code to any of ur desired javascsript
-
-//extended jquery to search fast.
-$.extend($.expr[':'], {
- 'containsi': function (elem, i, match, array) {
- return (elem.textContent || elem.innerText || '').toLowerCase().indexOf((match[3] || "").toLowerCase()) >= 0;
- }
-});
-var interval,sval;
-$(document).ready(function(){
- $("#user_filter").keyup(function(){
- sval = $(this).val();
- $(".checkbox").popover("hide");
- $("div.checkblock").hide();
- clearInterval(interval);
- interval = setInterval(waitForSearch,1000);
- })
-})
-var waitForSearch = function(){
- if(sval){
- var totalfoundbyname = $("div#users_checkbox_ary label.member-name:containsi("+sval+")").length
- if(totalfoundbyname!=0){
- $("div#users_checkbox_ary label.member-name:containsi("+sval+")").parent().parent().show();
- }else if(totalfoundbyname==0){
- $("div#users_checkbox_ary div.for_unit:containsi("+sval+")").parent().show();
- }
- }else{
- $(".checkbox").popover('hide');
- $("div.checkblock").show();
- }
- clearInterval(interval);
-}
\ No newline at end of file
diff --git a/app/controllers/admin/module_apps_controller.rb b/app/controllers/admin/module_apps_controller.rb
index e44be291..c6a8d2b2 100644
--- a/app/controllers/admin/module_apps_controller.rb
+++ b/app/controllers/admin/module_apps_controller.rb
@@ -17,6 +17,10 @@ class Admin::ModuleAppsController < ApplicationController
end
end
+ def module_auth_proc
+ @module_app = ModuleApp.find(params[:id])
+ end
+
def edit
@module_app = ModuleApp.find(params[:id])
end
diff --git a/app/controllers/admin/new_interface_module_apps_controller.rb b/app/controllers/admin/new_interface_module_apps_controller.rb
new file mode 100644
index 00000000..6603334c
--- /dev/null
+++ b/app/controllers/admin/new_interface_module_apps_controller.rb
@@ -0,0 +1,66 @@
+class Admin::NewInterfaceModuleAppsController < ApplicationController
+ before_filter :authenticate_user!
+ before_filter :is_admin?
+ include AdminHelper
+
+ layout "new_admin"
+
+ def setting
+ @sys_users = User.all
+ @module_app = ModuleApp.find(params[:module_app_id])
+ @options_from_collection_for_select_bulletin_categorys = [@module_app].collect{|ma| [ma.title,ma.id] }
+ # if params.has_key? :category
+ # @bulletin_category = BulletinCategory.find params[:category][:id]
+ # else
+ # @bulletin_category = @bulletin_categorys.first
+ # end
+ @users_array = @module_app.managing_users rescue []
+
+ respond_to do |format|
+ format.html
+ format.js
+ end
+ end
+
+ def update_setting
+ module_app = update_setting_by_params
+ if module_app.save!
+ flash[:notice] = "Update Done"
+ else
+ flash[:notice] = "Update Failed"
+ end
+ end
+
+ def user_list
+ @module_app = ModuleApp.find params[:module_app][:id]
+ end
+
+ protected
+ def update_setting_by_params
+ ma = ModuleApp.find params[:module_app][:id]
+ user_sat = User.find params[:users].keys
+ users_to_new = user_sat - ma.managing_users
+ users_to_remove = ma.managing_users - user_sat
+
+ users_to_new.each do |new_user|
+ ma.assign_manager(new_user,current_user)
+ end
+
+ users_to_remove.each do |remove_user|
+ ma.remove_manager(remove_user)
+ end
+ ma
+ end
+
+ def get_categorys(id = nil)
+ @bulletin_categorys = []
+ if(is_manager? || is_admin?)
+ @bulletin_categorys = (id ? BulletinCategory.find(id).to_a : BulletinCategory.excludes('disabled' => true))
+ elsif is_sub_manager?
+ @bulletin_categorys = BulletinCategory.authed_for_user(current_user,'submit_new')
+ end
+ end
+
+
+
+end
\ No newline at end of file
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index 74d3e662..844fbe14 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -68,9 +68,9 @@ module ApplicationHelper
end
end
- def active_sys_call_for_app(controller_name,action_name,app_title)
+ def active_sys_call_for_app(controller_name,action_name,app_title,field = :id)
unless active_for_action(controller_name,action_name).nil?
- app = ModuleApp.find params[:id]
+ app = ModuleApp.find params[field]
app.title == app_title ? 'active' : nil
else
nil
diff --git a/app/views/admin/new_interface_module_apps/_modal_list.html.erb b/app/views/admin/new_interface_module_apps/_modal_list.html.erb
new file mode 100644
index 00000000..b5b0ebcd
--- /dev/null
+++ b/app/views/admin/new_interface_module_apps/_modal_list.html.erb
@@ -0,0 +1,42 @@
+<% if module_app -%>
+
+
+
+
+
+ <% module_app.managing_users.each do |user| %>
+
+
+ <% if user.avatar? %>
+ <%= image_tag(user.avatar.thumb.url,:class => "member-img") %>
+ <% else %>
+ <%= image_tag "person.png",:class => "member-img" %>
+ <% end %>
+
+ <%= label_tag "lab-user-#{user.id}", (user.name rescue ''),:class=>"member-name",:id=>nil -%>
+
+ <% end -%>
+
+
+
+
+
+
+
+
+
+<% end -%>
\ No newline at end of file
diff --git a/app/views/admin/new_interface_module_apps/_privilege_user.html.erb b/app/views/admin/new_interface_module_apps/_privilege_user.html.erb
new file mode 100644
index 00000000..90f5cb65
--- /dev/null
+++ b/app/views/admin/new_interface_module_apps/_privilege_user.html.erb
@@ -0,0 +1,25 @@
+<%= content_tag :div ,:id => "users_checkbox_ary",:class => 'clear' do -%>
+ <% @sys_users.each do |sys_user| -%>
+
+
+
+ <% sys_user.sub_roles.each do |sr| %>
+
<%= sr.key %>
+ <% end %>
+ <%= content_tag :div,:data=>{'original-title'=>t('announcement.bulletin.approval_setting_window_title'),:content => "#{sys_user.sub_roles.collect{|sr| sr.i18n_variable[I18n.locale]}.join(',')}"},:class=>"checkbox clear" do %>
+
+
+
+ <% if sys_user.avatar? %>
+ <%= image_tag(sys_user.avatar.thumb.url,:class => "member-img") %>
+ <% else %>
+ <%= image_tag "person.png",:class => "member-img" %>
+ <% end %>
+
+ <%= label_tag "lab-user-#{sys_user.id}", (sys_user.name rescue ''),:class=>"member-name",:id=>nil -%>
+ <%= check_box_tag "[users][#{sys_user.id}]", 'true',users.include?(sys_user),:class => "check" -%>
+ <%end -%>
+
+
+ <% end -%>
+<% end -%>
\ No newline at end of file
diff --git a/app/views/admin/new_interface_module_apps/setting.html.erb b/app/views/admin/new_interface_module_apps/setting.html.erb
new file mode 100644
index 00000000..7d1179f0
--- /dev/null
+++ b/app/views/admin/new_interface_module_apps/setting.html.erb
@@ -0,0 +1,56 @@
+<% content_for :page_specific_css do %>
+ <%= stylesheet_link_tag "inc/permission-checkbox" %>
+<% end %>
+<% content_for :page_specific_javascript do %>
+ <%= javascript_include_tag "inc/permission-checkbox" %>
+ <%= javascript_include_tag "inc/search" %>
+ <%= javascript_include_tag "inc/modal-preview" %>
+<% end %>
+<%#= label_tag :fact_check_setting, t("announcement.bulletin.fact_check_setting") %>
+<%= form_tag('', :remote => true,:class => "prevent_enter_submit_form") %>
+
+
+ -
+
+ <%= label_tag :module, t("module") %>
+ <%= select "module_app",'id',@options_from_collection_for_select_bulletin_categorys %>
+ <%= search_field_tag 'user_filter' %>
+
+
+
+
+ <%= link_to t("admin.user_role.auth.manager"), admin_module_app_manager_auth_show_path , :class=>'preview_trigger btn btn-success pull-right'%>
+
+
+<%#= label_tag :role, t("admin.roles") %>
+
+<%= content_tag :div do -%>
+ <% form_tag admin_module_app_manager_auth_proc_path do %>
+ <%= render :partial => "privilege_user", :locals => {:users => @users_array} %>
+
+ <% end -%>
+<% end -%>
+
+
+
\ No newline at end of file
diff --git a/app/views/admin/new_interface_module_apps/setting.js.erb b/app/views/admin/new_interface_module_apps/setting.js.erb
new file mode 100644
index 00000000..0ca148da
--- /dev/null
+++ b/app/views/admin/new_interface_module_apps/setting.js.erb
@@ -0,0 +1,2 @@
+$("#users_checkbox_ary").replaceWith('<%= escape_javascript(render :partial => "privilege_user", :locals => {:users => @users_array})%>');
+permissionCheckbox();
\ No newline at end of file
diff --git a/app/views/admin/new_interface_module_apps/update_setting.js.erb b/app/views/admin/new_interface_module_apps/update_setting.js.erb
new file mode 100644
index 00000000..7486000a
--- /dev/null
+++ b/app/views/admin/new_interface_module_apps/update_setting.js.erb
@@ -0,0 +1 @@
+alert( "<% flash.each do |key, msg| %><%= msg %><% end%>");
\ No newline at end of file
diff --git a/app/views/admin/new_interface_module_apps/user_list.js.erb b/app/views/admin/new_interface_module_apps/user_list.js.erb
new file mode 100644
index 00000000..7caf1e39
--- /dev/null
+++ b/app/views/admin/new_interface_module_apps/user_list.js.erb
@@ -0,0 +1,2 @@
+$('#show_preview').html("<%= escape_javascript(render(:partial => 'modal_list',:locals => {:module_app => @module_app})) %>");
+var start_modal_with_id = "module_app-<%=@module_app.id%>"
\ No newline at end of file
diff --git a/app/views/layouts/_side_bar.html.erb b/app/views/layouts/_side_bar.html.erb
index e9417091..72baca6b 100644
--- a/app/views/layouts/_side_bar.html.erb
+++ b/app/views/layouts/_side_bar.html.erb
@@ -5,7 +5,7 @@
<%= javascript_include_tag "/static/kernel.js" %>
<% end %>
-<%= content_tag :li, :class => active_for_controllers('bulletins', '/panel/announcement/back_end/tags', 'bulletin_categorys', 'approvals','bulletin_category_setting') || active_sys_call_for_app('module_apps','edit','Announcement') do -%>
+<%= content_tag :li, :class => (active_for_controllers('bulletins', '/panel/announcement/back_end/tags', 'bulletin_categorys', 'approvals') || active_sys_call_for_app('new_interface_module_apps','setting','Announcement',:module_app_id) ) do -%>
<%= link_to content_tag(:i, nil, :class => 'icons-announcement') + t('admin.announcement'), panel_announcement_back_end_bulletins_path %>
<%= content_tag :ul, :class => ("nav nav-list " + visible_for_controllers('bulletins', '/panel/announcement/back_end/tags', 'bulletin_categorys', 'approvals')) do -%>
<%= content_tag :li, link_to(t('announcement.all_articles'), panel_announcement_back_end_bulletins_path), :class => active_for_action('bulletins', 'index') %>
@@ -13,13 +13,13 @@
<%= content_tag :li, link_to(t('announcement.categories'), panel_announcement_back_end_bulletin_categorys_path), :class => (active_for_action('bulletin_categorys', 'index') || active_for_action('bulletin_category_setting', 'setting')) %>
<%= content_tag :li, link_to(t('announcement.tags'), panel_announcement_back_end_tags_path), :class => active_for_action('/panel/announcement/back_end/tags', 'index') %>
<%= content_tag :li, link_to(t('announcement.bulletin.approval_setting'), panel_announcement_back_end_approval_setting_path), :class => active_for_action('approvals', 'setting') if (is_manager? rescue nil) %>
- <%= content_tag :li, link_to(t('admin.module.authorization'),edit_admin_module_app_path(ModuleApp.first(conditions: {title: "Announcement"}))), :class => active_sys_call_for_app('module_apps','edit','Announcement') if (is_admin? rescue nil) %>
+ <%= content_tag :li, link_to(t('admin.module.authorization'),admin_module_app_manager_auth_proc_path(ModuleApp.first(conditions: {title: "Announcement"}))), :class => active_sys_call_for_app('new_interface_module_apps','setting','Announcement',:module_app_id) if (is_admin? rescue nil) %>
<% end -%>
<% end -%>
-<%= content_tag :li, :class => active_for_controllers('news_bulletins', '/panel/news/back_end/tags', 'news_bulletin_categorys', 'news_approvals','news_bulletin_category_setting') do -%>
+<%= content_tag :li, :class =>( active_for_controllers('news_bulletins', '/panel/news/back_end/tags', 'news_bulletin_categorys', 'news_approvals')|| active_sys_call_for_app('new_interface_module_apps','setting','news',:module_app_id)) do -%>
<%= link_to content_tag(:i, nil, :class => 'icons-announcement') + t('admin.news'), panel_news_back_end_news_bulletins_path %>
<%= content_tag :ul, :class => ("nav nav-list " + visible_for_controllers('news_bulletins', '/panel/news/back_end/tags', 'news_bulletin_categorys', 'news_approvals')) do -%>
<%= content_tag :li, link_to(t('announcement.all_articles'), panel_news_back_end_news_bulletins_path), :class => active_for_action('news_bulletins', 'index') %>
@@ -27,7 +27,7 @@
<%= content_tag :li, link_to(t('announcement.categories'), panel_news_back_end_news_bulletin_categorys_path), :class => (active_for_action('news_bulletin_categorys', 'index') || active_for_action('news_bulletin_category_setting', 'setting'))%>
<%= content_tag :li, link_to(t('announcement.tags'), panel_news_back_end_tags_path), :class => active_for_action('/panel/news/back_end/tags', 'index') %>
<%= content_tag :li, link_to(t('announcement.bulletin.approval_setting'), panel_news_back_end_news_approval_setting_path), :class => active_for_action('news_approvals', 'setting') if (is_manager? rescue nil) %>
- <%= content_tag :li, link_to(t('admin.module.authorization'),edit_admin_module_app_path(ModuleApp.first(conditions: {key: "news"}))), :class => active_sys_call_for_app('module_apps','edit','news') if (is_admin? rescue nil) %>
+ <%= content_tag :li, link_to(t('admin.module.authorization'),admin_module_app_manager_auth_proc_path(ModuleApp.first(conditions: {key: "news"}))), :class => active_sys_call_for_app('new_interface_module_apps','setting','news',:module_app_id) if (is_admin? rescue nil) %>
<% end -%>
<% end -%>
diff --git a/dump.rdb b/dump.rdb
index a3c1b42c..748293b8 100644
Binary files a/dump.rdb and b/dump.rdb differ