Skip to content

Commit

Permalink
Clean up for open sourcing
Browse files Browse the repository at this point in the history
git-svn-id: svn://code.creativi.st/gallery/trunk@9 22c876fd-090a-0410-8685-aeedfd4d70f8
  • Loading branch information
creativistinc committed Feb 27, 2006
1 parent 4591507 commit 66bc672
Show file tree
Hide file tree
Showing 12 changed files with 118 additions and 42 deletions.
21 changes: 21 additions & 0 deletions MIT_LICENSE
@@ -0,0 +1,21 @@
Copyright (c) 2006 Robert Bousquet

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.
2 changes: 2 additions & 0 deletions app/controllers/account_controller.rb
Expand Up @@ -23,6 +23,8 @@ def login
if current_user
redirect_back_or_default(:controller => 'gallery', :action => 'index')
flash[:notice] = "Logged in successfully"
else
flash[:notice] = "Incorrect Login/Password"
end
end

Expand Down
2 changes: 1 addition & 1 deletion app/models/user.rb
Expand Up @@ -37,7 +37,7 @@ class User < ActiveRecord::Base
validates_length_of :login, :within => 3..40
validates_length_of :email, :within => 3..100
validates_length_of :password, :within => 4..40, :if => :password_required?
validates_presence_of :login, :email
validates_presence_of :login, :email, :first, :last
validates_presence_of :password,
:password_confirmation,
:if => :password_required?
Expand Down
7 changes: 5 additions & 2 deletions app/views/account/login.rhtml
@@ -1,11 +1,14 @@
<%= start_form_tag %>
<div id="login">
<% if flash[:notice] %>
<div id="errorExplanation"><h2><%= flash[:notice] %></h2></div>
<% end %>
<label for="user_login">Login</label>
<%= text_field :user, :login %>
<label for="user_password">Password</label>
<%= password_field :user, :password %>
<label>&nbsp;</label>
<!--p id="signup_link"><%= link_to "Create an account", :controller=>"account", :action=>"signup" %></p-->
<%= submit_tag 'Log in' %>
<%= submit_tag 'Login' %> <%= link_to "Cancel", :controller=>"gallery", :action=>"list" %>
</div>
<%= end_form_tag %>
4 changes: 3 additions & 1 deletion app/views/account/signup.rhtml
@@ -1,6 +1,8 @@
<%= start_form_tag %>
<div id="login">

<%= error_messages_for "user" %>

<label for="login">First</label>
<%= text_field :user, :first %>

Expand All @@ -20,7 +22,7 @@
<%= password_field :user, :password_confirmation %>

<label>&nbsp;</label>
<%= submit_tag 'Sign up' %>
<%= submit_tag 'Sign up' %> <%= link_to "Cancel", :controller=>"gallery", :action=>"list" %>
</div>

<%= end_form_tag %>
17 changes: 10 additions & 7 deletions app/views/albums/new.rhtml
@@ -1,7 +1,10 @@
<%= start_form_tag %>
<fieldset>
<label for="album_title">Title</label>
<%= text_field "album", "title" %>
<label>&nbsp;</label>
<%= submit_tag "Save" %>
</fieldset>
<h1>New Album</h1>
<div id="photos">
<%= error_messages_for "album" %>
<%= start_form_tag %>
<label for="album_title">Title</label>
<%= text_field "album", "title" %>
<label>&nbsp;</label>
<%= submit_tag "Save" %> <%= link_to "Cancel", :controller=>"gallery", :action=>"list" %>
<%= end_form_tag %>
</div>
9 changes: 5 additions & 4 deletions app/views/gallery/new.rhtml
@@ -1,13 +1,14 @@
<h2>New Photo</h2>
<h1>New Photo</h1>

<div id="photos">
<%= error_messages_for "photo" %>
<%= start_form_tag nil, :multipart=>true %>
<fieldset>
<label>Title</label>
<%= text_field "photo", "title" %>
<label>Photo</label>
<%= file_field_tag "file" %>
<label>&nbsp;</label>
<%= submit_tag "Upload" %>
</fieldset>
<%= submit_tag "Upload" %> <%= link_to "Cancel", :controller=>"gallery", :action=>"list" %>
<%= end_form_tag %>
</div>
2 changes: 1 addition & 1 deletion app/views/layouts/_header.rhtml
Expand Up @@ -3,7 +3,7 @@
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<title>Gallery</title>
<title>Powered by Tableau - Showcasing frozen moments</title>
<script type="text/javascript" language="javascript" charset="utf-8">
// <![CDATA[
var loadingImage = '<%= image_path "loading.gif" -%>';
Expand Down
18 changes: 7 additions & 11 deletions app/views/layouts/application.rhtml
@@ -1,21 +1,20 @@
<%= render :partial=>"layouts/header" %>

<!--p><%= logged_in? ? @curuser.full_name+" "+link_to("Logout", :controller=>"account", :action=>"logout") : link_to("Login", :controller=>"account", :action=>"login") %></p-->

<div id="page">

<% if logged_in? %>
<div id="admin">
<h2>Admin</h2>
<ul>
<li><%= link_to image_tag("images")+" New Album", :controller=>"albums", :action=>"new" %></li>
<li><%= link_to image_tag("image_add")+" New Photo", :controller=>"gallery", :action=>"new" %></li>
<li id="image_destroy"><%= link_to image_tag("trash.gif")+" Delete Photo", "#" %></li>
<%= drop_receiving_element "image_destroy",
:update => "photos", :url => { :controller=>"gallery", :action=>"destroy" },
:accept => "photo", :hoverclass => "image_destroy_active",
:loading => "Element.show('image_destroy_spinner')",
:complete => "Element.hide('image_destroy_spinner')" if logged_in? %>
<li><%= link_to image_tag("images")+" New Album", :controller=>"albums", :action=>"new" %></li>
</ul>
<div id="image_destroy_spinner" style="display:none;clear:both"><%= image_tag "spinner.gif", :style=>"vertical-align:middle" %> Deleting Photo...</div>
</div>
Expand All @@ -35,19 +34,16 @@
<%= content_tag "li", link_to(image_tag("arrow_left")+" Back to gallery", :controller=>"gallery", :action=>"index") if current_page?(:controller=>"gallery", :action=>"album") %>
</ul>
<div id="album_spinner" style="display:none;clear:both"><%= image_tag "spinner.gif", :style=>"vertical-align:middle" %> Adding photo to album...</div>
<p id="login_link"><%= logged_in? ? @curuser.full_name+" "+link_to("Logout", :controller=>"account", :action=>"logout") : link_to("Login", :controller=>"account", :action=>"login") %></p>

</div>

<div id="recent_posts">
<h2>Recent Posts</h2>
<ul>
<li><%= link_to "Aquarium 2006", "#" %></li>
<li><%= link_to "New Job 2006", "#" %></li>
<li><%= link_to "Christmas 2005", "#" %></li>
<li><%= link_to "Birthday 2005", "#" %></li>
</ul>
</div>

<%= @content_for_layout %>
<div style="clear:both"></div>
<div id="footer">
<p>Powered by <%= link_to "Tableau", "http://creativi.st/tableau" %></p>
</div>
</div>
</body>
</html>
Binary file added public/images/alert.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed public/images/logo.gif
Binary file not shown.
78 changes: 63 additions & 15 deletions public/stylesheets/gallery.css
@@ -1,5 +1,5 @@
body {
background:#CCC url(../images/logo.gif) no-repeat top right;
background:#CCC;
font-family: 'Lucida Grande';
font-size: 11px;
margin:25px;
Expand Down Expand Up @@ -58,7 +58,7 @@ label {



#photos {
#photos, h1 {
margin-left:230px;
}

Expand Down Expand Up @@ -90,7 +90,7 @@ label {
vertical-align:middle;
}

#albums a, #admin a {
#albums a, #admin a, #image_destroy a {
color:#FFF;
padding:5px;
text-decoration:none;
Expand All @@ -105,21 +105,14 @@ label {
background:#000 !important;
}

#recent_posts {
float:left;
clear:left;
width:200px;
#image_destroy a:hover {
background-color: #900;
}

#recent_posts ul {
margin:0;
padding:0;
.image_destroy_active {
background:#900 !important;
}

#recent_posts ul li {
list-style-type:none;
margin:2px 0;
}



Expand Down Expand Up @@ -161,5 +154,60 @@ label {
}

#signup_link {
float:right;
text-align:right;
}

#footer {
margin-top:100px;
text-align:center;
}

#login_link a {
color:#333;
}

#login_link a:hover {
background:none;
}

.fieldWithErrors {
border-left:6px solid #900;
padding-left:2px;
}


.fieldWithErrors+label {
margin-top:0;
}


#errorExplanation {
width:100%;
margin:10px 0 20px;
background:#FCC;
}

#errorExplanation h2 {
text-align: left;
font-weight: bold;
padding: .25em .25em .25em 35px;
font-size: 12px;
background:#C66 url(../images/alert.gif) no-repeat 10px 50%;
color: #fff;
border-top:3px solid #900;
border-bottom:3px solid #900;
margin-top:0;
}

#errorExplanation p {
color: #333;
margin-bottom: 0;
padding: .5em 1em;
font-size:11px;
font-weight:bold;
}

#errorExplanation ul {
margin-left:30px;
padding:0 0 20px;
}

0 comments on commit 66bc672

Please sign in to comment.