gem 'kaminari'
gem 'sanitize'
gem 'aws-s3'
+gem 'awesome_nested_set'
gem 'validates_existence'
gem "validate_url"
gem "pettanr_creative_commons_v30_licenses"
--- /dev/null
+# 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://jashkenas.github.com/coffee-script/
--- /dev/null
+// Place all the styles related to the folders controller here.
+// They will automatically be included in application.css.
+// You can use Sass (SCSS) here: http://sass-lang.com/
--- /dev/null
+class FoldersController < ApplicationController
+ if Manifest.manifest.magic_numbers['run_mode'] == 0
+ before_filter :authenticate_admin, :only => [:new, :create, :edit, :update, :destroy]
+ else
+ before_filter :authenticate_reader, :only => [:index, :show]
+ before_filter :authenticate_admin, :only => [:new, :create, :edit, :update, :destroy]
+ end
+
+ def self.model
+ Folder
+ end
+
+ def index
+ filer_list
+ end
+
+ def show_html_format format
+ format.html {
+ @folder = @item
+ }
+ end
+
+ def show
+ set_show
+ respond_to do |format|
+ show_html_format format
+ show_prof_format format
+ show_json_format format
+ end
+ end
+
+end
--- /dev/null
+module FoldersHelper
+end
--- /dev/null
+class Folder < Peta::Item
+ acts_as_nested_set
+
+ validates :controller_name, :length => {:maximum => 200}
+ validates :action_name, :length => {:maximum => 200}
+ validates :category_id, :presence => true, :numericality => true
+ validates :t, :presence => true, :numericality => true
+
+ def self.generate
+ if self.root
+ else
+ self.create :category_id => 0
+ end
+
+ end
+
+end
--- /dev/null
+class CreateFolders < ActiveRecord::Migration
+ def change
+ create_table :folders do |t|
+ t.string :controller_name, :null => false
+ t.string :action_name, :null => false
+ t.integer :category_id, :null => false, :default => 0
+ t.integer :t, :null => false, :default => 0
+ t.integer :parent_id
+ t.integer :lft
+ t.integer :rgt
+ t.integer :depth # this is optional.
+
+ t.timestamps
+ end
+ add_index :folders , [:rgt]
+ end
+end
--- /dev/null
+require 'spec_helper'
+
+describe FoldersController do
+
+end
--- /dev/null
+require 'spec_helper'
+
+# Specs in this file have access to a helper object that includes
+# the FoldersHelper. For example:
+#
+# describe FoldersHelper do
+# describe "string concat" do
+# it "concats two strings with spaces" do
+# helper.concat_strings("this","that").should == "this that"
+# end
+# end
+# end
+describe FoldersHelper do
+ pending "add some examples to (or delete) #{__FILE__}"
+end
--- /dev/null
+require 'spec_helper'
+
+describe Folder do
+ pending "add some examples to (or delete) #{__FILE__}"
+end