grandstand 0.2.4 → 0.2.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/MIT-LICENSE +1 -1
- data/README.markdown +43 -0
- data/README.txt +0 -0
- data/Rakefile +7 -1
- data/VERSION +1 -1
- data/app/controllers/galleries_controller.rb +2 -2
- data/app/controllers/{admin → grandstand}/galleries_controller.rb +9 -13
- data/app/controllers/{admin → grandstand}/images_controller.rb +6 -9
- data/app/controllers/{admin → grandstand}/main_controller.rb +8 -8
- data/app/controllers/{admin → grandstand}/pages_controller.rb +9 -9
- data/app/controllers/grandstand/posts_controller.rb +64 -0
- data/app/controllers/{admin → grandstand}/sessions_controller.rb +8 -8
- data/app/controllers/grandstand/templates_controller.rb +8 -0
- data/app/controllers/{admin → grandstand}/users_controller.rb +10 -10
- data/app/controllers/posts_controller.rb +1 -1
- data/app/helpers/galleries_helper.rb +2 -0
- data/app/helpers/grandstand/galleries_helper.rb +2 -0
- data/app/helpers/grandstand/images_helpers.rb +2 -0
- data/app/helpers/grandstand/main_helper.rb +74 -0
- data/app/helpers/grandstand/pages_helper.rb +2 -0
- data/app/helpers/grandstand/posts_helper.rb +2 -0
- data/app/helpers/grandstand/sessions_helper.rb +2 -0
- data/app/helpers/grandstand/templates_helper.rb +2 -0
- data/app/helpers/grandstand/users_helper.rb +2 -0
- data/app/models/{gallery.rb → grandstand/gallery.rb} +2 -2
- data/app/models/{image.rb → grandstand/image.rb} +10 -9
- data/app/models/{page.rb → grandstand/page.rb} +1 -1
- data/app/models/grandstand/page_section.rb +6 -0
- data/app/models/{post.rb → grandstand/post.rb} +14 -2
- data/app/models/{template.rb → grandstand/template.rb} +2 -2
- data/app/models/{user.rb → grandstand/user.rb} +1 -1
- data/app/stylesheets/application.less +103 -10
- data/app/stylesheets/global.less +47 -30
- data/app/stylesheets/login.less +1 -1
- data/app/stylesheets/wysiwyg.less +77 -65
- data/app/views/{admin → grandstand}/galleries/_form.html.erb +2 -2
- data/app/views/grandstand/galleries/_gallery.html.erb +16 -0
- data/app/views/grandstand/galleries/_list.html.erb +17 -0
- data/app/views/grandstand/galleries/delete.html.erb +8 -0
- data/app/views/grandstand/galleries/edit.html.erb +8 -0
- data/app/views/grandstand/galleries/editor.html.erb +33 -0
- data/app/views/grandstand/galleries/index.html.erb +14 -0
- data/app/views/grandstand/galleries/new.html.erb +8 -0
- data/app/views/grandstand/galleries/show.html.erb +19 -0
- data/app/views/{admin → grandstand}/images/_form.html.erb +2 -2
- data/app/views/grandstand/images/delete.html.erb +8 -0
- data/app/views/grandstand/images/edit.html.erb +8 -0
- data/app/views/grandstand/images/new.html.erb +8 -0
- data/app/views/grandstand/images/show.html.erb +33 -0
- data/app/views/{admin → grandstand}/images/upload.html.erb +2 -2
- data/app/views/grandstand/main/index.html.erb +10 -0
- data/app/views/{admin → grandstand}/pages/_form.html.erb +2 -2
- data/app/views/grandstand/pages/_left.html.erb +3 -0
- data/app/views/{admin → grandstand}/pages/_row.html.erb +3 -3
- data/app/views/{admin → grandstand}/pages/delete.html.erb +2 -2
- data/app/views/{admin → grandstand}/pages/edit.html.erb +2 -2
- data/app/views/{admin → grandstand}/pages/index.html.erb +1 -1
- data/app/views/{admin → grandstand}/pages/new.html.erb +2 -2
- data/app/views/{admin → grandstand}/pages/show.html.erb +1 -1
- data/app/views/grandstand/posts/_form.html.erb +15 -0
- data/app/views/grandstand/posts/_left.html.erb +3 -0
- data/app/views/grandstand/posts/_list.html.erb +26 -0
- data/app/views/{admin → grandstand}/posts/delete.html.erb +2 -2
- data/app/views/grandstand/posts/edit.html.erb +8 -0
- data/app/views/{admin → grandstand}/posts/index.html.erb +1 -1
- data/app/views/grandstand/posts/new.html.erb +8 -0
- data/app/views/grandstand/posts/preview.html.erb +9 -0
- data/app/views/grandstand/posts/show.html.erb +8 -0
- data/app/views/{admin → grandstand}/sessions/forgot.html.erb +2 -2
- data/app/views/{admin → grandstand}/sessions/show.html.erb +2 -2
- data/app/views/grandstand/shared/_flash.html.erb +3 -0
- data/app/views/{admin → grandstand}/users/_form.html.erb +2 -2
- data/app/views/grandstand/users/_left.html.erb +3 -0
- data/app/views/{admin → grandstand}/users/delete.html.erb +2 -2
- data/app/views/grandstand/users/edit.html.erb +8 -0
- data/app/views/{admin → grandstand}/users/index.html.erb +3 -3
- data/app/views/grandstand/users/new.html.erb +8 -0
- data/app/views/grandstand/users/show.html.erb +12 -0
- data/app/views/layouts/grandstand.html.erb +76 -0
- data/app/views/layouts/grandstand_login.html.erb +17 -0
- data/app/views/layouts/{admin_xhr.html.erb → grandstand_xhr.html.erb} +0 -0
- data/app/views/posts/show.html.erb +2 -2
- data/{lib/grandstand → config}/routes.rb +9 -7
- data/grandstand.gemspec +139 -122
- data/lib/grandstand.rb +50 -19
- data/lib/grandstand/application.rb +27 -35
- data/lib/grandstand/controller.rb +4 -6
- data/lib/grandstand/form_builder.rb +19 -0
- data/lib/grandstand/helper.rb +1 -47
- data/lib/grandstand/session.rb +2 -11
- data/lib/grandstand/stylesheets_controller.rb +14 -0
- data/public/{admin → grandstand}/images/background-input.gif +0 -0
- data/public/{admin → grandstand}/images/background-progress-bar.png +0 -0
- data/public/{admin → grandstand}/images/background-progress-complete.gif +0 -0
- data/public/{admin → grandstand}/images/background-progress.gif +0 -0
- data/public/grandstand/images/galleries-empty.png +0 -0
- data/public/{admin → grandstand}/images/icons/add.png +0 -0
- data/public/{admin → grandstand}/images/icons/collapse.png +0 -0
- data/public/{admin → grandstand}/images/icons/delete.png +0 -0
- data/public/{admin → grandstand}/images/icons/edit.png +0 -0
- data/public/{admin → grandstand}/images/icons/editor/bold.png +0 -0
- data/public/{admin → grandstand}/images/icons/editor/gallery.png +0 -0
- data/public/{admin → grandstand}/images/icons/editor/image-center.png +0 -0
- data/public/{admin → grandstand}/images/icons/editor/image-left.png +0 -0
- data/public/{admin → grandstand}/images/icons/editor/image-right.png +0 -0
- data/public/{admin → grandstand}/images/icons/editor/image.png +0 -0
- data/public/{admin → grandstand}/images/icons/editor/italic.png +0 -0
- data/public/{admin → grandstand}/images/icons/editor/ordered-list.png +0 -0
- data/public/{admin → grandstand}/images/icons/editor/quote.png +0 -0
- data/public/{admin → grandstand}/images/icons/editor/source.png +0 -0
- data/public/{admin → grandstand}/images/icons/editor/strikethrough.png +0 -0
- data/public/{admin → grandstand}/images/icons/editor/underline.png +0 -0
- data/public/{admin → grandstand}/images/icons/editor/unordered-list.png +0 -0
- data/public/{admin → grandstand}/images/icons/error.png +0 -0
- data/public/{admin → grandstand}/images/icons/expand.png +0 -0
- data/public/{admin → grandstand}/images/icons/galleries.png +0 -0
- data/public/{admin → grandstand}/images/icons/gallery.png +0 -0
- data/public/{admin → grandstand}/images/icons/image.png +0 -0
- data/public/{admin → grandstand}/images/icons/okay.png +0 -0
- data/public/{admin → grandstand}/images/icons/pages.png +0 -0
- data/public/{admin → grandstand}/images/icons/posts.png +0 -0
- data/public/grandstand/images/icons/processing.gif +0 -0
- data/public/{admin → grandstand}/images/icons/upload.png +0 -0
- data/public/{admin → grandstand}/images/icons/users.png +0 -0
- data/public/{admin → grandstand}/images/logo.png +0 -0
- data/public/{admin → grandstand}/images/spinner-dark.gif +0 -0
- data/public/{admin → grandstand}/images/uploader.swf +0 -0
- data/public/{admin → grandstand}/javascripts/application.js +139 -54
- data/public/grandstand/javascripts/jquery.js +414 -0
- data/public/{admin → grandstand}/javascripts/mustache.js +0 -0
- data/public/grandstand/javascripts/preview.js +9 -0
- data/public/{admin → grandstand}/javascripts/selection.js +77 -57
- data/public/{admin → grandstand}/javascripts/string.js +7 -6
- data/public/grandstand/javascripts/wysiwyg.js +311 -0
- data/public/{admin → grandstand}/stylesheets/wysiwyg-content.css +15 -2
- metadata +207 -126
- data/README +0 -7
- data/app/controllers/admin/posts_controller.rb +0 -48
- data/app/controllers/admin/templates_controller.rb +0 -6
- data/app/helpers/admin/main_helper.rb +0 -31
- data/app/helpers/admin/pages_helper.rb +0 -2
- data/app/helpers/admin/posts_helper.rb +0 -2
- data/app/helpers/admin/sessions_helper.rb +0 -2
- data/app/helpers/admin/templates_helper.rb +0 -2
- data/app/helpers/admin/users_helper.rb +0 -2
- data/app/models/page_section.rb +0 -6
- data/app/stylesheets/_dialogs.less +0 -85
- data/app/views/admin/galleries/_gallery.html.erb +0 -16
- data/app/views/admin/galleries/_list.html.erb +0 -17
- data/app/views/admin/galleries/delete.html.erb +0 -8
- data/app/views/admin/galleries/edit.html.erb +0 -8
- data/app/views/admin/galleries/editor.html.erb +0 -13
- data/app/views/admin/galleries/editor_with_images.html.erb +0 -19
- data/app/views/admin/galleries/index.html.erb +0 -13
- data/app/views/admin/galleries/new.html.erb +0 -8
- data/app/views/admin/galleries/show.html.erb +0 -15
- data/app/views/admin/images/delete.html.erb +0 -8
- data/app/views/admin/images/edit.html.erb +0 -8
- data/app/views/admin/images/new.html.erb +0 -8
- data/app/views/admin/main/index.html.erb +0 -10
- data/app/views/admin/pages/_left.html.erb +0 -3
- data/app/views/admin/posts/_form.html.erb +0 -29
- data/app/views/admin/posts/_left.html.erb +0 -3
- data/app/views/admin/posts/_list.html.erb +0 -22
- data/app/views/admin/posts/edit.html.erb +0 -10
- data/app/views/admin/posts/new.html.erb +0 -10
- data/app/views/admin/posts/show.html.erb +0 -4
- data/app/views/admin/shared/_flash.html.erb +0 -3
- data/app/views/admin/users/_left.html.erb +0 -3
- data/app/views/admin/users/edit.html.erb +0 -8
- data/app/views/admin/users/new.html.erb +0 -8
- data/app/views/admin/users/show.html.erb +0 -12
- data/app/views/layouts/admin.html.erb +0 -80
- data/app/views/layouts/admin_login.html.erb +0 -17
- data/lib/grandstand/controller/development.rb +0 -15
- data/public/admin/javascripts/jquery.js +0 -404
- data/public/admin/javascripts/wysiwyg.js +0 -335
- data/public/admin/stylesheets/application.css +0 -1
- data/public/admin/stylesheets/global.css +0 -1
- data/public/admin/stylesheets/login.css +0 -1
- data/public/admin/stylesheets/wysiwyg.css +0 -1
data/MIT-LICENSE
CHANGED
data/README.markdown
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
Grandstand
|
|
2
|
+
==========
|
|
3
|
+
|
|
4
|
+
Grandstand is a Rails 3 Gem that allows you to build totally simple blogs and portfolios using a gallery and blog post editor. It's as simple as adding
|
|
5
|
+
|
|
6
|
+
gem 'grandstand'
|
|
7
|
+
|
|
8
|
+
to your `Gemfile` and running `bundle install`. Try it now!
|
|
9
|
+
|
|
10
|
+
Configuration
|
|
11
|
+
---
|
|
12
|
+
Grandstand has three (count 'em) configuration options.
|
|
13
|
+
|
|
14
|
+
1. Image sizes
|
|
15
|
+
Use this to control how your images are resized when they are uploaded. It's a hash that accepts the size name as the key and the
|
|
16
|
+
geometry string as the value, e.g.
|
|
17
|
+
Grandstand.image_sizes[:large] = '800x600#'
|
|
18
|
+
|
|
19
|
+
2. Page sections
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
Authentication
|
|
23
|
+
---
|
|
24
|
+
Grandstand supports a very simple authentication scheme: users. With passwords! And that's it. It gives you a few helper methods, based on
|
|
25
|
+
most auth systems' standards:
|
|
26
|
+
|
|
27
|
+
require_user
|
|
28
|
+
|
|
29
|
+
Use as a before filter or call it directly in your controllers. Simple. Easy-peasy. Passes the user back to the admin login page.
|
|
30
|
+
|
|
31
|
+
current_user
|
|
32
|
+
|
|
33
|
+
Use in your controllers and views. Provides access to the logged-in user... if they're logged in.
|
|
34
|
+
|
|
35
|
+
Admin Interface
|
|
36
|
+
---
|
|
37
|
+
Grandstand has a basic admin interface that allows you to manage blog posts, galleries, pages, and users. That's... like... it.
|
|
38
|
+
|
|
39
|
+
Galleries
|
|
40
|
+
---
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
Copyright (c) 2010 Flip Sasser, released under the MIT license
|
data/README.txt
ADDED
|
File without changes
|
data/Rakefile
CHANGED
|
@@ -32,12 +32,18 @@ begin
|
|
|
32
32
|
# like authors, email and has_rdoc can also be included here
|
|
33
33
|
gemspec.description = %{
|
|
34
34
|
Grandstand is a simple blog and photo gallery application. It takes a minimal amount of configuration and can
|
|
35
|
-
be built installed as a gem and used
|
|
35
|
+
be built installed as a gem and used within minutes. It's totally cool. Seriously.
|
|
36
36
|
}
|
|
37
37
|
gemspec.email = "flip@x451.com"
|
|
38
38
|
gemspec.homepage = "http://github.com/flipsasser/grandstand"
|
|
39
39
|
gemspec.authors = ["Flip Sasser"]
|
|
40
40
|
gemspec.test_files = []
|
|
41
|
+
# TODO: Move less and more to development dependencies
|
|
42
|
+
gemspec.add_development_dependency 'less', '>= 1.2.21'
|
|
43
|
+
gemspec.add_development_dependency 'more', '>= 0.1.1'
|
|
44
|
+
gemspec.add_dependency 'aws-s3', '>= 0.6.2'
|
|
45
|
+
gemspec.add_dependency 'mustache', '>= 0.11.2'
|
|
46
|
+
gemspec.add_dependency 'paperclip', '>= 2.3.3'
|
|
41
47
|
end
|
|
42
48
|
rescue
|
|
43
49
|
puts "Jeweler or one of its dependencies is not installed."
|
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0.2.
|
|
1
|
+
0.2.6
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
class
|
|
1
|
+
class Grandstand::GalleriesController < Grandstand::MainController
|
|
2
2
|
before_filter :find_gallery, :except => [:create, :index, :new, :reorder]
|
|
3
3
|
|
|
4
4
|
def create
|
|
5
|
-
@gallery = Gallery.new(params[:gallery].merge(:user => current_user))
|
|
5
|
+
@gallery = Grandstand::Gallery.new(params[:gallery].merge(:user => current_user))
|
|
6
6
|
if @gallery.save
|
|
7
7
|
flash[:success] = "#{@gallery.name} was successfully added"
|
|
8
|
-
redirect_to
|
|
8
|
+
redirect_to grandstand_gallery_path(@gallery)
|
|
9
9
|
else
|
|
10
10
|
flash[:error] = 'There was a problem creating this gallery'
|
|
11
11
|
render :new
|
|
@@ -15,27 +15,23 @@ class Admin::GalleriesController < Admin::MainController
|
|
|
15
15
|
def destroy
|
|
16
16
|
@gallery.destroy
|
|
17
17
|
flash[:delete] = 'Your gallery has been deleted'
|
|
18
|
-
redirect_to
|
|
18
|
+
redirect_to grandstand_galleries_path
|
|
19
19
|
end
|
|
20
20
|
|
|
21
21
|
def index
|
|
22
|
-
@galleries = Gallery.all
|
|
22
|
+
@galleries = Grandstand::Gallery.all
|
|
23
23
|
if request.xhr?
|
|
24
|
-
|
|
25
|
-
render :editor_with_images
|
|
26
|
-
else
|
|
27
|
-
render :editor
|
|
28
|
-
end
|
|
24
|
+
render :editor
|
|
29
25
|
end
|
|
30
26
|
end
|
|
31
27
|
|
|
32
28
|
def new
|
|
33
|
-
@gallery = Gallery.new
|
|
29
|
+
@gallery = Grandstand::Gallery.new
|
|
34
30
|
end
|
|
35
31
|
|
|
36
32
|
def reorder
|
|
37
33
|
params[:galleries].each_with_index do |gallery_id, index|
|
|
38
|
-
Gallery.update(gallery_id, :position => index + 1)
|
|
34
|
+
Grandstand::Gallery.update(gallery_id, :position => index + 1)
|
|
39
35
|
end if params[:galleries]
|
|
40
36
|
render :json => {:status => :ok}
|
|
41
37
|
end
|
|
@@ -43,7 +39,7 @@ class Admin::GalleriesController < Admin::MainController
|
|
|
43
39
|
def update
|
|
44
40
|
if @gallery.update_attributes(params[:gallery])
|
|
45
41
|
flash[:success] = "#{@gallery.name} was successfully saved"
|
|
46
|
-
request.xhr? ? render(:json => {:status => :ok}) : redirect_to(
|
|
42
|
+
request.xhr? ? render(:json => {:status => :ok}) : redirect_to(grandstand_gallery_path(@gallery))
|
|
47
43
|
else
|
|
48
44
|
flash[:error] = 'There was a problem saving this gallery'
|
|
49
45
|
render :edit
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
class
|
|
1
|
+
class Grandstand::ImagesController < Grandstand::MainController
|
|
2
2
|
before_filter :find_gallery
|
|
3
3
|
before_filter :find_image, :only => [:delete, :destroy, :edit, :show, :update]
|
|
4
4
|
prepend_before_filter :relax_session, :only => :create
|
|
@@ -8,7 +8,7 @@ class Admin::ImagesController < Admin::MainController
|
|
|
8
8
|
@image = @gallery.images.new(params[:image])
|
|
9
9
|
if @image.save
|
|
10
10
|
flash[:success] = 'Your image was successfully uploaded'
|
|
11
|
-
params.has_key?('Filename') || request.xhr? ? render(:json => {:status => :ok}) : redirect_to(
|
|
11
|
+
params.has_key?('Filename') || request.xhr? ? render(:json => {:status => :ok}) : redirect_to(grandstand_gallery_path(@gallery))
|
|
12
12
|
else
|
|
13
13
|
render :new
|
|
14
14
|
end
|
|
@@ -20,22 +20,19 @@ class Admin::ImagesController < Admin::MainController
|
|
|
20
20
|
def destroy
|
|
21
21
|
@image.destroy
|
|
22
22
|
flash[:delete] = 'Your image has been deleted'
|
|
23
|
-
redirect_to
|
|
23
|
+
redirect_to grandstand_gallery_path(@gallery)
|
|
24
24
|
end
|
|
25
25
|
|
|
26
26
|
def edit
|
|
27
27
|
@image = @gallery.images.find(params[:id])
|
|
28
28
|
end
|
|
29
29
|
|
|
30
|
-
def editor
|
|
31
|
-
end
|
|
32
|
-
|
|
33
30
|
def index
|
|
34
|
-
redirect_to
|
|
31
|
+
redirect_to grandstand_gallery_path(@gallery)
|
|
35
32
|
end
|
|
36
33
|
|
|
37
34
|
def new
|
|
38
|
-
@image = Image.new
|
|
35
|
+
@image = Grandstand::Image.new
|
|
39
36
|
end
|
|
40
37
|
|
|
41
38
|
def reorder
|
|
@@ -48,7 +45,7 @@ class Admin::ImagesController < Admin::MainController
|
|
|
48
45
|
def update
|
|
49
46
|
if @image.update_attributes(params[:image])
|
|
50
47
|
flash[:success] = 'Your image was successfully saved'
|
|
51
|
-
request.xhr? ? render(:json => {:status => :ok}) : redirect_to(
|
|
48
|
+
request.xhr? ? render(:json => {:status => :ok}) : redirect_to(grandstand_gallery_path(@gallery))
|
|
52
49
|
else
|
|
53
50
|
render :new
|
|
54
51
|
end
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
class
|
|
1
|
+
class Grandstand::MainController < ApplicationController
|
|
2
2
|
skip_before_filter :find_page
|
|
3
|
-
before_filter :require_user
|
|
3
|
+
before_filter :require_user
|
|
4
4
|
before_filter :set_return_path, :only => [:index, :show]
|
|
5
5
|
|
|
6
|
-
layout :
|
|
6
|
+
layout :grandstand_layout
|
|
7
7
|
|
|
8
8
|
def expand
|
|
9
9
|
session[:expand] ||= []
|
|
@@ -16,21 +16,21 @@ class Admin::MainController < ApplicationController
|
|
|
16
16
|
end
|
|
17
17
|
|
|
18
18
|
protected
|
|
19
|
-
def
|
|
20
|
-
request.xhr? ? '
|
|
19
|
+
def grandstand_layout
|
|
20
|
+
request.xhr? ? 'grandstand_xhr' : 'grandstand'
|
|
21
21
|
end
|
|
22
22
|
|
|
23
|
-
def
|
|
23
|
+
def grandstand_not_found(options = {})
|
|
24
24
|
options = {:layout => 'minimal', :status => 404, :template => 'shared/404'}.merge(options)
|
|
25
25
|
render options
|
|
26
26
|
false
|
|
27
27
|
end
|
|
28
28
|
|
|
29
29
|
def find_gallery
|
|
30
|
-
return
|
|
30
|
+
return grandstand_not_found unless @gallery = Grandstand::Gallery.where(:id => params[:gallery_id] || params[:id]).first
|
|
31
31
|
end
|
|
32
32
|
|
|
33
33
|
def require_no_user
|
|
34
|
-
redirect_to return_path ||
|
|
34
|
+
redirect_to return_path || grandstand_root_path if current_user
|
|
35
35
|
end
|
|
36
36
|
end
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
class
|
|
1
|
+
class Grandstand::PagesController < Grandstand::MainController
|
|
2
2
|
before_filter :find_page, :except => [:create, :index, :new]
|
|
3
3
|
before_filter :build_page_sections, :only => [:edit]
|
|
4
4
|
|
|
5
5
|
def create
|
|
6
|
-
@page = Page.new(params[:page])
|
|
6
|
+
@page = Grandstand::Page.new(params[:page])
|
|
7
7
|
if @page.save
|
|
8
8
|
flash[:success] = "#{@page.name} was successfully added"
|
|
9
|
-
redirect_to
|
|
9
|
+
redirect_to grandstand_page_path(@page)
|
|
10
10
|
else
|
|
11
11
|
flash[:error] = 'There was a problem creating this page'
|
|
12
12
|
render :new
|
|
@@ -16,22 +16,22 @@ class Admin::PagesController < Admin::MainController
|
|
|
16
16
|
def destroy
|
|
17
17
|
@page.destroy
|
|
18
18
|
flash[:delete] = 'Your page has been deleted'
|
|
19
|
-
redirect_to
|
|
19
|
+
redirect_to grandstand_pages_path
|
|
20
20
|
end
|
|
21
21
|
|
|
22
22
|
def index
|
|
23
|
-
@pages = Page.where(:parent_id => nil).all
|
|
23
|
+
@pages = Grandstand::Page.where(:parent_id => nil).all
|
|
24
24
|
end
|
|
25
25
|
|
|
26
26
|
def new
|
|
27
|
-
@page = Page.new
|
|
27
|
+
@page = Grandstand::Page.new
|
|
28
28
|
build_page_sections
|
|
29
29
|
end
|
|
30
30
|
|
|
31
31
|
def update
|
|
32
32
|
if @page.update_attributes(params[:page])
|
|
33
33
|
flash[:success] = "#{@page.name} was successfully saved"
|
|
34
|
-
request.xhr? ? render(:json => {:status => :ok}) : redirect_to(
|
|
34
|
+
request.xhr? ? render(:json => {:status => :ok}) : redirect_to(grandstand_page_path(@page))
|
|
35
35
|
else
|
|
36
36
|
flash[:error] = 'There was a problem saving this page'
|
|
37
37
|
render :edit
|
|
@@ -40,12 +40,12 @@ class Admin::PagesController < Admin::MainController
|
|
|
40
40
|
|
|
41
41
|
protected
|
|
42
42
|
def build_page_sections
|
|
43
|
-
Grandstand
|
|
43
|
+
Grandstand.page_sections.each do |page_section|
|
|
44
44
|
@page.page_sections.where(:section => page_section).first || @page.page_sections.build(:section => page_section)
|
|
45
45
|
end
|
|
46
46
|
end
|
|
47
47
|
|
|
48
48
|
def find_page
|
|
49
|
-
return
|
|
49
|
+
return grandstand_not_found unless @page = Grandstand::Page.where(:id => params[:id]).first
|
|
50
50
|
end
|
|
51
51
|
end
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
class Grandstand::PostsController < Grandstand::MainController
|
|
2
|
+
before_filter :find_post, :except => [:create, :index, :new]
|
|
3
|
+
|
|
4
|
+
def create
|
|
5
|
+
@post = Grandstand::Post.new(params[:post].merge(:user => current_user))
|
|
6
|
+
if @post.save
|
|
7
|
+
flash[:success] = "#{@post.name} was successfully added"
|
|
8
|
+
redirect_to grandstand_post_path(@post)
|
|
9
|
+
else
|
|
10
|
+
flash[:error] = 'There was a problem creating this post'
|
|
11
|
+
if preview?
|
|
12
|
+
render :preview, :layout => 'application'
|
|
13
|
+
else
|
|
14
|
+
render :new
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def destroy
|
|
20
|
+
@post.destroy
|
|
21
|
+
flash[:delete] = 'Your post has been deleted'
|
|
22
|
+
redirect_to grandstand_posts_path
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def edit
|
|
26
|
+
if preview?
|
|
27
|
+
render :preview, :layout => 'application'
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def index
|
|
32
|
+
@posts = Grandstand::Post.all
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
def new
|
|
36
|
+
@post = Grandstand::Post.new
|
|
37
|
+
if preview?
|
|
38
|
+
render :preview, :layout => 'application'
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
def update
|
|
43
|
+
if @post.update_attributes(params[:post])
|
|
44
|
+
flash[:success] = "#{@post.name} was successfully saved"
|
|
45
|
+
request.xhr? ? render(:json => {:status => :ok}) : redirect_to(grandstand_post_path(@post))
|
|
46
|
+
else
|
|
47
|
+
flash[:error] = 'There was a problem saving this post'
|
|
48
|
+
if preview?
|
|
49
|
+
render :preview, :layout => 'application'
|
|
50
|
+
else
|
|
51
|
+
render :edit
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
protected
|
|
57
|
+
def find_post
|
|
58
|
+
return grandstand_not_found unless @post = Grandstand::Post.where(:id => params[:id]).first
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
def preview?
|
|
62
|
+
params[:preview] == 'yup'
|
|
63
|
+
end
|
|
64
|
+
end
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
class
|
|
1
|
+
class Grandstand::SessionsController < Grandstand::MainController
|
|
2
2
|
before_filter :require_no_user, :except => [:destroy]
|
|
3
3
|
skip_before_filter :require_user, :except => [:destroy]
|
|
4
4
|
skip_before_filter :set_return_path
|
|
5
|
-
layout '
|
|
5
|
+
layout 'grandstand_login'
|
|
6
6
|
|
|
7
7
|
def create
|
|
8
8
|
login_attempts = (session[:login_attempts] || 0).next
|
|
9
|
-
if !params[:email].blank? && user = User.authenticates_with(:email => params[:email])
|
|
9
|
+
if !params[:email].blank? && user = Grandstand::User.authenticates_with(:email => params[:email])
|
|
10
10
|
if user.authenticates_with?(params[:password])
|
|
11
11
|
saved_return_path = return_path
|
|
12
12
|
reset_session
|
|
13
13
|
session[:user_id] = user.id
|
|
14
|
-
redirect_to saved_return_path ||
|
|
14
|
+
redirect_to saved_return_path || grandstand_root_path
|
|
15
15
|
return
|
|
16
16
|
else
|
|
17
17
|
flash.now[:error] = 'The password you entered is incorrect. Please try again.'
|
|
@@ -25,17 +25,17 @@ class Admin::SessionsController < Admin::MainController
|
|
|
25
25
|
|
|
26
26
|
def destroy
|
|
27
27
|
reset_session
|
|
28
|
-
redirect_to
|
|
28
|
+
redirect_to grandstand_session_path
|
|
29
29
|
end
|
|
30
30
|
|
|
31
31
|
def reset
|
|
32
|
-
if user = User.where(:email => params[:email]).first
|
|
32
|
+
if user = Grandstand::User.where(:email => params[:email]).first
|
|
33
33
|
user.reset_password
|
|
34
34
|
flash[:notice] = "A link containing password reset instructions has been sent to #{user.email}"
|
|
35
|
-
redirect_to
|
|
35
|
+
redirect_to grandstand_session_path
|
|
36
36
|
else
|
|
37
37
|
flash[:error] = "There is no user account with that e-mail address!"
|
|
38
|
-
redirect_to
|
|
38
|
+
redirect_to forgot_grandstand_session_path
|
|
39
39
|
end
|
|
40
40
|
end
|
|
41
41
|
end
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
class
|
|
1
|
+
class Grandstand::UsersController < Grandstand::MainController
|
|
2
2
|
before_filter :find_user, :except => [:create, :index, :new]
|
|
3
3
|
|
|
4
4
|
def create
|
|
5
|
-
@user = User.new(params[:user])
|
|
5
|
+
@user = Grandstand::User.new(params[:user])
|
|
6
6
|
if @user.save
|
|
7
7
|
flash[:success] = "#{@user.name} was successfully added"
|
|
8
|
-
redirect_to
|
|
8
|
+
redirect_to grandstand_user_path(@user)
|
|
9
9
|
else
|
|
10
10
|
flash[:error] = 'There was a problem creating this user'
|
|
11
11
|
render :new
|
|
@@ -13,28 +13,28 @@ class Admin::UsersController < Admin::MainController
|
|
|
13
13
|
end
|
|
14
14
|
|
|
15
15
|
def delete
|
|
16
|
-
return
|
|
16
|
+
return grandstand_not_found if @user.id == current_user.id
|
|
17
17
|
end
|
|
18
18
|
|
|
19
19
|
def destroy
|
|
20
|
-
return
|
|
20
|
+
return grandstand_not_found if @user.id == current_user.id
|
|
21
21
|
@user.destroy
|
|
22
22
|
flash[:delete] = 'Your user has been deleted'
|
|
23
|
-
redirect_to
|
|
23
|
+
redirect_to grandstand_users_path
|
|
24
24
|
end
|
|
25
25
|
|
|
26
26
|
def index
|
|
27
|
-
@users = User.all
|
|
27
|
+
@users = Grandstand::User.all
|
|
28
28
|
end
|
|
29
29
|
|
|
30
30
|
def new
|
|
31
|
-
@user = User.new
|
|
31
|
+
@user = Grandstand::User.new
|
|
32
32
|
end
|
|
33
33
|
|
|
34
34
|
def update
|
|
35
35
|
if @user.update_attributes(params[:user])
|
|
36
36
|
flash[:success] = "#{@user.name} was successfully saved"
|
|
37
|
-
request.xhr? ? render(:json => {:status => :ok}) : redirect_to(
|
|
37
|
+
request.xhr? ? render(:json => {:status => :ok}) : redirect_to(grandstand_user_path(@user))
|
|
38
38
|
else
|
|
39
39
|
flash[:error] = 'There was a problem saving this user'
|
|
40
40
|
render :edit
|
|
@@ -43,6 +43,6 @@ class Admin::UsersController < Admin::MainController
|
|
|
43
43
|
|
|
44
44
|
protected
|
|
45
45
|
def find_user
|
|
46
|
-
return
|
|
46
|
+
return grandstand_not_found unless @user = Grandstand::User.where(:id => params[:id]).first
|
|
47
47
|
end
|
|
48
48
|
end
|