grandstand 0.2.7 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +6 -0
- data/README.md +72 -0
- data/app/controllers/galleries_controller.rb +4 -0
- data/app/controllers/grandstand/galleries_controller.rb +10 -1
- data/app/controllers/grandstand/images_controller.rb +9 -3
- data/app/controllers/grandstand/main_controller.rb +2 -4
- data/app/controllers/grandstand/pages_controller.rb +8 -1
- data/app/controllers/grandstand/sessions_controller.rb +1 -1
- data/app/helpers/grandstand/main_helper.rb +17 -0
- data/app/models/grandstand/gallery.rb +2 -1
- data/app/models/grandstand/image.rb +1 -0
- data/app/models/grandstand/page.rb +4 -0
- data/app/models/grandstand/page_section.rb +2 -0
- data/app/models/grandstand/post.rb +2 -0
- data/app/models/grandstand/user.rb +6 -4
- data/app/views/grandstand/galleries/delete.html.erb +2 -2
- data/app/views/grandstand/galleries/edit.html.erb +1 -1
- data/app/views/grandstand/galleries/editor.html.erb +3 -3
- data/app/views/grandstand/galleries/index.html.erb +5 -5
- data/app/views/grandstand/galleries/new.html.erb +1 -1
- data/app/views/grandstand/galleries/show.html.erb +11 -10
- data/app/views/grandstand/images/_form.html.erb +1 -1
- data/app/views/grandstand/images/delete.html.erb +2 -2
- data/app/views/grandstand/images/edit.html.erb +2 -2
- data/app/views/grandstand/images/new.html.erb +2 -2
- data/app/views/grandstand/images/show.html.erb +2 -2
- data/app/views/grandstand/main/index.html.erb +8 -10
- data/app/views/grandstand/pages/_form.html.erb +4 -5
- data/app/views/grandstand/pages/_row.html.erb +4 -3
- data/app/views/grandstand/pages/delete.html.erb +2 -2
- data/app/views/grandstand/pages/edit.html.erb +6 -3
- data/app/views/grandstand/pages/index.html.erb +10 -7
- data/app/views/grandstand/pages/new.html.erb +6 -3
- data/app/views/grandstand/pages/show.html.erb +25 -3
- data/app/views/grandstand/posts/_form.html.erb +1 -3
- data/app/views/grandstand/posts/_list.html.erb +1 -1
- data/app/views/grandstand/posts/delete.html.erb +1 -2
- data/app/views/grandstand/posts/edit.html.erb +5 -2
- data/app/views/grandstand/posts/index.html.erb +10 -5
- data/app/views/grandstand/posts/new.html.erb +5 -2
- data/app/views/grandstand/posts/show.html.erb +3 -5
- data/app/views/grandstand/sessions/forgot.html.erb +2 -2
- data/app/views/grandstand/sessions/show.html.erb +2 -2
- data/app/views/grandstand/shared/_footer.html.erb +1 -0
- data/app/views/grandstand/users/_form.html.erb +7 -3
- data/app/views/grandstand/users/delete.html.erb +1 -1
- data/app/views/grandstand/users/edit.html.erb +1 -1
- data/app/views/grandstand/users/index.html.erb +4 -2
- data/app/views/grandstand/users/new.html.erb +1 -1
- data/app/views/grandstand/users/show.html.erb +7 -4
- data/app/views/layouts/grandstand.html.erb +17 -55
- data/app/views/layouts/{grandstand_login.html.erb → grandstand_minimal.html.erb} +5 -2
- data/app/views/pages/show.html.erb +0 -8
- data/app/views/posts/show.html.erb +1 -1
- data/app/views/shared/404.html.erb +1 -1
- data/config/routes.rb +5 -0
- data/lib/generators/grandstand/install/install_generator.rb +40 -0
- data/lib/generators/grandstand/install/templates/initializer.rb +27 -0
- data/lib/generators/grandstand/install/templates/migration.rb +95 -0
- data/lib/generators/grandstand/install/templates/public/fonts/museosans.eot +0 -0
- data/lib/generators/grandstand/install/templates/public/fonts/museosans.svg +247 -0
- data/lib/generators/grandstand/install/templates/public/fonts/museosans.ttf +0 -0
- data/lib/generators/grandstand/install/templates/public/fonts/museosans.woff +0 -0
- data/{public/grandstand → lib/generators/grandstand/install/templates/public}/images/background-input.gif +0 -0
- data/{public/grandstand → lib/generators/grandstand/install/templates/public}/images/background-progress-bar.png +0 -0
- data/{public/grandstand → lib/generators/grandstand/install/templates/public}/images/background-progress-complete.gif +0 -0
- data/{public/grandstand → lib/generators/grandstand/install/templates/public}/images/background-progress.gif +0 -0
- data/lib/generators/grandstand/install/templates/public/images/icons/add.png +0 -0
- data/lib/generators/grandstand/install/templates/public/images/icons/delete.png +0 -0
- data/lib/generators/grandstand/install/templates/public/images/icons/edit.png +0 -0
- data/{public/grandstand → lib/generators/grandstand/install/templates/public}/images/icons/editor/bold.png +0 -0
- data/{public/grandstand → lib/generators/grandstand/install/templates/public}/images/icons/editor/gallery.png +0 -0
- data/{public/grandstand → lib/generators/grandstand/install/templates/public}/images/icons/editor/image-center.png +0 -0
- data/{public/grandstand → lib/generators/grandstand/install/templates/public}/images/icons/editor/image-left.png +0 -0
- data/{public/grandstand → lib/generators/grandstand/install/templates/public}/images/icons/editor/image-right.png +0 -0
- data/{public/grandstand → lib/generators/grandstand/install/templates/public}/images/icons/editor/image.png +0 -0
- data/{public/grandstand → lib/generators/grandstand/install/templates/public}/images/icons/editor/italic.png +0 -0
- data/{public/grandstand → lib/generators/grandstand/install/templates/public}/images/icons/editor/ordered-list.png +0 -0
- data/{public/grandstand → lib/generators/grandstand/install/templates/public}/images/icons/editor/quote.png +0 -0
- data/{public/grandstand → lib/generators/grandstand/install/templates/public}/images/icons/editor/source.png +0 -0
- data/{public/grandstand → lib/generators/grandstand/install/templates/public}/images/icons/editor/strikethrough.png +0 -0
- data/{public/grandstand → lib/generators/grandstand/install/templates/public}/images/icons/editor/underline.png +0 -0
- data/{public/grandstand → lib/generators/grandstand/install/templates/public}/images/icons/editor/unordered-list.png +0 -0
- data/{public/grandstand → lib/generators/grandstand/install/templates/public}/images/icons/error.png +0 -0
- data/lib/generators/grandstand/install/templates/public/images/icons/external.png +0 -0
- data/{public/grandstand/images → lib/generators/grandstand/install/templates/public/images/icons}/galleries-empty.png +0 -0
- data/lib/generators/grandstand/install/templates/public/images/icons/galleries.png +0 -0
- data/lib/generators/grandstand/install/templates/public/images/icons/gallery.png +0 -0
- data/lib/generators/grandstand/install/templates/public/images/icons/handle.gif +0 -0
- data/lib/generators/grandstand/install/templates/public/images/icons/image-library.png +0 -0
- data/lib/generators/grandstand/install/templates/public/images/icons/image.png +0 -0
- data/lib/generators/grandstand/install/templates/public/images/icons/okay.png +0 -0
- data/lib/generators/grandstand/install/templates/public/images/icons/pages.png +0 -0
- data/lib/generators/grandstand/install/templates/public/images/icons/posts.png +0 -0
- data/{public/grandstand → lib/generators/grandstand/install/templates/public}/images/icons/processing.gif +0 -0
- data/lib/generators/grandstand/install/templates/public/images/icons/users.png +0 -0
- data/{public/grandstand → lib/generators/grandstand/install/templates/public}/images/spinner-dark.gif +0 -0
- data/{public/grandstand → lib/generators/grandstand/install/templates/public}/images/uploader.swf +0 -0
- data/{public/grandstand → lib/generators/grandstand/install/templates/public}/javascripts/application.js +27 -21
- data/{public/grandstand → lib/generators/grandstand/install/templates/public}/javascripts/jquery.js +1 -1
- data/{public/grandstand → lib/generators/grandstand/install/templates/public}/javascripts/mustache.js +0 -0
- data/{public/grandstand → lib/generators/grandstand/install/templates/public}/javascripts/preview.js +0 -0
- data/{public/grandstand → lib/generators/grandstand/install/templates/public}/javascripts/selection.js +1 -1
- data/{public/grandstand → lib/generators/grandstand/install/templates/public}/javascripts/string.js +0 -1
- data/{public/grandstand → lib/generators/grandstand/install/templates/public}/javascripts/wysiwyg.js +8 -9
- data/lib/generators/grandstand/install/templates/public/stylesheets/application.css +368 -0
- data/lib/generators/grandstand/install/templates/public/stylesheets/buttons.css +81 -0
- data/lib/generators/grandstand/install/templates/public/stylesheets/dialog.css +142 -0
- data/lib/generators/grandstand/install/templates/public/stylesheets/forms.css +94 -0
- data/lib/generators/grandstand/install/templates/public/stylesheets/global.css +94 -0
- data/lib/generators/grandstand/install/templates/public/stylesheets/login.css +37 -0
- data/{public/grandstand → lib/generators/grandstand/install/templates/public}/stylesheets/wysiwyg-content.css +1 -0
- data/lib/generators/grandstand/install/templates/public/stylesheets/wysiwyg.css +94 -0
- data/lib/generators/grandstand/install/templates/s3.yml +8 -0
- data/lib/grandstand.rb +78 -16
- data/lib/grandstand/application.rb +1 -10
- data/lib/grandstand/controller.rb +7 -1
- data/lib/grandstand/form_builder.rb +2 -2
- data/lib/grandstand/helper.rb +3 -0
- data/lib/grandstand/session.rb +1 -1
- metadata +143 -101
- data/.gitignore +0 -2
- data/MIT-LICENSE +0 -20
- data/README.markdown +0 -43
- data/README.txt +0 -0
- data/Rakefile +0 -50
- data/VERSION +0 -1
- data/app/helpers/site_helper.rb +0 -2
- data/app/stylesheets/_buttons.less +0 -76
- data/app/stylesheets/application.less +0 -331
- data/app/stylesheets/global.less +0 -452
- data/app/stylesheets/login.less +0 -30
- data/app/stylesheets/wysiwyg.less +0 -108
- data/app/views/grandstand/pages/_left.html.erb +0 -3
- data/app/views/grandstand/posts/_left.html.erb +0 -3
- data/app/views/grandstand/users/_left.html.erb +0 -3
- data/grandstand.gemspec +0 -207
- data/lib/grandstand/stylesheets_controller.rb +0 -14
- data/public/grandstand/images/icons/add.png +0 -0
- data/public/grandstand/images/icons/collapse.png +0 -0
- data/public/grandstand/images/icons/delete.png +0 -0
- data/public/grandstand/images/icons/edit.png +0 -0
- data/public/grandstand/images/icons/expand.png +0 -0
- data/public/grandstand/images/icons/galleries.png +0 -0
- data/public/grandstand/images/icons/gallery.png +0 -0
- data/public/grandstand/images/icons/image.png +0 -0
- data/public/grandstand/images/icons/okay.png +0 -0
- data/public/grandstand/images/icons/pages.png +0 -0
- data/public/grandstand/images/icons/posts.png +0 -0
- data/public/grandstand/images/icons/upload.png +0 -0
- data/public/grandstand/images/icons/users.png +0 -0
- data/public/grandstand/images/logo.png +0 -0
- data/vendor/cache/more-0.1.1.gem +0 -0
data/Gemfile
ADDED
data/README.md
ADDED
@@ -0,0 +1,72 @@
|
|
1
|
+
# Grandstand
|
2
|
+
|
3
|
+
Grandstand is a Rails 3 Gem that allows you to build totally simple blogs and portfolios using a gallery and blog post editor.
|
4
|
+
|
5
|
+
## 5-Minute Install
|
6
|
+
|
7
|
+
To get Grandstand up-and-running in five minutes or less:
|
8
|
+
|
9
|
+
1. In your terminal: `rails new site && cd site`
|
10
|
+
2. And then: `echo "gem 'grandstand', '>= 0.3.0'" >> Gemfile && bundle install`
|
11
|
+
3. And then: `rails generate grandstand:install`
|
12
|
+
4. And then: `rake db:migrate` and enter an e-mail and password for the first admin user
|
13
|
+
5. And then start Rails: `rails s`
|
14
|
+
6. Navigate to [http://localhost:3000/grandstand](http://localhost:3000/grandstand) to get started.
|
15
|
+
|
16
|
+
## Configuration
|
17
|
+
|
18
|
+
Grandstand uses S3 to store image files. In order to configure it, you need to take a peek at config/s3.yml and add your access keys there. Grandstand automatically generates this file for you. It should look like this:
|
19
|
+
|
20
|
+
access_key_id: YOURSECRETACCESSID
|
21
|
+
secret_access_key: YOUR-secRE/TACCe\ssKEy
|
22
|
+
|
23
|
+
Grandstand also generates config/initializers/grandstand.rb. It has examples of all the configuration options you can set in Grandstand, of which there are precious few. Here's an overview of them:
|
24
|
+
|
25
|
+
1. **Image sizes:** Used to control how your images are resized when they are uploaded. It's a hash
|
26
|
+
that accepts the size name as the key and the geometry string as the value, e.g.
|
27
|
+
|
28
|
+
Grandstand.image_sizes[:large] = '800x600#'
|
29
|
+
|
30
|
+
2. **S3 storage settings:** A Paperclip-style hash of S3 storage settings. You need to supply, at a
|
31
|
+
minimum, a :bucket and a :credentials setting in order to upload images. Credentials will automatically
|
32
|
+
be read from config/s3.yml, but you can override them as well. Ahem:
|
33
|
+
|
34
|
+
Grandstand.s3[:bucket] = "yourmom"
|
35
|
+
Grandstand.s3[:credentials] = {:access_key_id => "foo", :secret_access_key => "bar"}
|
36
|
+
|
37
|
+
You can also do something like this:
|
38
|
+
|
39
|
+
Grandstand.s3 = {:credentials => {:access_key_id => "foo", :secret_access_key => "bar"}, :bucket => "yourmom"}
|
40
|
+
|
41
|
+
3. **Admin routing settings:** Allow you to control the admin interface in certain ways, e.g. requiring SSL, using a
|
42
|
+
different domain (for Heroku users, this will let you use the free SSL option), using a different path (default is
|
43
|
+
"/grandstand"), etc. The following keys will work wonders for you:
|
44
|
+
|
45
|
+
* :domain => The domain the admin interface should require users to be at. Useful if you want to piggyback on Heroku's SSL without paying for a certificate.
|
46
|
+
* :path => The path for the admin interface. The default is 'http://localhost:3000/grandstand' but you can change to 'admin' or whatever to force it to 'http://localhost:3000/admin'
|
47
|
+
* :ssl => require SSL. Best to turn this on in production (which is the default in config/initializers/grandstand.rb)
|
48
|
+
|
49
|
+
## Admin Interface
|
50
|
+
|
51
|
+
Grandstand has a basic admin interface that allows you to manage blog posts, galleries, and users. That's... like... it. You can access it by starting your app and visiting [http://localhost:3000/grandstand](http://localhost:3000/grandstand), where you'll need to log in with the username/password you set up when you installed Grandstand. Inside of it, you'll be able to edit galleries, blog posts, and users.
|
52
|
+
|
53
|
+
### Galleries
|
54
|
+
|
55
|
+
Grandstand's gallery editor is pretty straightforward. First, add a gallery. Then go to that gallery and upload images.
|
56
|
+
|
57
|
+
**Note:** I *very* strongly recommend you keep the multiple image uploader turned off until you've got SSL set up, as it has the potential to open up a security hole.
|
58
|
+
|
59
|
+
### Blog Posts
|
60
|
+
|
61
|
+
Blog posts come in one basic flavor: simple. The WYSIWYG editor will nicely clean pasted text including Word content (except in Firefox, which has shit access to the clipboard even when pasting). It will also let you embed images and, someday, entire galleries. Blog posts ***do not*** come with comments, since you're smart enough to be using Disqus or one of its friends. Plus, I'm fundamentally opposed to the idea of comments on blogs in the first place. All they've ever done is caused trouble.
|
62
|
+
|
63
|
+
### Users
|
64
|
+
|
65
|
+
Duh. These are the people using Grandstand. There are no roles, no specific permissions, no drafting processes. Just users.
|
66
|
+
|
67
|
+
## Bugs, Tests, and Contributions
|
68
|
+
|
69
|
+
Please file bug complaints in [Github Issues](http://github.com/flipsasser/grandstand/issues). Please also fork and do things like add tests or make the WYSIWYG editor work for the Grandstand::PagesController. I also need more documentation and your mom.
|
70
|
+
|
71
|
+
|
72
|
+
Copyright (c) 2011 Flip Sasser, released under the MIT license
|
@@ -12,6 +12,13 @@ class Grandstand::GalleriesController < Grandstand::MainController
|
|
12
12
|
end
|
13
13
|
end
|
14
14
|
|
15
|
+
def delete
|
16
|
+
unless @gallery.published?
|
17
|
+
flash[:error] = 'You cannot delete this gallery. It is required by the system.'
|
18
|
+
redirect_to return_path || grandstand_galleries_path
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
15
22
|
def destroy
|
16
23
|
@gallery.destroy
|
17
24
|
flash[:delete] = 'Your gallery has been deleted'
|
@@ -19,9 +26,11 @@ class Grandstand::GalleriesController < Grandstand::MainController
|
|
19
26
|
end
|
20
27
|
|
21
28
|
def index
|
22
|
-
@galleries = Grandstand::Gallery.all
|
23
29
|
if request.xhr?
|
30
|
+
@galleries = Grandstand::Gallery.all
|
24
31
|
render :editor
|
32
|
+
else
|
33
|
+
@galleries = Grandstand::Gallery.where(:published => true).all
|
25
34
|
end
|
26
35
|
end
|
27
36
|
|
@@ -7,8 +7,12 @@ class Grandstand::ImagesController < Grandstand::MainController
|
|
7
7
|
def create
|
8
8
|
@image = @gallery.images.new(params[:image])
|
9
9
|
if @image.save
|
10
|
-
|
11
|
-
|
10
|
+
if params.has_key?('Filename') || request.xhr?
|
11
|
+
render(:json => {:status => :ok})
|
12
|
+
else
|
13
|
+
flash[:success] = 'Your image was successfully uploaded'
|
14
|
+
redirect_to(grandstand_gallery_path(@gallery))
|
15
|
+
end
|
12
16
|
else
|
13
17
|
render :new
|
14
18
|
end
|
@@ -51,7 +55,9 @@ class Grandstand::ImagesController < Grandstand::MainController
|
|
51
55
|
end
|
52
56
|
end
|
53
57
|
|
54
|
-
|
58
|
+
if Grandstand.multiple_upload
|
59
|
+
def upload
|
60
|
+
end
|
55
61
|
end
|
56
62
|
|
57
63
|
protected
|
@@ -1,9 +1,7 @@
|
|
1
1
|
class Grandstand::MainController < ApplicationController
|
2
2
|
skip_before_filter :find_page
|
3
3
|
before_filter :require_user
|
4
|
-
if
|
5
|
-
before_filter :require_ssl
|
6
|
-
end
|
4
|
+
before_filter :require_ssl if Grandstand.routing[:ssl]
|
7
5
|
before_filter :set_return_path, :only => [:index, :show]
|
8
6
|
|
9
7
|
layout :grandstand_layout
|
@@ -24,7 +22,7 @@ class Grandstand::MainController < ApplicationController
|
|
24
22
|
end
|
25
23
|
|
26
24
|
def grandstand_not_found(options = {})
|
27
|
-
options = {:layout => '
|
25
|
+
options = {:layout => 'grandstand_minimal', :status => 404, :template => 'shared/404'}.merge(options)
|
28
26
|
render options
|
29
27
|
false
|
30
28
|
end
|
@@ -1,5 +1,5 @@
|
|
1
1
|
class Grandstand::PagesController < Grandstand::MainController
|
2
|
-
before_filter :find_page, :except => [:create, :index, :new]
|
2
|
+
before_filter :find_page, :except => [:create, :index, :new, :reorder]
|
3
3
|
before_filter :build_page_sections, :only => [:edit]
|
4
4
|
|
5
5
|
def create
|
@@ -28,6 +28,13 @@ class Grandstand::PagesController < Grandstand::MainController
|
|
28
28
|
build_page_sections
|
29
29
|
end
|
30
30
|
|
31
|
+
def reorder
|
32
|
+
params[:pages].each_with_index do |page_id, index|
|
33
|
+
Grandstand::Page.update(page_id, :position => index + 1)
|
34
|
+
end if params[:pages]
|
35
|
+
render :json => {:status => :ok}
|
36
|
+
end
|
37
|
+
|
31
38
|
def update
|
32
39
|
if @page.update_attributes(params[:page])
|
33
40
|
flash[:success] = "#{@page.name} was successfully saved"
|
@@ -2,7 +2,7 @@ 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_minimal'
|
6
6
|
|
7
7
|
def create
|
8
8
|
login_attempts = (session[:login_attempts] || 0).next
|
@@ -1,4 +1,21 @@
|
|
1
1
|
module Grandstand::MainHelper
|
2
|
+
# Returns 'active' if the current page matches the passed URL hash. This will
|
3
|
+
# require the controller to match. If one or more action is passed, those actions
|
4
|
+
# (or params[:return_to]) must match as well. If not, it lets the controller mean
|
5
|
+
# it's active.
|
6
|
+
def active_on(*conditions)
|
7
|
+
match = lambda do |condition|
|
8
|
+
controllers = Array(condition.delete(:controller)).compact.flatten.map(&:to_s).uniq
|
9
|
+
actions = Array(condition.delete(:action)).compact.map(&:to_s).flatten.uniq
|
10
|
+
controllers.include?(controller_name) && (actions.empty? || actions.include?(action_name) || actions.include?(params[:return_to]))
|
11
|
+
end
|
12
|
+
options = {}
|
13
|
+
if conditions.any?(&match)
|
14
|
+
options[:class] = 'active'
|
15
|
+
end
|
16
|
+
options
|
17
|
+
end
|
18
|
+
|
2
19
|
# Renders a <button> tag. Helpful for forms and the like.
|
3
20
|
#
|
4
21
|
# <%= button("Save Changes", :class => "blue") %>
|
@@ -1,7 +1,8 @@
|
|
1
1
|
class Grandstand::Gallery < ActiveRecord::Base
|
2
|
+
set_table_name :grandstand_galleries
|
2
3
|
before_save :set_url
|
3
4
|
belongs_to :user
|
4
|
-
default_scope order('position, id')
|
5
|
+
default_scope order('published, position, id ASC')
|
5
6
|
has_many :images, :dependent => :destroy
|
6
7
|
|
7
8
|
validates_presence_of :name, :message => 'Your gallery needs a name'
|
@@ -1,4 +1,6 @@
|
|
1
1
|
class Grandstand::Page < ActiveRecord::Base
|
2
|
+
set_table_name :grandstand_pages
|
3
|
+
|
2
4
|
attr_writer :new_parent_slug
|
3
5
|
|
4
6
|
after_update :update_children
|
@@ -7,6 +9,8 @@ class Grandstand::Page < ActiveRecord::Base
|
|
7
9
|
belongs_to :parent, :class_name => 'Page'
|
8
10
|
belongs_to :user
|
9
11
|
|
12
|
+
default_scope order('position, id')
|
13
|
+
|
10
14
|
has_many :children, :class_name => 'Page', :foreign_key => :parent_id
|
11
15
|
has_many :page_sections, :dependent => :destroy
|
12
16
|
accepts_nested_attributes_for :page_sections, :reject_if => lambda {|page_section| page_section['content'].try(:strip).blank? }
|
@@ -1,4 +1,6 @@
|
|
1
1
|
class Grandstand::User < ActiveRecord::Base
|
2
|
+
set_table_name :grandstand_users
|
3
|
+
|
2
4
|
attr_accessor :password
|
3
5
|
attr_accessible :email, :first_name, :last_name, :password, :password_confirmation
|
4
6
|
|
@@ -53,15 +55,15 @@ class Grandstand::User < ActiveRecord::Base
|
|
53
55
|
end
|
54
56
|
|
55
57
|
# Returns a hash of a given password string. Used both for storing
|
56
|
-
# passwords and authenticating later. The
|
58
|
+
# passwords and authenticating later. The digest_stretches method
|
57
59
|
# ensures passwords are hashed more than once - which prevents brute-
|
58
60
|
# force attacks from being even remotely efficient. Take that, hacker
|
59
61
|
# dickheads.
|
60
62
|
def password_digest(password)
|
61
|
-
password_digest =
|
63
|
+
password_digest = Grandstand.site_key
|
62
64
|
# Perform stretching per RESTful Authentication's guidelines
|
63
|
-
|
64
|
-
password_digest = Digest::SHA1.hexdigest([password_digest, salt, password,
|
65
|
+
Grandstand.digest_stretches.times do
|
66
|
+
password_digest = Digest::SHA1.hexdigest([password_digest, salt, password, Grandstand.site_key].join('--'))
|
65
67
|
end
|
66
68
|
password_digest
|
67
69
|
end
|
@@ -2,7 +2,7 @@
|
|
2
2
|
<% form_for(@gallery, :as => :gallery, :html => {:method => :delete}, :url => grandstand_gallery_path(@gallery)) do %>
|
3
3
|
<div class="field">You cannot undo this once it's done! This gallery, and all of its pictures, will be gone forever - poof!</div>
|
4
4
|
<div class="toolbar">
|
5
|
-
<%= button
|
6
|
-
<%= button_link_to
|
5
|
+
<%= button 'Delete', :default => true %>
|
6
|
+
<%= button_link_to 'Cancel', return_path || grandstand_gallery_path(@gallery), :class => 'cancel' %>
|
7
7
|
</div>
|
8
8
|
<% end %>
|
@@ -2,7 +2,7 @@
|
|
2
2
|
<% form_for(@gallery, :as => :gallery, :url => grandstand_gallery_path(@gallery)) do |form| -%>
|
3
3
|
<%= render :partial => 'form', :locals => {:form => form} %>
|
4
4
|
<div class="toolbar">
|
5
|
-
<%= button 'Save' %>
|
5
|
+
<%= button 'Save', :default => true %>
|
6
6
|
<%= button_link_to('Cancel', grandstand_galleries_path, :class => 'cancel') %>
|
7
7
|
</div>
|
8
8
|
<% end -%>
|
@@ -1,10 +1,10 @@
|
|
1
1
|
<% if @galleries.empty? -%>
|
2
|
-
<h2
|
2
|
+
<h2>Please Upload Images to a Gallery</h2>
|
3
3
|
<div class="center field">
|
4
|
-
|
4
|
+
<%= image_tag('/grandstand/images/icons/galleries-empty.png', :alt => 'No Galleries') %>
|
5
5
|
</div>
|
6
6
|
<div class="toolbar">
|
7
|
-
<%= button_link_to('Add a Gallery', new_grandstand_gallery_path, :class => 'remote', :icon => 'add') %>
|
7
|
+
<%= button_link_to('Add a Gallery', new_grandstand_gallery_path, :class => 'remote', :default => true, :icon => 'add') %>
|
8
8
|
<%= button_link_to('Close', return_path, :class => 'cancel')%>
|
9
9
|
</div>
|
10
10
|
<% else -%>
|
@@ -1,11 +1,11 @@
|
|
1
|
-
<% content_for :
|
1
|
+
<% content_for :title do %>
|
2
2
|
<%= button_link_to('Add a Gallery', new_grandstand_gallery_path, :class => 'remote', :icon => 'add') %>
|
3
3
|
<% end %>
|
4
|
+
<h2>Galleries</h2>
|
4
5
|
<% if @galleries.empty? -%>
|
5
|
-
<div class="
|
6
|
-
<
|
7
|
-
<%=
|
8
|
-
<br /><b class="grey">Get started:</b> <%= button_link_to('Add a Gallery', new_grandstand_gallery_path, :class => 'remote', :icon => 'add') %>
|
6
|
+
<div class="pad">
|
7
|
+
<h3>You haven't set up any galleries!</h3>
|
8
|
+
<%= button_link_to('Add One Now?', new_grandstand_gallery_path, :class => 'remote', :icon => 'add') %>
|
9
9
|
</div>
|
10
10
|
<% else -%>
|
11
11
|
<div class="galleries sortable">
|
@@ -2,7 +2,7 @@
|
|
2
2
|
<% form_for(@gallery, :as => :gallery, :url => grandstand_galleries_path) do |form| -%>
|
3
3
|
<%= render :partial => 'form', :locals => {:form => form} %>
|
4
4
|
<div class="toolbar">
|
5
|
-
<%= button 'Add Gallery' %>
|
5
|
+
<%= button 'Add Gallery', :default => true %>
|
6
6
|
<%= button_link_to('Cancel', grandstand_galleries_path, :class => 'cancel') %>
|
7
7
|
</div>
|
8
8
|
<% end -%>
|
@@ -1,16 +1,17 @@
|
|
1
|
-
<% content_for :
|
2
|
-
<%= button_link_to('Upload An Image', new_grandstand_gallery_image_path(@gallery), :class => 'remote', :icon => 'upload') %>
|
3
|
-
<%= button_link_to('Upload Multiple', upload_grandstand_gallery_images_path(@gallery), :class => 'remote', :icon => 'upload') %>
|
4
|
-
<% end %>
|
5
|
-
<h1 class="galleries icon">
|
6
|
-
<%= @gallery.name %>
|
1
|
+
<% content_for :title do %>
|
7
2
|
<%= button_link_to('Edit', edit_grandstand_gallery_path(@gallery), :class => 'remote', :icon => 'edit') %>
|
8
3
|
<%= button_link_to('Delete', delete_grandstand_gallery_path(@gallery), :class => 'remote', :icon => 'delete') %>
|
9
|
-
|
4
|
+
<% if Grandstand.multiple_upload -%>
|
5
|
+
<%= button_link_to('Add Images', upload_grandstand_gallery_images_path(@gallery), :class => 'remote', :icon => 'add') %>
|
6
|
+
<% else -%>
|
7
|
+
<%= button_link_to('Add An Image', new_grandstand_gallery_image_path(@gallery), :class => 'remote', :icon => 'add') %>
|
8
|
+
<% end -%>
|
9
|
+
<% end %>
|
10
|
+
<h2><%= @gallery.name %></h2>
|
10
11
|
<% if @gallery.images.empty? -%>
|
11
|
-
<div class="
|
12
|
-
<
|
13
|
-
|
12
|
+
<div class="pad">
|
13
|
+
<h3>You haven't uploaded any images!</h3>
|
14
|
+
<%= button_link_to('Add an Image', new_grandstand_gallery_image_path(@gallery), :class => 'remote', :icon => :add) %>
|
14
15
|
</div>
|
15
16
|
<% else -%>
|
16
17
|
<div class="images sortable">
|
@@ -2,7 +2,7 @@
|
|
2
2
|
<% form_for(@image, :as => :image, :html => {:method => :delete}, :url => grandstand_gallery_image_path(@gallery, @image)) do %>
|
3
3
|
<div class="field">You cannot undo this once it's done! This image will be gone forever - poof!</div>
|
4
4
|
<div class="toolbar">
|
5
|
-
<%= button
|
6
|
-
<%= button_link_to
|
5
|
+
<%= button 'Delete', :default => true %>
|
6
|
+
<%= button_link_to 'Cancel', grandstand_gallery_path(@gallery), :class => 'cancel' %>
|
7
7
|
</div>
|
8
8
|
<% end %>
|
@@ -2,7 +2,7 @@
|
|
2
2
|
<% form_for(@image, :as => :image, :html => {:multipart => true}, :url => grandstand_gallery_image_path(@gallery, @image)) do |form| %>
|
3
3
|
<%= render :partial => 'form', :locals => {:form => form} %>
|
4
4
|
<div class="toolbar">
|
5
|
-
<%= button 'Save' %>
|
6
|
-
<%= button_link_to
|
5
|
+
<%= button 'Save', :default => true %>
|
6
|
+
<%= button_link_to 'Cancel', grandstand_gallery_path(@gallery), :class => 'cancel' %>
|
7
7
|
</div>
|
8
8
|
<% end %>
|
@@ -2,7 +2,7 @@
|
|
2
2
|
<% form_for(@image, :as => :image, :html => {:multipart => true}, :url => grandstand_gallery_images_path) do |form| %>
|
3
3
|
<%= render :partial => 'form', :locals => {:form => form} %>
|
4
4
|
<div class="toolbar">
|
5
|
-
<%= button 'Add Image' %>
|
6
|
-
<%= button_link_to
|
5
|
+
<%= button 'Add Image', :default => true %>
|
6
|
+
<%= button_link_to 'Cancel', grandstand_gallery_path(@gallery), :class => 'cancel' %>
|
7
7
|
</div>
|
8
8
|
<% end %>
|
@@ -1,5 +1,5 @@
|
|
1
1
|
<h2>Edit Embedded Image</h2>
|
2
|
-
<form action="<%= request.fullpath %>"
|
2
|
+
<form action="<%= request.fullpath %>" method="POST">
|
3
3
|
<div class="field">
|
4
4
|
<img alt="<%= @image.caption %>" class="float-left" src="<%= @image.url(:grandstand_medium) %>" style="margin:0 10px 10px 0;" />
|
5
5
|
<div class="label">Alignment</div>
|
@@ -28,6 +28,6 @@
|
|
28
28
|
</div>
|
29
29
|
<div class="toolbar">
|
30
30
|
<%= button 'Update', :default => true %>
|
31
|
-
<%= button_link_to
|
31
|
+
<%= button_link_to 'Cancel', return_path, :class => 'cancel' %>
|
32
32
|
</div>
|
33
33
|
</form>
|
@@ -1,10 +1,8 @@
|
|
1
|
-
<
|
2
|
-
|
3
|
-
<
|
4
|
-
<
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
<% end -%>
|
10
|
-
</div>
|
1
|
+
<h2>Welcome to <%= Grandstand.app_name %>!</h2>
|
2
|
+
<div class="pad">
|
3
|
+
<h3>This is your dashboard.</h3>
|
4
|
+
<p>From here, you can edit things like <%= link_to 'pages', grandstand_pages_path, :class => 'pages icon' %>,
|
5
|
+
<%= link_to 'blog posts', grandstand_posts_path, :class => 'posts icon' %>,
|
6
|
+
<%= link_to 'photo galleries', grandstand_galleries_path, :class => 'galleries icon' %>,
|
7
|
+
and more!
|
8
|
+
</div>
|