diff --git a/app/controllers/admin/components_controller.rb b/app/controllers/admin/components_controller.rb deleted file mode 100644 index 07abc711..00000000 --- a/app/controllers/admin/components_controller.rb +++ /dev/null @@ -1,54 +0,0 @@ -class Admin::ComponentsController < ApplicationController - - layout "admin" - before_filter :authenticate_user! - before_filter :find_parent_item - - def show - #TODO - end - - def new - @component = Component.new - @component.is_published = true - @component.parent_name = @parent_item.name - - @component.engine_name = 'Announcement' # only support Announcement now - end - - def edit - @component = Component.find(params[:id]) - end - - def create - @component = Component.new(params[:component]) - - if @component.save - flash[:notice] = 'Component was successfully created.' - redirect_to admin_items_url( :parent_name => @component.parent_name ) - else - render :action => "new" - end - end - - def update - @component = Component.find(params[:id]) - - if @component.update_attributes(params[:component]) - flash[:notice] = 'Component was successfully updated.' - redirect_to admin_items_url( :parent_name => @component.parent_name ) - else - render :action => "edit" - end - end - - def destroy - @component = Component.find(params[:id]) - @component.destroy - - #TODO: destroy engine data - - redirect_to admin_items_url( :parent_name => @component.parent_name ) - end - -end diff --git a/app/controllers/announcements_controller.rb b/app/controllers/announcements_controller.rb deleted file mode 100644 index 2ba3ad56..00000000 --- a/app/controllers/announcements_controller.rb +++ /dev/null @@ -1,29 +0,0 @@ -class AnnouncementsController < ApplicationController - - def index - @announcements = Announcement.all( :conditions => { :entry_name => params[:entry_name] }) - - respond_to do |format| - format.html { - @page = Page.find_by_name( 'announcement_index') - @page_options = { "announcements" => @announcements.map{ |a| a.to_liquid } } - render_liquid_page - } - format.xml { render :xml => @announcements } - end - end - - def show - @announcement = Announcement.find(params[:id]) - - respond_to do |format| - format.html{ - @page = Page.find_by_name( 'announcement_show') - @page_options = { 'announcement' => @announcement.to_liquid } - render_liquid_page - } - format.xml { render :xml => @announcement } - end - end - -end diff --git a/app/controllers/panel/announcements_controller.rb b/app/controllers/panel/announcements_controller.rb deleted file mode 100644 index 9bbcc051..00000000 --- a/app/controllers/panel/announcements_controller.rb +++ /dev/null @@ -1,49 +0,0 @@ -class Panel::AnnouncementsController < ApplicationController - - before_filter :require_entry_name, :only => [:index, :new] - - layout "admin" - - def index - @announcements = Announcement.all( :conditions => { :entry_name => params[:entry_name] }) - end - - def new - @announcement = Announcement.new - @announcement.entry_name = params[:entry_name] - end - - def edit - @announcement = Announcement.find(params[:id]) - end - - def create - @announcement = Announcement.new(params[:announcement]) - - if @announcement.save - flash[:notice] = 'Announcement was successfully created.' - redirect_to panel_announcements_path( :entry_name => @announcement.entry_name ) - else - render :action => "new" - end - end - - def update - @announcement = Announcement.find(params[:id]) - - if @announcement.update_attributes(params[:announcement]) - flash[:notice] = 'Announcement was successfully updated.' - redirect_to panel_announcements_path( :entry_name => @announcement.entry_name ) - else - render :action => "edit" - end - end - - def destroy - @announcement = Announcement.find(params[:id]) - @announcement.destroy - - redirect_to panel_announcements_path( :entry_name => @announcement.entry_name ) - end - -end diff --git a/app/helpers/admin/user_attributes_helper.rb b/app/helpers/admin/user_attributes_helper.rb deleted file mode 100644 index c60beabb..00000000 --- a/app/helpers/admin/user_attributes_helper.rb +++ /dev/null @@ -1,2 +0,0 @@ -module Admin::UserAttributesHelper -end diff --git a/app/helpers/announcements_helper.rb b/app/helpers/announcements_helper.rb deleted file mode 100644 index beb2d039..00000000 --- a/app/helpers/announcements_helper.rb +++ /dev/null @@ -1,2 +0,0 @@ -module AnnouncementsHelper -end diff --git a/app/helpers/pages_helper.rb b/app/helpers/pages_helper.rb deleted file mode 100644 index 2c057fd0..00000000 --- a/app/helpers/pages_helper.rb +++ /dev/null @@ -1,2 +0,0 @@ -module PagesHelper -end diff --git a/app/models/announcement.rb b/app/models/announcement.rb deleted file mode 100644 index e708ce98..00000000 --- a/app/models/announcement.rb +++ /dev/null @@ -1,13 +0,0 @@ -class Announcement - - include MongoMapper::Document - - key :component_name, String, :required => true, :index => true - key_i18n :title, String - key_i18n :content, String - - def to_liquid - { "component_name" => self.entry_name, "id" => self.id.to_s, "title" => self.title, "content" => self.content } - end - -end \ No newline at end of file diff --git a/app/models/assets/asset_image.rb b/app/models/assets/asset_image.rb deleted file mode 100644 index 1dba508e..00000000 --- a/app/models/assets/asset_image.rb +++ /dev/null @@ -1,3 +0,0 @@ -class AssetImage < Asset - -end \ No newline at end of file diff --git a/app/models/assets/asset_javascript.rb b/app/models/assets/asset_javascript.rb deleted file mode 100644 index 5d14b9f3..00000000 --- a/app/models/assets/asset_javascript.rb +++ /dev/null @@ -1,3 +0,0 @@ -class AssetJavascript < Asset - -end \ No newline at end of file diff --git a/app/models/assets/asset_pdf.rb b/app/models/assets/asset_pdf.rb deleted file mode 100644 index 457f438d..00000000 --- a/app/models/assets/asset_pdf.rb +++ /dev/null @@ -1,2 +0,0 @@ -class AssetPdf < Asset -end \ No newline at end of file diff --git a/app/models/assets/asset_stylesheet.rb b/app/models/assets/asset_stylesheet.rb deleted file mode 100644 index f04f37ca..00000000 --- a/app/models/assets/asset_stylesheet.rb +++ /dev/null @@ -1,3 +0,0 @@ -class AssetStylesheet < Asset - -end \ No newline at end of file diff --git a/app/models/component.rb b/app/models/component.rb deleted file mode 100644 index c74ea4c0..00000000 --- a/app/models/component.rb +++ /dev/null @@ -1,22 +0,0 @@ -class Component < Item - - include LayoutSupport - - key :engine_name, String - key :layout_name, String, :required => true - key :layout_id, ObjectId, :required => true - - belongs_to :layout - - protected - - def setup_default_value - super - - if self.layout_name - self.layout_id = Layout.find_by_name( self.layout_name ).id - end - - end - -end \ No newline at end of file diff --git a/app/views/admin/components/_form.html.erb b/app/views/admin/components/_form.html.erb deleted file mode 100644 index ef8a4d56..00000000 --- a/app/views/admin/components/_form.html.erb +++ /dev/null @@ -1,32 +0,0 @@ -<%= f.error_messages %> -<%= f.hidden_field :parent_name %> - -

-<%= f.label :name, "Name" %> -<%= f.text_field :name, :class => 'text' %> -

- -

-<%= f.label :title, "Title en" %> -<%= f.text_field :title_en, :class => 'text' %> -

- -

-<%= f.label :layout_name, "Layout Name" %> -<%= f.select :layout_name, Layout.all.map{ |l| [l.description, l.name] } %> -

- -

-<%= f.label :title, "Title zh_tw" %> -<%= f.text_field :title_zh_tw, :class => 'text' %> -

- -

-<%= f.label :is_published, "Is Published" %> -<%= f.radio_button :is_published, true %>Yes <%= f.radio_button :is_published, false %> No -

- -

-<%= f.label :engine_name, "Choose Engine" %> -<%= f.text_field :engine_name %> -

\ No newline at end of file diff --git a/app/views/admin/components/edit.html.erb b/app/views/admin/components/edit.html.erb deleted file mode 100644 index 6d1e73b1..00000000 --- a/app/views/admin/components/edit.html.erb +++ /dev/null @@ -1,10 +0,0 @@ -

Editing pages

- -<% form_for @component, :url => admin_component_path(@component) do |f| %> - - <%= render :partial => "form", :locals => { :f => f } %> - -

- <%= f.submit 'Update' %> -

-<% end %> \ No newline at end of file diff --git a/app/views/admin/components/new.html.erb b/app/views/admin/components/new.html.erb deleted file mode 100644 index 237d22fc..00000000 --- a/app/views/admin/components/new.html.erb +++ /dev/null @@ -1,11 +0,0 @@ -

<%= t(:new_component, :scope => :admin) %>

- -<% form_for @component, :url => admin_components_path do |f| %> - - <%= render :partial => "form", :locals => { :f => f } %> - -

- <%= f.submit 'Create' %> -

- -<% end %> \ No newline at end of file diff --git a/app/views/panel/announcements/_form.html.erb b/app/views/panel/announcements/_form.html.erb deleted file mode 100644 index ace3e853..00000000 --- a/app/views/panel/announcements/_form.html.erb +++ /dev/null @@ -1,44 +0,0 @@ -<%= f.hidden_field :entry_name %> - -

-<%= f.label "title_zh_tw", "Title (zh_tw)" %> -<%= f.text_field "title_zh_tw" %> -

- -

Edit english

- -

-<%= f.label "title_en", "Title (en)" %> -<%= f.text_field "title_en" %> -

- -<% content_for :page_specific_javascript do %> - -<% end -%> - - -

-<%= f.label "content_zh_tw", "Content (zh_tw)" %> -<%= f.text_area "content_zh_tw", :size => '100x30' %> -

- -

Edit english

- -

-<%= f.label "content_en", "Content (en)" %> -<%= f.text_area "content_en", :size => '100x30' %> -

- -<% content_for :page_specific_javascript do %> - -<% end -%> \ No newline at end of file diff --git a/app/views/panel/announcements/edit.html.erb b/app/views/panel/announcements/edit.html.erb deleted file mode 100644 index 00ce99be..00000000 --- a/app/views/panel/announcements/edit.html.erb +++ /dev/null @@ -1,14 +0,0 @@ -

Editing announcement

- -<% form_for @announcement, :url => panel_announcement_path(@announcement) do |f| %> - <%= f.error_messages %> - - <%= render :partial => "form", :locals => { :f => f } %> - -

- <%= f.submit 'Update' %> -

-<% end %> - -<%= link_to 'Show', @announcement %> | -<%= link_to 'Back', panel_announcements_path %> \ No newline at end of file diff --git a/app/views/panel/announcements/index.html.erb b/app/views/panel/announcements/index.html.erb deleted file mode 100644 index 2d1d1c20..00000000 --- a/app/views/panel/announcements/index.html.erb +++ /dev/null @@ -1,21 +0,0 @@ -

Listing announcements

- - - - - - - -<% @announcements.each do |announcement| %> - - - - -<% end %> -
TitleActions
<%=h announcement.title %><%= link_to 'Show', announcement_path(announcement) %> | - <%= link_to 'Edit', edit_panel_announcement_path(announcement) %> | - <%= link_to 'Destroy', panel_announcement_path(announcement), :confirm => 'Are you sure?', :method => :delete %>
- -
- -<%= link_to 'New announcement', new_panel_announcement_path( :entry_name => params[:entry_name] ) %> \ No newline at end of file diff --git a/app/views/panel/announcements/new.html.erb b/app/views/panel/announcements/new.html.erb deleted file mode 100644 index 207aef11..00000000 --- a/app/views/panel/announcements/new.html.erb +++ /dev/null @@ -1,13 +0,0 @@ -

New announcement

- -<% form_for @announcement, :url => panel_announcements_path do |f| %> - <%= f.error_messages %> - - <%= render :partial => "form", :locals => { :f => f } %> - -

- <%= f.submit 'Create' %> -

-<% end %> - -<%= link_to 'Back', panel_announcements_path %> \ No newline at end of file diff --git a/config/initializers/mongo.rb b/config/initializers/mongo.rb deleted file mode 100644 index 78b4c26f..00000000 --- a/config/initializers/mongo.rb +++ /dev/null @@ -1,28 +0,0 @@ -MongoMapper.connection = Mongo::Connection.new('localhost', 27017) -MongoMapper.database = "r4-#{Rails.env}" - -if defined?(PhusionPassenger) - PhusionPassenger.on_event(:starting_worker_process) do |forked| - MongoMapper.connection.connect_to_master if forked - end -end - -module MongoMapper::Document::ClassMethods - - def key_i18n(key, *options) - VALID_LOCALES.each do |locale| - key "#{key.to_s}_#{locale}".to_sym, *options - end - - define_method(key) do - self.send("#{key.to_s}_#{I18n.locale}") - end - - define_method("#{key}=") do |value| - VALID_LOCALES.each do |locale| - self.send("#{key.to_s}_#{locale}=", value) - end - end - end - -end \ No newline at end of file diff --git a/lib/reroute_middleware.rb b/lib/reroute_middleware.rb deleted file mode 100644 index 1f7f79e0..00000000 --- a/lib/reroute_middleware.rb +++ /dev/null @@ -1,29 +0,0 @@ -class RerouteMiddleware - - def initialize(app) - @app = app - end - - def call(env) - - #Rails.logger.debug env.to_yaml - return @app.call(env) if env['REQUEST_URI'] =~ /^\/admin/ - - env['REQUEST_URI'] =~ /^\/([0-9a-zA-Z\-_\/]*)/ - parsed_entry_name = $1 - - entry = Item.first(:conditions => {:full_name => parsed_entry_name} ) - if entry - case entry.type.to_s - when 'Component' - env['REQUEST_URI'] = env['REQUEST_URI'].sub!(parsed_entry_name, entry.engine_name) - env['QUERY_STRING'] = (env['QUERY_STRING'].blank?)? "entry_name=#{parsed_entry_name}" : "entry_name=#{parsed_entry_name}&#{env['QUERY_STRING']}" - when 'Link' - return [301, {'Location' => entry.url }, ['See Ya!']] - end - end - - @app.call(env) - end - -end diff --git a/lib/template/about.page.en b/lib/template/about.page.en deleted file mode 100644 index 2b081c45..00000000 --- a/lib/template/about.page.en +++ /dev/null @@ -1 +0,0 @@ -

About us

\ No newline at end of file diff --git a/lib/template/about.page.zh_tw b/lib/template/about.page.zh_tw deleted file mode 100644 index d2ecbd83..00000000 --- a/lib/template/about.page.zh_tw +++ /dev/null @@ -1 +0,0 @@ -

關於我們

\ No newline at end of file diff --git a/lib/template/footer.snippet.en b/lib/template/footer.snippet.en deleted file mode 100644 index 1486284b..00000000 --- a/lib/template/footer.snippet.en +++ /dev/null @@ -1 +0,0 @@ -

Footer

\ No newline at end of file diff --git a/lib/template/footer.snippet.zh_tw b/lib/template/footer.snippet.zh_tw deleted file mode 100644 index d8b078c7..00000000 --- a/lib/template/footer.snippet.zh_tw +++ /dev/null @@ -1 +0,0 @@ -

頁尾

\ No newline at end of file diff --git a/lib/template/locale.snippet.en b/lib/template/locale.snippet.en deleted file mode 100644 index 490dd3a5..00000000 --- a/lib/template/locale.snippet.en +++ /dev/null @@ -1,4 +0,0 @@ - \ No newline at end of file diff --git a/lib/template/locale.snippet.zh_tw b/lib/template/locale.snippet.zh_tw deleted file mode 100644 index 490dd3a5..00000000 --- a/lib/template/locale.snippet.zh_tw +++ /dev/null @@ -1,4 +0,0 @@ - \ No newline at end of file diff --git a/lib/template/nav.snippet.en b/lib/template/nav.snippet.en deleted file mode 100644 index 94d35a67..00000000 --- a/lib/template/nav.snippet.en +++ /dev/null @@ -1,4 +0,0 @@ -