first version app config for Spen durning Chris's leave.

This commit is contained in:
Matthew K. Fu JuYuan 2012-09-24 11:43:48 +08:00
parent 2321116597
commit 3a65f599e6
16 changed files with 191 additions and 55 deletions

View File

@ -26,6 +26,8 @@ class Admin::UsersNewInterfaceController < ApplicationController
def show def show
@user = User.find(params[:id]) @user = User.find(params[:id])
@plugins = OrbitApp::Module::Registration.all
@profile_data = [] @profile_data = []
@teacher_data = [] @teacher_data = []
@student_data = [] @student_data = []
@ -47,6 +49,12 @@ class Admin::UsersNewInterfaceController < ApplicationController
@staff_data.push({:name => att_val.attribute_field.title,:value =>eval("att_val.#{att_val.key}")}) if att_val.attribute_field.role.key=="staff_data"rescue false @staff_data.push({:name => att_val.attribute_field.title,:value =>eval("att_val.#{att_val.key}")}) if att_val.attribute_field.role.key=="staff_data"rescue false
} }
if(!params[:show_plugin_profile].nil?)
@right_partial = OrbitApp::Plugin::Registration.find_by_key(params[:show_plugin_profile]).profile_partial_path rescue 'plugin_summary'
else
@right_partial = "plugin_summary"
end
# binding.pry # binding.pry
# @user.attribute_values.each{|att_val| # @user.attribute_values.each{|att_val|
# @teacher_data.push({:name => att_val.attribute_field.title,:value =>att_val[I18n.locale]}) # @teacher_data.push({:name => att_val.attribute_field.title,:value =>att_val[I18n.locale]})

View File

@ -0,0 +1,6 @@
<div class="member-plugin">
<% #binding.pry%>
<%= render :partial=> 'plugin_summary'%>
<%= render :partial=> 'plugin_summary'%>
<%= render :partial=> 'plugin_summary'%>
</div>

View File

@ -6,23 +6,20 @@
<div class="arrow_prev pull-left"><i class="icon-chevron-left"></i></div> <div class="arrow_prev pull-left"><i class="icon-chevron-left"></i></div>
<div class="module-nav-view"> <div class="module-nav-view">
<ul class="nav nav-pills"> <ul class="nav nav-pills">
<li class="active"> <%= content_tag :li,:class=>(params[:show_plugin_profile].nil? ? "active" : nil) do %>
<a href="#"><%= t("admin.new_admin.users.all_plugin_summary")%></a> <%= link_to t("admin.new_admin.users.all_plugin_summary")%>
</li> <%end -%>
<li><a href="#">學歷</a></li> <% @plugins.each do |plugin|%>
<li><a href="#">學歷</a></li> <%= content_tag :li,:class=>(params[:show_plugin_profile]==plugin.name ? "active" : nil) do %>
<li><a href="#">學歷</a></li> <%= link_to plugin.name,:show_plugin_profile=> plugin.name %>
<li><a href="#">學歷</a></li> <% end -%>
<%end -%>
</ul> </ul>
</div> </div>
</div> </div>
<div class="member-plugin"> <%=render :partial=> @right_partial%>
<% #binding.pry%>
<%= render :partial=> 'plugin_summary'%>
<%= render :partial=> 'plugin_summary'%>
<%= render :partial=> 'plugin_summary'%>
</div>
</div> </div>
<div class="user-info"> <div class="user-info">
<div id="brand" class="clear"> <div id="brand" class="clear">

View File

@ -1,8 +1,10 @@
require "orbit_app/summary" require "orbit_app/summary"
require "orbit_app/dsl" require "orbit_app/dsl"
require "orbit_app/backend_side_bar" require "orbit_app/module/backend_side_bar"
require "orbit_app/plugin/plugin_summary" require "orbit_app/plugin/summary"
require "orbit_app/module/module_summary" require "orbit_app/plugin/registration"
require "orbit_app/module/summary"
require "orbit_app/module/registration"
module OrbitApp module OrbitApp
extend DSL extend DSL

View File

@ -1,15 +0,0 @@
module OrbitApp
class BackendSideBar
attr_reader :name
def initialize(name, &block)
@name = name
block.arity < 1 ? instance_eval(&block) : block.call(self) if block_given?
end
def item(*args)
end
end
end

View File

@ -1,16 +1,26 @@
module OrbitApp module OrbitApp
module DSL module DSL
def backend_side_bar(name,&block) def registration(name,type ={:type=> "ModuleApp"} ,&block)
BackendSideBar.new(name,&block) if type[:type] == "ModuleApp"
end Module::Registration.new(name,&block)
elsif type[:type] == "PersonalPlugin"
def plugin_summary(name,&block) Plugin::Registration.new(name,&block)
# Plugin::PluginSummary.new(name,&block)
end
def module_summary(name,&block)
Module::ModuleSummary.new(name,&block)
end end
end end
# def backend_side_bar(name,&block)
# Module::BackendSideBar.new(name,&block)
# end
# def plugin_summary(name,&block)
# # Plugin::PluginSummary.new(name,&block)
# end
# def module_summary(name,&block)
# Module::Summary.new(name,&block)
# end
end
end end

View File

@ -0,0 +1,17 @@
module OrbitApp
module Module
class BackendSideBar
attr_reader :name
def initialize(name, &block)
@name = name
block.arity < 1 ? instance_eval(&block) : block.call(self) if block_given?
end
# def personal_plugin(*args)
# binding.pry
# end
end
end
end

View File

@ -0,0 +1,54 @@
module OrbitApp
module Module
module Registration
Version = "0.1"
module ClassMethods
@@registrations = []
def new( name ,&block)
@@registrations << DataSheet.new(name,&block)
end
def find_by_key(key)
@@registrations.each{|t|
return t if t.name == key
}
return nil
end
def all
return @@registrations
end
end
extend ClassMethods
def self.included( other )
other.extend( ClassMethods )
end
class DataSheet
attr_reader :name
attr_reader :base_path
def initialize(name, &block)
@name = name
block.arity < 1 ? instance_eval(&block) : block.call(self) if block_given?
end
def plugin
end
def personal_plugin(params)
# TODO 這裡要看是一些檔案是不是都有
Plugin::Registration.new_from_module_app(@name,@base_path,params)
end
def base_url(var)
@base_path = var
end
end
end
end
end

View File

@ -3,8 +3,8 @@ require "orbit_app/summary"
module OrbitApp module OrbitApp
module Module module Module
module ModuleSummary module Summary
include Summary include OrbitApp::Summary
class Item class Item
def initialize() def initialize()

View File

@ -0,0 +1,58 @@
module OrbitApp
module Plugin
module Registration
Version = "0.1"
module ClassMethods
@@registrations = []
def new( name ,&block)
@@registrations << DataSheet.new(name,&block)
end
def new_from_module_app(name,base_path,arg)
@@registrations << DataSheet.new(name,arg,:base_path=>base_path)
end
def find_by_key(key)
@@registrations.each{|t|
return t if t.name == key
}
return nil
end
def all
return @@registrations
end
end
extend ClassMethods
def self.included( other )
other.extend( ClassMethods )
end
class DataSheet
attr_reader :name
attr_reader :base_path
def initialize(name,partial=nil,*args ,&block)
@base_path = args[0][:base_path]
@name = name
@partial_path = ''
unless partial.nil?
@partial_path = partial[:path]
end
block.arity < 1 ? instance_eval(&block) : block.call(self) if block_given?
end
def profile_partial_path
return @partial_path
end
end
end
end
end

View File

@ -2,7 +2,8 @@ require "orbit_app/summary"
module OrbitApp module OrbitApp
module Plugin module Plugin
module PluginSummary module Summary
# include OrbitApp::Summary
include OrbitApp::Summary include OrbitApp::Summary
end end

View File

@ -0,0 +1 @@
Hello~ I am your plugin profile

View File

@ -1,7 +1,15 @@
OrbitApp.module_summary "Announcement" do module Announcement
OrbitApp.registration "Announcement",:type=> 'ModuleApp' do
base_url File.expand_path File.dirname(__FILE__)
personal_plugin :enable => true,:path=>"panel/announcement/plugin/profile"
end end
end
# OrbitApp.backend_side_bar 'News' do # OrbitApp.backend_side_bar 'News' do
# block :available_for => [:admin,:guest,:manager,:sub_manager], # block :available_for => [:admin,:guest,:manager,:sub_manager],

View File

@ -1,4 +0,0 @@
require "announcement/engine"
module Announcement
end

View File

@ -1,4 +0,0 @@
module Announcement
class Engine < Rails::Engine
end
end

View File

@ -1,3 +0,0 @@
module Announcement
VERSION = "0.0.1"
end