Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Updating the dashboard

  • Loading branch information...
commit 223e6962373941d6061b14e52abc248d5a2c4a1e 1 parent 9f9fecc
@florida authored
View
1  Gemfile
@@ -9,6 +9,7 @@ gem 'sqlite3'
gem 'activeadmin'
gem "bcrypt-ruby", :require => "bcrypt"
gem "paperclip", "~> 3.0"
+
# Gems used only for assets and not required
# in production environments by default.
group :assets do
View
4 Gemfile.lock
@@ -48,6 +48,9 @@ GEM
sass (>= 3.2)
thor
builder (3.0.4)
+ ckeditor (3.7.3)
+ mime-types
+ orm_adapter
cocaine (0.4.2)
coffee-rails (3.2.2)
coffee-script (>= 2.2.0)
@@ -157,6 +160,7 @@ PLATFORMS
DEPENDENCIES
activeadmin
bcrypt-ruby
+ ckeditor (= 3.7.3)
coffee-rails (~> 3.2.1)
jquery-rails
paperclip (~> 3.0)
View
45 app/admin/dashboard.rb
@@ -20,6 +20,51 @@
end
+
+ div :class => "panel" do
+ h3 {"Recent Customers"}
+
+ div :class => "panel_contents" do
+ table_for Order.order("created_at desc").limit(10) do
+ column :first_name do |order|
+ link_to order.first_name, [:admin, order]
+ end
+
+ column :last_name do |order|
+ link_to order.last_name, [:admin, order]
+ end
+
+ column "Ordered On", :created_at
+
+ end
+ strong { link_to "View All Sold Products", "admin_orders_path" }
+ end
+ end
+
+
+ div :class => "panel" do
+ h3 {"Newest Registered Customers"}
+
+ div :class => "panel_contents" do
+ table_for User.order("created_at desc").limit(10) do
+ column :first_name do |order|
+ link_to order.first_name, [:admin, order]
+ end
+
+ column :last_name do |order|
+ link_to order.last_name, [:admin, order]
+ end
+
+ column "Signed Up On", :created_at
+
+ end
+ strong { link_to "View All Users", "admin_users_path" }
+ end
+ end
+
+
+
+
# Here is an example of a simple dashboard with columns and panels.
#
# columns do
View
2  app/admin/pages.rb
@@ -1,3 +1,3 @@
ActiveAdmin.register Page do
-
+
end
View
2  app/assets/javascripts/application.js
@@ -12,4 +12,4 @@
//
//= require jquery
//= require jquery_ujs
-//= require_tree .
+//= require_tree .
View
4 app/controllers/store_controller.rb
@@ -1,13 +1,9 @@
class StoreController < ApplicationController
-
-
def index
@products = Product.available_items
end
-
-
def add_to_cart
product = Product.find(params[:id])
@cart = get_cart
View
13 app/models/ckeditor/picture.rb
@@ -0,0 +1,13 @@
+class Ckeditor::Picture < Ckeditor::Asset
+ has_attached_file :data,
+ :url => "/ckeditor_assets/pictures/:id/:style_:basename.:extension",
+ :path => ":rails_root/public/ckeditor_assets/pictures/:id/:style_:basename.:extension",
+ :styles => { :content => '800>', :thumb => '118x100#' }
+
+ validates_attachment_size :data, :less_than => 2.megabytes
+ validates_attachment_presence :data
+
+ def url_content
+ url(:content)
+ end
+end
View
1  config/environments/production.rb
@@ -3,7 +3,6 @@
# Code is not reloaded between requests
config.cache_classes = true
-
# Full error reports are disabled and caching is turned on
config.consider_all_requests_local = false
config.action_controller.perform_caching = true
View
1  config/routes.rb
@@ -1,4 +1,5 @@
Elmorfstore::Application.routes.draw do
+
get "page/show"
ActiveAdmin.routes(self)
Please sign in to comment.
Something went wrong with that request. Please try again.