Merge branch 'ntu' of https://github.com/Rulingcom/orbit into ntu
* 'ntu' of https://github.com/Rulingcom/orbit: fix calendar broken
This commit is contained in:
		
						commit
						80f545966e
					
				|  | @ -2,8 +2,9 @@ class ApplicationController < ActionController::Base | |||
|   protect_from_forgery | ||||
| 
 | ||||
|   include ParserFrontEnd, ParserBackEnd, ApplicationHelper | ||||
|   include OrbitApp::ErrorHandlers::ObjectAuthErrorHandler | ||||
|   include OrbitApp::ErrorHandlers | ||||
|   rescue_from ObjectAuthError, :with => :render_object_auth_error | ||||
|   rescue_from ModuleAppError, :with => :render_module_app_error | ||||
| 
 | ||||
|   layout :layout_by_resource | ||||
|    | ||||
|  |  | |||
|  | @ -13,6 +13,7 @@ class OrbitBackendController < ApplicationController | |||
|   def setup_vars | ||||
|     @app_title ||= controller_path.split('/')[1].singularize | ||||
|     @module_app ||= ModuleApp.first(conditions: {:key => @app_title} ) | ||||
|     raise ModuleAppError, 'Can not find ModuleApp' if @module_app.nil? | ||||
|   end | ||||
| 
 | ||||
|   private | ||||
|  |  | |||
|  | @ -0,0 +1,3 @@ | |||
| class ModuleAppError < StandardError | ||||
|    | ||||
| end | ||||
|  | @ -0,0 +1,16 @@ | |||
| module OrbitApp | ||||
|   module ErrorHandlers | ||||
|     module ModuleAppErrorHandler | ||||
|        | ||||
| 
 | ||||
|       def render_module_app_error(exception = nil) | ||||
|         default_message = 'ModuleAppErrorHandler' | ||||
|         meaasge = '' | ||||
|         if exception | ||||
|           meaasge = default_message + exception.message | ||||
|         end | ||||
|         render :text=>meaasge | ||||
|       end | ||||
|     end | ||||
|   end | ||||
| end | ||||
|  | @ -338,4 +338,16 @@ namespace :migrate do | |||
|       @module_app.save | ||||
|   end | ||||
| 
 | ||||
|   task  :reinstall_calendar => :environment do | ||||
|       old_calendar = ModuleApp.where(key: "calendar") | ||||
|       old_calendar.destroy_all unless old_calendar.empty? | ||||
|       ModuleApp.new.from_json(File.open("#{Rails.root}/vendor/built_in_modules/calendar/calendar.json").read).save | ||||
|   end | ||||
| 
 | ||||
|   task  :reinstall_gallery => :environment do | ||||
|       old_gallery = ModuleApp.where(key: "gallery") | ||||
|       old_gallery.destroy_all unless old_gallery.empty? | ||||
|       ModuleApp.new.from_json(File.open("#{Rails.root}/vendor/built_in_modules/gallery/gallery.json").read).save | ||||
|   end | ||||
| 
 | ||||
| end | ||||
|  |  | |||
|  | @ -0,0 +1,14 @@ | |||
| { | ||||
|   "title": "calendar", | ||||
|   "version": "0.1", | ||||
|   "organization": "Rulingcom", | ||||
|   "author": "Visual dep", | ||||
|   "intro": "A simple and amazing calendar", | ||||
|   "update_info": "Some info", | ||||
|   "create_date": "11-08-2012", | ||||
|   "app_pages":  ["calendar"], | ||||
|   "widgets": [], | ||||
|   "category": [], | ||||
|   "widget_fields":[], | ||||
|   "enable_frontend": true | ||||
| } | ||||
		Loading…
	
		Reference in New Issue