From 0ff748acc42c13c3bb0c57cd56b04189979873ba Mon Sep 17 00:00:00 2001 From: Saurabh Bhatia Date: Tue, 8 Apr 2014 18:46:27 +0800 Subject: [PATCH] Added Items,Pages, Some UI for backend --- app/assets/images/menber-pic.png | Bin 0 -> 2036 bytes app/assets/images/orbit-logo.png | Bin 0 -> 587 bytes app/assets/images/orbit-logo.svg | 13 ++++++ app/assets/javascripts/admin/items.js.coffee | 3 ++ app/assets/javascripts/designs.js.coffee | 3 ++ app/assets/javascripts/module_store.js.coffee | 3 ++ app/assets/javascripts/sites.js.coffee | 3 ++ app/assets/stylesheets/admin/items.css.scss | 3 ++ .../stylesheets/basic/font-awesome.css.erb | 8 ++-- app/assets/stylesheets/basic/icon.css.erb | 8 ++-- .../stylesheets/basic/orbit_bar.css.erb | 8 ++-- app/assets/stylesheets/designs.css.scss | 3 ++ app/assets/stylesheets/module_store.css.scss | 3 ++ app/assets/stylesheets/sites.css.scss | 3 ++ app/controllers/admin/items_controller.rb | 8 ++++ app/controllers/application_controller.rb | 5 +++ app/controllers/designs_controller.rb | 4 ++ app/controllers/module_store_controller.rb | 4 ++ app/controllers/sites_controller.rb | 29 +++++++++++++ app/helpers/admin/items_helper.rb | 2 + app/helpers/application_helper.rb | 3 ++ app/helpers/designs_helper.rb | 2 + app/helpers/module_store_helper.rb | 2 + app/helpers/orbit_helper.rb | 4 ++ app/helpers/sites_helper.rb | 2 + app/models/site.rb | 21 +++++++++ app/views/admin/items/index.html.erb | 3 ++ app/views/designs/index.html.erb | 2 + app/views/layouts/_left_menu.html.erb | 29 +++++++++++++ app/views/layouts/_orbit_bar_backend.html.erb | 6 +++ app/views/layouts/_right_menu.html.erb | 41 ++++++++++++++++++ app/views/layouts/_side_bar.html.erb | 23 +++------- app/views/layouts/_side_bar_content.html.erb | 16 +++++++ app/views/layouts/back_end.html.erb | 11 ++--- app/views/layouts/structure.html.erb | 20 +++++++++ app/views/module_store/index.html.erb | 2 + app/views/shared/_google_font.html.erb | 1 + app/views/shared/_ie_html5_fix.html.erb | 4 ++ app/views/shared/_meta.html.erb | 5 +++ app/views/shared/_side_bar.html.erb | 29 +++++++++++++ config/locales/en.yml | 22 ++++++++++ config/locales/zh_tw.yml | 23 +++++++++- config/routes.rb | 21 ++++++++- lib/orbit_app/module/side_bar.rb | 9 ---- .../admin/items_controller_test.rb | 9 ++++ test/controllers/designs_controller_test.rb | 9 ++++ .../module_store_controller_test.rb | 9 ++++ test/controllers/sites_controller_test.rb | 7 +++ test/fixtures/sites.yml | 21 +++++++++ test/helpers/admin/items_helper_test.rb | 4 ++ test/helpers/designs_helper_test.rb | 4 ++ test/helpers/module_store_helper_test.rb | 4 ++ test/helpers/sites_helper_test.rb | 4 ++ test/models/site_test.rb | 7 +++ 54 files changed, 444 insertions(+), 48 deletions(-) create mode 100644 app/assets/images/menber-pic.png create mode 100644 app/assets/images/orbit-logo.png create mode 100644 app/assets/images/orbit-logo.svg create mode 100644 app/assets/javascripts/admin/items.js.coffee create mode 100644 app/assets/javascripts/designs.js.coffee create mode 100644 app/assets/javascripts/module_store.js.coffee create mode 100644 app/assets/javascripts/sites.js.coffee create mode 100644 app/assets/stylesheets/admin/items.css.scss create mode 100644 app/assets/stylesheets/designs.css.scss create mode 100644 app/assets/stylesheets/module_store.css.scss create mode 100644 app/assets/stylesheets/sites.css.scss create mode 100644 app/controllers/admin/items_controller.rb create mode 100644 app/controllers/designs_controller.rb create mode 100644 app/controllers/module_store_controller.rb create mode 100644 app/controllers/sites_controller.rb create mode 100644 app/helpers/admin/items_helper.rb create mode 100644 app/helpers/designs_helper.rb create mode 100644 app/helpers/module_store_helper.rb create mode 100644 app/helpers/sites_helper.rb create mode 100644 app/models/site.rb create mode 100644 app/views/admin/items/index.html.erb create mode 100644 app/views/designs/index.html.erb create mode 100644 app/views/layouts/_left_menu.html.erb create mode 100644 app/views/layouts/_orbit_bar_backend.html.erb create mode 100644 app/views/layouts/_right_menu.html.erb create mode 100644 app/views/layouts/_side_bar_content.html.erb create mode 100644 app/views/layouts/structure.html.erb create mode 100644 app/views/module_store/index.html.erb create mode 100644 app/views/shared/_google_font.html.erb create mode 100644 app/views/shared/_ie_html5_fix.html.erb create mode 100644 app/views/shared/_meta.html.erb create mode 100644 app/views/shared/_side_bar.html.erb create mode 100644 test/controllers/admin/items_controller_test.rb create mode 100644 test/controllers/designs_controller_test.rb create mode 100644 test/controllers/module_store_controller_test.rb create mode 100644 test/controllers/sites_controller_test.rb create mode 100644 test/fixtures/sites.yml create mode 100644 test/helpers/admin/items_helper_test.rb create mode 100644 test/helpers/designs_helper_test.rb create mode 100644 test/helpers/module_store_helper_test.rb create mode 100644 test/helpers/sites_helper_test.rb create mode 100644 test/models/site_test.rb diff --git a/app/assets/images/menber-pic.png b/app/assets/images/menber-pic.png new file mode 100644 index 0000000000000000000000000000000000000000..f0493974cc8e8e49e1048eef058ec50949e90a6c GIT binary patch literal 2036 zcmaJ?X;c&E8XiI*Hl=8)P}VpN;6lm9Dv{Vi2HIGXvI$%^3CR$0A(=6mNZ5|Fih$mN z6^gaca%E9KEGUJDmTMFQ4T}ZsIdauDqNuSVAW%3^dhW!Ey+1B@&dhw@_n!B8-t9Rv z#bLq^-y%DZ0RVW5{}B{{uVJQV4FP|fso+I?vB!dAu}CBp%M>YLAW(v&z#v~PlEM+N zNRqYZIvfB1=B~1+SS(f$$`K=ShREc@(8y674FCb}YfzCm9mc>ESSnL+X_FT((LkAm zON;RlummU%PLq9Kog@V1yN&M8lLH&CCJg&vraGScD0($Kf+4Cj1O<7K zzTg&tNGwyB3|n6!1Og6Up~6H8G0ca!G@OGWlSw#%Y!)lXlLz_uu)NspV9%gnRuB~8 z=NA&f^V=5a&0fJmh*&L$71#<^@)tIERjf%2aukmY!AjX)SQ4T{J<~NAJg`=aPh-y>B9|x(NEgnz=PU9qKFZ*-m{kIy$=9$&!RKFo=}d_)hM?kt-r9OT zx28zS9i!;Kpa1soUG(0Oj>l7u4=!eK`f{^}CaY$a2JM>)3M_>DG5-Q1X@Rs*$zMLc z@7eFa=VoTkKYH}YU@$B$#?=nnecpTEz=5i&s`Ka1BNkRisHM`pyyZ7;Kc3+qC009H zS#~8M?Qy~3-j##Z=w|nka~rHIovr)E#%k_N{I;|_xzE0}^6Rh3WU}N9tH5;aonsXh z;6Hd5THD*(Pn-x$)rrO8va&MK?xgT=(b?G0O_2)4cUJi%OG_|6JajapV`xZtvVX*2 z0Bz~lj9AT*`Fgt-H}!h*;?v}JG!h9h?|NcF!Ut|*ik<%1__$kel10Aj|l6 zZ;nw*jYavQm;u^UPY;nYH9Lznki-vlt+2W?0lRnQ)~yZkI{Xt+H!(akWF4&8rCVq)AG+k0BMT>h1f_5A(8iHS3JCa4Y$WXt_u#Q*x_Nken9yL35;1$0DA71$#;T>lUb}U>a|+!UHR*}yu7^P;l@0CieB?~Fs1P}$VO$F*?aaX8}QPwl@vE`GA16R60!9zQ+UqQb> ze?Vva&0MBH-|=Y^v*)cW%d6B<%Hh66l5H59+T~Us7fzOg`hbv7jx$@yA)V!bCL&%d z3%J#q47hm>{;D`|T}T#=32UO_tQHbm$HWC&i$ev?Oo`6aYuURFyY*bn8Bzm-x^=m$ zdk+|-z`iqafcS1T*PM(yIL`;WTaqhL$z+ z=vk0NC+?!XRDp4_1WfCVPoe7^z*78G;2vyVEZ~2|5a`R Z3; + + + + + diff --git a/app/assets/javascripts/admin/items.js.coffee b/app/assets/javascripts/admin/items.js.coffee new file mode 100644 index 0000000..24f83d1 --- /dev/null +++ b/app/assets/javascripts/admin/items.js.coffee @@ -0,0 +1,3 @@ +# Place all the behaviors and hooks related to the matching controller here. +# All this logic will automatically be available in application.js. +# You can use CoffeeScript in this file: http://coffeescript.org/ diff --git a/app/assets/javascripts/designs.js.coffee b/app/assets/javascripts/designs.js.coffee new file mode 100644 index 0000000..24f83d1 --- /dev/null +++ b/app/assets/javascripts/designs.js.coffee @@ -0,0 +1,3 @@ +# Place all the behaviors and hooks related to the matching controller here. +# All this logic will automatically be available in application.js. +# You can use CoffeeScript in this file: http://coffeescript.org/ diff --git a/app/assets/javascripts/module_store.js.coffee b/app/assets/javascripts/module_store.js.coffee new file mode 100644 index 0000000..24f83d1 --- /dev/null +++ b/app/assets/javascripts/module_store.js.coffee @@ -0,0 +1,3 @@ +# Place all the behaviors and hooks related to the matching controller here. +# All this logic will automatically be available in application.js. +# You can use CoffeeScript in this file: http://coffeescript.org/ diff --git a/app/assets/javascripts/sites.js.coffee b/app/assets/javascripts/sites.js.coffee new file mode 100644 index 0000000..24f83d1 --- /dev/null +++ b/app/assets/javascripts/sites.js.coffee @@ -0,0 +1,3 @@ +# Place all the behaviors and hooks related to the matching controller here. +# All this logic will automatically be available in application.js. +# You can use CoffeeScript in this file: http://coffeescript.org/ diff --git a/app/assets/stylesheets/admin/items.css.scss b/app/assets/stylesheets/admin/items.css.scss new file mode 100644 index 0000000..6c4fb95 --- /dev/null +++ b/app/assets/stylesheets/admin/items.css.scss @@ -0,0 +1,3 @@ +// Place all the styles related to the admin/items controller here. +// They will automatically be included in application.css. +// You can use Sass (SCSS) here: http://sass-lang.com/ diff --git a/app/assets/stylesheets/basic/font-awesome.css.erb b/app/assets/stylesheets/basic/font-awesome.css.erb index fb29938..dbcd8c6 100644 --- a/app/assets/stylesheets/basic/font-awesome.css.erb +++ b/app/assets/stylesheets/basic/font-awesome.css.erb @@ -22,10 +22,10 @@ */ @font-face { font-family: 'FontAwesome'; - src:url(<%= asset_path'fontawesome-webfont.eot' %>); - src:url(<%= asset_path'fontawesome-webfont.eot?#iefix' %>) format('embedded-opentype'), - url(<%= asset_path'fontawesome-webfont.woff' %>) format('woff'), - url(<%= asset_path'fontawesome-webfont.ttf' %>) format('truetype'); + src:url('<%= asset_path'fontawesome-webfont.eot' %>'); + src:url('<%= asset_path'fontawesome-webfont.eot?#iefix' %>') format('embedded-opentype'), + url('<%= asset_path'fontawesome-webfont.woff' %>') format('woff'), + url('<%= asset_path'fontawesome-webfont.ttf' %>') format('truetype'); font-weight: normal; font-style: normal; } \ No newline at end of file diff --git a/app/assets/stylesheets/basic/icon.css.erb b/app/assets/stylesheets/basic/icon.css.erb index 33cebba..d825825 100644 --- a/app/assets/stylesheets/basic/icon.css.erb +++ b/app/assets/stylesheets/basic/icon.css.erb @@ -7,10 +7,10 @@ } @font-face { font-family: 'entypo'; - src:url(<%= asset_path 'entypo.eot' %>); - src:url(<%= asset_path 'entypo.eot?#iefix' %>) format('embedded-opentype'), - url(<%= asset_path 'entypo.svg#entypo' %>) format('svg'), - url(<%= asset_path 'entypo.woff' %>) format('woff'), + src:url('<%= asset_path 'entypo.eot' %>'); + src:url('<%= asset_path 'entypo.eot?#iefix' %>') format('embedded-opentype'), + url('<%= asset_path 'entypo.svg#entypo' %>') format('svg'), + url('<%= asset_path 'entypo.woff' %>') format('woff'), url('<%= asset_path 'entypo.ttf' %>'); font-weight: normal; font-style: normal; diff --git a/app/assets/stylesheets/basic/orbit_bar.css.erb b/app/assets/stylesheets/basic/orbit_bar.css.erb index 082e63d..26b3752 100644 --- a/app/assets/stylesheets/basic/orbit_bar.css.erb +++ b/app/assets/stylesheets/basic/orbit_bar.css.erb @@ -14,10 +14,10 @@ display: inline-block; background-position: center; background-repeat: no-repeat; - background-image: url(<%= asset_path 'orbit-logo.svg' %>); + background-image: url('<%= asset_path 'orbit-logo.svg' %>'); /* For Suck IE */ - background-image: url(<%= asset_path 'orbit-logo.png' %>)\9; + background-image: url('<%= asset_path 'orbit-logo.png' %>'); } #orbit-bar.navbar .nav > li > a { color: #EEE; @@ -238,7 +238,7 @@ /*Language & flag*/ #orbit-bar #orbit-language [class^="flag-"], #orbit-bar #orbit-language [class*=" flag-"] { - background-image: url(<%= asset_path 'flag.png' %>); + background-image: url('<%= asset_path 'flag.png' %>'); background-repeat: no-repeat; background-color: transparent; display: inline-block; @@ -288,7 +288,7 @@ @media screen and (-webkit-min-device-pixel-ratio: 2), screen and (max--moz-device-pixel-ratio: 2) { #orbit-bar #orbit-language [class^="flag-"], #orbit-bar #orbit-language [class*=" flag-"] { - background-image: url(<%= asset_path 'flag@2x.png' %>); + background-image: url('<%= asset_path 'flag@2x.png' %>'); background-size: 96px 192px; } } diff --git a/app/assets/stylesheets/designs.css.scss b/app/assets/stylesheets/designs.css.scss new file mode 100644 index 0000000..db79e0f --- /dev/null +++ b/app/assets/stylesheets/designs.css.scss @@ -0,0 +1,3 @@ +// Place all the styles related to the designs controller here. +// They will automatically be included in application.css. +// You can use Sass (SCSS) here: http://sass-lang.com/ diff --git a/app/assets/stylesheets/module_store.css.scss b/app/assets/stylesheets/module_store.css.scss new file mode 100644 index 0000000..b7d604b --- /dev/null +++ b/app/assets/stylesheets/module_store.css.scss @@ -0,0 +1,3 @@ +// Place all the styles related to the module_store controller here. +// They will automatically be included in application.css. +// You can use Sass (SCSS) here: http://sass-lang.com/ diff --git a/app/assets/stylesheets/sites.css.scss b/app/assets/stylesheets/sites.css.scss new file mode 100644 index 0000000..682e55c --- /dev/null +++ b/app/assets/stylesheets/sites.css.scss @@ -0,0 +1,3 @@ +// Place all the styles related to the sites controller here. +// They will automatically be included in application.css. +// You can use Sass (SCSS) here: http://sass-lang.com/ diff --git a/app/controllers/admin/items_controller.rb b/app/controllers/admin/items_controller.rb new file mode 100644 index 0000000..afbc72d --- /dev/null +++ b/app/controllers/admin/items_controller.rb @@ -0,0 +1,8 @@ +class Admin::ItemsController < ApplicationController + include OrbitHelper + + layout "structure" + def index + @items = Page.all + end +end diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index b2e9772..74aeaa1 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -3,6 +3,8 @@ class ApplicationController < ActionController::Base # For APIs, you may want to use :null_session instead. protect_from_forgery with: :exception before_action :set_locale + helper_method :current_site + def default_url_options(options={}) { locale: I18n.locale } end @@ -19,4 +21,7 @@ class ApplicationController < ActionController::Base @key = Template::KEY end + def current_site + @current_site = Site.find_by(site_active: true) + end end diff --git a/app/controllers/designs_controller.rb b/app/controllers/designs_controller.rb new file mode 100644 index 0000000..cb3415f --- /dev/null +++ b/app/controllers/designs_controller.rb @@ -0,0 +1,4 @@ +class DesignsController < ApplicationController + def index + end +end diff --git a/app/controllers/module_store_controller.rb b/app/controllers/module_store_controller.rb new file mode 100644 index 0000000..88a44a7 --- /dev/null +++ b/app/controllers/module_store_controller.rb @@ -0,0 +1,4 @@ +class ModuleStoreController < ApplicationController + def index + end +end diff --git a/app/controllers/sites_controller.rb b/app/controllers/sites_controller.rb new file mode 100644 index 0000000..6b52b17 --- /dev/null +++ b/app/controllers/sites_controller.rb @@ -0,0 +1,29 @@ +class SitesController < ApplicationController + + def mail_setting + end + + def site_info + end + + def responsive_setting + end + + def search_engine + end + + def sitemap + end + + def system_info + end + + def preference + end + + def update_manager + end + + def update_orbit + end +end diff --git a/app/helpers/admin/items_helper.rb b/app/helpers/admin/items_helper.rb new file mode 100644 index 0000000..d442067 --- /dev/null +++ b/app/helpers/admin/items_helper.rb @@ -0,0 +1,2 @@ +module Admin::ItemsHelper +end diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 5ab3363..b5b458e 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -132,4 +132,7 @@ module ApplicationHelper data end + def active_for_action(controller_name, action_name) + ((controller.controller_name.eql?(controller_name) || request.fullpath.eql?(controller_name)) && controller.action_name.eql?(action_name)) ? 'active' : nil + end end diff --git a/app/helpers/designs_helper.rb b/app/helpers/designs_helper.rb new file mode 100644 index 0000000..2d9b249 --- /dev/null +++ b/app/helpers/designs_helper.rb @@ -0,0 +1,2 @@ +module DesignsHelper +end diff --git a/app/helpers/module_store_helper.rb b/app/helpers/module_store_helper.rb new file mode 100644 index 0000000..5e9795a --- /dev/null +++ b/app/helpers/module_store_helper.rb @@ -0,0 +1,2 @@ +module ModuleStoreHelper +end diff --git a/app/helpers/orbit_helper.rb b/app/helpers/orbit_helper.rb index 2c3e652..ce8cf98 100644 --- a/app/helpers/orbit_helper.rb +++ b/app/helpers/orbit_helper.rb @@ -16,6 +16,10 @@ module OrbitHelper end end + def page_url(url) + "#{request.host_with_port}/#{locale}#{url}" + end + def self.set_site_locale(locale) @site_locale = locale end diff --git a/app/helpers/sites_helper.rb b/app/helpers/sites_helper.rb new file mode 100644 index 0000000..621069d --- /dev/null +++ b/app/helpers/sites_helper.rb @@ -0,0 +1,2 @@ +module SitesHelper +end diff --git a/app/models/site.rb b/app/models/site.rb new file mode 100644 index 0000000..e64b0d2 --- /dev/null +++ b/app/models/site.rb @@ -0,0 +1,21 @@ +class Site + include Mongoid::Document + include Mongoid::Timestamps + + field :title, type: String + field :school, type: String + field :department, type: String + field :address, type: String + field :footer, type: String + field :sub_menu, type: String + field :terms_of_use, type: String + field :google_analytics, type: String + field :in_use_locales, :type => Array + field :valid_locales, :type => Array + field :site_active, :type => Boolean + + def to_param + I18n.locale = :en + title.parameterize + end +end diff --git a/app/views/admin/items/index.html.erb b/app/views/admin/items/index.html.erb new file mode 100644 index 0000000..dbe3760 --- /dev/null +++ b/app/views/admin/items/index.html.erb @@ -0,0 +1,3 @@ +<% @items.each do |i|%> + <%= link_to i.name, page_url(i.url) %> +<% end %> \ No newline at end of file diff --git a/app/views/designs/index.html.erb b/app/views/designs/index.html.erb new file mode 100644 index 0000000..29c2828 --- /dev/null +++ b/app/views/designs/index.html.erb @@ -0,0 +1,2 @@ +

Designs#index

+

Find me in app/views/designs/index.html.erb

diff --git a/app/views/layouts/_left_menu.html.erb b/app/views/layouts/_left_menu.html.erb new file mode 100644 index 0000000..486bbda --- /dev/null +++ b/app/views/layouts/_left_menu.html.erb @@ -0,0 +1,29 @@ + \ No newline at end of file diff --git a/app/views/layouts/_orbit_bar_backend.html.erb b/app/views/layouts/_orbit_bar_backend.html.erb new file mode 100644 index 0000000..6ff0fa0 --- /dev/null +++ b/app/views/layouts/_orbit_bar_backend.html.erb @@ -0,0 +1,6 @@ + \ No newline at end of file diff --git a/app/views/layouts/_right_menu.html.erb b/app/views/layouts/_right_menu.html.erb new file mode 100644 index 0000000..e7a43ad --- /dev/null +++ b/app/views/layouts/_right_menu.html.erb @@ -0,0 +1,41 @@ + \ 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 b07128d..99e787a 100644 --- a/app/views/layouts/_side_bar.html.erb +++ b/app/views/layouts/_side_bar.html.erb @@ -1,17 +1,6 @@ - - - \ No newline at end of file + diff --git a/app/views/layouts/_side_bar_content.html.erb b/app/views/layouts/_side_bar_content.html.erb new file mode 100644 index 0000000..c0796fa --- /dev/null +++ b/app/views/layouts/_side_bar_content.html.erb @@ -0,0 +1,16 @@ + + + \ No newline at end of file diff --git a/app/views/layouts/back_end.html.erb b/app/views/layouts/back_end.html.erb index 69b302e..343aba8 100644 --- a/app/views/layouts/back_end.html.erb +++ b/app/views/layouts/back_end.html.erb @@ -8,14 +8,9 @@ - - -<%= yield %> + <%= render 'layouts/orbit_bar_backend' %> + <%= render 'layouts/side_bar' %> + <%= yield %> diff --git a/app/views/layouts/structure.html.erb b/app/views/layouts/structure.html.erb new file mode 100644 index 0000000..c087a70 --- /dev/null +++ b/app/views/layouts/structure.html.erb @@ -0,0 +1,20 @@ + + + + <%= current_site.title || t('site.settings') %> + <%= render 'shared/meta' %> + <%= render 'shared/google_font' %> + <%= stylesheet_link_tag "structure" %> + <%= render 'shared/ie_html5_fix' %> + <%= csrf_meta_tag %> + + + <%= render 'layouts/orbit_bar_backend' %> + <%= render 'shared/side_bar' %> +
+
+ <%= yield %> +
+
+ + diff --git a/app/views/module_store/index.html.erb b/app/views/module_store/index.html.erb new file mode 100644 index 0000000..a1df3b1 --- /dev/null +++ b/app/views/module_store/index.html.erb @@ -0,0 +1,2 @@ +

ModuleStore#index

+

Find me in app/views/module_store/index.html.erb

diff --git a/app/views/shared/_google_font.html.erb b/app/views/shared/_google_font.html.erb new file mode 100644 index 0000000..f33cbe6 --- /dev/null +++ b/app/views/shared/_google_font.html.erb @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/app/views/shared/_ie_html5_fix.html.erb b/app/views/shared/_ie_html5_fix.html.erb new file mode 100644 index 0000000..fd7a303 --- /dev/null +++ b/app/views/shared/_ie_html5_fix.html.erb @@ -0,0 +1,4 @@ + + \ No newline at end of file diff --git a/app/views/shared/_meta.html.erb b/app/views/shared/_meta.html.erb new file mode 100644 index 0000000..a00bb81 --- /dev/null +++ b/app/views/shared/_meta.html.erb @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/app/views/shared/_side_bar.html.erb b/app/views/shared/_side_bar.html.erb new file mode 100644 index 0000000..b9e3116 --- /dev/null +++ b/app/views/shared/_side_bar.html.erb @@ -0,0 +1,29 @@ + \ No newline at end of file diff --git a/config/locales/en.yml b/config/locales/en.yml index 5554c54..44efd39 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -20,4 +20,26 @@ # available at http://guides.rubyonrails.org/i18n.html. en: + _locale: English more: "More" + site_: Site + site_info: Site Info + site_map: Site Map + sitemap: Sitemap + site_name: Site Name + site_structure: Structure + modules: Modules + mobile_settings: Mobile Settings + search_engine: Search Engine + templates: Templates + preference: Preferences + update_manager: Update Manager + locale: Locale + login: Login + logout: Logout + language: Language + dashboard_: Dashboard + desktop: Desktop + homepage: Homepage +site: + system_preference: System Preference \ No newline at end of file diff --git a/config/locales/zh_tw.yml b/config/locales/zh_tw.yml index a873934..96872f0 100644 --- a/config/locales/zh_tw.yml +++ b/config/locales/zh_tw.yml @@ -1,2 +1,23 @@ zh_tw: - more: "更多" \ No newline at end of file + more: "更多" + site_: 網站 + site_info: 基本資訊 + site_map: 網站地圖 + site_structure: 網站架構 + sitemap: 網站地圖 + site_name: 網站名稱 + mobile_settings: 行動設定 + modules: 網站模組 + search_engine: 搜尋引擎 + templates: 網站模版 + preference: 系統偏好 + update_manager: 更新管理員 + homepage: 首頁 + locale: 位置 + login: 登入 + logout: 登出 + dashboard_: 儀表版 + desktop: 桌面 +site: + system_preference: 系統狀態 + diff --git a/config/routes.rb b/config/routes.rb index 819cdca..eb17a9e 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -17,9 +17,28 @@ OrbitStore::Application.routes.draw do # You can have the root of your site routed with "root" root 'pages#home' - scope "(:locale)", locale: /en|zh_tw/ do + + locales = Site.find_by(site_active: true).in_use_locales + + scope "(:locale)", locale: Regexp.new(locales.join("|")) do namespace :admin do resources :dashboards + resources :items + + resources :sites do + get 'mail_setting' + get 'site_info' + get 'responsive_setting' + get 'search_engine' + get 'sitemap' + get 'system_info' + get 'preference' + get 'update_manager' + get 'update_orbit' + end + + resources :designs + get 'module_store' => 'module_store#index' end get ':page(/:page)(/:page)(/:page)', to: 'pages#show', constraints: KeywordConstraint.new resources :pages diff --git a/lib/orbit_app/module/side_bar.rb b/lib/orbit_app/module/side_bar.rb index e698c1c..6a56e2c 100644 --- a/lib/orbit_app/module/side_bar.rb +++ b/lib/orbit_app/module/side_bar.rb @@ -49,7 +49,6 @@ module OrbitApp @get_module_app = get_module_app @sidebar_order = 0 block.arity < 1 ? instance_eval(&block) : block.call(self) if block_given? - finalize! SideBarRegistration.add(self) SideBarRegistration.all_get_ordered! end @@ -78,14 +77,6 @@ module OrbitApp def head_link_path(var) @head_link = var end - - def finalize! - set_controllers_scope - current_priority = @context_links.count - @context_links.each do |t| - t.finalize! - end - end end end end diff --git a/test/controllers/admin/items_controller_test.rb b/test/controllers/admin/items_controller_test.rb new file mode 100644 index 0000000..45f83dc --- /dev/null +++ b/test/controllers/admin/items_controller_test.rb @@ -0,0 +1,9 @@ +require 'test_helper' + +class Admin::ItemsControllerTest < ActionController::TestCase + test "should get index" do + get :index + assert_response :success + end + +end diff --git a/test/controllers/designs_controller_test.rb b/test/controllers/designs_controller_test.rb new file mode 100644 index 0000000..42da6b8 --- /dev/null +++ b/test/controllers/designs_controller_test.rb @@ -0,0 +1,9 @@ +require 'test_helper' + +class DesignsControllerTest < ActionController::TestCase + test "should get index" do + get :index + assert_response :success + end + +end diff --git a/test/controllers/module_store_controller_test.rb b/test/controllers/module_store_controller_test.rb new file mode 100644 index 0000000..e704c26 --- /dev/null +++ b/test/controllers/module_store_controller_test.rb @@ -0,0 +1,9 @@ +require 'test_helper' + +class ModuleStoreControllerTest < ActionController::TestCase + test "should get index" do + get :index + assert_response :success + end + +end diff --git a/test/controllers/sites_controller_test.rb b/test/controllers/sites_controller_test.rb new file mode 100644 index 0000000..a67cfa4 --- /dev/null +++ b/test/controllers/sites_controller_test.rb @@ -0,0 +1,7 @@ +require 'test_helper' + +class SitesControllerTest < ActionController::TestCase + # test "the truth" do + # assert true + # end +end diff --git a/test/fixtures/sites.yml b/test/fixtures/sites.yml new file mode 100644 index 0000000..2e6f274 --- /dev/null +++ b/test/fixtures/sites.yml @@ -0,0 +1,21 @@ +# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html + +one: + title: MyString + school: MyString + department: MyString + address: MyString + footer: MyString + sub_menu: MyString + terms_of_use: MyString + google_analytics: MyString + +two: + title: MyString + school: MyString + department: MyString + address: MyString + footer: MyString + sub_menu: MyString + terms_of_use: MyString + google_analytics: MyString diff --git a/test/helpers/admin/items_helper_test.rb b/test/helpers/admin/items_helper_test.rb new file mode 100644 index 0000000..759adc1 --- /dev/null +++ b/test/helpers/admin/items_helper_test.rb @@ -0,0 +1,4 @@ +require 'test_helper' + +class Admin::ItemsHelperTest < ActionView::TestCase +end diff --git a/test/helpers/designs_helper_test.rb b/test/helpers/designs_helper_test.rb new file mode 100644 index 0000000..11a38a6 --- /dev/null +++ b/test/helpers/designs_helper_test.rb @@ -0,0 +1,4 @@ +require 'test_helper' + +class DesignsHelperTest < ActionView::TestCase +end diff --git a/test/helpers/module_store_helper_test.rb b/test/helpers/module_store_helper_test.rb new file mode 100644 index 0000000..832aea7 --- /dev/null +++ b/test/helpers/module_store_helper_test.rb @@ -0,0 +1,4 @@ +require 'test_helper' + +class ModuleStoreHelperTest < ActionView::TestCase +end diff --git a/test/helpers/sites_helper_test.rb b/test/helpers/sites_helper_test.rb new file mode 100644 index 0000000..0e92edf --- /dev/null +++ b/test/helpers/sites_helper_test.rb @@ -0,0 +1,4 @@ +require 'test_helper' + +class SitesHelperTest < ActionView::TestCase +end diff --git a/test/models/site_test.rb b/test/models/site_test.rb new file mode 100644 index 0000000..38c8dd0 --- /dev/null +++ b/test/models/site_test.rb @@ -0,0 +1,7 @@ +require 'test_helper' + +class SiteTest < ActiveSupport::TestCase + # test "the truth" do + # assert true + # end +end