Skip to content

Commit

Permalink
Merge pull request #95 from bigbinary/qamode
Browse files Browse the repository at this point in the history
moving simple engine based design
  • Loading branch information
Neeraj Singh committed Mar 7, 2013
2 parents c90759d + 047010e commit 2d122ca
Show file tree
Hide file tree
Showing 124 changed files with 438 additions and 631 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ response.html
tags
pkg
.rvmrc
admindatademo/

test/rails_root/tmp/**/*
test/rails_root/log/*.*
Expand Down
21 changes: 19 additions & 2 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,22 @@
source "http://rubygems.org"

gem 'rake', '=0.8.7'

# Declare your gem's dependencies in admin_data.gemspec.
# Bundler will treat runtime dependencies like base dependencies, and
# development dependencies will be added by default to the :development group.
gemspec

# jquery-rails is used by the dummy application
gem "jquery-rails"
gem 'sqlite3'

group :tools do
gem 'guard-test'
end

# Declare any dependencies that are still in development here instead of in
# your gemspec. These might include edge Rails or gems from your path or
# Git. Remember to move these dependencies to your gemspec before releasing
# your gem to rubygems.org.

# To use debugger
# gem 'debugger'
121 changes: 74 additions & 47 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,94 +1,121 @@
PATH
remote: .
specs:
admin_data (1.2.1)
admin_data (0.0.1)
rails (~> 3.1)
will_paginate (>= 3.0.0)

GEM
remote: http://rubygems.org/
specs:
actionmailer (3.2.3)
actionpack (= 3.2.3)
actionmailer (3.2.12)
actionpack (= 3.2.12)
mail (~> 2.4.4)
actionpack (3.2.3)
activemodel (= 3.2.3)
activesupport (= 3.2.3)
actionpack (3.2.12)
activemodel (= 3.2.12)
activesupport (= 3.2.12)
builder (~> 3.0.0)
erubis (~> 2.7.0)
journey (~> 1.0.1)
rack (~> 1.4.0)
journey (~> 1.0.4)
rack (~> 1.4.5)
rack-cache (~> 1.2)
rack-test (~> 0.6.1)
sprockets (~> 2.1.2)
activemodel (3.2.3)
activesupport (= 3.2.3)
sprockets (~> 2.2.1)
activemodel (3.2.12)
activesupport (= 3.2.12)
builder (~> 3.0.0)
activerecord (3.2.3)
activemodel (= 3.2.3)
activesupport (= 3.2.3)
activerecord (3.2.12)
activemodel (= 3.2.12)
activesupport (= 3.2.12)
arel (~> 3.0.2)
tzinfo (~> 0.3.29)
activeresource (3.2.3)
activemodel (= 3.2.3)
activesupport (= 3.2.3)
activesupport (3.2.3)
activeresource (3.2.12)
activemodel (= 3.2.12)
activesupport (= 3.2.12)
activesupport (3.2.12)
i18n (~> 0.6)
multi_json (~> 1.0)
arel (3.0.2)
builder (3.0.0)
builder (3.0.4)
coderay (1.0.9)
erubis (2.7.0)
guard (1.6.2)
listen (>= 0.6.0)
lumberjack (>= 1.0.2)
pry (>= 0.9.10)
terminal-table (>= 1.4.3)
thor (>= 0.14.6)
guard-test (0.7.0)
guard (>= 1.1)
test-unit (~> 2.2)
hike (1.2.1)
i18n (0.6.0)
journey (1.0.3)
json (1.7.0)
i18n (0.6.4)
journey (1.0.4)
jquery-rails (2.2.1)
railties (>= 3.0, < 5.0)
thor (>= 0.14, < 2.0)
json (1.7.7)
listen (0.7.3)
lumberjack (1.0.2)
mail (2.4.4)
i18n (>= 0.4.0)
mime-types (~> 1.16)
treetop (~> 1.4.8)
mime-types (1.18)
multi_json (1.3.4)
method_source (0.8.1)
mime-types (1.21)
multi_json (1.6.1)
polyglot (0.3.3)
rack (1.4.1)
pry (0.9.12)
coderay (~> 1.0.5)
method_source (~> 0.8)
slop (~> 3.4)
rack (1.4.5)
rack-cache (1.2)
rack (>= 0.4)
rack-ssl (1.3.2)
rack-ssl (1.3.3)
rack
rack-test (0.6.1)
rack-test (0.6.2)
rack (>= 1.0)
rails (3.2.3)
actionmailer (= 3.2.3)
actionpack (= 3.2.3)
activerecord (= 3.2.3)
activeresource (= 3.2.3)
activesupport (= 3.2.3)
rails (3.2.12)
actionmailer (= 3.2.12)
actionpack (= 3.2.12)
activerecord (= 3.2.12)
activeresource (= 3.2.12)
activesupport (= 3.2.12)
bundler (~> 1.0)
railties (= 3.2.3)
railties (3.2.3)
actionpack (= 3.2.3)
activesupport (= 3.2.3)
railties (= 3.2.12)
railties (3.2.12)
actionpack (= 3.2.12)
activesupport (= 3.2.12)
rack-ssl (~> 1.3.2)
rake (>= 0.8.7)
rdoc (~> 3.4)
thor (~> 0.14.6)
rake (0.8.7)
rdoc (3.12)
thor (>= 0.14.6, < 2.0)
rake (10.0.3)
rdoc (3.12.2)
json (~> 1.4)
sprockets (2.1.3)
slop (3.4.3)
sprockets (2.2.2)
hike (~> 1.2)
multi_json (~> 1.0)
rack (~> 1.0)
tilt (~> 1.1, != 1.3.0)
thor (0.14.6)
tilt (1.3.3)
treetop (1.4.10)
sqlite3 (1.3.7)
terminal-table (1.4.5)
test-unit (2.5.4)
thor (0.17.0)
tilt (1.3.4)
treetop (1.4.12)
polyglot
polyglot (>= 0.3.1)
tzinfo (0.3.33)
will_paginate (3.0.3)
tzinfo (0.3.36)
will_paginate (3.0.4)

PLATFORMS
ruby

DEPENDENCIES
admin_data!
rake (= 0.8.7)
guard-test
jquery-rails
sqlite3
14 changes: 14 additions & 0 deletions Guardfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# A sample Guardfile
# More info at https://github.com/guard/guard#readme

guard :test do
watch(%r{^lib/(.+)\.rb$}) { |m| "test/#{m[1]}_test.rb" }
watch(%r{^test/.+_test\.rb$})
watch('test/test_helper.rb') { "test" }

# Rails example
watch(%r{^app/models/(.+)\.rb$}) { |m| "test/unit/#{m[1]}_test.rb" }
watch(%r{^app/controllers/(.+)\.rb$}) { |m| "test/functional/#{m[1]}_test.rb" }
watch(%r{^app/views/.+\.rb$}) { "test/integration" }
watch('app/controllers/application_controller.rb') { ["test/functional", "test/integration"] }
end
20 changes: 20 additions & 0 deletions MIT-LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
Copyright 2013 YOURNAME

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
3 changes: 3 additions & 0 deletions README.rdoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
= AdminData

This project rocks and uses MIT-LICENSE.
40 changes: 39 additions & 1 deletion Rakefile
Original file line number Diff line number Diff line change
@@ -1,2 +1,40 @@
require 'bundler'
#!/usr/bin/env rake
begin
require 'bundler/setup'
rescue LoadError
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
end
begin
require 'rdoc/task'
rescue LoadError
require 'rdoc/rdoc'
require 'rake/rdoctask'
RDoc::Task = Rake::RDocTask
end

RDoc::Task.new(:rdoc) do |rdoc|
rdoc.rdoc_dir = 'rdoc'
rdoc.title = 'AdminData'
rdoc.options << '--line-numbers'
rdoc.rdoc_files.include('README.rdoc')
rdoc.rdoc_files.include('lib/**/*.rb')
end

APP_RAKEFILE = File.expand_path("../test/dummy/Rakefile", __FILE__)
load 'rails/tasks/engine.rake'



Bundler::GemHelper.install_tasks

require 'rake/testtask'

Rake::TestTask.new(:test) do |t|
t.libs << 'lib'
t.libs << 'test'
t.pattern = 'test/**/*_test.rb'
t.verbose = false
end


task :default => :test
3 changes: 1 addition & 2 deletions admin_data.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ Gem::Specification.new do |s|
s.rubyforge_project = "admin_data"

s.files = `git ls-files`.split("\n")
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
s.test_files = `git ls-files -- {test}/*`.split("\n")
s.require_paths = ["lib"]

s.add_dependency("will_paginate", ">= 3.0.0")
Expand Down
File renamed without changes.
15 changes: 15 additions & 0 deletions app/assets/javascripts/admin_data/application.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// This is a manifest file that'll be compiled into application.js, which will include all the files
// listed below.
//
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
// or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
//
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
// the compiled file.
//
// WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD
// GO AFTER THE REQUIRES BELOW.
//
//= require jquery
//= require jquery_ujs
//= require_tree .
13 changes: 13 additions & 0 deletions app/assets/stylesheets/admin_data/application.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/*
* This is a manifest file that'll be compiled into application.css, which will include all the files
* listed below.
*
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
* or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
*
* You're free to add application-wide styles to this file and they'll appear at the top of the
* compiled file, but it's generally better to create a new file per style scope.
*
*= require_self
*= require_tree .
*/
38 changes: 0 additions & 38 deletions app/controllers/admin_data/analytics_controller.rb

This file was deleted.

13 changes: 8 additions & 5 deletions app/controllers/admin_data/application_controller.rb
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
module AdminData

class ApplicationController < ::ApplicationController

layout 'admin_data'

before_filter :ensure_is_allowed_to_view

helper_method :is_allowed_to_update?

layout 'admin_data'

before_filter :build_klasses, :build_drop_down_for_klasses, :check_page_parameter, :prepare_drop_down_klasses
before_filter :build_klasses,
:build_drop_down_for_klasses,
:check_page_parameter,
:prepare_drop_down_klasses

attr_reader :klass

Expand Down Expand Up @@ -73,8 +76,8 @@ def get_klass_names(model_names)
end

def build_drop_down_for_klasses
@drop_down_for_klasses = @klasses.inject([]) do |result, klass|
result << [klass.name.underscore, admin_data_search_url(:klass => klass.name.underscore)]
@drop_down_for_klasses = ModelFinder.models.inject([]) do |result, klass|
result << [klass, search_url(:klass => klass)]
end
end

Expand Down
Loading

0 comments on commit 2d122ca

Please sign in to comment.