diff --git a/app/controllers/admin/app_auths_controller.rb b/app/controllers/admin/app_auths_controller.rb
index f2c01451..e925b857 100644
--- a/app/controllers/admin/app_auths_controller.rb
+++ b/app/controllers/admin/app_auths_controller.rb
@@ -4,14 +4,15 @@ class Admin::AppAuthsController < ApplicationController
before_filter :is_admin?
def index
- @roles = Role.all.entries
- apps = Purchase.where(:type =>"App")
- @app_auth_data = apps.entries.map do |app|
- app_c = eval(app.app_controller)
- obj = app_c.new
- obj_auth = obj.send "auth"
- [:app_obj => app,:auth_field => obj_auth]
- end
+ # @roles = Role.all.entries
+ # apps = Purchase.where(:type =>"App")
+ # @app_auth_data = apps.entries.map do |app|
+ # app_c = eval(app.app_controller)
+ # obj = app_c.new
+ # obj_auth = obj.send "auth"
+ # [:app_obj => app,:auth_field => obj_auth]
+ # end
+ @module_apps = ModuleApp.all
end
end
\ 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 98683345..142830f1 100644
--- a/app/controllers/admin/module_apps_controller.rb
+++ b/app/controllers/admin/module_apps_controller.rb
@@ -12,4 +12,22 @@ class Admin::ModuleAppsController < ApplicationController
format.js {}
end
end
+
+ def edit
+ @module_app = ModuleApp.find(params[:id])
+
+ end
+
+ def update
+ @module_app = ModuleApp.find(params[:id])
+ unless params['module_app']['enable_frontend'].nil?
+ @module_app.update_attribute('enable_frontend',params['module_app']['enable_frontend'])
+ @module_app.save!
+ end
+ @attribute = @module_app
+ respond_to do |format|
+ format.html { redirect_to :action => :index }
+ format.js { render 'admin/attributes/toggle_enable' }
+ end
+ end
end
\ No newline at end of file
diff --git a/app/helpers/admin/app_auth_helper.rb b/app/helpers/admin/app_auth_helper.rb
new file mode 100644
index 00000000..fe63a2a6
--- /dev/null
+++ b/app/helpers/admin/app_auth_helper.rb
@@ -0,0 +1,6 @@
+module Admin::AppAuthHelper
+ def on_off_switch(attribute,attribute_type)
+ link_to t(:enable), eval("admin_#{attribute_type}_path(attribute, :authenticity_token => form_authenticity_token, :#{attribute_type} => {:disabled => true})"), :remote => true, :method => :put, :id => "disable_#{attribute.id}", :style => "display:#{attribute.is_disabled? ? 'none' : ''}", :class => 'switch'
+ link_to t(:disable), eval("admin_#{attribute_type}_path(attribute, :authenticity_token => form_authenticity_token, :#{attribute_type} => {:disabled => false})"), :remote => true, :method => :put, :id => "enable_#{attribute.id}", :style => "display:#{attribute.is_disabled? ? '' : 'none'}", :class => 'switch'
+ end
+end
\ No newline at end of file
diff --git a/app/views/admin/app_auths/index.html.erb b/app/views/admin/app_auths/index.html.erb
index 0d804b2b..392f8d2b 100644
--- a/app/views/admin/app_auths/index.html.erb
+++ b/app/views/admin/app_auths/index.html.erb
@@ -1,32 +1,52 @@
<% content_for :secondary do %>
-
-
-
User Role
-
- <% @roles.each do |role| %>
- - <%= link_to content_tag(:span, "Role") %>
- <% end -%>
-
-
-
-<% end -%>
-
-<%= t('admin.list_app_auths') %>
-
-
-
- <%= t('admin.app.name') %> |
- <%= t('admin.description') %> |
-
-
-<% @app_auth_data.each do |app| %>
-
- <%= app[0][:app_obj].title %> |
- <% app[0][:auth_field].each do |unit| %>
-
- <%= render :partial => "auth_unit",:locals => {:unit => unit } %>
- |
- <%end%>
-
+ <% #render 'side_bar' %>
<% end %>
-
+
+
+ <%= flash_messages %>
+
+ <% #link_to t('admin.new_user'), new_admin_user_path, :class => 'new' %>
+
+
+
+
+ <%= t('admin.app.title') %> |
+ <%= t('admin.app.description') %> |
+ <%= t('admin.app.use_status') %> |
+ <%= t('admin.app.autdor') %> |
+ <%= t('admin.app.organization') %> |
+ <%= t('admin.app.version') %> |
+ <%= t('admin.action') %> |
+
+
+
+ <% @module_apps.each do |module_app| %>
+ ">
+ <%= module_app.title %> |
+ <%= module_app.intro %> |
+
+ <% attribute_type = "module_app" %>
+ <% attribute = module_app %>
+ <%= link_to t(:enable), admin_module_app_path(attribute, :authenticity_token => form_authenticity_token, :module_app => {:enable_frontend => true}), :remote => true, :method => :put, :id => "disable_#{attribute.id}", :style => "display:#{attribute.enable_frontend ? 'none' : ''}", :class => 'switch' %>
+ <%= link_to t(:disable), admin_module_app_path(attribute, :authenticity_token => form_authenticity_token, :module_app => {:enable_frontend => false}), :remote => true, :method => :put, :id => "enable_#{attribute.id}", :style => "display:#{attribute.enable_frontend ? '' : 'none'}", :class => 'switch' %>
+
+ |
+ <%= module_app.author %> |
+ <%= module_app.organization %> |
+ <%= module_app.version %> |
+
+ <%= link_to t(:show), admin_module_app_path(module_app), :class => 'show' %>
+ <%= link_to t(:edit), edit_admin_module_app_path(module_app), :class => 'edit' %>
+ <%= link_to t(:delete), admin_module_app_path(module_app), :class => 'delete', :confirm => t('sure?'), :method => :delete %>
+ |
+
+
+ |
+
+ <% end %>
+
+
+
+ <%# link_to t('admin.new_user'), new_admin_user_path, :class => 'new' %>
+
+